diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/AutorouteEngine.java b/src/main/java/eu/mihosoft/freerouting/autoroute/AutorouteEngine.java index 46cf3fb..54bf307 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/AutorouteEngine.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/AutorouteEngine.java @@ -44,6 +44,7 @@ import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.ShapeSearchTree90Degree; import eu.mihosoft.freerouting.board.ShapeSearchTree45Degree; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Temporary eu.mihosoft.freerouting.autoroute data stored on the RoutingBoard. @@ -120,8 +121,7 @@ public class AutorouteEngine maze_search_algo = MazeSearchAlgo.get_instance(p_start_set, p_dest_set, this, p_ctrl); } catch (Exception e) { - System.out.println("AutorouteEngine.autoroute_connection: Exception in MazeSearchAlgo.get_instance"); - System.out.println(e); + FRLogger.error("AutorouteEngine.autoroute_connection: Exception in MazeSearchAlgo.get_instance", e); maze_search_algo = null; } MazeSearchAlgo.Result search_result = null; @@ -132,7 +132,7 @@ public class AutorouteEngine search_result = maze_search_algo.find_connection(); } catch (Exception e) { - System.out.println("AutorouteEngine.autoroute_connection: Exception in maze_search_algo.find_connection"); + FRLogger.error("AutorouteEngine.autoroute_connection: Exception in maze_search_algo.find_connection", e); } } LocateFoundConnectionAlgo autoroute_result = null; @@ -145,7 +145,7 @@ public class AutorouteEngine board.rules.get_trace_angle_restriction(), p_ripped_item_list, board.get_test_level()); } catch (Exception e) { - System.out.println("AutorouteEngine.autoroute_connection: Exception in LocateFoundConnectionAlgo.get_instance"); + FRLogger.error("AutorouteEngine.autoroute_connection: Exception in LocateFoundConnectionAlgo.get_instance", e); } } if (!this.maintain_database) @@ -164,7 +164,7 @@ public class AutorouteEngine { if (this.board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("AutorouteEngine.autoroute_connection: result_items != null expected"); + FRLogger.warn("AutorouteEngine.autoroute_connection: result_items != null expected"); } return AutorouteResult.ALREADY_CONNECTED; } @@ -371,7 +371,7 @@ public class AutorouteEngine } else { - System.out.println("AutorouteEngine.remove_complete_expansion_room: this.complete_expansion_rooms is null"); + FRLogger.warn("AutorouteEngine.remove_complete_expansion_room: this.complete_expansion_rooms is null"); } this.drill_page_array.invalidate(room_shape); } @@ -444,8 +444,7 @@ public class AutorouteEngine return result; } catch (Exception e) { - System.out.print("AutorouteEngine.complete_expansion_room: "); - System.out.println(e); + FRLogger.error("AutorouteEngine.complete_expansion_room: ", e); return new LinkedList(); } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java index c3549ee..b2ee9ff 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java @@ -127,7 +127,7 @@ public class BatchAutorouter var current_board_hash = this.routing_board.get_hash(); if (already_checked_board_hashes.contains(current_board_hash)) { - FRLogger.logger.warn("This board was already evaluated, so we stop autorouter to avoid the endless loop."); + FRLogger.warn("This board was already evaluated, so we stop autorouter to avoid the endless loop."); thread.request_stop(); break; } @@ -162,7 +162,7 @@ public class BatchAutorouter if (average.getAsDouble() < 20.0) { - FRLogger.logger.warn("There were only " + average.getAsDouble() + " changes in the last 20 passes, so it's very likely that autorouter can't improve the result much further. It is recommended to stop it and finish the board manually."); + FRLogger.warn("There were only " + average.getAsDouble() + " changes in the last 20 passes, so it's very likely that autorouter can't improve the result much further. It is recommended to stop it and finish the board manually."); } } FRLogger.traceExit("BatchAutorouter.autoroute_pass #"+curr_pass_no+" on board '"+current_board_hash+"' making {} changes", newTraceDifferences); diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchFanout.java b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchFanout.java index abff2e5..0aa2525 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchFanout.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchFanout.java @@ -28,6 +28,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.board.RoutingBoard; import eu.mihosoft.freerouting.interactive.InteractiveActionThread; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Handles the sequencing of the fanout inside the batch autorouter. @@ -114,7 +115,7 @@ public class BatchFanout } if (this.routing_board.get_test_level() != eu.mihosoft.freerouting.board.TestLevel.RELEASE_VERSION) { - System.out.println("fanout pass: " + (p_pass_no + 1) + ", routed: " + routed_count + FRLogger.warn("fanout pass: " + (p_pass_no + 1) + ", routed: " + routed_count + ", not routed: " + not_routed_count + ", errors: " + insert_error_count); } return routed_count; diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchOptRoute.java b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchOptRoute.java index 67357b3..cae59d6 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchOptRoute.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchOptRoute.java @@ -34,6 +34,7 @@ import eu.mihosoft.freerouting.board.FixedState; import eu.mihosoft.freerouting.board.TestLevel; import eu.mihosoft.freerouting.interactive.InteractiveActionThread; +import eu.mihosoft.freerouting.logger.FRLogger; /** * To optimize the vias and traces after the batch autorouter has completed the eu.mihosoft.freerouting.board. @@ -60,7 +61,7 @@ public class BatchOptRoute { if (routing_board.get_test_level() != TestLevel.RELEASE_VERSION) { - System.out.println("Before optimize: Via count: " + routing_board.get_vias().size() + ", trace length: " + Math.round(routing_board.cumulative_trace_length())); + FRLogger.warn("Before optimize: Via count: " + routing_board.get_vias().size() + ", trace length: " + Math.round(routing_board.cumulative_trace_length())); } boolean route_improved = true; int curr_pass_no = 0; diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/CompleteFreeSpaceExpansionRoom.java b/src/main/java/eu/mihosoft/freerouting/autoroute/CompleteFreeSpaceExpansionRoom.java index bdef34f..6e8e229 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/CompleteFreeSpaceExpansionRoom.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/CompleteFreeSpaceExpansionRoom.java @@ -35,6 +35,7 @@ import eu.mihosoft.freerouting.board.SearchTreeObject; import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.Connectable; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -230,7 +231,7 @@ public class CompleteFreeSpaceExpansionRoom extends FreeSpaceExpansionRoom imple TileShape intersection = this.get_shape().intersection(curr_shape); if (intersection.dimension() > 1) { - System.out.println("ExpansionRoom overlap conflict"); + FRLogger.warn("ExpansionRoom overlap conflict"); result = false; } } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/InsertFoundConnectionAlgo.java b/src/main/java/eu/mihosoft/freerouting/autoroute/InsertFoundConnectionAlgo.java index 5b7c823..c8c7204 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/InsertFoundConnectionAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/InsertFoundConnectionAlgo.java @@ -31,6 +31,7 @@ import java.util.Iterator; import java.util.Set; import eu.mihosoft.freerouting.library.Padstack; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ViaInfo; import eu.mihosoft.freerouting.board.ForcedViaAlgo; @@ -75,8 +76,7 @@ public class InsertFoundConnectionAlgo { if (p_board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.print("InsertFoundConnectionAlgo: insert trace failed for net "); - System.out.println(p_ctrl.net_no); + FRLogger.warn("InsertFoundConnectionAlgo: insert trace failed for net #" + p_ctrl.net_no); } return null; } @@ -194,7 +194,7 @@ public class InsertFoundConnectionAlgo } if (board.get_test_level().ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("InsertFoundConnectionAlgo: violation corrected"); + FRLogger.warn("InsertFoundConnectionAlgo: violation corrected"); } } else @@ -387,8 +387,7 @@ public class InsertFoundConnectionAlgo { if (this.board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.print("InsertFoundConnectionAlgo: via mask not found for net "); - System.out.println(ctrl.net_no); + FRLogger.warn("InsertFoundConnectionAlgo: via mask not found for net #" + ctrl.net_no); } return false; } @@ -399,8 +398,7 @@ public class InsertFoundConnectionAlgo { if (this.board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.print("InsertFoundConnectionAlgo: forced via failed for net "); - System.out.println(ctrl.net_no); + FRLogger.warn("InsertFoundConnectionAlgo: forced via failed for net #" + ctrl.net_no); } return false; } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/ItemAutorouteInfo.java b/src/main/java/eu/mihosoft/freerouting/autoroute/ItemAutorouteInfo.java index ced9b00..ebca07b 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/ItemAutorouteInfo.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/ItemAutorouteInfo.java @@ -26,6 +26,7 @@ package eu.mihosoft.freerouting.autoroute; import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -87,7 +88,7 @@ public class ItemAutorouteInfo } if (p_index < 0 || p_index >= expansion_room_arr.length) { - System.out.println("ItemAutorouteInfo.get_expansion_room: p_index out of range"); + FRLogger.warn("ItemAutorouteInfo.get_expansion_room: p_index out of range"); return null; } if (expansion_room_arr[p_index] == null) diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo.java b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo.java index c079354..3dffe32 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo.java @@ -37,6 +37,7 @@ import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.AngleRestriction; import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -88,7 +89,7 @@ public abstract class LocateFoundConnectionAlgo BacktrackElement start_info = this.backtrack_array[backtrack_array.length - 1]; if (!(start_info.door instanceof TargetItemExpansionDoor)) { - System.out.println("LocateFoundConnectionAlgo: ItemExpansionDoor expected for start_info.door"); + FRLogger.warn("LocateFoundConnectionAlgo: ItemExpansionDoor expected for start_info.door"); this.start_item = null; this.start_layer = 0; this.target_item = null; @@ -120,7 +121,7 @@ public abstract class LocateFoundConnectionAlgo } else { - System.out.println("LocateFoundConnectionAlgo: unexpected type of destination_door"); + FRLogger.warn("LocateFoundConnectionAlgo: unexpected type of destination_door"); this.target_item = null; this.target_layer = 0; return; @@ -348,7 +349,7 @@ public abstract class LocateFoundConnectionAlgo int curr_section_no = curr_maze_search_element.section_no_of_backtrack_door; if (curr_section_no >= curr_backtrack_door.maze_search_element_count()) { - System.out.println("LocateFoundConnectionAlgo: curr_section_no to big"); + FRLogger.warn("LocateFoundConnectionAlgo: curr_section_no to big"); curr_section_no = curr_backtrack_door.maze_search_element_count() - 1; } if (curr_backtrack_door instanceof ExpansionDrill) diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo45Degree.java b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo45Degree.java index b6f7a37..6a457d7 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo45Degree.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgo45Degree.java @@ -40,6 +40,7 @@ import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.AngleRestriction; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -71,7 +72,7 @@ public class LocateFoundConnectionAlgo45Degree extends LocateFoundConnectionAlgo if (curr_from_info.next_room == null) { - System.out.println("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: next_room is null"); + FRLogger.warn("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: next_room is null"); return result; } @@ -126,7 +127,7 @@ public class LocateFoundConnectionAlgo45Degree extends LocateFoundConnectionAlgo BacktrackElement curr_to_info = this.backtrack_array[this.current_to_door_index]; if (!(curr_to_info.door instanceof ExpansionDoor)) { - System.out.println("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: ExpansionDoor expected"); + FRLogger.warn("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: ExpansionDoor expected"); return result; } ExpansionDoor curr_to_door = (ExpansionDoor) curr_to_info.door; @@ -147,7 +148,7 @@ public class LocateFoundConnectionAlgo45Degree extends LocateFoundConnectionAlgo FloatLine[] line_sections = curr_to_door.get_section_segments(trace_halfwidth); if (curr_to_info.section_no_of_door >= line_sections.length) { - System.out.println("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: line_sections inconsistent"); + FRLogger.warn("LocateFoundConnectionAlgo45Degree.calculate_next_trace_corners: line_sections inconsistent"); return result; } FloatLine curr_line_section = line_sections[curr_to_info.section_no_of_door]; diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgoAnyAngle.java b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgoAnyAngle.java index fd0a3ec..4244ead 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgoAnyAngle.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/LocateFoundConnectionAlgoAnyAngle.java @@ -36,6 +36,7 @@ import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.AngleRestriction; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -125,7 +126,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.calculate_next_trace_corner: left tangent point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.calculate_next_trace_corner: left tangent point is null"); } left_tangent_point = door_left_corner; } @@ -134,7 +135,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.calculate_next_trace_corner: right tangent point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.calculate_next_trace_corner: right tangent point is null"); } right_tangent_point = door_right_corner; } @@ -186,7 +187,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo // Should not happen because the previous door was not passed compledtely. if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.calculate_next_trace_corner: next door passed unexpected"); + FRLogger.warn("LocateFoundConnectionAlgo.calculate_next_trace_corner: next door passed unexpected"); } ++this.current_to_door_index; result.add(this.current_from_point); @@ -384,7 +385,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.right_turn_next_corner: left tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.right_turn_next_corner: left tangential point is null"); } return p_from_corner; } @@ -394,7 +395,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.right_turn_next_corner: right tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.right_turn_next_corner: right tangential point is null"); } return p_from_corner; } @@ -418,7 +419,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.left_turn_next_corner: right tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.left_turn_next_corner: right tangential point is null"); } return p_from_corner; } @@ -428,7 +429,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo.left_turn_next_corner: left tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo.left_turn_next_corner: left tangential point is null"); } return p_from_corner; } @@ -450,7 +451,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo. right_left_tangential_point: right tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo. right_left_tangential_point: right tangential point is null"); } return null; } @@ -460,7 +461,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo. right_left_tangential_point: left tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo. right_left_tangential_point: left tangential point is null"); } return null; } @@ -481,7 +482,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo. left_right_tangential_point: left tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo. left_right_tangential_point: left tangential point is null"); } return null; } @@ -491,7 +492,7 @@ class LocateFoundConnectionAlgoAnyAngle extends LocateFoundConnectionAlgo { if (this.test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("LocateFoundConnectionAlgo. left_right_tangential_point: right tangential point is null"); + FRLogger.warn("LocateFoundConnectionAlgo. left_right_tangential_point: right tangential point is null"); } return null; } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/MazeSearchAlgo.java b/src/main/java/eu/mihosoft/freerouting/autoroute/MazeSearchAlgo.java index 96f3d18..9694e14 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/MazeSearchAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/MazeSearchAlgo.java @@ -47,6 +47,7 @@ import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.AngleRestriction; import eu.mihosoft.freerouting.board.SearchTreeObject; import eu.mihosoft.freerouting.board.ItemSelectionFilter; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for autorouting an incomplete connection via a maze search algorithm. @@ -271,7 +272,7 @@ public class MazeSearchAlgo FloatPoint[] nearest_points = next_room_shape.nearest_border_points_approx(shape_entry_middle, 2); if (nearest_points.length < 2) { - System.out.println("MazeSearchAlgo.expand_to_room_doors: nearest_points.length == 2 expected"); + FRLogger.warn("MazeSearchAlgo.expand_to_room_doors: nearest_points.length == 2 expected"); next_room_is_thick = false; } else @@ -550,7 +551,7 @@ public class MazeSearchAlgo { if (this.autoroute_engine.board.get_test_level().ordinal() >= eu.mihosoft.freerouting.board.TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("MazeSearchAlgo:check_door_width door_shape is empty"); + FRLogger.warn("MazeSearchAlgo:check_door_width door_shape is empty"); } return true; } @@ -1042,7 +1043,7 @@ public class MazeSearchAlgo } else { - System.out.println("MazeSearchAlgo. room_shape_is_thick: unexpected obstacle item"); + FRLogger.warn("MazeSearchAlgo. room_shape_is_thick: unexpected obstacle item"); obstacle_half_width = 0; } return obstacle_half_width >= this.ctrl.compensated_trace_half_width[layer]; diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/MazeShoveTraceAlgo.java b/src/main/java/eu/mihosoft/freerouting/autoroute/MazeShoveTraceAlgo.java index 7c7b107..cb8ac16 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/MazeShoveTraceAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/MazeShoveTraceAlgo.java @@ -39,6 +39,7 @@ import eu.mihosoft.freerouting.geometry.planar.LineSegment; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.RoutingBoard; import eu.mihosoft.freerouting.board.ShoveTraceAlgo; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Auxiliary functions used in MazeSearchAlgo. @@ -85,7 +86,7 @@ public class MazeShoveTraceAlgo if (trace_corner_no >= trace_polyline.arr.length - 1) { - System.out.println("MazeShoveTraceAlgo.check_shove_trace_line: trace_corner_no to big"); + FRLogger.warn("MazeShoveTraceAlgo.check_shove_trace_line: trace_corner_no to big"); return false; } Collection room_doors = p_obstacle_room.get_doors(); @@ -296,7 +297,7 @@ public class MazeShoveTraceAlgo { if (p_board.get_test_level() == eu.mihosoft.freerouting.board.TestLevel.ALL_DEBUGGING_OUTPUT) { - System.out.println("MazeShoveTraceAlgo.check_shove_trace_line: door shape is empty"); + FRLogger.warn("MazeShoveTraceAlgo.check_shove_trace_line: door shape is empty"); } continue; } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/Sorted45DegreeRoomNeighbours.java b/src/main/java/eu/mihosoft/freerouting/autoroute/Sorted45DegreeRoomNeighbours.java index c38ab5e..8caaafe 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/Sorted45DegreeRoomNeighbours.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/Sorted45DegreeRoomNeighbours.java @@ -41,6 +41,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.SearchTreeObject; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -105,7 +106,7 @@ public class Sorted45DegreeRoomNeighbours } else { - System.out.println("Sorted45DegreeRoomNeighbours.calculate_neighbours: unexpected expansion room type"); + FRLogger.warn("Sorted45DegreeRoomNeighbours.calculate_neighbours: unexpected expansion room type"); return null; } IntOctagon room_oct = room_shape.bounding_octagon(); @@ -219,7 +220,7 @@ public class Sorted45DegreeRoomNeighbours { if (!(this.from_room instanceof ObstacleExpansionRoom)) { - System.out.println("Sorted45DegreeRoomNeighbours.calculate_side_incomplete_rooms_of_obstacle_expansion_room: ObstacleExpansionRoom expected for this.from_room"); + FRLogger.warn("Sorted45DegreeRoomNeighbours.calculate_side_incomplete_rooms_of_obstacle_expansion_room: ObstacleExpansionRoom expected for this.from_room"); return; } IntOctagon board_bounding_oct = p_autoroute_engine.board.get_bounding_box().bounding_octagon(); @@ -273,7 +274,7 @@ public class Sorted45DegreeRoomNeighbours } else { - System.out.println("SortedOrthoganelRoomNeighbours.calculate_edge_incomplete_rooms_of_obstacle_expansion_room: curr_side_no illegal"); + FRLogger.warn("SortedOrthoganelRoomNeighbours.calculate_edge_incomplete_rooms_of_obstacle_expansion_room: curr_side_no illegal"); return; } insert_incomplete_room(p_autoroute_engine, lx, ly, rx, uy, ulx, lrx, llx, urx); @@ -387,7 +388,7 @@ public class Sorted45DegreeRoomNeighbours IncompleteFreeSpaceExpansionRoom curr_incomplete_room = (IncompleteFreeSpaceExpansionRoom) this.from_room; if (!(curr_incomplete_room.get_shape() instanceof IntOctagon)) { - System.out.println("Sorted45DegreeRoomNeighbours.try_remove_edge_line: IntOctagon expected for room_shape type"); + FRLogger.warn("Sorted45DegreeRoomNeighbours.try_remove_edge_line: IntOctagon expected for room_shape type"); return false; } IntOctagon room_oct = (IntOctagon) curr_incomplete_room.get_shape(); @@ -862,7 +863,7 @@ public class Sorted45DegreeRoomNeighbours } else { - System.out.println("Sorted45DegreeRoomNeighbour.calculate_new_incomplete: illegal touching side"); + FRLogger.warn("Sorted45DegreeRoomNeighbour.calculate_new_incomplete: illegal touching side"); } insert_incomplete_room(p_autoroute_engine, lx, ly, rx, uy, ulx, lrx, llx, urx); } @@ -1065,7 +1066,7 @@ public class Sorted45DegreeRoomNeighbours } else { - System.out.println("SortedRoomNeighbour.compareTo: first_touching_side out of range "); + FRLogger.warn("SortedRoomNeighbour.compareTo: first_touching_side out of range "); return 0; } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/SortedOrthogonalRoomNeighbours.java b/src/main/java/eu/mihosoft/freerouting/autoroute/SortedOrthogonalRoomNeighbours.java index 2d5d08f..c6301f1 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/SortedOrthogonalRoomNeighbours.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/SortedOrthogonalRoomNeighbours.java @@ -39,6 +39,7 @@ import eu.mihosoft.freerouting.geometry.planar.Limits; import eu.mihosoft.freerouting.board.SearchTreeObject; import eu.mihosoft.freerouting.board.ShapeSearchTree; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -89,7 +90,7 @@ public class SortedOrthogonalRoomNeighbours TileShape room_shape = p_room.get_shape(); if (!(room_shape instanceof IntBox)) { - System.out.println("SortedOrthoganelRoomNeighbours.calculate_incomplete_rooms_with_empty_neighbours: IntBox expected for room_shape"); + FRLogger.warn("SortedOrthoganelRoomNeighbours.calculate_incomplete_rooms_with_empty_neighbours: IntBox expected for room_shape"); return; } IntBox room_box = (IntBox) room_shape; @@ -115,7 +116,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedOrthoganelRoomNeighbours.calculate_incomplete_rooms_with_empty_neighbours: illegal index i"); + FRLogger.warn("SortedOrthoganelRoomNeighbours.calculate_incomplete_rooms_with_empty_neighbours: illegal index i"); return; } IntBox new_contained_box = room_box.intersection(new_room_box); @@ -136,7 +137,7 @@ public class SortedOrthogonalRoomNeighbours TileShape room_shape = p_room.get_shape(); if (!(room_shape instanceof IntBox)) { - System.out.println("SortedOrthogonalRoomNeighbours.calculate: IntBox expected for room_shape"); + FRLogger.warn("SortedOrthogonalRoomNeighbours.calculate: IntBox expected for room_shape"); return null; } IntBox room_box = (IntBox) room_shape; @@ -151,7 +152,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedOrthogonalRoomNeighbours.calculate: unexpected expansion room type"); + FRLogger.warn("SortedOrthogonalRoomNeighbours.calculate: unexpected expansion room type"); return null; } SortedOrthogonalRoomNeighbours result = new SortedOrthogonalRoomNeighbours(p_room, completed_room); @@ -176,7 +177,7 @@ public class SortedOrthogonalRoomNeighbours curr_object.get_tree_shape(p_autoroute_search_tree, curr_entry.shape_index_in_object); if (!(curr_shape instanceof IntBox)) { - System.out.println("OrthogonalAutorouteEngine:calculate_sorted_neighbours: IntBox expected for curr_shape"); + FRLogger.warn("OrthogonalAutorouteEngine:calculate_sorted_neighbours: IntBox expected for curr_shape"); return null; } IntBox curr_box = (IntBox) curr_shape; @@ -201,8 +202,8 @@ public class SortedOrthogonalRoomNeighbours } if (dimension < 0) { - - System.out.println("AutorouteEngine.calculate_doors: dimension >= 0 expected"); + + FRLogger.warn("AutorouteEngine.calculate_doors: dimension >= 0 expected"); continue; } result.add_sorted_neighbour(curr_box, intersection); @@ -392,7 +393,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedOrthogonalRoomNeighbour.calculate_new_incomplete: illegal touching side"); + FRLogger.warn("SortedOrthogonalRoomNeighbour.calculate_new_incomplete: illegal touching side"); } } prev_neighbour = next_neighbour; @@ -449,7 +450,7 @@ public class SortedOrthogonalRoomNeighbours IncompleteFreeSpaceExpansionRoom curr_incomplete_room = (IncompleteFreeSpaceExpansionRoom) this.from_room; if (!(curr_incomplete_room.get_shape() instanceof IntBox)) { - System.out.println("SortedOrthogonalRoomNeighbours.try_remove_edge: IntBox expected for room_shape type"); + FRLogger.warn("SortedOrthogonalRoomNeighbours.try_remove_edge: IntBox expected for room_shape type"); return false; } IntBox room_box = (IntBox) curr_incomplete_room.get_shape(); @@ -537,7 +538,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedOrthogonalRoomNeighbours.remove_border_line: illegal p_remove_edge_no"); + FRLogger.warn("SortedOrthogonalRoomNeighbours.remove_border_line: illegal p_remove_edge_no"); result = null; } return result; @@ -608,7 +609,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedRoomNeighbour: case not expected"); + FRLogger.warn("SortedRoomNeighbour: case not expected"); this.first_touching_side = -1; } @@ -630,7 +631,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedRoomNeighbour: case not expected"); + FRLogger.warn("SortedRoomNeighbour: case not expected"); this.last_touching_side = -1; } } @@ -673,7 +674,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedRoomNeighbour.compareTo: first_touching_side out of range "); + FRLogger.warn("SortedRoomNeighbour.compareTo: first_touching_side out of range "); return 0; } if (cmp_value == 0) @@ -710,7 +711,7 @@ public class SortedOrthogonalRoomNeighbours } else { - System.out.println("SortedRoomNeighbour.compareTo: first_touching_side out of range "); + FRLogger.warn("SortedRoomNeighbour.compareTo: first_touching_side out of range "); return 0; } } diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/SortedRoomNeighbours.java b/src/main/java/eu/mihosoft/freerouting/autoroute/SortedRoomNeighbours.java index cb4f647..2b72afe 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/SortedRoomNeighbours.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/SortedRoomNeighbours.java @@ -48,6 +48,7 @@ import eu.mihosoft.freerouting.board.Connectable; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.PolylineTrace; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * To calculate the neigbour rooms of an expansion room. @@ -96,7 +97,7 @@ public class SortedRoomNeighbours room_neighbours.calculate_new_incomplete_rooms(p_autoroute_engine); if (test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal() && result.get_shape().dimension() < 2) { - System.out.println("AutorouteEngine.calculate_new_incomplete_rooms_with_mmore_than_1_neighbour: unexpected dimension for smoothened_shape"); + FRLogger.warn("AutorouteEngine.calculate_new_incomplete_rooms_with_mmore_than_1_neighbour: unexpected dimension for smoothened_shape"); } } @@ -173,7 +174,7 @@ public class SortedRoomNeighbours } else { - System.out.println("SortedRoomNeighbours.calculate: unexpected expansion room type"); + FRLogger.warn("SortedRoomNeighbours.calculate: unexpected expansion room type"); return null; } SortedRoomNeighbours result = new SortedRoomNeighbours(p_room, completed_room); @@ -214,7 +215,7 @@ public class SortedRoomNeighbours } else if (p_test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("SortedRoomNeighbours.calculate: unexpected area overlap of free space expansion room"); + FRLogger.warn("SortedRoomNeighbours.calculate: unexpected area overlap of free space expansion room"); } continue; } @@ -222,7 +223,7 @@ public class SortedRoomNeighbours { if (p_test_level.ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("SortedRoomNeighbours.calculate: dimension >= 0 expected"); + FRLogger.warn("SortedRoomNeighbours.calculate: dimension >= 0 expected"); } continue; } @@ -233,7 +234,7 @@ public class SortedRoomNeighbours { if (p_test_level.ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("SortedRoomNeighbours.calculate: touching_sides length 2 expected"); + FRLogger.warn("SortedRoomNeighbours.calculate: touching_sides length 2 expected"); } continue; } @@ -283,7 +284,7 @@ public class SortedRoomNeighbours touching_side_no_of_room = room_shape.contains_on_border_line_no(touching_point); if (touching_side_no_of_room < 0 && p_test_level.ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("SortedRoomNeighbours.calculate: touching_side_no_of_room >= 0 expected"); + FRLogger.warn("SortedRoomNeighbours.calculate: touching_side_no_of_room >= 0 expected"); } } int neighbour_room_corner_no = curr_shape.equals_corner(touching_point); @@ -301,7 +302,7 @@ public class SortedRoomNeighbours touching_side_no_of_neighbour_room = curr_shape.contains_on_border_line_no(touching_point); if (touching_side_no_of_neighbour_room < 0 && p_test_level.ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("AutorouteEngine.SortedRoomNeighbours.calculate: touching_side_no_of_neighbour_room >= 0 expected"); + FRLogger.warn("AutorouteEngine.SortedRoomNeighbours.calculate: touching_side_no_of_neighbour_room >= 0 expected"); } } result.add_sorted_neighbour(curr_shape, intersection, @@ -396,7 +397,7 @@ public class SortedRoomNeighbours { if (p_test_level.ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("AutorouteEngine.calculate_doors: 1 completed shape expected"); + FRLogger.warn("AutorouteEngine.calculate_doors: 1 completed shape expected"); } return false; } @@ -664,7 +665,7 @@ public class SortedRoomNeighbours { if (p_door_line == null) { - System.out.println("SortedRoomNeighbours.insert_door_ok: p_door_line is null"); + FRLogger.warn("SortedRoomNeighbours.insert_door_ok: p_door_line is null"); return false; } Item curr_item = p_room.get_item(); diff --git a/src/main/java/eu/mihosoft/freerouting/board/BasicBoard.java b/src/main/java/eu/mihosoft/freerouting/board/BasicBoard.java index 4539cc7..c0a7e00 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/BasicBoard.java +++ b/src/main/java/eu/mihosoft/freerouting/board/BasicBoard.java @@ -105,7 +105,7 @@ public class BasicBoard implements java.io.Serializable return output_stream.toByteArray(); } catch (Exception e) { - FRLogger.logger.error(e); + FRLogger.error("Couldn't serialize board", e); } return null; @@ -121,7 +121,7 @@ public class BasicBoard implements java.io.Serializable return (BasicBoard)object_stream.readObject(); } catch (Exception e) { - FRLogger.logger.error(e); + FRLogger.error("Couldn't deserialize board", e); } return null; @@ -143,7 +143,7 @@ public class BasicBoard implements java.io.Serializable return convert_byte_array_to_hex_string(hashedBytes); } catch (Exception e) { - FRLogger.logger.error(e); + FRLogger.error("Couldn't calculate hash for board", e); } return null; @@ -250,7 +250,7 @@ public class BasicBoard implements java.io.Serializable { if (!this.bounding_box.contains(p_points[i])) { - System.out.println("LayeredBoard.insert_trace: input point out of range"); + FRLogger.warn("LayeredBoard.insert_trace: input point out of range"); } } Polyline poly = new Polyline(p_points); @@ -299,7 +299,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_obstacle: p_area is null"); return null; } ObstacleArea obs = new ObstacleArea(p_area, p_layer, Vector.ZERO, 0, false, p_clearance_class, 0, 0, null, p_fixed_state, this); @@ -316,7 +316,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_obstacle: p_area is null"); return null; } ObstacleArea obs = new ObstacleArea(p_area, p_layer, p_translation, p_rotation_in_degree, p_side_changed, @@ -334,7 +334,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_via_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_via_obstacle: p_area is null"); return null; } ViaObstacleArea obs = new ViaObstacleArea(p_area, p_layer, Vector.ZERO, 0, false, @@ -353,7 +353,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_via_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_via_obstacle: p_area is null"); return null; } ViaObstacleArea obs = new ViaObstacleArea(p_area, p_layer, p_translation, p_rotation_in_degree, p_side_changed, @@ -371,7 +371,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_component_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_component_obstacle: p_area is null"); return null; } ComponentObstacleArea obs = new ComponentObstacleArea(p_area, p_layer, Vector.ZERO, 0, false, @@ -389,7 +389,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_component_obstacle: p_area is null"); + FRLogger.warn("BasicBoard.insert_component_obstacle: p_area is null"); return null; } ComponentObstacleArea obs = new ComponentObstacleArea(p_area, p_layer, p_translation, p_rotation_in_degree, p_side_changed, @@ -406,12 +406,12 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_component_outline: p_area is null"); + FRLogger.warn("BasicBoard.insert_component_outline: p_area is null"); return null; } if (!p_area.is_bounded()) { - System.out.println("BasicBoard.insert_component_outline: p_area is not bounded"); + FRLogger.warn("BasicBoard.insert_component_outline: p_area is not bounded"); return null; } ComponentOutline outline = new ComponentOutline(p_area, p_is_front, p_translation, p_rotation_in_degree, @@ -431,7 +431,7 @@ public class BasicBoard implements java.io.Serializable { if (p_area == null) { - System.out.println("BasicBoard.insert_conduction_area: p_area is null"); + FRLogger.warn("BasicBoard.insert_conduction_area: p_area is null"); return null; } ConductionArea c = new ConductionArea(p_area, p_layer, Vector.ZERO, 0, false, p_net_no_arr, p_clearance_class, @@ -1365,7 +1365,7 @@ public class BasicBoard implements java.io.Serializable if (rules == null || rules.clearance_matrix == null || p_item.clearance_class_no() < 0 || p_item.clearance_class_no() >= rules.clearance_matrix.get_class_count()) { - System.out.println("LayeredBoard.insert_item: clearance_class no out of range"); + FRLogger.warn("LayeredBoard.insert_item: clearance_class no out of range"); p_item.set_clearance_class_no(0); } p_item.board = this; @@ -1482,7 +1482,7 @@ public class BasicBoard implements java.io.Serializable */ public void generate_snapshot() { - FRLogger.logger.info("Generating snapshot"); + FRLogger.info("Generating snapshot"); item_list.generate_snapshot(); components.generate_snapshot(); diff --git a/src/main/java/eu/mihosoft/freerouting/board/BoardOutline.java b/src/main/java/eu/mihosoft/freerouting/board/BoardOutline.java index c6070d3..1e5f7b1 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/BoardOutline.java +++ b/src/main/java/eu/mihosoft/freerouting/board/BoardOutline.java @@ -32,6 +32,7 @@ import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.boardgraphics.GraphicsContext; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class describing a eu.mihosoft.freerouting.board outline. @@ -85,7 +86,7 @@ public class BoardOutline extends Item implements java.io.Serializable } if (result < 0 || result >= this.board.layer_structure.arr.length) { - System.out.println("BoardOutline.shape_layer: p_index out of range"); + FRLogger.warn("BoardOutline.shape_layer: p_index out of range"); } return result; } @@ -193,7 +194,7 @@ public class BoardOutline extends Item implements java.io.Serializable { if (p_index < 0 || p_index >= this.shapes.length) { - System.out.println("BoardOutline.get_shape: p_index out of range"); + FRLogger.warn("BoardOutline.get_shape: p_index out of range"); return null; } return this.shapes[p_index]; diff --git a/src/main/java/eu/mihosoft/freerouting/board/CalcFromSide.java b/src/main/java/eu/mihosoft/freerouting/board/CalcFromSide.java index ea2e746..3fb90fe 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/CalcFromSide.java +++ b/src/main/java/eu/mihosoft/freerouting/board/CalcFromSide.java @@ -30,6 +30,7 @@ import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.Polyline; import eu.mihosoft.freerouting.geometry.planar.TileShape; import eu.mihosoft.freerouting.geometry.planar.Side; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -99,7 +100,7 @@ public class CalcFromSide this.no = p_shape.contains_on_border_line_no(border_projection); if (this.no < 0) { - System.out.println("CalcFromSide: this.no >= 0 expected"); + FRLogger.warn("CalcFromSide: this.no >= 0 expected"); } this.border_intersection = border_projection.to_float(); } @@ -143,7 +144,7 @@ public class CalcFromSide } if (front_side_no < 0) { - System.out.println("CalcFromSide: start corner not found"); + FRLogger.warn("CalcFromSide: start corner not found"); no = -1; border_intersection = null; return; diff --git a/src/main/java/eu/mihosoft/freerouting/board/ComponentOutline.java b/src/main/java/eu/mihosoft/freerouting/board/ComponentOutline.java index 5a8dd88..8d0f133 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ComponentOutline.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ComponentOutline.java @@ -32,6 +32,7 @@ import eu.mihosoft.freerouting.geometry.planar.IntPoint; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.boardgraphics.GraphicsContext; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -211,7 +212,7 @@ public class ComponentOutline extends Item implements java.io.Serializable { if (this.relative_area == null) { - System.out.println("ObstacleArea.get_area: area is null"); + FRLogger.warn("ObstacleArea.get_area: area is null"); return null; } Area turned_area = this.relative_area; diff --git a/src/main/java/eu/mihosoft/freerouting/board/Components.java b/src/main/java/eu/mihosoft/freerouting/board/Components.java index 3bff1b5..b8ad45f 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/Components.java +++ b/src/main/java/eu/mihosoft/freerouting/board/Components.java @@ -34,6 +34,7 @@ import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.IntPoint; import eu.mihosoft.freerouting.library.Package; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Contains the lists of components on the eu.mihosoft.freerouting.board. @@ -100,7 +101,7 @@ public class Components implements java.io.Serializable Component result = component_arr.elementAt(p_component_no - 1); if (result != null && result.no != p_component_no) { - System.out.println("Components.get: inconsistent component number"); + FRLogger.warn("Components.get: inconsistent component number"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/board/ConductionArea.java b/src/main/java/eu/mihosoft/freerouting/board/ConductionArea.java index 596aca9..bdaaa14 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ConductionArea.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ConductionArea.java @@ -30,6 +30,7 @@ import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Set; import java.util.TreeSet; @@ -56,7 +57,7 @@ public class ConductionArea extends ObstacleArea implements Connectable { if (this.net_count() != 1) { - System.out.println("ConductionArea.copy not yet implemented for areas with more than 1 net"); + FRLogger.warn("ConductionArea.copy not yet implemented for areas with more than 1 net"); return null; } return new ConductionArea(get_relative_area(), get_layer(), get_translation(), get_rotation_in_degree(), @@ -109,7 +110,7 @@ public class ConductionArea extends ObstacleArea implements Connectable { if (p_index < 0 || p_index >= this.tree_shape_count(p_search_tree)) { - System.out.println("ConductionArea.get_trace_connection_shape p_index out of range"); + FRLogger.warn("ConductionArea.get_trace_connection_shape p_index out of range"); return null; } return this.get_tree_shape(p_search_tree, p_index); diff --git a/src/main/java/eu/mihosoft/freerouting/board/CoordinateTransform.java b/src/main/java/eu/mihosoft/freerouting/board/CoordinateTransform.java index d89e957..892f07b 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/CoordinateTransform.java +++ b/src/main/java/eu/mihosoft/freerouting/board/CoordinateTransform.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.board; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for transforming objects between user coordinate space and eu.mihosoft.freerouting.board coordinate space. @@ -96,7 +97,7 @@ public class CoordinateTransform implements java.io.Serializable } else { - System.out.println("CoordinateTransform.board_to_user not yet implemented for p_shape"); + FRLogger.warn("CoordinateTransform.board_to_user not yet implemented for p_shape"); result = null; } return result; diff --git a/src/main/java/eu/mihosoft/freerouting/board/DrillItem.java b/src/main/java/eu/mihosoft/freerouting/board/DrillItem.java index ec8f3d4..3318946 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/DrillItem.java +++ b/src/main/java/eu/mihosoft/freerouting/board/DrillItem.java @@ -38,6 +38,7 @@ import java.util.Set; import java.util.TreeSet; import eu.mihosoft.freerouting.library.Padstack; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Common superclass for Pins and Vias @@ -273,7 +274,7 @@ public abstract class DrillItem extends Item implements Connectable, java.io.Ser int to_layer = last_layer(); if (p_layer < from_layer || p_layer > to_layer) { - System.out.println("DrillItem.get_tree_shape_on_layer: p_layer out of range"); + FRLogger.warn("DrillItem.get_tree_shape_on_layer: p_layer out of range"); return null; } return get_tree_shape(p_tree, p_layer - from_layer); @@ -285,7 +286,7 @@ public abstract class DrillItem extends Item implements Connectable, java.io.Ser int to_layer = last_layer(); if (p_layer < from_layer || p_layer > to_layer) { - System.out.println("DrillItem.get_tile_shape_on_layer: p_layer out of range"); + FRLogger.warn("DrillItem.get_tile_shape_on_layer: p_layer out of range"); return null; } return get_tile_shape(p_layer - from_layer); @@ -297,7 +298,7 @@ public abstract class DrillItem extends Item implements Connectable, java.io.Ser int to_layer = last_layer(); if (p_layer < from_layer || p_layer > to_layer) { - System.out.println("DrillItem.get_shape_on_layer: p_layer out of range"); + FRLogger.warn("DrillItem.get_shape_on_layer: p_layer out of range"); return null; } return get_shape(p_layer - from_layer); diff --git a/src/main/java/eu/mihosoft/freerouting/board/ForcedPadAlgo.java b/src/main/java/eu/mihosoft/freerouting/board/ForcedPadAlgo.java index 47b2fa2..f487081 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ForcedPadAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ForcedPadAlgo.java @@ -35,6 +35,7 @@ import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.Line; import eu.mihosoft.freerouting.geometry.planar.Polyline; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Collection; @@ -189,7 +190,7 @@ public class ForcedPadAlgo { if (p_pad_shape.is_empty()) { - System.out.println("ShoveTraceAux.forced_pad: p_pad_shape is empty"); + FRLogger.warn("ShoveTraceAux.forced_pad: p_pad_shape is empty"); return true; } if (!p_pad_shape.is_contained_in(board.get_bounding_box())) @@ -497,7 +498,7 @@ public class ForcedPadAlgo break; default: { - System.out.println("ForcedPadAlgo.in_front_of_pad: p_from_side out of range"); + FRLogger.warn("ForcedPadAlgo.in_front_of_pad: p_from_side out of range"); result = true; } } diff --git a/src/main/java/eu/mihosoft/freerouting/board/Item.java b/src/main/java/eu/mihosoft/freerouting/board/Item.java index 43b0d08..3760471 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/Item.java +++ b/src/main/java/eu/mihosoft/freerouting/board/Item.java @@ -35,6 +35,7 @@ import java.util.Iterator; import java.util.Set; import java.util.TreeSet; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.Nets; import eu.mihosoft.freerouting.boardgraphics.Drawable; import eu.mihosoft.freerouting.boardgraphics.GraphicsContext; @@ -150,7 +151,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane { if (this.board == null) { - System.out.println("Item.get_tile_shape: eu.mihosoft.freerouting.board is null"); + FRLogger.warn("Item.get_tile_shape: eu.mihosoft.freerouting.board is null"); return null; } return get_tree_shape(this.board.search_tree_manager.get_default_tree(), p_index); @@ -421,7 +422,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane TileShape shape_2 = curr_item.get_tree_shape(default_tree, curr_entry.shape_index_in_object); if (shape_1 == null || shape_2 == null) { - System.out.println("Item.clearance_violations: unexpected null shape"); + FRLogger.warn("Item.clearance_violations: unexpected null shape"); continue; } if (!this.board.search_tree_manager.is_clearance_compensation_used()) @@ -867,7 +868,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane TileShape curr_shape = this.get_tile_shape(i); if (curr_shape.is_empty()) { - System.out.println("Item.validate: shape is empty"); + FRLogger.warn("Item.validate: shape is empty"); result = false; } } @@ -1067,7 +1068,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane { if (p_index < 0 || p_index >= this.board.rules.clearance_matrix.get_class_count()) { - System.out.println("Item.set_clearance_class_no: p_index out of range"); + FRLogger.warn("Item.set_clearance_class_no: p_index out of range"); return; } clearance_class = p_index; @@ -1080,7 +1081,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane { if (p_index < 0 || p_index >= this.board.rules.clearance_matrix.get_class_count()) { - System.out.println("Item.set_clearance_class_no: p_index out of range"); + FRLogger.warn("Item.set_clearance_class_no: p_index out of range"); return; } clearance_class = p_index; @@ -1113,7 +1114,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } if (p_net_no > board.rules.nets.max_net_no()) { - System.out.println("Item.assign_net_no: p_net_no to big"); + FRLogger.warn("Item.assign_net_no: p_net_no to big"); return; } board.item_list.save_for_undo(this); @@ -1129,7 +1130,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } else if (net_no_arr.length > 1) { - System.out.println("Item.assign_net_no: unexpected net_count > 1"); + FRLogger.warn("Item.assign_net_no: unexpected net_count > 1"); } net_no_arr[0] = p_net_no; } @@ -1197,7 +1198,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } if (this.search_trees_info == null) { - System.out.println("Item.set_precalculated_tree_shapes search_trees_info not allocated"); + FRLogger.warn("Item.set_precalculated_tree_shapes search_trees_info not allocated"); return; } this.search_trees_info.set_precalculated_tree_shapes(p_shapes, p_tree); @@ -1269,7 +1270,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } /** - * Internal funktion used in the implementation of print_info + * Internal function used in the implementation of print_info */ protected void print_clearance_info(ObjectInfoPanel p_window, java.util.Locale p_locale) { @@ -1298,7 +1299,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } /** - * Internal funktion used in the implementation of print_info + * Internal function used in the implementation of print_info */ protected void print_contact_info(ObjectInfoPanel p_window, java.util.Locale p_locale) { @@ -1314,7 +1315,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } /** - * Internal funktion used in the implementation of print_info + * Internal function used in the implementation of print_info */ protected void print_clearance_violation_info(ObjectInfoPanel p_window, java.util.Locale p_locale) { @@ -1340,7 +1341,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } /** - * Internal funktion used in the implementation of print_info + * Internal function used in the implementation of print_info */ protected void print_connectable_item_info(ObjectInfoPanel p_window, java.util.Locale p_locale) { @@ -1352,7 +1353,7 @@ public abstract class Item implements Drawable, SearchTreeObject, ObjectInfoPane } /** - * Internal funktion used in the implementation of print_info + * Internal function used in the implementation of print_info */ protected void print_item_info(ObjectInfoPanel p_window, java.util.Locale p_locale) { diff --git a/src/main/java/eu/mihosoft/freerouting/board/ItemIdNoGenerator.java b/src/main/java/eu/mihosoft/freerouting/board/ItemIdNoGenerator.java index 9f2e31b..85a1542 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ItemIdNoGenerator.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ItemIdNoGenerator.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.board; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Creates unique Item identication nunbers. * @@ -47,7 +49,7 @@ public class ItemIdNoGenerator implements eu.mihosoft.freerouting.datastructures { if (last_generated_id_no >= c_max_id_no) { - System.out.println("IdNoGenerator: danger of overflow, please regenerate id numbers from scratch!"); + FRLogger.warn("IdNoGenerator: danger of overflow, please regenerate id numbers from scratch!"); } ++last_generated_id_no; return last_generated_id_no; diff --git a/src/main/java/eu/mihosoft/freerouting/board/ObstacleArea.java b/src/main/java/eu/mihosoft/freerouting/board/ObstacleArea.java index 98f8d99..1a3e05f 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ObstacleArea.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ObstacleArea.java @@ -30,6 +30,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import java.awt.Color; import eu.mihosoft.freerouting.boardgraphics.GraphicsContext; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -81,7 +82,7 @@ public class ObstacleArea extends Item implements java.io.Serializable { if (this.relative_area == null) { - System.out.println("ObstacleArea.get_area: area is null"); + FRLogger.warn("ObstacleArea.get_area: area is null"); return null; } Area turned_area = this.relative_area; @@ -171,7 +172,7 @@ public class ObstacleArea extends Item implements java.io.Serializable TileShape[] tile_shapes = this.split_to_convex(); if (tile_shapes == null || p_no < 0 || p_no >= tile_shapes.length) { - System.out.println("ConvexObstacle.get_tile_shape: p_no out of range"); + FRLogger.warn("ConvexObstacle.get_tile_shape: p_no out of range"); return null; } return tile_shapes[p_no]; @@ -345,7 +346,7 @@ public class ObstacleArea extends Item implements java.io.Serializable { if (this.relative_area == null) { - System.out.println("ObstacleArea.split_to_convex: area is null"); + FRLogger.warn("ObstacleArea.split_to_convex: area is null"); return null; } return this.get_area().split_to_convex(); diff --git a/src/main/java/eu/mihosoft/freerouting/board/OptViaAlgo.java b/src/main/java/eu/mihosoft/freerouting/board/OptViaAlgo.java index a8ab05b..e314d75 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/OptViaAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/board/OptViaAlgo.java @@ -36,6 +36,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatLine; import eu.mihosoft.freerouting.geometry.planar.Side; import eu.mihosoft.freerouting.autoroute.AutorouteControl.ExpansionCostFactor; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Contains functions for optimizing and improving via locations. @@ -62,7 +63,7 @@ public class OptViaAlgo { if (p_board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("OptViaAlgo.opt_via_location: probably endless loop") ; + FRLogger.warn("OptViaAlgo.opt_via_location: probably endless loop") ; } return false; } @@ -133,7 +134,7 @@ public class OptViaAlgo } else { - System.out.println("OptViaAlgo.opt_via_location: incorrect first contact"); + FRLogger.warn("OptViaAlgo.opt_via_location: incorrect first contact"); return false; } @@ -148,7 +149,7 @@ public class OptViaAlgo } else { - System.out.println("OptViaAlgo.opt_via_location: incorrect second contact"); + FRLogger.warn("OptViaAlgo.opt_via_location: incorrect second contact"); return false; } @@ -178,7 +179,7 @@ public class OptViaAlgo Vector delta = new_location.difference_by(via_center); if (!MoveDrillItemAlgo.insert(p_via, delta, 9, 9, null, p_board)) { - System.out.println("OptViaAlgo.opt_via_location: move via failed"); + FRLogger.warn("OptViaAlgo.opt_via_location: move via failed"); return false; } ItemSelectionFilter filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.TRACES); @@ -213,7 +214,7 @@ public class OptViaAlgo { if (p_board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("OptViaAlgo.opt_plane_or_fanout_via: probably endless loop") ; + FRLogger.warn("OptViaAlgo.opt_plane_or_fanout_via: probably endless loop") ; } return false; } @@ -263,7 +264,7 @@ public class OptViaAlgo } else { - System.out.println("OptViaAlgo.opt_plane_or_fanout_via: unconsistant contact"); + FRLogger.warn("OptViaAlgo.opt_plane_or_fanout_via: unconsistant contact"); return false; } Polyline trace_polyline = contact_trace.polyline(); @@ -355,7 +356,7 @@ public class OptViaAlgo Vector diff_vector = new_via_location.difference_by(via_center); if (!MoveDrillItemAlgo.insert(p_via, diff_vector, 9, 9, null, p_board)) { - System.out.println("OptViaAlgo.opt_plane_or_fanout_via: move via failed"); + FRLogger.warn("OptViaAlgo.opt_plane_or_fanout_via: move via failed"); return false; } ItemSelectionFilter filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.TRACES); @@ -448,7 +449,7 @@ public class OptViaAlgo { if (p_board.get_test_level() == TestLevel.ALL_DEBUGGING_OUTPUT) { - System.out.println("OptViaAlgo.reposition_via: from_location equal p_to_location"); + FRLogger.warn("OptViaAlgo.reposition_via: from_location equal p_to_location"); } return false; } diff --git a/src/main/java/eu/mihosoft/freerouting/board/Pin.java b/src/main/java/eu/mihosoft/freerouting/board/Pin.java index 6bbeaeb..a2eb091 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/Pin.java +++ b/src/main/java/eu/mihosoft/freerouting/board/Pin.java @@ -37,6 +37,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.library.Package; import eu.mihosoft.freerouting.library.Padstack; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class describing the functionality of an electrical Item on the eu.mihosoft.freerouting.board @@ -121,7 +122,7 @@ public class Pin extends DrillItem implements java.io.Serializable } if (curr_shape == null) { - System.out.println("Pin: At least 1 shape != null expected"); + FRLogger.warn("Pin: At least 1 shape != null expected"); } else if (!curr_shape.contains_inside(pin_center)) { @@ -137,7 +138,7 @@ public class Pin extends DrillItem implements java.io.Serializable Component component = board.components.get(get_component_no()); if (component == null) { - System.out.println("Pin.get_padstack; component not found"); + FRLogger.warn("Pin.get_padstack; component not found"); return null; } int padstack_no = component.get_package().get_pin(pin_no).padstack_no; @@ -163,7 +164,7 @@ public class Pin extends DrillItem implements java.io.Serializable Component component = board.components.get(this.get_component_no()); if (component == null) { - System.out.println("Pin.name: component not found"); + FRLogger.warn("Pin.name: component not found"); return null; } return component.get_package().get_pin(pin_no).name; @@ -189,19 +190,19 @@ public class Pin extends DrillItem implements java.io.Serializable Component component = board.components.get(this.get_component_no()); if (component == null) { - System.out.println("Pin.get_shape: component not found"); + FRLogger.warn("Pin.get_shape: component not found"); return null; } Package lib_package = component.get_package(); if (lib_package == null) { - System.out.println("Pin.get_shape: package not found"); + FRLogger.warn("Pin.get_shape: package not found"); return null; } Package.Pin package_pin = lib_package.get_pin(this.pin_no); if (package_pin == null) { - System.out.println("Pin.get_shape: pin_no out of range"); + FRLogger.warn("Pin.get_shape: pin_no out of range"); return null; } Vector rel_location = package_pin.relative_location; @@ -364,7 +365,7 @@ public class Pin extends DrillItem implements java.io.Serializable int intersecting_border_line_no = pad_shape.intersecting_border_line_no(pin_center, curr_exit_direction); if (intersecting_border_line_no < 0) { - System.out.println("Pin.get_trace_exit_restrictions: border line not found"); + FRLogger.warn("Pin.get_trace_exit_restrictions: border line not found"); continue; } Line curr_exit_line = new Line(pin_center, curr_exit_direction); @@ -489,7 +490,7 @@ public class Pin extends DrillItem implements java.io.Serializable } else { - System.out.println("Pin.get_swappable_pins: swappable pin not found"); + FRLogger.warn("Pin.get_swappable_pins: swappable pin not found"); } } } @@ -533,7 +534,7 @@ public class Pin extends DrillItem implements java.io.Serializable { if (this.net_count() > 1 || p_other.net_count() > 1) { - System.out.println("Pin.swap not yet implemented for pins belonging to more than 1 net "); + FRLogger.warn("Pin.swap not yet implemented for pins belonging to more than 1 net "); return false; } int this_net_no; @@ -605,13 +606,13 @@ public class Pin extends DrillItem implements java.io.Serializable Shape padstack_shape = this.get_padstack().get_shape(padstack_layer); if (padstack_shape == null) { - System.out.println("Pin.get_min_width: padstack_shape is null"); + FRLogger.warn("Pin.get_min_width: padstack_shape is null"); return 0; } eu.mihosoft.freerouting.geometry.planar.IntBox padstack_bounding_box = padstack_shape.bounding_box(); if (padstack_bounding_box == null) { - System.out.println("Pin.get_min_width: padstack_bounding_box is null"); + FRLogger.warn("Pin.get_min_width: padstack_bounding_box is null"); return 0; } return padstack_bounding_box.min_width(); @@ -637,13 +638,13 @@ public class Pin extends DrillItem implements java.io.Serializable Shape padstack_shape = this.get_padstack().get_shape(padstack_layer); if (padstack_shape == null) { - System.out.println("Pin.get_max_width: padstack_shape is null"); + FRLogger.warn("Pin.get_max_width: padstack_shape is null"); return 0; } eu.mihosoft.freerouting.geometry.planar.IntBox padstack_bounding_box = padstack_shape.bounding_box(); if (padstack_bounding_box == null) { - System.out.println("Pin.get_max_width: padstack_bounding_box is null"); + FRLogger.warn("Pin.get_max_width: padstack_bounding_box is null"); return 0; } return padstack_bounding_box.max_width(); diff --git a/src/main/java/eu/mihosoft/freerouting/board/PolylineTrace.java b/src/main/java/eu/mihosoft/freerouting/board/PolylineTrace.java index b83a005..9098441 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/PolylineTrace.java +++ b/src/main/java/eu/mihosoft/freerouting/board/PolylineTrace.java @@ -41,6 +41,7 @@ import java.util.Iterator; import java.util.LinkedList; import eu.mihosoft.freerouting.boardgraphics.GraphicsContext; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -63,7 +64,7 @@ public class PolylineTrace extends Trace implements java.io.Serializable p_id_no, p_group_no, p_fixed_state, p_board); if (p_polyline.arr.length < 3) { - System.out.println("PolylineTrace: p_polyline.arr.length >= 3 expected"); + FRLogger.warn("PolylineTrace: p_polyline.arr.length >= 3 expected"); } lines = p_polyline; } @@ -771,7 +772,7 @@ public class PolylineTrace extends Trace implements java.io.Serializable } if (split_polylines.length != 2) { - System.out.println("PolylineTrace.split: array of length 2 expected for split_polylines"); + FRLogger.warn("PolylineTrace.split: array of length 2 expected for split_polylines"); return null; } if (split_inside_drill_pad_prohibited(p_line_no, p_new_end_line)) @@ -953,7 +954,7 @@ public class PolylineTrace extends Trace implements java.io.Serializable { if (p_index < 0 || p_index >= this.tile_shape_count()) { - System.out.println("PolylineTrace.get_trace_connection_shape p_index out of range"); + FRLogger.warn("PolylineTrace.get_trace_connection_shape p_index out of range"); return null; } LineSegment curr_line_segment = new LineSegment(this.lines, p_index + 1); diff --git a/src/main/java/eu/mihosoft/freerouting/board/PullTightAlgo.java b/src/main/java/eu/mihosoft/freerouting/board/PullTightAlgo.java index 2aadf9e..8f08ca9 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/PullTightAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/board/PullTightAlgo.java @@ -40,6 +40,7 @@ import eu.mihosoft.freerouting.datastructures.Stoppable; import eu.mihosoft.freerouting.datastructures.TimeLimit; import eu.mihosoft.freerouting.autoroute.AutorouteControl.ExpansionCostFactor; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class with functionality for optimising traces and vias. @@ -204,7 +205,7 @@ public abstract class PullTightAlgo boolean time_limit_exceeded = this.time_limit.limit_exceeded(); if (time_limit_exceeded && this.board.get_test_level().ordinal() >= TestLevel.CRITICAL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("PullTightAlgo.is_stop_requested: time limit exceeded"); + FRLogger.warn("PullTightAlgo.is_stop_requested: time limit exceeded"); } return time_limit_exceeded; } diff --git a/src/main/java/eu/mihosoft/freerouting/board/RoutingBoard.java b/src/main/java/eu/mihosoft/freerouting/board/RoutingBoard.java index e305a75..468a0a7 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/RoutingBoard.java +++ b/src/main/java/eu/mihosoft/freerouting/board/RoutingBoard.java @@ -40,6 +40,7 @@ import eu.mihosoft.freerouting.datastructures.Stoppable; import eu.mihosoft.freerouting.datastructures.TimeLimit; import eu.mihosoft.freerouting.datastructures.ShapeTree.TreeEntry; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ViaInfo; import eu.mihosoft.freerouting.rules.BoardRules; @@ -707,7 +708,7 @@ public class RoutingBoard extends BasicBoard implements java.io.Serializable } if (!(from_corner instanceof IntPoint && to_corner instanceof IntPoint)) { - System.out.println("RoutingBoard.insert_forced_trace_segment: only implemented for IntPoints"); + FRLogger.warn("RoutingBoard.insert_forced_trace_segment: only implemented for IntPoints"); return from_corner; } start_marking_changed_area(); @@ -809,7 +810,7 @@ public class RoutingBoard extends BasicBoard implements java.io.Serializable Point curr_last_corner = new_polyline.last_corner(); if (!(curr_last_corner instanceof IntPoint)) { - System.out.println("insert_forced_trace_segment: IntPoint expected"); + FRLogger.warn("insert_forced_trace_segment: IntPoint expected"); return from_corner; } new_corner = curr_last_corner; @@ -846,7 +847,7 @@ public class RoutingBoard extends BasicBoard implements java.io.Serializable p_max_via_recursion_depth, p_max_spring_over_recursion_depth); if (!insert_ok) { - System.out.println("shove trace failed"); + FRLogger.warn("shove trace failed"); return null; } } @@ -945,7 +946,7 @@ public class RoutingBoard extends BasicBoard implements java.io.Serializable } if (p_item.net_count() > 1) { - System.out.println("RoutingBoard.eu.mihosoft.freerouting.autoroute: net_count > 1 not yet implemented"); + FRLogger.warn("RoutingBoard.autoroute: net_count > 1 not yet implemented"); } int route_net_no = p_item.get_net_no(0); AutorouteControl ctrl_settings = new AutorouteControl(this, route_net_no, p_settings, p_via_costs, p_settings.autoroute_settings.get_trace_cost_arr()); diff --git a/src/main/java/eu/mihosoft/freerouting/board/SearchTreeManager.java b/src/main/java/eu/mihosoft/freerouting/board/SearchTreeManager.java index 5e139f5..7d17b6f 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/SearchTreeManager.java +++ b/src/main/java/eu/mihosoft/freerouting/board/SearchTreeManager.java @@ -33,6 +33,7 @@ import eu.mihosoft.freerouting.datastructures.ShapeTree; import eu.mihosoft.freerouting.geometry.planar.FortyfiveDegreeBoundingDirections; import eu.mihosoft.freerouting.geometry.planar.Polyline; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -176,7 +177,7 @@ public class SearchTreeManager Iterator it = this.compensated_search_trees.iterator(); if (p_no == default_tree.compensated_clearance_class_no) { - System.out.println("SearchtreeManager.clearance_class_removed: unable to remove default tree"); + FRLogger.warn("SearchtreeManager.clearance_class_removed: unable to remove default tree"); return; } while(it.hasNext()) @@ -258,7 +259,7 @@ public class SearchTreeManager { if (this.board == null) { - System.out.println("SearchtreeManager.remove_all_board_items: eu.mihosoft.freerouting.board is null"); + FRLogger.warn("SearchtreeManager.remove_all_board_items: eu.mihosoft.freerouting.board is null"); return; } Iterator it = this.board.item_list.start_read_object(); @@ -277,7 +278,7 @@ public class SearchTreeManager { if (this.board == null) { - System.out.println("SearchtreeManager.insert_all_board_items: eu.mihosoft.freerouting.board is null"); + FRLogger.warn("SearchtreeManager.insert_all_board_items: eu.mihosoft.freerouting.board is null"); return; } Iterator it = this.board.item_list.start_read_object(); diff --git a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree.java b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree.java index a21a515..d2511fb 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree.java @@ -43,6 +43,7 @@ import java.util.LinkedList; import java.util.Set; import java.util.TreeSet; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ClearanceMatrix; import eu.mihosoft.freerouting.datastructures.Signum; @@ -401,13 +402,13 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA } if (p_tree_entries == null) { - System.out.println("eu.mihosoft.freerouting.board.ShapeSearchTree.overlaps: p_obstacle_entries is null"); + FRLogger.warn("ShapeSearchTree.overlaps: p_obstacle_entries is null"); return; } RegularTileShape bounds = p_shape.bounding_shape(bounding_directions); if (bounds == null) { - System.out.println("eu.mihosoft.freerouting.board.ShapeSearchTree.overlaps: p_shape not bounded"); + FRLogger.warn("ShapeSearchTree.overlaps: p_shape not bounded"); return; } Collection tmp_list = this.overlaps(bounds); @@ -475,14 +476,14 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA } if (p_obstacle_entries == null) { - System.out.println("eu.mihosoft.freerouting.board.ShapeSearchTree.overlaps_with_clearance: p_obstacle_entries is null"); + FRLogger.warn("ShapeSearchTree.overlaps_with_clearance: p_obstacle_entries is null"); return; } ClearanceMatrix cl_matrix = board.rules.clearance_matrix; RegularTileShape bounds = p_shape.bounding_shape(bounding_directions); if (bounds == null) { - System.out.println("eu.mihosoft.freerouting.board.ShapeSearchTree.overlaps_with_clearance: p_shape is not bounded"); + FRLogger.warn("ShapeSearchTree.overlaps_with_clearance: p_shape is not bounded"); bounds = board.get_bounding_box(); } int max_clearance = @@ -644,7 +645,7 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA { if (p_room.get_contained_shape() == null) { - System.out.println("ShapeSearchTree.complete_shape: p_shape_to_be_contained != null expected"); + FRLogger.warn("ShapeSearchTree.complete_shape: p_shape_to_be_contained != null expected"); return new LinkedList(); } if (this.root == null) @@ -756,7 +757,7 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA { if (this.board.get_test_level().ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("ShapeSearchTree.restrain_shape: p_shape_to_be_contained is empty"); + FRLogger.warn("ShapeSearchTree.restrain_shape: p_shape_to_be_contained is empty"); } return result; } @@ -968,7 +969,7 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA int offset_width = this.clearance_compensation_value(p_drill_item.clearance_class_no(), p_drill_item.shape_layer(i)); if (curr_tile_shape == null) { - System.out.println("ShapeSearchTree.calculate_tree_shapes: shape is null"); + FRLogger.warn("ShapeSearchTree.calculate_tree_shapes: shape is null"); } else { @@ -1158,7 +1159,7 @@ public class ShapeSearchTree extends eu.mihosoft.freerouting.datastructures.MinA Leaf curr_leaf = curr_tree_entries[i]; if (curr_leaf.shape_index_in_object != i) { - System.out.println("tree entry inconsistent for Item"); + FRLogger.warn("tree entry inconsistent for Item"); return false; } } diff --git a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree45Degree.java b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree45Degree.java index d727898..5de1462 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree45Degree.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree45Degree.java @@ -36,6 +36,7 @@ import eu.mihosoft.freerouting.geometry.planar.Line; import eu.mihosoft.freerouting.autoroute.IncompleteFreeSpaceExpansionRoom; import eu.mihosoft.freerouting.autoroute.CompleteFreeSpaceExpansionRoom; +import eu.mihosoft.freerouting.logger.FRLogger; /** * A special simple ShapeSearchtree, where the shapes are of class IntOctagon. @@ -65,7 +66,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree { if (!(p_room.get_contained_shape().is_IntOctagon()) && this.board.get_test_level() != TestLevel.RELEASE_VERSION) { - System.out.println("ShapeSearchTree45Degree.complete_shape: unexpected p_shape_to_be_contained"); + FRLogger.warn("ShapeSearchTree45Degree.complete_shape: unexpected p_shape_to_be_contained"); return new LinkedList(); } IntOctagon shape_to_be_contained = p_room.get_contained_shape().bounding_octagon(); @@ -78,7 +79,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree { if (!(p_room.get_shape() instanceof IntOctagon)) { - System.out.println("ShapeSearchTree45Degree.complete_shape: p_start_shape of type IntOctagon expected"); + FRLogger.warn("ShapeSearchTree45Degree.complete_shape: p_start_shape of type IntOctagon expected"); return new LinkedList(); } start_shape = p_room.get_shape().bounding_octagon().intersection(start_shape); @@ -249,7 +250,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree { if (this.board.get_test_level().ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("ShapeSearchTree45Degree.restrain_shape: p_shape_to_be_contained is empty"); + FRLogger.warn("ShapeSearchTree45Degree.restrain_shape: p_shape_to_be_contained is empty"); } return result; } @@ -369,7 +370,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree } else { - System.out.println("ShapeSearchTree45Degree.signed_line_distance: p_obstacle_line_no out of range"); + FRLogger.warn("ShapeSearchTree45Degree.signed_line_distance: p_obstacle_line_no out of range"); result = 0; } return result; @@ -423,7 +424,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree } else { - System.out.println("ShapeSearchTree45Degree.calc_outside_restrained_shape: p_obstacle_line_no out of range"); + FRLogger.warn("ShapeSearchTree45Degree.calc_outside_restrained_shape: p_obstacle_line_no out of range"); } IntOctagon result = new IntOctagon(lx, ly, rx, uy, ulx, lrx, llx, urx); @@ -478,7 +479,7 @@ public class ShapeSearchTree45Degree extends ShapeSearchTree } else { - System.out.println("ShapeSearchTree45Degree.calc_inside_restrained_shape: p_obstacle_line_no out of range"); + FRLogger.warn("ShapeSearchTree45Degree.calc_inside_restrained_shape: p_obstacle_line_no out of range"); } IntOctagon result = new IntOctagon(lx, ly, rx, uy, ulx, lrx, llx, urx); diff --git a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree90Degree.java b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree90Degree.java index deb4d10..78f9ade 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree90Degree.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ShapeSearchTree90Degree.java @@ -35,6 +35,7 @@ import eu.mihosoft.freerouting.geometry.planar.Polyline; import eu.mihosoft.freerouting.autoroute.IncompleteFreeSpaceExpansionRoom; import eu.mihosoft.freerouting.autoroute.CompleteFreeSpaceExpansionRoom; +import eu.mihosoft.freerouting.logger.FRLogger; /** * A special simple ShapeSearchtree, where the shapes are of class IntBox. @@ -64,7 +65,7 @@ public class ShapeSearchTree90Degree extends ShapeSearchTree { if (!(p_room.get_contained_shape() instanceof IntBox)) { - System.out.println("BoxShapeSearchTree.complete_shape: unexpected p_shape_to_be_contained"); + FRLogger.warn("BoxShapeSearchTree.complete_shape: unexpected p_shape_to_be_contained"); return new LinkedList(); } IntBox shape_to_be_contained = (IntBox) p_room.get_contained_shape(); @@ -77,7 +78,7 @@ public class ShapeSearchTree90Degree extends ShapeSearchTree { if (!(p_room.get_shape() instanceof IntBox)) { - System.out.println("BoxShapeSearchTree.complete_shape: p_start_shape of type IntBox expected"); + FRLogger.warn("BoxShapeSearchTree.complete_shape: p_start_shape of type IntBox expected"); return new LinkedList(); } start_shape = ((IntBox)p_room.get_shape()).intersection(start_shape); @@ -177,7 +178,7 @@ public class ShapeSearchTree90Degree extends ShapeSearchTree { if (this.board.get_test_level().ordinal() >= TestLevel.ALL_DEBUGGING_OUTPUT.ordinal()) { - System.out.println("BoxShapeSearchTree.restrain_shape: p_shape_to_be_contained is empty"); + FRLogger.warn("BoxShapeSearchTree.restrain_shape: p_shape_to_be_contained is empty"); } return result; } @@ -242,7 +243,7 @@ public class ShapeSearchTree90Degree extends ShapeSearchTree IntBox is = shape_to_be_contained.intersection(p_obstacle_shape); if (is.is_empty()) { - System.out.println("BoxShapeSearchTree.restrain_shape: Intersection between obstacle_shape and shape_to_be_contained expected"); + FRLogger.warn("BoxShapeSearchTree.restrain_shape: Intersection between obstacle_shape and shape_to_be_contained expected"); return result; } IntBox new_shape_1 = null; @@ -303,7 +304,7 @@ public class ShapeSearchTree90Degree extends ShapeSearchTree int offset_width = this.clearance_compensation_value(p_drill_item.clearance_class_no(), p_drill_item.shape_layer(i)); if (curr_tile_shape == null) { - System.out.println("BoxShapeSearchTree.calculate_tree_shapes: shape is null"); + FRLogger.warn("BoxShapeSearchTree.calculate_tree_shapes: shape is null"); } else { diff --git a/src/main/java/eu/mihosoft/freerouting/board/ShapeTraceEntries.java b/src/main/java/eu/mihosoft/freerouting/board/ShapeTraceEntries.java index c65d601..bd6f472 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ShapeTraceEntries.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ShapeTraceEntries.java @@ -25,6 +25,7 @@ import eu.mihosoft.freerouting.geometry.planar.Line; import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.Polyline; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Collection; import java.util.Iterator; @@ -254,7 +255,7 @@ public class ShapeTraceEntries { if (!p_trace.is_on_the_board()) { - System.out.println("ShapeTraceEntries.cutout_trace : trace is deleted"); + FRLogger.warn("ShapeTraceEntries.cutout_trace : trace is deleted"); return; } ConvexShape offset_shape; @@ -500,7 +501,7 @@ public class ShapeTraceEntries int edge_count = this.shape.border_line_count(); if (this.from_side.no < 0 || from_side.no >= edge_count) { - System.out.println("ShapeTraceEntries.resort: from side not calculated"); + FRLogger.warn("ShapeTraceEntries.resort: from side not calculated"); return; } // resort the intersection points, so that they start in the @@ -521,8 +522,7 @@ public class ShapeTraceEntries { from_point_projection = from_side.border_intersection.projection_approx(shape.border_line(from_side.no)); from_point_dist = from_point_projection.distance_square(compare_corner_1); - if (from_point_dist >= - compare_corner_1.distance_square(compare_corner_2)) + if (from_point_dist >= compare_corner_1.distance_square(compare_corner_2)) { from_side = new CalcFromSide(from_side.no, null); } @@ -769,8 +769,7 @@ public class ShapeTraceEntries } if (curr_level != 1) { - System.out.println( - "ShapeTraceEntries.calculate_stack_levels: curr_level inconsistent"); + FRLogger.warn("ShapeTraceEntries.calculate_stack_levels: curr_level inconsistent"); return false; } return true; @@ -788,7 +787,7 @@ public class ShapeTraceEntries { if (this.trace_piece_count != 0) { - System.out.println("ShapeTraceEntries: trace_piece_count is inconsistent"); + FRLogger.warn("ShapeTraceEntries: trace_piece_count is inconsistent"); } return null; } @@ -806,7 +805,7 @@ public class ShapeTraceEntries } if (first == null) { - System.out.println("ShapeTraceEntries: max_stack_level not found"); + FRLogger.warn("ShapeTraceEntries: max_stack_level not found"); return null; } EntryPoint [] result = new EntryPoint [2]; diff --git a/src/main/java/eu/mihosoft/freerouting/board/ShoveTraceAlgo.java b/src/main/java/eu/mihosoft/freerouting/board/ShoveTraceAlgo.java index dc3ecd0..ed8ff9b 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/ShoveTraceAlgo.java +++ b/src/main/java/eu/mihosoft/freerouting/board/ShoveTraceAlgo.java @@ -31,6 +31,7 @@ import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.Polyline; import eu.mihosoft.freerouting.geometry.planar.TileShape; import eu.mihosoft.freerouting.geometry.planar.LineSegment; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Collection; import java.util.Iterator; @@ -67,7 +68,7 @@ public class ShoveTraceAlgo if (p_trace_shape.is_empty()) { - System.out.println("ShoveTraceAux.check: p_trace_shape is empty"); + FRLogger.warn("ShoveTraceAux.check: p_trace_shape is empty"); return true; } if (!p_trace_shape.is_contained_in(board.get_bounding_box())) @@ -212,14 +213,14 @@ public class ShoveTraceAlgo TileShape[] trace_shapes = p_line_segment.to_polyline().offset_shapes(p_trace_half_width); if (trace_shapes.length != 1) { - System.out.println("ShoveTraceAlgo.check: trace_shape count 1 expected"); + FRLogger.warn("ShoveTraceAlgo.check: trace_shape count 1 expected"); return 0; } TileShape trace_shape = trace_shapes[0]; if (trace_shape.is_empty()) { - System.out.println("ShoveTraceAlgo.check: trace_shape is empty"); + FRLogger.warn("ShoveTraceAlgo.check: trace_shape is empty"); return 0; } if (!trace_shape.is_contained_in(p_board.get_bounding_box())) @@ -372,7 +373,7 @@ public class ShoveTraceAlgo { if (p_trace_shape.is_empty()) { - System.out.println("ShoveTraceAux.insert: p_trace_shape is empty"); + FRLogger.warn("ShoveTraceAux.insert: p_trace_shape is empty"); return true; } if (!p_trace_shape.is_contained_in(board.get_bounding_box())) diff --git a/src/main/java/eu/mihosoft/freerouting/board/Trace.java b/src/main/java/eu/mihosoft/freerouting/board/Trace.java index 43b0a81..0f0bc00 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/Trace.java +++ b/src/main/java/eu/mihosoft/freerouting/board/Trace.java @@ -23,6 +23,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.geometry.planar.IntOctagon; import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Collection; import java.util.Iterator; @@ -511,7 +512,7 @@ public abstract class Trace extends Item implements Connectable, java.io.Seriali if (this.first_corner().equals(this.last_corner())) { - System.out.println("Trace.validate: first and last corner are equal"); + FRLogger.warn("Trace.validate: first and last corner are equal"); result = false; } return result; diff --git a/src/main/java/eu/mihosoft/freerouting/board/Via.java b/src/main/java/eu/mihosoft/freerouting/board/Via.java index 05320a0..6e1f2ec 100644 --- a/src/main/java/eu/mihosoft/freerouting/board/Via.java +++ b/src/main/java/eu/mihosoft/freerouting/board/Via.java @@ -31,6 +31,7 @@ import eu.mihosoft.freerouting.geometry.planar.TileShape; import eu.mihosoft.freerouting.geometry.planar.Shape; import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.library.Padstack; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class describing the functionality of an electrical Item on the eu.mihosoft.freerouting.board, @@ -61,7 +62,7 @@ public class Via extends DrillItem implements java.io.Serializable { if (padstack == null) { - System.out.println("Via.get_shape: padstack is null"); + FRLogger.warn("Via.get_shape: padstack is null"); return null; } if (this.precalculated_shapes == null) diff --git a/src/main/java/eu/mihosoft/freerouting/boardgraphics/ColorIntensityTable.java b/src/main/java/eu/mihosoft/freerouting/boardgraphics/ColorIntensityTable.java index 7009504..f0a460e 100644 --- a/src/main/java/eu/mihosoft/freerouting/boardgraphics/ColorIntensityTable.java +++ b/src/main/java/eu/mihosoft/freerouting/boardgraphics/ColorIntensityTable.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.boardgraphics; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * The color intensities for each item type. * The values are between 0 (invisible) and 1 (full intensity). @@ -68,7 +70,7 @@ public class ColorIntensityTable implements java.io.Serializable { if (p_no < 0 || p_no >= ObjectNames.values().length) { - System.out.println("ColorIntensityTable.get_value: p_no out of range"); + FRLogger.warn("ColorIntensityTable.get_value: p_no out of range"); return 0; } return arr[p_no]; @@ -78,7 +80,7 @@ public class ColorIntensityTable implements java.io.Serializable { if (p_no < 0 || p_no >= ObjectNames.values().length) { - System.out.println("ColorIntensityTable.set_value: p_no out of range"); + FRLogger.warn("ColorIntensityTable.set_value: p_no out of range"); return; } arr [p_no] = p_value; diff --git a/src/main/java/eu/mihosoft/freerouting/boardgraphics/GraphicsContext.java b/src/main/java/eu/mihosoft/freerouting/boardgraphics/GraphicsContext.java index 40c47d8..2c54075 100644 --- a/src/main/java/eu/mihosoft/freerouting/boardgraphics/GraphicsContext.java +++ b/src/main/java/eu/mihosoft/freerouting/boardgraphics/GraphicsContext.java @@ -27,6 +27,7 @@ import eu.mihosoft.freerouting.geometry.planar.IntBox; import eu.mihosoft.freerouting.geometry.planar.PolylineShape; import eu.mihosoft.freerouting.geometry.planar.Shape; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; import java.awt.AlphaComposite; import java.awt.BasicStroke; @@ -429,7 +430,7 @@ public class GraphicsContext implements java.io.Serializable PolylineShape border = (PolylineShape) p_area.get_border(); if (!border.is_bounded()) { - System.out.println("GraphicsContext.fill_area: shape not bounded"); + FRLogger.warn("GraphicsContext.fill_area: shape not bounded"); return; } java.awt.Shape clip_shape = p_g.getClip() ; diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/IdentifierType.java b/src/main/java/eu/mihosoft/freerouting/datastructures/IdentifierType.java index b4f4437..f97d0c0 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/IdentifierType.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/IdentifierType.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.datastructures; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.io.OutputStreamWriter; /** @@ -60,7 +62,7 @@ public class IdentifierType } catch (java.io.IOException e) { - System.out.println("IndentFileWriter.new_line: unable to write to file"); + FRLogger.warn("IndentFileWriter.new_line: unable to write to file"); } } @@ -71,7 +73,7 @@ public class IdentifierType { if (p_string == null) { - System.out.println("IdentifierType.is_legal: p_string is null"); + FRLogger.warn("IdentifierType.is_legal: p_string is null"); return false; } for (int i = 0; i < reserved_chars.length; ++i) diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/IndentFileWriter.java b/src/main/java/eu/mihosoft/freerouting/datastructures/IndentFileWriter.java index e00f66b..c07ba81 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/IndentFileWriter.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/IndentFileWriter.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.datastructures; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Handles the indenting of scopes while writing to an output text file. * @@ -49,7 +51,7 @@ public class IndentFileWriter extends java.io.OutputStreamWriter } catch (java.io.IOException e) { - System.out.println("IndentFileWriter.start_scope: unable to write to file"); + FRLogger.error("IndentFileWriter.start_scope: unable to write to file", e); } ++current_indent_level; } @@ -67,7 +69,7 @@ public class IndentFileWriter extends java.io.OutputStreamWriter } catch (java.io.IOException e) { - System.out.println("IndentFileWriter.end_scope: unable to write to file"); + FRLogger.error("IndentFileWriter.end_scope: unable to write to file", e); } } @@ -86,7 +88,7 @@ public class IndentFileWriter extends java.io.OutputStreamWriter } catch (java.io.IOException e) { - System.out.println("IndentFileWriter.new_line: unable to write to file"); + FRLogger.error("IndentFileWriter.new_line: unable to write to file", e); } } diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/MinAreaTree.java b/src/main/java/eu/mihosoft/freerouting/datastructures/MinAreaTree.java index e981eb8..f1cf155 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/MinAreaTree.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/MinAreaTree.java @@ -28,6 +28,7 @@ import java.util.TreeSet; import eu.mihosoft.freerouting.geometry.planar.ShapeBoundingDirections; import eu.mihosoft.freerouting.geometry.planar.RegularTileShape; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Binary search tree for shapes in the plane. @@ -200,7 +201,7 @@ public class MinAreaTree extends ShapeTree } else { - System.out.println("MinAreaTree.remove_leaf: parent inconsistent"); + FRLogger.warn("MinAreaTree.remove_leaf: parent inconsistent"); other_leaf = null; } // link the other leaf to the grand_parent and remove the parent node @@ -223,7 +224,7 @@ public class MinAreaTree extends ShapeTree } else { - System.out.println("MinAreaTree.remove_leaf: grand_parent inconsistent"); + FRLogger.warn("MinAreaTree.remove_leaf: grand_parent inconsistent"); } } parent.parent = null; diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/PlanarDelaunayTriangulation.java b/src/main/java/eu/mihosoft/freerouting/datastructures/PlanarDelaunayTriangulation.java index e57ed6a..002d040 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/PlanarDelaunayTriangulation.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/PlanarDelaunayTriangulation.java @@ -34,6 +34,7 @@ import eu.mihosoft.freerouting.geometry.planar.Point; import eu.mihosoft.freerouting.geometry.planar.IntPoint; import eu.mihosoft.freerouting.geometry.planar.Side; import eu.mihosoft.freerouting.geometry.planar.Limits; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Creates a Delaunay triangulation in the plane for the input objects. @@ -158,7 +159,7 @@ public class PlanarDelaunayTriangulation if (curr_side == Side.ON_THE_RIGHT) { // p_corner is outside this triangle - System.out.println("PlanarDelaunayTriangulation.split: p_corner is outside"); + FRLogger.warn("PlanarDelaunayTriangulation.split: p_corner is outside"); return false; } else if (curr_side == Side.COLLINEAR) @@ -170,7 +171,7 @@ public class PlanarDelaunayTriangulation Corner common_corner = curr_edge.common_corner(containing_edge); if (common_corner == null) { - System.out.println("PlanarDelaunayTriangulation.split: common corner expected"); + FRLogger.warn("PlanarDelaunayTriangulation.split: common corner expected"); return false; } if (p_corner.object == common_corner.object) @@ -269,7 +270,7 @@ public class PlanarDelaunayTriangulation } else { - System.out.println("PlanarDelaunayTriangulation.legalize_edge: edge lines inconsistant"); + FRLogger.warn("PlanarDelaunayTriangulation.legalize_edge: edge lines inconsistant"); return false; } Edge flipped_edge = p_edge.flip(); @@ -303,11 +304,11 @@ public class PlanarDelaunayTriangulation boolean result = this.search_graph.anchor.validate(); if (result == true) { - System.out.println("Delauny triangulation check passed ok"); + FRLogger.warn("Delauny triangulation check passed ok"); } else { - System.out.println("Delauny triangulation check has detected problems"); + FRLogger.warn("Delauny triangulation check has detected problems"); } return result; } @@ -477,7 +478,7 @@ public class PlanarDelaunayTriangulation } else { - System.out.println("Edge.other_neighbour: inconsistant neigbour triangle"); + FRLogger.warn("Edge.other_neighbour: inconsistant neigbour triangle"); result = null; } return result; @@ -532,7 +533,7 @@ public class PlanarDelaunayTriangulation } if (left_index < 0 || right_index < 0) { - System.out.println("Edge.flip: edge line inconsistant"); + FRLogger.warn("Edge.flip: edge line inconsistant"); return null; } Edge left_prev_edge = this.left_triangle.edge_lines[(left_index + 2) % 3]; @@ -604,7 +605,7 @@ public class PlanarDelaunayTriangulation { if (this.start_corner.object != null || this.end_corner.object != null) { - System.out.println("Edge.validate: left triangle may be null only for bounding edges"); + FRLogger.warn("Edge.validate: left triangle may be null only for bounding edges"); result = false; } } @@ -622,7 +623,7 @@ public class PlanarDelaunayTriangulation } if (!found) { - System.out.println("Edge.validate: left triangle does not contain this edge"); + FRLogger.warn("Edge.validate: left triangle does not contain this edge"); result = false; } } @@ -630,7 +631,7 @@ public class PlanarDelaunayTriangulation { if (this.start_corner.object != null || this.end_corner.object != null) { - System.out.println("Edge.validate: right triangle may be null only for bounding edges"); + FRLogger.warn("Edge.validate: right triangle may be null only for bounding edges"); result = false; } } @@ -648,7 +649,7 @@ public class PlanarDelaunayTriangulation } if (!found) { - System.out.println("Edge.validate: right triangle does not contain this edge"); + FRLogger.warn("Edge.validate: right triangle does not contain this edge"); result = false; } } @@ -702,7 +703,7 @@ public class PlanarDelaunayTriangulation { if (p_no < 0 || p_no >= 3) { - System.out.println("Triangle.get_corner: p_no out of range"); + FRLogger.warn("Triangle.get_corner: p_no out of range"); return null; } Edge curr_edge = edge_lines[p_no]; @@ -717,7 +718,7 @@ public class PlanarDelaunayTriangulation } else { - System.out.println("Triangle.get_corner: inconsistant edge lines"); + FRLogger.warn("Triangle.get_corner: inconsistant edge lines"); result = null; } return result; @@ -740,7 +741,7 @@ public class PlanarDelaunayTriangulation } if (edge_line_no < 0) { - System.out.println("Triangle.opposite_corner: p_edge_line not found"); + FRLogger.warn("Triangle.opposite_corner: p_edge_line not found"); return null; } Edge next_edge = this.edge_lines[(edge_line_no + 1)% 3]; @@ -763,7 +764,7 @@ public class PlanarDelaunayTriangulation { if (this.is_on_the_left_of_edge_line == null) { - System.out.println("Triangle.contains: array is_on_the_left_of_edge_line not initialized"); + FRLogger.warn("Triangle.contains: array is_on_the_left_of_edge_line not initialized"); return false; } for (int i = 0; i < 3; ++i) @@ -917,12 +918,12 @@ public class PlanarDelaunayTriangulation } if (this_touching_edge_no < 0 || neigbbour_touching_edge_no < 0) { - System.out.println("Triangle.split_at_border_point: touching edge not found"); + FRLogger.warn("Triangle.split_at_border_point: touching edge not found"); return null; } if (touching_edge != other_touching_edge) { - System.out.println("Triangle.split_at_border_point: edges inconsistent"); + FRLogger.warn("Triangle.split_at_border_point: edges inconsistent"); return null; } @@ -1080,12 +1081,12 @@ public class PlanarDelaunayTriangulation } else { - System.out.println("Triangle.validate: edge inconsistent"); + FRLogger.warn("Triangle.validate: edge inconsistent"); return false; } if (curr_start_corner != prev_end_corner) { - System.out.println("Triangle.validate: corner inconsistent"); + FRLogger.warn("Triangle.validate: corner inconsistent"); result = false; } prev_edge = curr_edge; @@ -1198,7 +1199,7 @@ public class PlanarDelaunayTriangulation return result; } } - System.out.println("TriangleGraph.position_locate: containing triangle not found"); + FRLogger.warn("TriangleGraph.position_locate: containing triangle not found"); return null; } @@ -1224,7 +1225,7 @@ public class PlanarDelaunayTriangulation return result; } } - System.out.println("TriangleGraph.position_locate_reku: containing triangle not found"); + FRLogger.warn("TriangleGraph.position_locate_reku: containing triangle not found"); return null; } diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/ShapeTree.java b/src/main/java/eu/mihosoft/freerouting/datastructures/ShapeTree.java index 92ec67d..2acea25 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/ShapeTree.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/ShapeTree.java @@ -27,6 +27,9 @@ import eu.mihosoft.freerouting.geometry.planar.ShapeBoundingDirections; import eu.mihosoft.freerouting.geometry.planar.RegularTileShape; import eu.mihosoft.freerouting.geometry.planar.Shape; import eu.mihosoft.freerouting.geometry.planar.TileShape; +import eu.mihosoft.freerouting.logger.FRLogger; + +import java.awt.event.WindowFocusListener; /** * Abstract binary search tree for shapes in the plane. @@ -79,7 +82,7 @@ public abstract class ShapeTree RegularTileShape bounding_shape = object_shape.bounding_shape(bounding_directions) ; if ( bounding_shape == null ) { - System.out.println("ShapeTree.insert: bounding shape of TreeObject is null"); + FRLogger.warn("ShapeTree.insert: bounding shape of TreeObject is null"); return null; } // Construct a new KdLeaf and set it up @@ -169,17 +172,11 @@ public abstract class ShapeTree } } double everage_depth = cumulative_depth / leaf_arr.length; - System.out.print("MinAreaTree: Entry count: "); - System.out.print(leaf_arr.length); - System.out.print(" log: "); - System.out.print(Math.round(Math.log(leaf_arr.length))); - System.out.print(" Everage depth: "); - System.out.print(Math.round(everage_depth)); - System.out.print(" "); - System.out.print(" Maximum depth: "); - System.out.print(maximum_depth); - System.out.print(" "); - System.out.println(p_message); + FRLogger.info("MinAreaTree: Entry count: " + leaf_arr.length + + " log: " + Math.round(Math.log(leaf_arr.length)) + + " Everage depth: " + Math.round(everage_depth) + " " + + " Maximum depth: " + maximum_depth + " " + + p_message); } diff --git a/src/main/java/eu/mihosoft/freerouting/datastructures/UndoableObjects.java b/src/main/java/eu/mihosoft/freerouting/datastructures/UndoableObjects.java index e49c5dc..74e8486 100644 --- a/src/main/java/eu/mihosoft/freerouting/datastructures/UndoableObjects.java +++ b/src/main/java/eu/mihosoft/freerouting/datastructures/UndoableObjects.java @@ -22,6 +22,8 @@ */ package eu.mihosoft.freerouting.datastructures; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -110,7 +112,7 @@ public class UndoableObjects implements java.io.Serializable } if (object_node.object != p_object) { - System.out.println("UndoableObjectList.delete: Object inconsistent"); + FRLogger.warn("UndoableObjectList.delete: Object inconsistent"); return false; } @@ -245,7 +247,7 @@ public class UndoableObjects implements java.io.Serializable } if (this.objects.remove(curr_deleted_node.object) == null) { - System.out.println("previous deleted object not found"); + FRLogger.warn("previous deleted object not found"); } if (p_restored_objects == null || !p_restored_objects.remove(curr_deleted_node.object)) { @@ -327,7 +329,7 @@ public class UndoableObjects implements java.io.Serializable UndoableObjectNode curr_node = objects.get(p_object); if (curr_node == null) { - System.out.println("UndoableObjects.save_for_undo: object node not found"); + FRLogger.warn("UndoableObjects.save_for_undo: object node not found"); return; } if (curr_node.level < this.stack_level) diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java index f46baef..f7e622a 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java @@ -25,6 +25,7 @@ package eu.mihosoft.freerouting.designforms.specctra; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -48,12 +49,12 @@ public class AutorouteSettings next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("AutorouteSettings.read_scope: IO error scanning file"); + FRLogger.error("AutorouteSettings.read_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("AutorouteSettings.read_scope: unexpected end of file"); + FRLogger.warn("AutorouteSettings.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -125,18 +126,18 @@ public class AutorouteSettings next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file"); + FRLogger.error("AutorouteSettings.read_layer_rule: IO error scanning file", e); return null; } if (!(next_token instanceof String)) { - System.out.println("AutorouteSettings.read_layer_rule: String expected"); + FRLogger.warn("AutorouteSettings.read_layer_rule: String expected"); return null; } int layer_no = p_layer_structure.get_no((String) next_token); if (layer_no < 0) { - System.out.println("AutorouteSettings.read_layer_rule: layer not found"); + FRLogger.warn("AutorouteSettings.read_layer_rule: layer not found"); return null; } for (;;) @@ -147,12 +148,12 @@ public class AutorouteSettings next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file"); + FRLogger.error("AutorouteSettings.read_layer_rule: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("AutorouteSettings.read_layer_rule: unexpected end of file"); + FRLogger.warn("AutorouteSettings.read_layer_rule: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -178,19 +179,19 @@ public class AutorouteSettings } else if (next_token != Keyword.HORIZONTAL) { - System.out.println("AutorouteSettings.read_layer_rule: unexpected key word"); + FRLogger.warn("AutorouteSettings.read_layer_rule: unexpected key word"); return null; } p_settings.set_preferred_direction_is_horizontal(layer_no, pref_dir_is_horizontal); next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("AutorouteSettings.read_layer_rule: uclosing bracket expected"); + FRLogger.warn("AutorouteSettings.read_layer_rule: uclosing bracket expected"); return null; } } catch (java.io.IOException e) { - System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file"); + FRLogger.error("AutorouteSettings.read_layer_rule: IO error scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Circuit.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Circuit.java index e9d102b..4d0cd49 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Circuit.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Circuit.java @@ -24,6 +24,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * @author Alfons Wirtz @@ -50,12 +52,12 @@ public class Circuit } catch (java.io.IOException e) { - System.out.println("Circuit.read_scope: IO error scanning file"); + FRLogger.error("Circuit.read_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("Circuit.read_scope: unexpected end of file"); + FRLogger.warn("Circuit.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -104,7 +106,7 @@ public class Circuit } catch (java.io.IOException e) { - System.out.println("Circuit.read_length_scope: IO error scanning file"); + FRLogger.error("Circuit.read_length_scope: IO error scanning file", e); return null; } if (next_token instanceof Double) @@ -117,7 +119,7 @@ public class Circuit } else { - System.out.println("Circuit.read_length_scope: number expected"); + FRLogger.warn("Circuit.read_length_scope: number expected"); return null; } } @@ -131,12 +133,12 @@ public class Circuit } catch (java.io.IOException e) { - System.out.println("Circuit.read_length_scope: IO error scanning file"); + FRLogger.error("Circuit.read_length_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("Circuit.read_length_scope: unexpected end of file"); + FRLogger.warn("Circuit.read_length_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Component.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Component.java index 4ffbac9..717c13a 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Component.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Component.java @@ -24,6 +24,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Handels the placement bata of a eu.mihosoft.freerouting.library component. * @@ -54,7 +56,7 @@ public class Component extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Component.read_scope: IO error scanning file"); + FRLogger.error("Component.read_scope: IO error scanning file", e); return false; } return true; @@ -68,7 +70,7 @@ public class Component extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Component.read_scope: component name expected"); + FRLogger.warn("Component.read_scope: component name expected"); return null; } String name = (String) next_token; @@ -141,19 +143,19 @@ public class Component extends ScopeKeyword eu.mihosoft.freerouting.library.Package.Pin package_pin = p_component.get_package().get_pin(p_pin_no); if (package_pin == null) { - System.out.println("Component.write_pin_info: package pin not found"); + FRLogger.warn("Component.write_pin_info: package pin not found"); return; } eu.mihosoft.freerouting.board.Pin component_pin = p_par.board.get_pin(p_component.no, p_pin_no); if (component_pin == null) { - System.out.println("Component.write_pin_info: component pin not found"); + FRLogger.warn("Component.write_pin_info: component pin not found"); return; } String cl_class_name = p_par.board.rules.clearance_matrix.get_name(component_pin.clearance_class_no()); if (cl_class_name == null) { - System.out.println("Component.write_pin_info: clearance class name not found"); + FRLogger.warn("Component.write_pin_info: clearance class name not found"); return; } p_par.file.new_line(); @@ -201,7 +203,7 @@ public class Component extends ScopeKeyword String cl_class_name = p_par.board.rules.clearance_matrix.get_name(curr_obstacle_area.clearance_class_no()); if (cl_class_name == null) { - System.out.println("Component.write_keepout_infos: clearance class name not found"); + FRLogger.warn("Component.write_keepout_infos: clearance class name not found"); return; } p_par.file.new_line(); @@ -253,7 +255,7 @@ public class Component extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Component.read_place_scope: String expected"); + FRLogger.warn("Component.read_place_scope: String expected"); return null; } String name = (String) next_token; @@ -277,7 +279,7 @@ public class Component extends ScopeKeyword } else { - System.out.println("Component.read_place_scope: number expected"); + FRLogger.warn("Component.read_place_scope: number expected"); return null; } } @@ -289,7 +291,7 @@ public class Component extends ScopeKeyword } else if (next_token != FRONT) { - System.out.println("Component.read_place_scope: Keyword.FRONT expected"); + FRLogger.warn("Component.read_place_scope: Keyword.FRONT expected"); } double rotation; next_token = p_scanner.next_token(); @@ -303,7 +305,7 @@ public class Component extends ScopeKeyword } else { - System.out.println("Component.read_place_scope: number expected"); + FRLogger.warn("Component.read_place_scope: number expected"); return null; } boolean position_fixed = false; @@ -359,7 +361,7 @@ public class Component extends ScopeKeyword } if (next_token != CLOSED_BRACKET) { - System.out.println("Component.read_place_scope: ) expected"); + FRLogger.warn("Component.read_place_scope: ) expected"); return null; } ComponentPlacement.ComponentLocation result = @@ -369,9 +371,8 @@ public class Component extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Component.read_scope: IO error scanning file"); - System.out.println(e); - return null; + FRLogger.error("Component.read_scope: IO error scanning file", e); + return null; } } @@ -381,7 +382,7 @@ public class Component extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Component.read_item_clearance_info: String expected"); + FRLogger.warn("Component.read_item_clearance_info: String expected"); return null; } String name = (String) next_token; @@ -402,12 +403,12 @@ public class Component extends ScopeKeyword } if (next_token != CLOSED_BRACKET) { - System.out.println("Component.read_item_clearance_info: ) expected"); + FRLogger.warn("Component.read_item_clearance_info: ) expected"); return null; } if (cl_class_name == null) { - System.out.println("Component.read_item_clearance_info: clearance class name not found"); + FRLogger.warn("Component.read_item_clearance_info: clearance class name not found"); return null; } return new ComponentPlacement.ItemClearanceInfo(name, cl_class_name); diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/CoordinateTransform.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/CoordinateTransform.java index 7bdcce6..0aeac54 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/CoordinateTransform.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/CoordinateTransform.java @@ -28,6 +28,7 @@ import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.Line; import eu.mihosoft.freerouting.geometry.planar.IntBox; import eu.mihosoft.freerouting.geometry.planar.PolylineShape; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Computes transformations between a specctra dsn-file coordinates and eu.mihosoft.freerouting.board coordinates. @@ -222,7 +223,7 @@ public class CoordinateTransform implements java.io.Serializable } else { - System.out.println("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape"); + FRLogger.warn("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape"); result = null; } return result; @@ -253,7 +254,7 @@ public class CoordinateTransform implements java.io.Serializable } else { - System.out.println("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape"); + FRLogger.warn("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape"); result = null; } return result; diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/DsnFile.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/DsnFile.java index bbbdfe7..e4f7e0e 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/DsnFile.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/DsnFile.java @@ -26,6 +26,7 @@ import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.board.BasicBoard; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for reading and writing dsn-files. @@ -63,8 +64,7 @@ public class DsnFile } catch (java.io.IOException e) { - System.out.println("DsnFile.read: IO error scanning file"); - System.out.println(e); + FRLogger.error("DsnFile.read: IO error scanning file", e); return ReadResult.ERROR; } boolean keyword_ok = true; @@ -79,7 +79,7 @@ public class DsnFile } if (!keyword_ok) { - System.out.println("DsnFile.read: specctra dsn file format expected"); + FRLogger.warn("DsnFile.read: specctra dsn file format expected"); return ReadResult.ERROR; } } @@ -239,7 +239,7 @@ public class DsnFile IndentFileWriter output_file = new IndentFileWriter(p_file); if (output_file == null) { - System.out.println("unable to write dsn file"); + FRLogger.warn("unable to write dsn file"); return false; } @@ -249,7 +249,7 @@ public class DsnFile } catch (java.io.IOException e) { - System.out.println("unable to write dsn file"); + FRLogger.error("unable to write dsn file", e); return false; } try @@ -258,7 +258,7 @@ public class DsnFile } catch (java.io.IOException e) { - System.out.println("unable to close dsn file"); + FRLogger.error("unable to close dsn file", e); return false; } return true; @@ -300,14 +300,14 @@ public class DsnFile } else if (next_token != Keyword.OFF) { - System.out.println("DsnFile.read_boolean: Keyword.OFF expected"); + FRLogger.warn("DsnFile.read_boolean: Keyword.OFF expected"); } ScopeKeyword.skip_scope(p_scanner); return result; } catch (java.io.IOException e) { - System.out.println("DsnFile.read_boolean: IO error scanning file"); + FRLogger.warn("DsnFile.read_boolean: IO error scanning file"); return false; } } @@ -324,20 +324,20 @@ public class DsnFile } else { - System.out.println("DsnFile.read_integer_scope: number expected"); + FRLogger.warn("DsnFile.read_integer_scope: number expected"); return 0; } next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("DsnFile.read_integer_scope: closing bracket expected"); + FRLogger.warn("DsnFile.read_integer_scope: closing bracket expected"); return 0; } return value; } catch (java.io.IOException e) { - System.out.println("DsnFile.read_integer_scope: IO error scanning file"); + FRLogger.error("DsnFile.read_integer_scope: IO error scanning file", e); return 0; } } @@ -358,20 +358,20 @@ public class DsnFile } else { - System.out.println("DsnFile.read_float_scope: number expected"); + FRLogger.warn("DsnFile.read_float_scope: number expected"); return 0; } next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("DsnFile.read_float_scope: closing bracket expected"); + FRLogger.warn("DsnFile.read_float_scope: closing bracket expected"); return 0; } return value; } catch (java.io.IOException e) { - System.out.println("DsnFile.read_float_scope: IO error scanning file"); + FRLogger.error("DsnFile.read_float_scope: IO error scanning file", e); return 0; } } @@ -384,20 +384,20 @@ public class DsnFile Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("DsnFile:read_string_scope: String expected"); + FRLogger.warn("DsnFile:read_string_scope: String expected"); return null; } String result = (String) next_token; next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("DsnFile.read_string_scope: closing bracket expected"); + FRLogger.warn("DsnFile.read_string_scope: closing bracket expected"); } return result; } catch (java.io.IOException e) { - System.out.println("DsnFile.read_string_scope: IO error scanning file"); + FRLogger.error("DsnFile.read_string_scope: IO error scanning file", e); return null; } } @@ -417,7 +417,7 @@ public class DsnFile } if (!(next_token instanceof String)) { - System.out.println("DsnFileread_string_list_scope: string expected"); + FRLogger.warn("DsnFileread_string_list_scope: string expected"); return null; } result.add((String) next_token); @@ -425,7 +425,7 @@ public class DsnFile } catch (java.io.IOException e) { - System.out.println("DsnFile.read_string_list_scope: IO error scanning file"); + FRLogger.error("DsnFile.read_string_list_scope: IO error scanning file", e); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Library.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Library.java index 4bf0558..ec0c688 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Library.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Library.java @@ -27,6 +27,7 @@ import eu.mihosoft.freerouting.geometry.planar.IntVector; import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.PolygonShape; import eu.mihosoft.freerouting.geometry.planar.Simplex; +import eu.mihosoft.freerouting.logger.FRLogger; import java.util.Collection; import java.util.Iterator; @@ -62,13 +63,12 @@ public class Library extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Library.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Library.read_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Library.read_scope: unexpected end of file"); + FRLogger.warn("Library.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -119,9 +119,7 @@ public class Library extends ScopeKeyword } else { - System.out.print("Library.read_scope: via padstack with name "); - System.out.print(curr_padstack_name); - System.out.println(" not found"); + FRLogger.warn("Library.read_scope: via padstack with name '" + curr_padstack_name + " not found"); } } if (found_padstack_count != via_padstacks.length) @@ -150,7 +148,7 @@ public class Library extends ScopeKeyword eu.mihosoft.freerouting.library.Padstack board_padstack = board.library.padstacks.get(pin_info.padstack_name); if (board_padstack == null) { - System.out.println("Library.read_scope: eu.mihosoft.freerouting.board padstack not found"); + FRLogger.warn("Library.read_scope: eu.mihosoft.freerouting.board padstack not found"); return false; } pin_arr[i] = new eu.mihosoft.freerouting.library.Package.Pin(pin_info.pin_name, board_padstack.no, rel_coor, pin_info.rotation); @@ -167,7 +165,7 @@ public class Library extends ScopeKeyword } else { - System.out.println("Library.read_scope: outline shape is null"); + FRLogger.warn("Library.read_scope: outline shape is null"); } } generate_missing_keepout_names("keepout_", curr_package.keepouts); @@ -244,7 +242,7 @@ public class Library extends ScopeKeyword } if (first_layer_no >= p_par.board.get_layer_count() || last_layer_no < 0) { - System.out.println("Library.write_padstack_scope: padstack shape not found"); + FRLogger.warn("Library.write_padstack_scope: padstack shape not found"); return; } @@ -295,7 +293,7 @@ public class Library extends ScopeKeyword } else { - System.out.println("Library.read_padstack_scope: unexpected padstack identifier"); + FRLogger.warn("Library.read_padstack_scope: unexpected padstack identifier"); return false; } @@ -321,7 +319,7 @@ public class Library extends ScopeKeyword } if (curr_next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Library.read_padstack_scope: closing bracket expected"); + FRLogger.warn("Library.read_padstack_scope: closing bracket expected"); return false; } } @@ -343,8 +341,7 @@ public class Library extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Library.read_padstack_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Library.read_padstack_scope: IO error scanning file", e); return false; } if (p_board_padstacks.get(padstack_name) != null) @@ -354,8 +351,7 @@ public class Library extends ScopeKeyword } if (shape_list.isEmpty()) { - System.out.print("Library.read_padstack_scope: shape not found for padstack with name "); - System.out.println(padstack_name); + FRLogger.warn("Library.read_padstack_scope: shape not found for padstack with name '" + padstack_name + "'"); return true; } eu.mihosoft.freerouting.geometry.planar.ConvexShape[] padstack_shapes = new eu.mihosoft.freerouting.geometry.planar.ConvexShape[p_layer_structure.arr.length]; @@ -378,7 +374,7 @@ public class Library extends ScopeKeyword eu.mihosoft.freerouting.geometry.planar.TileShape[] convex_shapes = curr_shape.split_to_convex(); if (convex_shapes.length != 1) { - System.out.println("Library.read_padstack_scope: convex shape expected"); + FRLogger.warn("Library.read_padstack_scope: convex shape expected"); } convex_shape = convex_shapes[0]; if (convex_shape instanceof Simplex) @@ -391,8 +387,8 @@ public class Library extends ScopeKeyword { if (padstack_shape.dimension() < 2) { - System.out.print("Library.read_padstack_scope: shape is not an area "); - // enllarge the shape a little bit, so that it is an area + FRLogger.warn("Library.read_padstack_scope: shape is not an area "); + // enlarge the shape a little bit, so that it is an area padstack_shape = padstack_shape.offset(1); if (padstack_shape.dimension() < 2) { @@ -413,7 +409,7 @@ public class Library extends ScopeKeyword int shape_layer = p_layer_structure.get_no(pad_shape.layer.name); if (shape_layer < 0 || shape_layer >= padstack_shapes.length) { - System.out.println("Library.read_padstack_scope: layer number found"); + FRLogger.warn("Library.read_padstack_scope: layer number found"); return false; } padstack_shapes[shape_layer] = padstack_shape; diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Net.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Net.java index 77871d5..a71060e 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Net.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Net.java @@ -30,6 +30,7 @@ import java.util.Iterator; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -80,13 +81,13 @@ public class Net eu.mihosoft.freerouting.board.Component curr_component = p_par.board.components.get(p_pin.get_component_no()); if (curr_component == null) { - System.out.println("Net.write_scope: component not found"); + FRLogger.warn("Net.write_scope: component not found"); return; } eu.mihosoft.freerouting.library.Package.Pin lib_pin = curr_component.get_package().get_pin(p_pin.get_index_in_package()); if (lib_pin == null) { - System.out.println("Net.write_scope: pin number out of range"); + FRLogger.warn("Net.write_scope: pin number out of range"); return; } p_par.file.new_line(); diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/NetClass.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/NetClass.java index 9399ec3..01e3192 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/NetClass.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/NetClass.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.LinkedList; @@ -44,7 +46,7 @@ public class NetClass Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("NetClass.read_scope: String expected"); + FRLogger.warn("NetClass.read_scope: String expected"); return null; } String class_name = (String) next_token; @@ -66,7 +68,7 @@ public class NetClass } if (!(next_token instanceof String)) { - System.out.println("NetClass.read_scope: String expected"); + FRLogger.warn("NetClass.read_scope: String expected"); return null; } net_list.add((String) next_token); @@ -89,7 +91,7 @@ public class NetClass next_token = p_scanner.next_token(); if (next_token == null) { - System.out.println("NetClass.read_scope: unexpected end of file"); + FRLogger.warn("NetClass.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -151,7 +153,7 @@ public class NetClass } catch (java.io.IOException e) { - System.out.println("NetClass.read_scope: IO error while scanning file"); + FRLogger.error("NetClass.read_scope: IO error while scanning file", e); return null; } } @@ -169,7 +171,7 @@ public class NetClass Object next_token = p_scanner.next_token(); if (next_token == null) { - System.out.println("ClassClass.read_scope: unexpected end of file"); + FRLogger.warn("ClassClass.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -198,7 +200,7 @@ public class NetClass } catch (java.io.IOException e) { - System.out.println("NetClass.read_scope: IO error while scanning file"); + FRLogger.error("NetClass.read_scope: IO error while scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Network.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Network.java index 085fdcb..c6cb79a 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Network.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Network.java @@ -34,6 +34,7 @@ import java.util.Iterator; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.BoardRules; import eu.mihosoft.freerouting.rules.DefaultItemClearanceClasses.ItemClass; import eu.mihosoft.freerouting.board.RoutingBoard; @@ -67,13 +68,12 @@ public class Network extends ScopeKeyword next_token = p_par.scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Network.read_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Network.read_scope: unexpected end of file"); + FRLogger.warn("Network.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -317,12 +317,12 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_net_scope: IO error while scanning file"); + FRLogger.error("Network.read_net_scope: IO error while scanning file", e); return false; } if (!(next_token instanceof String)) { - System.out.println("Network.read_net_scope: String expected"); + FRLogger.warn("Network.read_net_scope: String expected"); return false; } String net_name = (String) next_token; @@ -332,7 +332,7 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_net_scope: IO error while scanning file"); + FRLogger.error("Network.read_net_scope: IO error while scanning file", e); return false; } boolean scope_is_empty = (next_token == CLOSED_BRACKET); @@ -354,12 +354,12 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_net_scope: IO error scanning file"); + FRLogger.error("Network.read_net_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Network.read_net_scope: unexpected end of file"); + FRLogger.warn("Network.read_net_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -399,7 +399,7 @@ public class Network extends ScopeKeyword } else if (next_token == Keyword.LAYER_RULE) { - System.out.println("Netwark.read_net_scope: layer_rule not yet implemented"); + FRLogger.warn("Netwark.read_net_scope: layer_rule not yet implemented"); skip_scope(p_scanner); } else @@ -435,7 +435,7 @@ public class Network extends ScopeKeyword Net curr_subnet = p_net_list.get_net(net_id); if (curr_subnet == null) { - System.out.println("Network.read_net_scope: net not found in netlist"); + FRLogger.warn("Network.read_net_scope: net not found in netlist"); return false; } curr_subnet.set_pins(curr_pin_list); @@ -445,7 +445,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.rules.Net board_net = p_board.rules.nets.get(curr_subnet.id.name, curr_subnet.id.subnet_number); if (board_net == null) { - System.out.println("Network.read_net_scope: board net not found"); + FRLogger.warn("Network.read_net_scope: board net not found"); return false; } Iterator it = net_rules.iterator(); @@ -470,7 +470,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.read_net_scope: Rule not yet implemented"); + FRLogger.warn("Network.read_net_scope: Rule not yet implemented"); } } } @@ -515,7 +515,7 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_net_pins: IO error while scanning file"); + FRLogger.error("Network.read_net_pins: IO error while scanning file", e); return false; } if (next_token == Keyword.CLOSED_BRACKET) @@ -524,7 +524,7 @@ public class Network extends ScopeKeyword } if (!(next_token instanceof String)) { - System.out.println("Network.read_net_pins: String expected"); + FRLogger.warn("Network.read_net_pins: String expected"); return false; } String component_name = (String) next_token; @@ -536,12 +536,12 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); } catch (java.io.IOException e) { - System.out.println("Network.read_net_pins: IO error while scanning file"); + FRLogger.error("Network.read_net_pins: IO error while scanning file", e); return false; } if (!(next_token instanceof String)) { - System.out.println("Network.read_net_pins: String expected"); + FRLogger.warn("Network.read_net_pins: String expected"); return false; } String pin_name = (String) next_token; @@ -559,7 +559,7 @@ public class Network extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Network.read_via_info: string expected"); + FRLogger.warn("Network.read_via_info: string expected"); return null; } String name = (String) next_token; @@ -567,7 +567,7 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Network.read_via_info: string expected"); + FRLogger.warn("Network.read_via_info: string expected"); return null; } String padstack_name = (String) next_token; @@ -578,7 +578,7 @@ public class Network extends ScopeKeyword via_padstack = p_board.library.padstacks.get(padstack_name); if (via_padstack == null) { - System.out.println("Network.read_via_info: padstack not found"); + FRLogger.warn("Network.read_via_info: padstack not found"); return null; } p_board.library.add_via_padstack(via_padstack); @@ -587,7 +587,7 @@ public class Network extends ScopeKeyword next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Network.read_via_info: string expected"); + FRLogger.warn("Network.read_via_info: string expected"); return null; } int clearance_class = p_board.rules.clearance_matrix.get_no((String) next_token); @@ -602,21 +602,21 @@ public class Network extends ScopeKeyword { if (next_token != Keyword.ATTACH) { - System.out.println("Network.read_via_info: Keyword.ATTACH expected"); + FRLogger.warn("Network.read_via_info: Keyword.ATTACH expected"); return null; } attach_allowed = true; next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Network.read_via_info: closing bracket expected"); + FRLogger.warn("Network.read_via_info: closing bracket expected"); return null; } } return new eu.mihosoft.freerouting.rules.ViaInfo(name, via_padstack, clearance_class, attach_allowed, p_board.rules); } catch (java.io.IOException e) { - System.out.println("Network.read_via_info: IO error while scanning file"); + FRLogger.error("Network.read_via_info: IO error while scanning file", e); return null; } } @@ -636,7 +636,7 @@ public class Network extends ScopeKeyword } if (!(next_token instanceof String)) { - System.out.println("Network.read_via_rule: string expected"); + FRLogger.warn("Network.read_via_rule: string expected"); return null; } result.add((String) next_token); @@ -644,7 +644,7 @@ public class Network extends ScopeKeyword return result; } catch (java.io.IOException e) { - System.out.println("Network.read_via_rule: IO error while scanning file"); + FRLogger.error("Network.read_via_rule: IO error while scanning file", e); return null; } } @@ -731,7 +731,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_via_rules: via_info not found"); + FRLogger.warn("Network.insert_via_rules: via_info not found"); rule_ok = false; } } @@ -769,7 +769,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_net_class: clearance class not found"); + FRLogger.warn("Network.insert_net_class: clearance class not found"); } } if (p_class.via_rule != null) @@ -781,7 +781,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_net_class: via rule not found"); + FRLogger.warn("Network.insert_net_class: via rule not found"); } } if (p_class.max_trace_length > 0) @@ -820,8 +820,7 @@ public class Network extends ScopeKeyword } else { - - System.out.println("Network.insert_net_class: rule type not yet implemented"); + FRLogger.warn("Network.insert_net_class: rule type not yet implemented"); } } @@ -834,7 +833,7 @@ public class Network extends ScopeKeyword int layer_no = p_board.layer_structure.get_no(curr_layer_name); if (layer_no < 0) { - System.out.println("Network.insert_net_class: layer not found"); + FRLogger.warn("Network.insert_net_class: layer not found"); continue; } for (Rule curr_rule : curr_layer_rule.rules) @@ -851,7 +850,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_net_class: layer rule type not yet implemented"); + FRLogger.warn("Network.insert_net_class: layer rule type not yet implemented"); } } } @@ -893,7 +892,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.rules.NetClass first_class = routing_board.rules.net_classes.get(first_name); if (first_class == null) { - System.out.println("Network.insert_class_pairs: first class not found"); + FRLogger.warn("Network.insert_class_pairs: first class not found"); } else { @@ -904,7 +903,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.rules.NetClass second_class = routing_board.rules.net_classes.get(second_name); if (second_class == null) { - System.out.println("Network.insert_class_pairs: second class not found"); + FRLogger.warn("Network.insert_class_pairs: second class not found"); } else { @@ -930,7 +929,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_class_pair_info: unexpected rule"); + FRLogger.warn("Network.insert_class_pair_info: unexpected rule"); } } for (Rule.LayerRule curr_layer_rule : p_class_class.layer_rules) @@ -940,7 +939,7 @@ public class Network extends ScopeKeyword int layer_no = p_board.layer_structure.get_no(curr_layer_name); if (layer_no < 0) { - System.out.println("Network.insert_class_pair_info: layer not found"); + FRLogger.warn("Network.insert_class_pair_info: layer not found"); continue; } for (Rule curr_rule : curr_layer_rule.rules) @@ -953,7 +952,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_class_pair_info: unexpected layer rule type"); + FRLogger.warn("Network.insert_class_pair_info: unexpected layer rule type"); } } } @@ -1175,7 +1174,7 @@ public class Network extends ScopeKeyword int net_class_no = p_clearance_matrix.get_no(net_class_name); if (net_class_no < 0 || result < 0) { - System.out.println("Network.get_clearance_class: clearance class not found"); + FRLogger.warn("Network.get_clearance_class: clearance class not found"); return result; } // initalise the clearance values of p_new_class_name from p_net_class_name @@ -1246,7 +1245,7 @@ public class Network extends ScopeKeyword int pin_no = lib_package.get_pin_no(curr_part_pin.pin_name); if (pin_no < 0) { - System.out.println("Network.insert_logical_parts: package pin not found"); + FRLogger.warn("Network.insert_logical_parts: package pin not found"); return false; } board_part_pins[curr_index] = @@ -1264,7 +1263,7 @@ public class Network extends ScopeKeyword { if (curr_logical_part == null) { - System.out.println("Network.insert_logical_parts: logical part not found"); + FRLogger.warn("Network.insert_logical_parts: logical part not found"); } } for (String curr_cmp_name : next_mapping.components) @@ -1276,7 +1275,7 @@ public class Network extends ScopeKeyword } else { - System.out.println("Network.insert_logical_parts: eu.mihosoft.freerouting.board component not found"); + FRLogger.warn("Network.insert_logical_parts: board component not found"); } } } @@ -1284,7 +1283,7 @@ public class Network extends ScopeKeyword } /** - * Calculates the eu.mihosoft.freerouting.library package belonging to the logical part with name p_part_name. + * Calculates the library package belonging to the logical part with name p_part_name. * Returns null, if the package was not found. */ private static eu.mihosoft.freerouting.library.Package search_lib_package(String p_part_name, @@ -1296,27 +1295,25 @@ public class Network extends ScopeKeyword { if (curr_mapping.components.isEmpty()) { - System.out.println("Network.search_lib_package: component list empty"); + FRLogger.warn("Network.search_lib_package: component list empty"); return null; } String component_name = curr_mapping.components.first(); if (component_name == null) { - System.out.println("Network.search_lib_package: component list empty"); + FRLogger.warn("Network.search_lib_package: component list empty"); return null; } eu.mihosoft.freerouting.board.Component curr_component = p_board.components.get(component_name); if (curr_component == null) { - System.out.println("Network.search_lib_package: component not found"); + FRLogger.warn("Network.search_lib_package: component not found"); return null; } return curr_component.get_package(); } } - System.out.print("Network.search_lib_package: eu.mihosoft.freerouting.library package "); - System.out.print(p_part_name); - System.out.println(" not found"); + FRLogger.warn("Network.search_lib_package: library package '" + p_part_name + "' not found"); return null; } @@ -1331,7 +1328,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.library.Package curr_back_package = routing_board.library.packages.get(p_lib_key, false); if (curr_front_package == null || curr_back_package == null) { - System.out.println("Network.insert_component: component package not found"); + FRLogger.warn("Network.insert_component: component package not found"); return; } @@ -1370,7 +1367,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.library.Padstack curr_padstack = routing_board.library.padstacks.get(curr_pin.padstack_no); if (curr_padstack == null) { - System.out.println("Network.insert_component: pin padstack not found"); + FRLogger.warn("Network.insert_component: pin padstack not found"); return; } Collection pin_nets = p_par.netlist.get_nets(p_location.name, curr_pin.name); @@ -1380,8 +1377,7 @@ public class Network extends ScopeKeyword eu.mihosoft.freerouting.rules.Net curr_board_net = routing_board.rules.nets.get(curr_pin_net.id.name, curr_pin_net.id.subnet_number); if (curr_board_net == null) { - System.out.println("Network.insert_component: eu.mihosoft.freerouting.board net not found"); - + FRLogger.warn("Network.insert_component: board net not found"); } else { @@ -1459,7 +1455,7 @@ public class Network extends ScopeKeyword int layer = curr_keepout.layer; if (layer >= routing_board.get_layer_count()) { - System.out.println("Network.insert_component: keepout layer is to big"); + FRLogger.warn("Network.insert_component: keepout layer is to big"); continue; } if (layer >= 0 && !p_location.is_front) diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Package.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Package.java index 82e5549..1b62f05 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Package.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Package.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.LinkedList; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for reading and writing package scopes from dsn-files. @@ -62,7 +63,7 @@ public class Package Object next_token = p_scanner.next_token(); if ( !(next_token instanceof String)) { - System.out.println("Package.read_scope: String expected"); + FRLogger.warn("Package.read_scope: String expected"); return null; } String package_name = (String) next_token; @@ -74,7 +75,7 @@ public class Package if (next_token == null) { - System.out.println("Package.read_scope: unexpected end of file"); + FRLogger.warn("Package.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -108,7 +109,7 @@ public class Package next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Package.read_scope: closed bracket expected"); + FRLogger.warn("Package.read_scope: closed bracket expected"); return null; } } @@ -152,8 +153,7 @@ public class Package } catch (java.io.IOException e) { - System.out.println("Package.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Package.read_scope: IO error scanning file", e); return null; } } @@ -242,8 +242,8 @@ public class Package } else { - boundary_shape = p_keepout.area .get_border(); - holes = p_keepout.area .get_holes(); + boundary_shape = p_keepout.area.get_border(); + holes = p_keepout.area.get_holes(); } p_par.file.start_scope(); if (p_is_via_keepout) @@ -286,7 +286,7 @@ public class Package } else { - System.out.println("Package.read_pin_info: String or Integer expected"); + FRLogger.warn("Package.read_pin_info: String or Integer expected"); return null; } double rotation = 0; @@ -320,7 +320,7 @@ public class Package } else { - System.out.println("Package.read_pin_info: String or Integer expected"); + FRLogger.warn("Package.read_pin_info: String or Integer expected"); return null; } @@ -338,7 +338,7 @@ public class Package } else { - System.out.println("Package.read_pin_info: number expected"); + FRLogger.warn("Package.read_pin_info: number expected"); return null; } } @@ -350,7 +350,7 @@ public class Package if (next_token == null) { - System.out.println("Package.read_pin_info: unexpected end of file"); + FRLogger.warn("Package.read_pin_info: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -374,7 +374,7 @@ public class Package } catch (java.io.IOException e) { - System.out.println("Package.read_pin_info: IO error while scanning file"); + FRLogger.error("Package.read_pin_info: IO error while scanning file", e); return null; } } @@ -395,18 +395,18 @@ public class Package } else { - System.out.println("Package.read_rotation: number expected"); + FRLogger.warn("Package.read_rotation: number expected"); } // Overread The closing bracket. next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Package.read_rotation: closing bracket expected"); + FRLogger.warn("Package.read_rotation: closing bracket expected"); } } catch (java.io.IOException e) { - System.out.println("Package.read_rotation: IO error while scanning file"); + FRLogger.error("Package.read_rotation: IO error while scanning file", e); } return result; } @@ -464,7 +464,7 @@ public class Package next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Package.read_placement_side: closing bracket expected"); + FRLogger.warn("Package.read_placement_side: closing bracket expected"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Parser.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Parser.java index 41ef9ef..dbc5015 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Parser.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Parser.java @@ -23,6 +23,7 @@ package eu.mihosoft.freerouting.designforms.specctra; import eu.mihosoft.freerouting.board.Communication.SpecctraParserInfo; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for reading and writing parser scopes from dsn-files. @@ -50,12 +51,12 @@ public class Parser extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Parser.read_scope: IO error scanning file"); + FRLogger.warn("Parser.read_scope: IO error scanning file"); return false; } if (next_token == null) { - System.out.println("Parser.read_scope: unexpected end of file"); + FRLogger.warn("Parser.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -121,28 +122,28 @@ public class Parser extends ScopeKeyword Object next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Parser.read_write_solution: string expected"); + FRLogger.warn("Parser.read_write_solution: string expected"); return null; } String resolution_string = (String) next_token; next_token = p_par.scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("Parser.read_write_solution: integer expected expected"); + FRLogger.warn("Parser.read_write_solution: integer expected expected"); return null; } int resolution_value = (Integer) next_token; next_token = p_par.scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Parser.read_write_solution: closing_bracket expected"); + FRLogger.warn("Parser.read_write_solution: closing_bracket expected"); return null; } return new SpecctraParserInfo.WriteResolution(resolution_string, resolution_value); } catch (java.io.IOException e) { - System.out.println("Parser.read_write_solution: IO error scanning file"); + FRLogger.error("Parser.read_write_solution: IO error scanning file", e); return null; } } @@ -156,7 +157,7 @@ public class Parser extends ScopeKeyword Object next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Parser.read_constant: string expected"); + FRLogger.warn("Parser.read_constant: string expected"); return null; } result[0] = (String) next_token; @@ -164,21 +165,21 @@ public class Parser extends ScopeKeyword next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Parser.read_constant: string expected"); + FRLogger.warn("Parser.read_constant: string expected"); return null; } result[1] = (String) next_token; next_token = p_par.scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Parser.read_constant: closing_bracket expected"); + FRLogger.warn("Parser.read_constant: closing_bracket expected"); return null; } return result; } catch (java.io.IOException e) { - System.out.println("Parser.read_constant: IO error scanning file"); + FRLogger.error("Parser.read_constant: IO error scanning file", e); return null; } } @@ -253,21 +254,21 @@ public class Parser extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Parser.read_quote_char: string expected"); + FRLogger.warn("Parser.read_quote_char: string expected"); return null; } String result = (String) next_token; next_token = p_scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Parser.read_quote_char: closing bracket expected"); + FRLogger.warn("Parser.read_quote_char: closing bracket expected"); return null; } return result; } catch (java.io.IOException e) { - System.out.println("Parser.read_quote_char: IO error scanning file"); + FRLogger.error("Parser.read_quote_char: IO error scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PartLibrary.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PartLibrary.java index 1b3339d..db82613 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PartLibrary.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PartLibrary.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * @author Alfons Wirtz @@ -48,13 +50,12 @@ public class PartLibrary extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("PartLibrary.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("PartLibrary.read_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("PartLibrary.read_scope: unexpected end of file"); + FRLogger.warn("PartLibrary.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -168,20 +169,20 @@ public class PartLibrary extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_logical_part_mapping: string expected"); + FRLogger.warn("PartLibrary.read_logical_part_mapping: string expected"); return null; } String name = (String) next_token; next_token = p_scanner.next_token(); if (next_token != OPEN_BRACKET) { - System.out.println("PartLibrary.read_logical_part_mapping: open bracket expected"); + FRLogger.warn("PartLibrary.read_logical_part_mapping: open bracket expected"); return null; } next_token = p_scanner.next_token(); if (next_token != COMPONENT_SCOPE) { - System.out.println("PartLibrary.read_logical_part_mapping: Keyword.COMPONENT_SCOPE expected"); + FRLogger.warn("PartLibrary.read_logical_part_mapping: Keyword.COMPONENT_SCOPE expected"); return null; } java.util.SortedSet result = new java.util.TreeSet(); @@ -195,7 +196,7 @@ public class PartLibrary extends ScopeKeyword } if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_logical_part_mapping: string expected"); + FRLogger.warn("PartLibrary.read_logical_part_mapping: string expected"); return null; } result.add((String) next_token); @@ -203,14 +204,14 @@ public class PartLibrary extends ScopeKeyword next_token = p_scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("PartLibrary.read_logical_part_mapping: closing bracket expected"); + FRLogger.warn("PartLibrary.read_logical_part_mapping: closing bracket expected"); return null; } return new LogicalPartMapping(name, result); } catch (java.io.IOException e) { - System.out.println("PartLibrary.read_logical_part_mapping: IO error scanning file"); + FRLogger.error("PartLibrary.read_logical_part_mapping: IO error scanning file", e); return null; } } @@ -225,12 +226,12 @@ public class PartLibrary extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("PartLibrary.read_logical_part: IO error scanning file"); + FRLogger.error("PartLibrary.read_logical_part: IO error scanning file", e); return null; } if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_logical_part: string expected"); + FRLogger.warn("PartLibrary.read_logical_part: string expected"); return null; } String part_name = (String) next_token; @@ -243,12 +244,12 @@ public class PartLibrary extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("PartLibrary.read_logical_part: IO error scanning file"); + FRLogger.error("PartLibrary.read_logical_part: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("PartLibrary.read_logical_part: unexpected end of file"); + FRLogger.warn("PartLibrary.read_logical_part: unexpected end of file"); return null; } if (next_token == CLOSED_BRACKET) @@ -289,28 +290,28 @@ public class PartLibrary extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_part_pin: string expected"); + FRLogger.warn("PartLibrary.read_part_pin: string expected"); return null; } String pin_name = (String) next_token; next_token = p_scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("PartLibrary.read_part_pin: integer expected"); + FRLogger.warn("PartLibrary.read_part_pin: integer expected"); return null; } p_scanner.yybegin(SpecctraFileScanner.NAME); next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_part_pin: string expected"); + FRLogger.warn("PartLibrary.read_part_pin: string expected"); return null; } String gate_name = (String) next_token; next_token = p_scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("PartLibrary.read_part_pin: integer expected"); + FRLogger.warn("PartLibrary.read_part_pin: integer expected"); return null; } int gate_swap_code = (Integer) next_token; @@ -318,14 +319,14 @@ public class PartLibrary extends ScopeKeyword next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("PartLibrary.read_part_pin: string expected"); + FRLogger.warn("PartLibrary.read_part_pin: string expected"); return null; } String gate_pin_name = (String) next_token; next_token = p_scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("PartLibrary.read_part_pin: integer expected"); + FRLogger.warn("PartLibrary.read_part_pin: integer expected"); return null; } int gate_pin_swap_code = (Integer) next_token; @@ -342,7 +343,7 @@ public class PartLibrary extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("PartLibrary.read_part_pin: IO error scanning file"); + FRLogger.error("PartLibrary.read_part_pin: IO error scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PlaceControl.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PlaceControl.java index 432eefc..0865e18 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PlaceControl.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PlaceControl.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Class for reading place_control scopes from dsn-files. * @@ -51,12 +53,12 @@ public class PlaceControl extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("PlaceControl.read_scope: IO error scanning file"); + FRLogger.error("PlaceControl.read_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("PlaceControl.read_scope: unexpected end of file"); + FRLogger.warn("PlaceControl.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -98,15 +100,15 @@ public class PlaceControl extends ScopeKeyword next_token = p_scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Structure.read_flip_style: closing bracket expected"); - return false; + FRLogger.warn("Structure.read_flip_style: closing bracket expected"); + return false; } return result; } catch (java.io.IOException e) { - System.out.println("Structure.read_flip_style: IO error scanning file"); - return false; + FRLogger.error("Structure.read_flip_style: IO error scanning file", e); + return false; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Plane.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Plane.java index 41f59f4..e3c6235 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Plane.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Plane.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for reading and writing plane scopes from dsn-files. @@ -52,7 +53,7 @@ public class Plane extends ScopeKeyword Object next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Plane.read_scope: String expected"); + FRLogger.warn("Plane.read_scope: String expected"); return false; } net_name = (String) next_token; @@ -60,8 +61,7 @@ public class Plane extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Plane.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Plane.read_scope: IO error scanning file", e); return false; } ReadScopeParameter.PlaneInfo plane_info = new ReadScopeParameter.PlaneInfo(conduction_area, net_name); @@ -74,7 +74,7 @@ public class Plane extends ScopeKeyword int net_count = p_conduction.net_count(); if (net_count <= 0 || net_count > 1) { - System.out.println("Plane.write_scope: unexpected net count"); + FRLogger.warn("Plane.write_scope: unexpected net count"); return; } String net_name = p_par.board.rules.nets.get(p_conduction.get_net_no(0)).name; diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PolylinePath.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PolylinePath.java index 0ef0686..30c721c 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PolylinePath.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/PolylinePath.java @@ -25,6 +25,7 @@ package eu.mihosoft.freerouting.designforms.specctra; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -87,20 +88,20 @@ public class PolylinePath extends Path public eu.mihosoft.freerouting.geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform) { - System.out.println("PolylinePath.transform_to_board_rel not implemented"); + FRLogger.warn("PolylinePath.transform_to_board_rel not implemented"); return null; } public eu.mihosoft.freerouting.geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform) { - System.out.println("PolylinePath.transform_to_board_rel not implemented"); + FRLogger.warn("PolylinePath.transform_to_board_rel not implemented"); return null; } public Rectangle bounding_box() { - System.out.println("PolylinePath.boundingbox not implemented"); + FRLogger.warn("PolylinePath.boundingbox not implemented"); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Resolution.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Resolution.java index e7db1e9..18611bc 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Resolution.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Resolution.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Class for reading resolution scopes from dsn-files. * @@ -45,20 +47,20 @@ public class Resolution extends ScopeKeyword Object next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Resolution.read_scope: string expected"); + FRLogger.warn("Resolution.read_scope: string expected"); return false; } p_par.unit = eu.mihosoft.freerouting.board.Unit.from_string((String) next_token); if (p_par.unit == null) { - System.out.println("Resolution.read_scope: unit mil, inch or mm expected"); + FRLogger.warn("Resolution.read_scope: unit mil, inch or mm expected"); return false; } // read the scale factor next_token = p_par.scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("Resolution.read_scope: integer expected"); + FRLogger.warn("Resolution.read_scope: integer expected"); return false; } p_par.resolution = ((Integer)next_token).intValue(); @@ -66,14 +68,14 @@ public class Resolution extends ScopeKeyword next_token = p_par.scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Resolution.read_scope: closing bracket expected"); + FRLogger.warn("Resolution.read_scope: closing bracket expected"); return false; } return true; } catch (java.io.IOException e) { - System.out.println("Resolution.read_scope: IO error scanning file"); + FRLogger.error("Resolution.read_scope: IO error scanning file", e); return false; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Rule.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Rule.java index 73392a9..3ebc6b8 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Rule.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Rule.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.LinkedList; @@ -50,13 +52,12 @@ public abstract class Rule } catch (java.io.IOException e) { - System.out.println("Rule.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Rule.read_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("Rule.read_scope: unexpected end of file"); + FRLogger.warn("Rule.read_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -108,8 +109,8 @@ public abstract class Rule } if (!(next_token instanceof String)) { - - System.out.println("Rule.read_layer_rule_scope: string expected"); + + FRLogger.warn("Rule.read_layer_rule_scope: string expected"); return null; } layer_names.add((String) next_token); @@ -123,8 +124,8 @@ public abstract class Rule } if (next_token != Keyword.RULE) { - - System.out.println("Rule.read_layer_rule_scope: rule expected"); + + FRLogger.warn("Rule.read_layer_rule_scope: rule expected"); return null; } rule_list.addAll(read_scope(p_scanner)); @@ -133,7 +134,7 @@ public abstract class Rule } catch (java.io.IOException e) { - System.out.println("Rule.read_layer_rule_scope: IO error scanning file"); + FRLogger.error("Rule.read_layer_rule_scope: IO error scanning file", e); return null; } } @@ -154,20 +155,20 @@ public abstract class Rule } else { - System.out.println("Rule.read_width_rule: number expected"); + FRLogger.warn("Rule.read_width_rule: number expected"); return null; } next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Rule.read_width_rule: closing bracket expected"); + FRLogger.warn("Rule.read_width_rule: closing bracket expected"); return null; } return new WidthRule(value); } catch (java.io.IOException e) { - System.out.println("Rule.read_width_rule: IO error scanning file"); + FRLogger.error("Rule.read_width_rule: IO error scanning file", e); return null; } } @@ -294,7 +295,7 @@ public abstract class Rule } else { - System.out.println("Rule.read_clearance_rule: number expected"); + FRLogger.warn("Rule.read_clearance_rule: number expected"); return null; } Collection class_pairs = new LinkedList (); @@ -303,13 +304,13 @@ public abstract class Rule { if (next_token != Keyword.OPEN_BRACKET) { - System.out.println("Rule.read_clearance_rule: ( expected"); + FRLogger.warn("Rule.read_clearance_rule: ( expected"); return null; } next_token = p_scanner.next_token(); if (next_token != Keyword.TYPE) { - System.out.println("Rule.read_clearance_rule: type expected"); + FRLogger.warn("Rule.read_clearance_rule: type expected"); return null; } for (;;) @@ -322,7 +323,7 @@ public abstract class Rule } if (!(next_token instanceof String)) { - System.out.println("Rule.read_clearance_rule: string expected"); + FRLogger.warn("Rule.read_clearance_rule: string expected"); return null; } class_pairs.add((String)next_token); @@ -330,7 +331,7 @@ public abstract class Rule next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Rule.read_clearance_rule: closing bracket expected"); + FRLogger.warn("Rule.read_clearance_rule: closing bracket expected"); return null; } } @@ -338,7 +339,7 @@ public abstract class Rule } catch (java.io.IOException e) { - System.out.println("Rule.read_clearance_rule: IO error scanning file"); + FRLogger.error("Rule.read_clearance_rule: IO error scanning file", e); return null; } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/RulesFile.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/RulesFile.java index 69f3522..334018c 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/RulesFile.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/RulesFile.java @@ -27,6 +27,7 @@ package eu.mihosoft.freerouting.designforms.specctra; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.board.BasicBoard; +import eu.mihosoft.freerouting.logger.FRLogger; /** * File for saving the eu.mihosoft.freerouting.board rules, so that they can be restored after the Board @@ -51,7 +52,7 @@ public class RulesFile } catch (java.io.IOException e) { - System.out.println("unable to write rules to file"); + FRLogger.error("unable to write rules to file", e); } try { @@ -59,7 +60,7 @@ public class RulesFile } catch (java.io.IOException e) { - System.out.println("unable to close rules file"); + FRLogger.error("unable to close rules file", e); } } @@ -73,32 +74,32 @@ public class RulesFile Object curr_token = scanner.next_token(); if (curr_token != Keyword.OPEN_BRACKET) { - System.out.println("RulesFile.read: open bracket expected"); + FRLogger.warn("RulesFile.read: open bracket expected"); return false; } curr_token = scanner.next_token(); if (curr_token != Keyword.RULES) { - System.out.println("RulesFile.read: keyword rules expected"); + FRLogger.warn("RulesFile.read: keyword rules expected"); return false; } curr_token = scanner.next_token(); if (curr_token != Keyword.PCB_SCOPE) { - System.out.println("RulesFile.read: keyword pcb expected"); + FRLogger.warn("RulesFile.read: keyword pcb expected"); return false; } scanner.yybegin(SpecctraFileScanner.NAME); curr_token = scanner.next_token(); if (!(curr_token instanceof String) || !((String) curr_token).equals(p_design_name)) { - System.out.println("RulesFile.read: design_name not matching"); + FRLogger.warn("RulesFile.read: design_name not matching"); return false; } } catch (java.io.IOException e) { - System.out.println("RulesFile.read: IO error scanning file"); + FRLogger.error("RulesFile.read: IO error scanning file", e); return false; } LayerStructure layer_structure = new LayerStructure(routing_board.layer_structure); @@ -113,12 +114,12 @@ public class RulesFile } catch (java.io.IOException e) { - System.out.println("RulesFile.read: IO error scanning file"); + FRLogger.error("RulesFile.read: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Structure.read_scope: unexpected end of file"); + FRLogger.warn("Structure.read_scope: unexpected end of file"); return false; } if (next_token == Keyword.CLOSED_BRACKET) @@ -217,7 +218,7 @@ public class RulesFile layer_no = p_board.layer_structure.get_no(p_layer_name); if (layer_no < 0) { - System.out.println("RulesFile.add_rules: layer not found"); + FRLogger.warn("RulesFile.add_rules: layer not found"); } } CoordinateTransform coordinate_transform = p_board.communication.coordinate_transform; @@ -251,7 +252,7 @@ public class RulesFile Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("RulesFile.add_layer_rules: String expected"); + FRLogger.warn("RulesFile.add_layer_rules: String expected"); return false; } String layer_string = (String) next_token; @@ -260,7 +261,7 @@ public class RulesFile { if (next_token != Keyword.OPEN_BRACKET) { - System.out.println("RulesFile.add_layer_rules: ( expected"); + FRLogger.warn("RulesFile.add_layer_rules: ( expected"); return false; } next_token = p_scanner.next_token(); @@ -279,7 +280,7 @@ public class RulesFile } catch (java.io.IOException e) { - System.out.println("RulesFile.add_layer_rules: IO error scanning file"); + FRLogger.error("RulesFile.add_layer_rules: IO error scanning file", e); return false; } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/ScopeKeyword.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/ScopeKeyword.java index 6388bd2..26bfb83 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/ScopeKeyword.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/ScopeKeyword.java @@ -28,6 +28,8 @@ package eu.mihosoft.freerouting.designforms.specctra; * @author alfons */ +import eu.mihosoft.freerouting.logger.FRLogger; + /** Keywords defining a scope object*/ public class ScopeKeyword extends Keyword { @@ -53,8 +55,7 @@ public class ScopeKeyword extends Keyword } catch (Exception e) { - System.out.println("ScopeKeyword.skip_scope: Error while scanning file"); - System.out.println(e); + FRLogger.error("ScopeKeyword.skip_scope: Error while scanning file", e); return false; } if (curr_token == null) @@ -88,8 +89,7 @@ public class ScopeKeyword extends Keyword } catch (java.io.IOException e) { - System.out.println("ScopeKeyword.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("ScopeKeyword.read_scope: IO error scanning file", e); return false; } if (next_token == null) diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionFile.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionFile.java index a30eedf..7dac324 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionFile.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionFile.java @@ -35,6 +35,7 @@ import eu.mihosoft.freerouting.board.Via; import eu.mihosoft.freerouting.board.ConductionArea; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Methods to handle a Specctra session file. @@ -59,7 +60,7 @@ public class SessionFile } catch (Exception e) { - System.out.println("unable to create session file"); + FRLogger.error("unable to create session file", e); return false; } String session_name = p_design_name.replace(".dsn", ".ses"); @@ -71,7 +72,7 @@ public class SessionFile } catch (java.io.IOException e) { - System.out.println("unable to write session file"); + FRLogger.error("unable to write session file", e); return false; } try @@ -80,7 +81,7 @@ public class SessionFile } catch (java.io.IOException e) { - System.out.println("unable to close session file"); + FRLogger.error("unable to close session file", e); return false; } return true; @@ -217,7 +218,7 @@ public class SessionFile } else { - System.out.println("SessionFile.write_was_is: component not found"); + FRLogger.warn("SessionFile.write_was_is: component not found"); } p_file.write(" "); eu.mihosoft.freerouting.board.Component swap_cmp = p_board.components.get(swapped_with.get_component_no()); @@ -230,7 +231,7 @@ public class SessionFile } else { - System.out.println("SessionFile.write_was_is: component not found"); + FRLogger.warn("SessionFile.write_was_is: component not found"); } p_file.write(")"); } @@ -287,7 +288,7 @@ public class SessionFile } if (first_layer_no >= p_board.get_layer_count() || last_layer_no < 0) { - System.out.println("SessionFile.write_padstack: padstack shape not found"); + FRLogger.warn("SessionFile.write_padstack: padstack shape not found"); return; } @@ -355,7 +356,7 @@ public class SessionFile eu.mihosoft.freerouting.rules.Net curr_net = p_board.rules.nets.get(p_net_no); if (curr_net == null) { - System.out.println("SessionFile.write_net: net not found"); + FRLogger.warn("SessionFile.write_net: net not found"); } else { @@ -489,7 +490,7 @@ public class SessionFile int net_count = p_conduction_area.net_count(); if (net_count <= 0 || net_count > 1) { - System.out.println("SessionFile.write_conduction_area: unexpected net count"); + FRLogger.warn("SessionFile.write_conduction_area: unexpected net count"); return; } eu.mihosoft.freerouting.geometry.planar.Area curr_area = p_conduction_area.get_area(); diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionToEagle.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionToEagle.java index 5e3fa73..0ed9246 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionToEagle.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/SessionToEagle.java @@ -24,6 +24,8 @@ package eu.mihosoft.freerouting.designforms.specctra; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Transformes a Specctra session file into an Eagle script file. * @@ -59,7 +61,7 @@ public class SessionToEagle extends javax.swing.JFrame } catch (java.io.IOException e) { - System.out.println("unable to process session scope"); + FRLogger.error("unable to process session scope", e); result = false; } @@ -71,7 +73,7 @@ public class SessionToEagle extends javax.swing.JFrame } catch (java.io.IOException e) { - System.out.println("unable to close files"); + FRLogger.error("unable to close files", e); } return result; } @@ -112,7 +114,7 @@ public class SessionToEagle extends javax.swing.JFrame } if (!keyword_ok) { - System.out.println("SessionToEagle.process_session_scope specctra session file format expected"); + FRLogger.warn("SessionToEagle.process_session_scope specctra session file format expected"); return false; } } @@ -364,7 +366,7 @@ public class SessionToEagle extends javax.swing.JFrame Object next_token = this.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("SessionToEagle.processnet_scope: String expected"); + FRLogger.warn("SessionToEagle.processnet_scope: String expected"); return false; } String net_name = (String) next_token; @@ -423,7 +425,7 @@ public class SessionToEagle extends javax.swing.JFrame next_token = this.scanner.next_token(); if (next_token == null) { - System.out.println("SessionToEagle.process_wire_scope: unexpected end of file"); + FRLogger.warn("SessionToEagle.process_wire_scope: unexpected end of file"); return false; } if (next_token == Keyword.CLOSED_BRACKET) @@ -494,7 +496,7 @@ public class SessionToEagle extends javax.swing.JFrame Object next_token = this.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("SessionToEagle.process_via_scope: padstack name expected"); + FRLogger.warn("SessionToEagle.process_via_scope: padstack name expected"); return false; } String padstack_name = (String) next_token; @@ -513,7 +515,7 @@ public class SessionToEagle extends javax.swing.JFrame } else { - System.out.println("SessionToEagle.process_via_scope: number expected"); + FRLogger.warn("SessionToEagle.process_via_scope: number expected"); return false; } } @@ -526,13 +528,13 @@ public class SessionToEagle extends javax.swing.JFrame } if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("SessionToEagle.process_via_scope: closing bracket expected"); + FRLogger.warn("SessionToEagle.process_via_scope: closing bracket expected"); return false; } if (padstack_name == null) { - System.out.println("SessionToEagle.process_via_scope: padstack_name missing"); + FRLogger.warn("SessionToEagle.process_via_scope: padstack_name missing"); return false; } @@ -540,7 +542,7 @@ public class SessionToEagle extends javax.swing.JFrame if (via_padstack == null) { - System.out.println("SessionToEagle.process_via_scope: via padstack not found"); + FRLogger.warn("SessionToEagle.process_via_scope: via padstack not found"); return false; } @@ -664,7 +666,7 @@ public class SessionToEagle extends javax.swing.JFrame } if (other_pin_info == null) { - System.out.println("SessuinToEagle.process_swapped_pins: other_pin_info not found"); + FRLogger.warn("SessuinToEagle.process_swapped_pins: other_pin_info not found"); return false; } write_pin_swap(curr_pin_info.pin, other_pin_info.pin); diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Shape.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Shape.java index 01e65b1..5c75ab5 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Shape.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Shape.java @@ -29,6 +29,7 @@ import java.util.LinkedList; import eu.mihosoft.freerouting.geometry.planar.PolylineShape; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Describes a shape in a Specctra dsn file. @@ -92,8 +93,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Shape.read_scope: IO error scanning file", e); return result; } return result; @@ -120,20 +120,18 @@ public abstract class Shape { if (p_layer_structure == null) { - System.out.println("PolylinePath.read_scope: only layer types pcb or signal expected"); + FRLogger.warn("PolylinePath.read_scope: only layer types pcb or signal expected"); return null; } if (!(next_token instanceof String)) { - System.out.println("PolylinePath.read_scope: layer name string expected"); + FRLogger.warn("PolylinePath.read_scope: layer name string expected"); return null; } int layer_no = p_layer_structure.get_no((String) next_token); if (layer_no < 0 || layer_no >= p_layer_structure.arr.length) { - System.out.print("Shape.read_polyline_path_scope: layer name "); - System.out.print((String) next_token); - System.out.println(" not found in layer structure "); + FRLogger.warn("Shape.read_polyline_path_scope: layer name '" + (String)next_token + "' not found in layer structure "); return null; } layer = p_layer_structure.arr[layer_no]; @@ -152,7 +150,7 @@ public abstract class Shape } if (corner_list.size() < 5) { - System.out.println("PolylinePath.read_scope: to few numbers in scope"); + FRLogger.warn("PolylinePath.read_scope: to few numbers in scope"); return null; } Iterator it = corner_list.iterator(); @@ -168,7 +166,7 @@ public abstract class Shape } else { - System.out.println("PolylinePath.read_scope: number expected"); + FRLogger.warn("PolylinePath.read_scope: number expected"); return null; } double[] corner_arr = new double[corner_list.size() - 1]; @@ -185,7 +183,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_polygon_path_scope: number expected"); + FRLogger.warn("Shape.read_polygon_path_scope: number expected"); return null; } @@ -194,8 +192,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("PolylinePath.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("PolylinePath.read_scope: IO error scanning file", e); return null; } } @@ -219,7 +216,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_area_scope: IO error scanning file"); + FRLogger.warn("Shape.read_area_scope: IO error scanning file"); return null; } if (next_token instanceof String) @@ -246,12 +243,12 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_area_scope: IO error scanning file"); + FRLogger.error("Shape.read_area_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("Shape.read_area_scope: unexpected end of file"); + FRLogger.warn("Shape.read_area_scope: unexpected end of file"); return null; } if (next_token == Keyword.CLOSED_BRACKET) @@ -274,12 +271,12 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_area_scope: IO error scanning file"); + FRLogger.error("Shape.read_area_scope: IO error scanning file", e); return null; } if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Shape.read_area_scope: closed bracket expected"); + FRLogger.warn("Shape.read_area_scope: closed bracket expected"); return null; } @@ -326,15 +323,14 @@ public abstract class Shape { if (!(next_token instanceof String)) { - System.out.println("Shape.read_rectangle_scope: layer name string expected"); + FRLogger.warn("Shape.read_rectangle_scope: layer name string expected"); return null; } String layer_name = (String) next_token; int layer_no = p_layer_structure.get_no(layer_name); if (layer_no < 0 || layer_no >= p_layer_structure.arr.length) { - System.out.println("Shape.read_rectangle_scope: layer name " + layer_name + - " not found in layer structure "); + FRLogger.warn("Shape.read_rectangle_scope: layer name " + layer_name + " not found in layer structure "); } else { @@ -359,7 +355,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_rectangle_scope: number expected"); + FRLogger.warn("Shape.read_rectangle_scope: number expected"); return null; } } @@ -368,7 +364,7 @@ public abstract class Shape next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Shape.read_rectangle_scope ) expected"); + FRLogger.warn("Shape.read_rectangle_scope ) expected"); return null; } if (rect_layer == null) @@ -379,8 +375,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_rectangle_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Shape.read_rectangle_scope: IO error scanning file", e); return null; } } @@ -408,20 +403,18 @@ public abstract class Shape { if (p_layer_structure == null) { - System.out.println("Shape.read_polygon_scope: only layer types pcb or signal expected"); + FRLogger.warn("Shape.read_polygon_scope: only layer types pcb or signal expected"); return null; } if (!(next_token instanceof String)) { - System.out.println("Shape.read_polygon_scope: layer name string expected"); + FRLogger.warn("Shape.read_polygon_scope: layer name string expected"); return null; } int layer_no = p_layer_structure.get_no((String) next_token); if (layer_no < 0 || layer_no >= p_layer_structure.arr.length) { - System.out.print("Shape.read_polygon_scope: layer name "); - System.out.print((String) next_token); - System.out.println(" not found in layer structure "); + FRLogger.warn("Shape.read_polygon_scope: layer name '" + (String)next_token + "' not found in layer structure "); layer_ok = false; } else @@ -441,7 +434,7 @@ public abstract class Shape next_token = p_scanner.next_token(); if (next_token == null) { - System.out.println("Shape.read_polygon_scope: unexpected end of file"); + FRLogger.warn("Shape.read_polygon_scope: unexpected end of file"); return null; } if (next_token == Keyword.OPEN_BRACKET) @@ -475,7 +468,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_polygon_scope: number expected"); + FRLogger.warn("Shape.read_polygon_scope: number expected"); return null; } @@ -484,8 +477,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Rectangle.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Rectangle.read_scope: IO error scanning file", e); return null; } } @@ -514,20 +506,18 @@ public abstract class Shape { if (p_layer_structure == null) { - System.out.println("Shape.read_circle_scope: p_layer_structure != null expected"); + FRLogger.warn("Shape.read_circle_scope: p_layer_structure != null expected"); return null; } if (!(next_token instanceof String)) { - System.out.println("Shape.read_circle_scope: string for layer_name expected"); + FRLogger.warn("Shape.read_circle_scope: string for layer_name expected"); return null; } int layer_no = p_layer_structure.get_no((String) next_token); if (layer_no < 0 || layer_no >= p_layer_structure.arr.length) { - System.out.print("Shape.read_circle_scope: layer with name "); - System.out.print((String) next_token); - System.out.println(" not found in layer stracture "); + FRLogger.warn("Shape.read_circle_scope: layer with name '" + (String)next_token + "' not found in layer stracture "); layer_ok = false; } else @@ -546,7 +536,7 @@ public abstract class Shape } if (curr_index > 2) { - System.out.println("Shape.read_circle_scope: closed bracket expected"); + FRLogger.warn("Shape.read_circle_scope: closed bracket expected"); return null; } if (next_token instanceof Double) @@ -559,7 +549,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_circle_scope: number expected"); + FRLogger.warn("Shape.read_circle_scope: number expected"); return null; } ++curr_index; @@ -572,8 +562,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_rectangle_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Shape.read_rectangle_scope: IO error scanning file", e); return null; } } @@ -600,20 +589,18 @@ public abstract class Shape { if (p_layer_structure == null) { - System.out.println("Shape.read_polygon_path_scope: only layer types pcb or signal expected"); + FRLogger.warn("Shape.read_polygon_path_scope: only layer types pcb or signal expected"); return null; } if (!(next_token instanceof String)) { - System.out.println("Path.read_scope: layer name string expected"); + FRLogger.warn("Path.read_scope: layer name string expected"); return null; } int layer_no = p_layer_structure.get_no((String) next_token); if (layer_no < 0 || layer_no >= p_layer_structure.arr.length) { - System.out.print("Shape.read_polygon_path_scope: layer with name "); - System.out.print((String) next_token); - System.out.println(" not found in layer structure "); + FRLogger.warn("Shape.read_polygon_path_scope: layer with name '" + (String)next_token + "' not found in layer structure "); layer_ok = false; } else @@ -641,7 +628,7 @@ public abstract class Shape } if (corner_list.size() < 5) { - System.out.println("Shape.read_polygon_path_scope: to few numbers in scope"); + FRLogger.warn("Shape.read_polygon_path_scope: to few numbers in scope"); return null; } if (!layer_ok) @@ -661,7 +648,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_polygon_path_scope: number expected"); + FRLogger.warn("Shape.read_polygon_path_scope: number expected"); return null; } double[] coordinate_arr = new double[corner_list.size() - 1]; @@ -678,7 +665,7 @@ public abstract class Shape } else { - System.out.println("Shape.read_polygon_path_scope: number expected"); + FRLogger.warn("Shape.read_polygon_path_scope: number expected"); return null; } @@ -687,8 +674,7 @@ public abstract class Shape } catch (java.io.IOException e) { - System.out.println("Shape.read_polygon_path_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Shape.read_polygon_path_scope: IO error scanning file", e); return null; } } @@ -703,7 +689,7 @@ public abstract class Shape int hole_count = p_area.size() - 1; if (hole_count <= -1) { - System.out.println("Shape.transform_area_to_board: p_area.size() > 0 expected"); + FRLogger.warn("Shape.transform_area_to_board: p_area.size() > 0 expected"); return null; } Iterator it = p_area.iterator(); @@ -719,7 +705,7 @@ public abstract class Shape // Area with holes if (!(boundary_shape instanceof eu.mihosoft.freerouting.geometry.planar.PolylineShape)) { - System.out.println("Shape.transform_area_to_board: PolylineShape expected"); + FRLogger.warn("Shape.transform_area_to_board: PolylineShape expected"); return null; } PolylineShape border = (PolylineShape) boundary_shape; @@ -729,7 +715,7 @@ public abstract class Shape eu.mihosoft.freerouting.geometry.planar.Shape hole_shape = it.next().transform_to_board(p_coordinate_transform); if (!(hole_shape instanceof PolylineShape)) { - System.out.println("Shape.transform_area_to_board: PolylineShape expected"); + FRLogger.warn("Shape.transform_area_to_board: PolylineShape expected"); return null; } holes[i] = (PolylineShape) hole_shape; @@ -749,7 +735,7 @@ public abstract class Shape int hole_count = p_area.size() - 1; if (hole_count <= -1) { - System.out.println("Shape.transform_area_to_board_rel: p_area.size() > 0 expected"); + FRLogger.warn("Shape.transform_area_to_board_rel: p_area.size() > 0 expected"); return null; } Iterator it = p_area.iterator(); @@ -765,7 +751,7 @@ public abstract class Shape // Area with holes if (!(boundary_shape instanceof eu.mihosoft.freerouting.geometry.planar.PolylineShape)) { - System.out.println("Shape.transform_area_to_board_rel: PolylineShape expected"); + FRLogger.warn("Shape.transform_area_to_board_rel: PolylineShape expected"); return null; } PolylineShape border = (PolylineShape) boundary_shape; @@ -775,7 +761,7 @@ public abstract class Shape eu.mihosoft.freerouting.geometry.planar.Shape hole_shape = it.next().transform_to_board_rel(p_coordinate_transform); if (!(hole_shape instanceof PolylineShape)) { - System.out.println("Shape.transform_area_to_board: PolylineShape expected"); + FRLogger.warn("Shape.transform_area_to_board: PolylineShape expected"); return null; } holes[i] = (PolylineShape) hole_shape; diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Structure.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Structure.java index c51da63..43b5e39 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Structure.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Structure.java @@ -33,6 +33,7 @@ import java.util.LinkedList; import eu.mihosoft.freerouting.datastructures.UndoableObjects; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.BoardRules; import eu.mihosoft.freerouting.rules.DefaultItemClearanceClasses.ItemClass; @@ -80,13 +81,12 @@ class Structure extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Structure.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Structure.read_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Structure.read_scope: unexpected end of file"); + FRLogger.warn("Structure.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -251,7 +251,7 @@ class Structure extends ScopeKeyword eu.mihosoft.freerouting.rules.Net curr_net = board.rules.nets.get(plane_info.net_name, 1); if (curr_net == null) { - System.out.println("Plane.read_scope: net not found"); + FRLogger.warn("Plane.read_scope: net not found"); continue; } eu.mihosoft.freerouting.geometry.planar.Area plane_area = @@ -265,7 +265,7 @@ class Structure extends ScopeKeyword clearance_class_no = board.rules.clearance_matrix.get_no(plane_info.area.clearance_class_name); if (clearance_class_no < 0) { - System.out.println("Structure.read_scope: clearance class not found"); + FRLogger.warn("Structure.read_scope: clearance class not found"); clearance_class_no = BoardRules.clearance_class_none(); } } @@ -280,7 +280,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Plane.read_scope: unexpected layer name"); + FRLogger.warn("Plane.read_scope: unexpected layer name"); return false; } } @@ -323,7 +323,7 @@ class Structure extends ScopeKeyword } if (curr_ob == null) { - System.out.println("Structure.write_scope; outline not found"); + FRLogger.warn("Structure.write_scope; outline not found"); return; } eu.mihosoft.freerouting.board.BoardOutline outline = (eu.mihosoft.freerouting.board.BoardOutline) curr_ob; @@ -432,7 +432,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.write_via_padstacks: padstack is null"); + FRLogger.warn("Structure.write_via_padstacks: padstack is null"); } } p_file.write(")"); @@ -535,12 +535,12 @@ class Structure extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Structure.read_boundary_scope: IO error scanning file"); + FRLogger.error("Structure.read_boundary_scope: IO error scanning file", e); return false; } if (curr_shape == null) { - System.out.println("Structure.read_boundary_scope: shape is null"); + FRLogger.warn("Structure.read_boundary_scope: shape is null"); return true; } if (curr_shape.layer == Layer.PCB) @@ -551,7 +551,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.read_boundary_scope: exact 1 bounding_shape expected"); + FRLogger.warn("Structure.read_boundary_scope: exact 1 bounding_shape expected"); } } else if (curr_shape.layer == Layer.SIGNAL) @@ -560,7 +560,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.read_boundary_scope: unexpected layer"); + FRLogger.warn("Structure.read_boundary_scope: unexpected layer"); } return true; } @@ -574,7 +574,7 @@ class Structure extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Structure.read_layer_scope: String expected"); + FRLogger.warn("Structure.read_layer_scope: String expected"); return false; } Collection net_names = new LinkedList(); @@ -584,7 +584,7 @@ class Structure extends ScopeKeyword { if (next_token != Keyword.OPEN_BRACKET) { - System.out.println("Structure.read_layer_scope: ( expected"); + FRLogger.warn("Structure.read_layer_scope: ( expected"); return false; } next_token = p_scanner.next_token(); @@ -597,18 +597,19 @@ class Structure extends ScopeKeyword } else if (next_token != Keyword.SIGNAL) { - System.out.print("Structure.read_layer_scope: unknown layer type "); if (next_token instanceof String) { - System.out.print((String) next_token); + FRLogger.warn("Structure.read_layer_scope: unknown layer type '" + (String)next_token + "'"); + } else + { + FRLogger.warn("Structure.read_layer_scope: unknown layer type"); } - System.out.println(); layer_ok = false; } next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Structure.read_layer_scope: ) expected"); + FRLogger.warn("Structure.read_layer_scope: ) expected"); return false; } } @@ -633,7 +634,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.read_layer_scope: string expected"); + FRLogger.warn("Structure.read_layer_scope: string expected"); } } } @@ -652,8 +653,7 @@ class Structure extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Layer.read_scope: IO error scanning file"); - System.out.println(e); + FRLogger.error("Layer.read_scope: IO error scanning file", e); return false; } return true; @@ -691,7 +691,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.read_via_padstack: String expected"); + FRLogger.warn("Structure.read_via_padstack: String expected"); return null; } } @@ -701,7 +701,7 @@ class Structure extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Structure.read_via_padstack: IO error scanning file"); + FRLogger.error("Structure.read_via_padstack: IO error scanning file", e); return null; } } @@ -718,12 +718,12 @@ class Structure extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Structure.read_control_scope: IO error scanning file"); + FRLogger.error("Structure.read_control_scope: IO error scanning file", e); return false; } if (next_token == null) { - System.out.println("Structure.read_control_scope: unexpected end of file"); + FRLogger.warn("Structure.read_control_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -766,20 +766,20 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.read_snap_angle_scope: unexpected token"); + FRLogger.warn("Structure.read_snap_angle_scope: unexpected token"); return null; } next_token = p_scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("Structure.read_selection_layer_scop: closing bracket expected"); + FRLogger.warn("Structure.read_selection_layer_scop: closing bracket expected"); return null; } return snap_angle; } catch (java.io.IOException e) { - System.out.println("Structure.read_snap_angl: IO error scanning file"); + FRLogger.error("Structure.read_snap_angl: IO error scanning file", e); return null; } } @@ -810,7 +810,7 @@ class Structure extends ScopeKeyword int layer_count = p_board_construction_info.layer_info.size(); if (layer_count == 0) { - System.out.println("Structure.create_board: layers missing in structure scope"); + FRLogger.warn("Structure.create_board: layers missing in structure scope"); return false; } if (p_board_construction_info.bounding_shape == null) @@ -818,7 +818,7 @@ class Structure extends ScopeKeyword // happens if the boundary shape with layer pcb is missing if (p_board_construction_info.outline_shapes.isEmpty()) { - System.out.println("Structure.create_board: outline missing"); + FRLogger.warn("Structure.create_board: outline missing"); p_par.board_outline_ok = false; return false; } @@ -839,7 +839,7 @@ class Structure extends ScopeKeyword Layer curr_layer = it.next(); if (curr_layer.no < 0 || curr_layer.no >= layer_count) { - System.out.println("Structure.create_board: illegal layer number"); + FRLogger.warn("Structure.create_board: illegal layer number"); return false; } board_layer_arr[i] = new eu.mihosoft.freerouting.board.Layer(curr_layer.name, curr_layer.is_signal); @@ -970,7 +970,7 @@ class Structure extends ScopeKeyword { if (curr_net == null) { - System.out.println("Structure.insert_missing_power_planes: net not found"); + FRLogger.warn("Structure.insert_missing_power_planes: net not found"); continue; } } @@ -1133,7 +1133,7 @@ class Structure extends ScopeKeyword curr_pair = curr_string.split(p_string_quote, 2); if (curr_pair.length != 2 || !curr_pair[1].startsWith("_")) { - System.out.println("Structure.set_clearance_rule: '_' exprcted"); + FRLogger.warn("Structure.set_clearance_rule: '_' expected"); continue; } curr_pair[1] = curr_pair[1].substring(1); @@ -1275,13 +1275,13 @@ class Structure extends ScopeKeyword Shape.transform_area_to_board(p_area.shape_list, p_par.coordinate_transform); if (keepout_area.dimension() < 2) { - System.out.println("Structure.insert_keepout: keepout is not an area"); + FRLogger.warn("Structure.insert_keepout: keepout is not an area"); return true; } eu.mihosoft.freerouting.board.BasicBoard board = p_par.board_handling.get_routing_board(); if (board == null) { - System.out.println("Structure.insert_keepout: eu.mihosoft.freerouting.board not initialized"); + FRLogger.warn("Structure.insert_keepout: eu.mihosoft.freerouting.board not initialized"); return false; } Layer curr_layer = (p_area.shape_list.iterator().next()).layer; @@ -1301,7 +1301,7 @@ class Structure extends ScopeKeyword } else { - System.out.println("Structure.insert_keepout: unknown layer name"); + FRLogger.warn("Structure.insert_keepout: unknown layer name"); return false; } @@ -1322,7 +1322,7 @@ class Structure extends ScopeKeyword clearance_class_no = p_board.rules.clearance_matrix.get_no(p_clearance_class_name); if (clearance_class_no < 0) { - System.out.println("Keepout.insert_leepout: clearance class not found"); + FRLogger.warn("Keepout.insert_leepout: clearance class not found"); clearance_class_no = BoardRules.clearance_class_none(); } } diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Wiring.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Wiring.java index 732aae8..dc2d48d 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Wiring.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/Wiring.java @@ -46,6 +46,7 @@ import eu.mihosoft.freerouting.board.ItemSelectionFilter; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.datastructures.IdentifierType; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Class for reading and writing wiring scopes from dsn-files. @@ -73,12 +74,12 @@ class Wiring extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Wiring.read_scope: IO error scanning file"); + FRLogger.warn("Wiring.read_scope: IO error scanning file"); return false; } if (next_token == null) { - System.out.println("Wiring.read_scope: unexpected end of file"); + FRLogger.warn("Wiring.read_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -194,7 +195,7 @@ class Wiring extends ScopeKeyword { if (!(p_wire instanceof PolylineTrace)) { - System.out.println("Wiring.write_wire_scope: trace type not yet implemented"); + FRLogger.warn("Wiring.write_wire_scope: trace type not yet implemented"); return; } PolylineTrace curr_wire = (PolylineTrace) p_wire; @@ -209,7 +210,7 @@ class Wiring extends ScopeKeyword } if (wire_net == null) { - System.out.println("Wiring.write_wire_scope: net not found"); + FRLogger.warn("Wiring.write_wire_scope: net not found"); return; } p_par.file.start_scope(); @@ -245,7 +246,7 @@ class Wiring extends ScopeKeyword int net_count = p_conduction_area.net_count(); if (net_count <= 0 || net_count > 1) { - System.out.println("Plane.write_scope: unexpected net count"); + FRLogger.warn("Plane.write_scope: unexpected net count"); return; } eu.mihosoft.freerouting.rules.Net curr_net = p_par.board.rules.nets.get(p_conduction_area.get_net_no(0)); @@ -331,12 +332,12 @@ class Wiring extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Wiring.read_wire_scope: IO error scanning file"); + FRLogger.error("Wiring.read_wire_scope: IO error scanning file", e); return null; } if (next_token == null) { - System.out.println("Wiring.read_wire_scope: unexpected end of file"); + FRLogger.warn("Wiring.read_wire_scope: unexpected end of file"); return null; } if (next_token == CLOSED_BRACKET) @@ -380,12 +381,12 @@ class Wiring extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Wiring.read_wire_scope: IO error scanning file"); + FRLogger.error("Wiring.read_wire_scope: IO error scanning file", e); return null; } if (next_token != CLOSED_BRACKET) { - System.out.println("Wiring.read_wire_scope: closing bracket expected"); + FRLogger.warn("Wiring.read_wire_scope: closing bracket expected"); return null; } } @@ -409,7 +410,7 @@ class Wiring extends ScopeKeyword } if (path == null && border_shape == null) { - System.out.println("Wiring.read_wire_scope: shape missing"); + FRLogger.warn("Wiring.read_wire_scope: shape missing"); return null; } RoutingBoard board = p_par.board_handling.get_routing_board(); @@ -443,14 +444,14 @@ class Wiring extends ScopeKeyword } if (layer_no < 0 || layer_no >= board.get_layer_count()) { - System.out.print("Wiring.read_wire_scope: unexpected layer "); + FRLogger.warn("Wiring.read_wire_scope: unexpected layer "); if (path != null) { - System.out.println(path.layer.name); + FRLogger.warn(path.layer.name); } else { - System.out.println(border_shape.layer.name); + FRLogger.warn(border_shape.layer.name); } return null; } @@ -489,7 +490,7 @@ class Wiring extends ScopeKeyword FloatPoint curr_corner = p_par.coordinate_transform.dsn_to_board(curr_point); if (!bounding_box.contains(curr_corner)) { - System.out.println("Wiring.read_wire_scope: wire corner outside eu.mihosoft.freerouting.board"); + FRLogger.warn("Wiring.read_wire_scope: wire corner outside board"); return null; } corner_arr[i] = curr_corner.round(); @@ -522,7 +523,7 @@ class Wiring extends ScopeKeyword } else { - System.out.println("Wiring.read_wire_scope: unexpected Path subclass"); + FRLogger.warn("Wiring.read_wire_scope: unexpected Path subclass"); return null; } if (result != null && result.net_count() == 0) @@ -590,7 +591,7 @@ class Wiring extends ScopeKeyword Object next_token = p_par.scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Wiring.read_via_scope: padstack name expected"); + FRLogger.warn("Wiring.read_via_scope: padstack name expected"); return false; } String padstack_name = (String) next_token; @@ -609,7 +610,7 @@ class Wiring extends ScopeKeyword } else { - System.out.println("Wiring.read_via_scope: number expected"); + FRLogger.warn("Wiring.read_via_scope: number expected"); return false; } } @@ -621,7 +622,7 @@ class Wiring extends ScopeKeyword next_token = p_par.scanner.next_token(); if (next_token == null) { - System.out.println("Wiring.read_via_scope: unexpected end of file"); + FRLogger.warn("Wiring.read_via_scope: unexpected end of file"); return false; } if (next_token == CLOSED_BRACKET) @@ -653,16 +654,14 @@ class Wiring extends ScopeKeyword eu.mihosoft.freerouting.library.Padstack curr_padstack = board.library.padstacks.get(padstack_name); if (curr_padstack == null) { - System.out.println("Wiring.read_via_scope: via padstack not found"); + FRLogger.warn("Wiring.read_via_scope: via padstack not found"); return false; } eu.mihosoft.freerouting.rules.NetClass net_class = board.rules.get_default_net_class(); Collection found_nets = get_subnets(net_id, board.rules); if (net_id != null && found_nets.isEmpty()) { - System.out.print("Wiring.read_via_scope: net with name "); - System.out.print(net_id.name); - System.out.println(" not found"); + FRLogger.warn("Wiring.read_via_scope: net with name '" + net_id.name + "' not found"); } int[] net_no_arr = new int[found_nets.size()]; int curr_index = 0; @@ -683,8 +682,7 @@ class Wiring extends ScopeKeyword IntPoint board_location = p_par.coordinate_transform.dsn_to_board(location).round(); if (via_exists(board_location, curr_padstack, net_no_arr, board)) { - System.out.print("Multiple via skipped at ("); - System.out.println(board_location.x + ", " + board_location.y + ")"); + FRLogger.warn("Multiple via skipped at (" + board_location.x + ", " + board_location.y + ")"); } else { @@ -695,7 +693,7 @@ class Wiring extends ScopeKeyword } catch (java.io.IOException e) { - System.out.println("Wiring.read_via_scope: IO error scanning file"); + FRLogger.error("Wiring.read_via_scope: IO error scanning file", e); return false; } } @@ -740,14 +738,14 @@ class Wiring extends ScopeKeyword next_token = p_scanner.next_token(); if (next_token != CLOSED_BRACKET) { - System.out.println("Wiring.is_fixed: ) expected"); + FRLogger.warn("Wiring.is_fixed: ) expected"); return eu.mihosoft.freerouting.board.FixedState.UNFIXED; } return result; } catch (java.io.IOException e) { - System.out.println("Wiring.is_fixed: IO error scanning file"); + FRLogger.error("Wiring.is_fixed: IO error scanning file", e); return eu.mihosoft.freerouting.board.FixedState.UNFIXED; } } @@ -764,7 +762,7 @@ class Wiring extends ScopeKeyword Object next_token = p_scanner.next_token(); if (!(next_token instanceof String)) { - System.out.println("Wiring:read_net_id: String expected"); + FRLogger.warn("Wiring:read_net_id: String expected"); return null; } String net_name = (String) next_token; @@ -776,13 +774,13 @@ class Wiring extends ScopeKeyword } if (next_token != CLOSED_BRACKET) { - System.out.println("Wiring.read_net_id: closing bracket expected"); + FRLogger.warn("Wiring.read_net_id: closing bracket expected"); } return new Net.Id(net_name, subnet_number); } catch (java.io.IOException e) { - System.out.println("DsnFile.read_string_scope: IO error scanning file"); + FRLogger.error("DsnFile.read_string_scope: IO error scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/BigIntDirection.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/BigIntDirection.java index f30f061..0ab2e88 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/BigIntDirection.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/BigIntDirection.java @@ -22,6 +22,8 @@ */ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.math.BigInteger; /** @@ -52,7 +54,7 @@ public class BigIntDirection extends Direction implements java.io.Serializable public Direction turn_45_degree(int p_factor) { - System.out.println("BigIntDirection: turn_45_degree not yet implemented"); + FRLogger.warn("BigIntDirection: turn_45_degree not yet implemented"); return this; } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Circle.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Circle.java index 7b5cf3d..3c8f364 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Circle.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Circle.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Discribes functionality of a circle shape in the plane. * @@ -37,7 +39,7 @@ public class Circle implements ConvexShape, java.io.Serializable center = p_center; if (p_radius < 0) { - System.out.println("Circle: unexpected negative radius"); + FRLogger.warn("Circle: unexpected negative radius"); radius = -p_radius; } else @@ -281,7 +283,7 @@ public class Circle implements ConvexShape, java.io.Serializable } if (!(p_vector instanceof IntVector)) { - System.out.println("Circle.translate_by only implemented for IntVectors till now"); + FRLogger.warn("Circle.translate_by only implemented for IntVectors till now"); return this; } IntPoint new_center = (IntPoint) center.translate_by(p_vector); @@ -291,7 +293,7 @@ public class Circle implements ConvexShape, java.io.Serializable public FloatPoint nearest_point_approx(FloatPoint p_point) { - System.out.println("Circle.nearest_point_approx not yet implemented"); + FRLogger.warn("Circle.nearest_point_approx not yet implemented"); return null; } @@ -318,7 +320,7 @@ public class Circle implements ConvexShape, java.io.Serializable public Polyline[] cutout(Polyline p_polyline) { - System.out.println("Circle.cutout not yet implemented"); + FRLogger.warn("Circle.cutout not yet implemented"); return null; } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatLine.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatLine.java index 928a04c..2941ba7 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatLine.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatLine.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Defines a line in the plane by to FloatPoints. * Calculations with FloatLines are generally not exact. @@ -41,7 +43,7 @@ public class FloatLine { if (p_a == null || p_b == null) { - System.out.println("FloatLine: Parameter is null"); + FRLogger.warn("FloatLine: Parameter is null"); } a = p_a; b = p_b; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatPoint.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatPoint.java index e60a815..ced17fb 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatPoint.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/FloatPoint.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * Implements a point in the plane as a touple of double's. @@ -250,7 +252,7 @@ public class FloatPoint implements java.io.Serializable { if (p_1 == null || p_2 == null) { - System.out.println("FloatPoint.scalar_product: parameter point is null"); + FRLogger.warn("FloatPoint.scalar_product: parameter point is null"); return 0; } double dx_1 = p_1.x - this.x; @@ -287,7 +289,7 @@ public class FloatPoint implements java.io.Serializable double dy = p_to_point.y - this.y; if (dx == 0 && dy == 0) { - System.out.println("IntPoint.change_length: Points are equal"); + FRLogger.warn("IntPoint.change_length: Points are equal"); return p_to_point; } double length = Math.sqrt(dx * dx + dy * dy); diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntBox.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntBox.java index 52f8385..7cece41 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntBox.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntBox.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * Implements functionality of orthogonal rectangles in the plane @@ -524,7 +526,7 @@ public class IntBox extends RegularTileShape implements java.io.Serializable public int border_line_index(Line p_line) { - System.out.println("edge_index_of_line not yet implemented for IntBoxes"); + FRLogger.warn("edge_index_of_line not yet implemented for IntBoxes"); return -1; } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntOctagon.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntOctagon.java index 2f62f5c..6cf2b91 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntOctagon.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntOctagon.java @@ -19,6 +19,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * Implements functionality for convex shapes, whose borderline directions are @@ -679,7 +681,7 @@ public class IntOctagon extends RegularTileShape implements java.io.Serializable } else { - System.out.println("IntOctagon.side_of_border_line: p_border_line_no out of range"); + FRLogger.warn("IntOctagon.side_of_border_line: p_border_line_no out of range"); tmp = 0; } Side result; @@ -1144,8 +1146,7 @@ public class IntOctagon extends RegularTileShape implements java.io.Serializable } break; default: - throw new IllegalArgumentException - ("IntBox.compare: p_edge_no out of range"); + throw new IllegalArgumentException("IntBox.compare: p_edge_no out of range"); } return result; @@ -1158,7 +1159,7 @@ public class IntOctagon extends RegularTileShape implements java.io.Serializable public int border_line_index(Line p_line) { - System.out.println("edge_index_of_line not yet implemented for octagons"); + FRLogger.warn("edge_index_of_line not yet implemented for octagons"); return -1; } /** @@ -1216,7 +1217,7 @@ public class IntOctagon extends RegularTileShape implements java.io.Serializable result_y = p_point.y + p_point.x - result_x; break; default: - System.out.println("IntOctagon.border_point: unexpected 45 degree direction"); + FRLogger.warn("IntOctagon.border_point: unexpected 45 degree direction"); result_x = 0; result_y = 0; } @@ -1401,7 +1402,7 @@ public class IntOctagon extends RegularTileShape implements java.io.Serializable } else { - System.out.println("IntOctagon.border_line_side_of: p_line_no out of range"); + FRLogger.warn("IntOctagon.border_line_side_of: p_line_no out of range"); result = Side.COLLINEAR; } return result; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntPoint.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntPoint.java index 4529788..6e1073f 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntPoint.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/IntPoint.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.math.BigInteger; /** @@ -43,7 +45,7 @@ public class IntPoint extends Point implements java.io.Serializable { if (Math.abs(p_x) > Limits.CRIT_INT || Math.abs(p_y) > Limits.CRIT_INT) { - System.out.println("Warning in IntPoint: p_x or p_y to big"); + FRLogger.warn("Warning in IntPoint: p_x or p_y to big"); } x = p_x; y = p_y; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Line.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Line.java index a599f8b..877a335 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Line.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Line.java @@ -22,6 +22,7 @@ package eu.mihosoft.freerouting.geometry.planar; import java.math.BigInteger; import eu.mihosoft.freerouting.datastructures.Signum; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -43,7 +44,7 @@ public class Line implements Comparable, java.io.Serializable dir = null; if (!(a instanceof IntPoint && b instanceof IntPoint)) { - System.out.println("Line(p_a, p_b) only implemented for IntPoints till now"); + FRLogger.warn("Line(p_a, p_b) only implemented for IntPoints till now"); } } @@ -67,7 +68,7 @@ public class Line implements Comparable, java.io.Serializable dir = p_dir; if (!(a instanceof IntPoint && b instanceof IntPoint)) { - System.out.println("Line(p_a, p_dir) only implemented for IntPoints till now"); + FRLogger.warn("Line(p_a, p_dir) only implemented for IntPoints till now"); } } @@ -633,7 +634,7 @@ public class Line implements Comparable, java.io.Serializable double dx = p2.x - p1.x; if (dx == 0) { - System.out.println("function_value_approx: line is vertical"); + FRLogger.warn("function_value_approx: line is vertical"); return 0; } double dy = p2.y - p1.y; @@ -653,7 +654,7 @@ public class Line implements Comparable, java.io.Serializable double dy = p2.y - p1.y; if (dy == 0) { - System.out.println("function_in_y_value_approx: line is horizontal"); + FRLogger.warn("function_in_y_value_approx: line is horizontal"); return 0; } double dx = p2.x - p1.x; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/LineSegment.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/LineSegment.java index 3e5710a..30be3a5 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/LineSegment.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/LineSegment.java @@ -19,6 +19,7 @@ package eu.mihosoft.freerouting.geometry.planar; import eu.mihosoft.freerouting.datastructures.Signum; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Implements functionality for line segments. @@ -53,7 +54,7 @@ public class LineSegment implements java.io.Serializable { if (p_no <= 0 || p_no >= p_polyline.arr.length - 1) { - System.out.println("LineSegment from Polyline: p_no out of range"); + FRLogger.warn("LineSegment from Polyline: p_no out of range"); start = null; middle = null; end = null; @@ -73,7 +74,7 @@ public class LineSegment implements java.io.Serializable int line_count = p_shape.border_line_count(); if (p_no < 0 || p_no >= line_count) { - System.out.println("LineSegment from TileShape: p_no out of range"); + FRLogger.warn("LineSegment from TileShape: p_no out of range"); start = null; middle = null; end = null; @@ -236,7 +237,7 @@ public class LineSegment implements java.io.Serializable { if (!(p_point instanceof IntPoint)) { - System.out.println("LineSegments.contains currently only implementet for IntPoints"); + FRLogger.warn("LineSegments.contains currently only implementet for IntPoints"); return false; } if (middle.side_of(p_point) != Side.COLLINEAR) @@ -808,7 +809,7 @@ public class LineSegment implements java.io.Serializable } else { - System.out.println("border_intersections: intersection_count to big!"); + FRLogger.warn("border_intersections: intersection_count to big!"); } } @@ -844,8 +845,7 @@ public class LineSegment implements java.io.Serializable if (intersection_count != 1) { - System.out.println( - "LineSegment.border_intersections: intersection_count 1 expected"); + FRLogger.warn("LineSegment.border_intersections: intersection_count 1 expected"); } int[] normalised_result = new int[1]; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polygon.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polygon.java index 15bc88b..327a5ae 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polygon.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polygon.java @@ -19,6 +19,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -175,7 +177,7 @@ public class Polygon implements java.io.Serializable angle_sum /= 2.0 * Math.PI; if (Math.abs(angle_sum) < 0.5) { - System.out.println ("Polygon.winding_number_after_closing: winding number != 0 expected"); + FRLogger.warn("Polygon.winding_number_after_closing: winding number != 0 expected"); } return (int) Math.round(angle_sum); } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolygonShape.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolygonShape.java index 35d4cdf..86718a5 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolygonShape.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolygonShape.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -128,7 +130,7 @@ public class PolygonShape extends PolylineShape { if (p_no < 0 || p_no >= corners.length) { - System.out.println("PolygonShape.corner: p_no out of range"); + FRLogger.warn("PolygonShape.corner: p_no out of range"); return null; } return corners[p_no]; @@ -195,7 +197,7 @@ public class PolygonShape extends PolylineShape public Polyline[] cutout(Polyline p_polyline) { - System.out.println("PolygonShape.cutout not yet implemented"); + FRLogger.warn("PolygonShape.cutout not yet implemented"); return null; } @@ -205,13 +207,13 @@ public class PolygonShape extends PolylineShape { return this; } - System.out.println("PolygonShape.enlarge not yet implemented"); + FRLogger.warn("PolygonShape.enlarge not yet implemented"); return null; } public double border_distance(FloatPoint p_point) { - System.out.println("PolygonShape.border_distance not yet implemented"); + FRLogger.warn("PolygonShape.border_distance not yet implemented"); return 0; } @@ -258,13 +260,13 @@ public class PolygonShape extends PolylineShape public boolean contains_on_border(Point p_point) { - //System.out.println("PolygonShape.contains_on_edge not yet implemented"); + //FRLogger.warn("PolygonShape.contains_on_edge not yet implemented"); return false; } public double distance(FloatPoint p_point) { - System.out.println("PolygonShape.distance not yet implemented"); + FRLogger.warn("PolygonShape.distance not yet implemented"); return 0; } public PolygonShape translate_by(Vector p_vector) @@ -490,7 +492,7 @@ public class PolygonShape extends PolylineShape { if (p_no < 0 || p_no >= corners.length) { - System.out.println("PolygonShape.edge_line: p_no out of range"); + FRLogger.warn("PolygonShape.edge_line: p_no out of range"); return null; } Point next_corner; @@ -841,7 +843,7 @@ public class PolygonShape extends PolylineShape } if (min_projection_dist == Integer.MAX_VALUE ) { - System.out.println("PolygonShape.DivisionPoint: projection not found"); + FRLogger.warn("PolygonShape.DivisionPoint: projection not found"); } projection = min_projection; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polyline.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polyline.java index 0940602..696c246 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polyline.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Polyline.java @@ -19,6 +19,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -52,7 +54,7 @@ public class Polyline implements java.io.Serializable Point[] point_arr = p_polygon.corner_array(); if (point_arr.length < 2) { - System.out.println("Polyline: must contain at least 2 different points"); + FRLogger.warn("Polyline: must contain at least 2 different points"); arr = new Line[0]; return; } @@ -271,12 +273,12 @@ public class Polyline implements java.io.Serializable int no; if (p_no < 0) { - System.out.println("Polyline.corner_approx: p_no is < 0"); + FRLogger.warn("Polyline.corner_approx: p_no is < 0"); no = 0; } else if (p_no >= arr.length - 1) { - System.out.println("Polyline.corner_approx: p_no must be less than arr.length - 1"); + FRLogger.warn("Polyline.corner_approx: p_no must be less than arr.length - 1"); no = arr.length - 2; } else @@ -307,18 +309,18 @@ public class Polyline implements java.io.Serializable { if (arr.length < 2) { - System.out.println("Polyline.corner: arr.length is < 2"); + FRLogger.warn("Polyline.corner: arr.length is < 2"); return null; } int no; if (p_no < 0) { - System.out.println("Polyline.corner: p_no is < 0"); + FRLogger.warn("Polyline.corner: p_no is < 0"); no = 0; } else if (p_no >= arr.length - 1) { - System.out.println("Polyline.corner: p_no must be less than arr.length - 1"); + FRLogger.warn("Polyline.corner: p_no must be less than arr.length - 1"); no = arr.length - 2; } else @@ -584,7 +586,7 @@ public class Polyline implements java.io.Serializable shape_arr[curr_shape_no] = bounding_shape.intersection_with_simplify(s1); if (shape_arr[curr_shape_no].is_empty()) { - System.out.println("offset_shapes: shape is empty"); + FRLogger.warn("offset_shapes: shape is empty"); } prev_dir = curr_dir; @@ -603,7 +605,7 @@ public class Polyline implements java.io.Serializable { if (p_no < 0 || p_no > arr.length - 3) { - System.out.println("Polyline.offset_shape: p_no out of range"); + FRLogger.warn("Polyline.offset_shape: p_no out of range"); return null; } TileShape[] result = offset_shapes(p_half_width, p_no, p_no + 2); @@ -927,7 +929,7 @@ public class Polyline implements java.io.Serializable { if (p_line_no < 1 || p_line_no > arr.length - 2) { - System.out.println("Polyline.split: p_line_no out of range"); + FRLogger.warn("Polyline.split: p_line_no out of range"); return null; } if (this.arr[p_line_no].is_parallel(p_end_line)) diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineArea.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineArea.java index 0c06dda..75c0964 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineArea.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineArea.java @@ -22,6 +22,8 @@ */ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -204,7 +206,7 @@ public class PolylineArea implements Area, java.io.Serializable { if (hole_arr[i].dimension() < 2) { - System.out.println("PolylineArea. split_to_convex: dimennsion 2 for hole expected"); + FRLogger.warn("PolylineArea. split_to_convex: dimennsion 2 for hole expected"); continue; } TileShape[] convex_hole_pieces = hole_arr[i].split_to_convex(); diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineShape.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineShape.java index 1e49916..035e7bb 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineShape.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/PolylineShape.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -252,8 +254,8 @@ public abstract class PolylineShape implements Shape, java.io.Serializable { if (this.is_empty()) { - System.out.println("PolylineShape.polar_line_segment: shape is empty"); - return null; + FRLogger.warn("PolylineShape.polar_line_segment: shape is empty"); + return null; } FloatPoint left_most_corner = corner_approx(0); FloatPoint right_most_corner = corner_approx(0); diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/RationalVector.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/RationalVector.java index edc0371..7496f85 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/RationalVector.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/RationalVector.java @@ -26,6 +26,7 @@ import java.math.BigInteger; import eu.mihosoft.freerouting.datastructures.BigIntAux; import eu.mihosoft.freerouting.datastructures.Signum; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -177,7 +178,7 @@ public class RationalVector extends Vector implements java.io.Serializable public Vector change_length_approx(double p_lenght) { - System.out.println("RationalVector: change_length_approx not yet implemented"); + FRLogger.warn("RationalVector: change_length_approx not yet implemented"); return this; } diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Simplex.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Simplex.java index 211d78b..fd6b323 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/Simplex.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/Simplex.java @@ -19,6 +19,8 @@ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -98,12 +100,12 @@ public class Simplex extends TileShape implements java.io.Serializable int no; if (p_no < 0) { - System.out.println("corner: p_no is < 0"); + FRLogger.warn("corner: p_no is < 0"); no = 0; } else if (p_no >= arr.length) { - System.out.println("corner: p_index must be less than arr.length - 1"); + FRLogger.warn("corner: p_index must be less than arr.length - 1"); no = arr.length - 1; } else @@ -171,12 +173,12 @@ public class Simplex extends TileShape implements java.io.Serializable int no; if (p_no < 0) { - System.out.println("Simplex.corner: p_no is < 0"); + FRLogger.warn("Simplex.corner: p_no is < 0"); no = 0; } else if (p_no >= arr.length) { - System.out.println("Simplex.corner: p_no must be less than arr.length - 1"); + FRLogger.warn("Simplex.corner: p_no must be less than arr.length - 1"); no = arr.length - 1; } else @@ -220,12 +222,12 @@ public class Simplex extends TileShape implements java.io.Serializable int no; if (p_no < 0) { - System.out.println("Simplex.corner_approx: p_no is < 0"); + FRLogger.warn("Simplex.corner_approx: p_no is < 0"); no = 0; } else if (p_no >= arr.length) { - System.out.println("Simplex.corner_approx: p_no must be less than arr.length - 1"); + FRLogger.warn("Simplex.corner_approx: p_no must be less than arr.length - 1"); no = arr.length - 1; } else @@ -289,18 +291,18 @@ public class Simplex extends TileShape implements java.io.Serializable { if (arr.length <= 0) { - System.out.println("Simplex.edge_line : simplex is empty"); + FRLogger.warn("Simplex.edge_line : simplex is empty"); return null; } int no; if (p_no < 0) { - System.out.println("Simplex.edge_line : p_no is < 0"); + FRLogger.warn("Simplex.edge_line : p_no is < 0"); no = 0; } else if (p_no >= arr.length) { - System.out.println("Simplex.edge_line: p_no must be less than arr.length - 1"); + FRLogger.warn("Simplex.edge_line: p_no must be less than arr.length - 1"); no = arr.length - 1; } else @@ -353,7 +355,7 @@ public class Simplex extends TileShape implements java.io.Serializable } if (side_of_line0 == Side.ON_THE_LEFT) { - System.out.println("empty Simplex not normalized"); + FRLogger.warn("empty Simplex not normalized"); return -1; } // now the 3 lines intersect in the same point @@ -864,7 +866,7 @@ public class Simplex extends TileShape implements java.io.Serializable { if(this.dimension() < 2) { - System.out.println("Simplex.cutout_from only implemented for 2-dim simplex"); + FRLogger.warn("Simplex.cutout_from only implemented for 2-dim simplex"); return null; } Simplex inner_simplex = this.intersection(p_outer_simplex); @@ -883,7 +885,7 @@ public class Simplex extends TileShape implements java.io.Serializable inner_simplex.calc_division_lines(inner_corner_no, p_outer_simplex); if (division_line_arr[inner_corner_no] == null) { - System.out.println("Simplex.cutout_from: division line is null"); + FRLogger.warn("Simplex.cutout_from: division line is null"); Simplex[] result = new Simplex[1]; result[0] = p_outer_simplex; return result; @@ -1275,7 +1277,7 @@ public class Simplex extends TileShape implements java.io.Serializable FloatPoint intersection = curr_inner_line.intersection_approx(prev_inner_line); if (intersection.x >= Integer.MAX_VALUE) { - System.out.println("Simplex.calc_division_lines: intersection expexted"); + FRLogger.warn("Simplex.calc_division_lines: intersection expexted"); return null; } IntPoint inner_corner = intersection.round(); @@ -1390,7 +1392,7 @@ public class Simplex extends TileShape implements java.io.Serializable } if (min_distance == Integer.MAX_VALUE) { - System.out.println("Simplex.calc_division_lines: division not found"); + FRLogger.warn("Simplex.calc_division_lines: division not found"); return null; } Line[] result; diff --git a/src/main/java/eu/mihosoft/freerouting/geometry/planar/TileShape.java b/src/main/java/eu/mihosoft/freerouting/geometry/planar/TileShape.java index f8ef8e9..83953b8 100644 --- a/src/main/java/eu/mihosoft/freerouting/geometry/planar/TileShape.java +++ b/src/main/java/eu/mihosoft/freerouting/geometry/planar/TileShape.java @@ -18,6 +18,8 @@ */ package eu.mihosoft.freerouting.geometry.planar; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; @@ -747,7 +749,7 @@ public abstract class TileShape extends PolylineShape implements ConvexShape, ja } if (dir2 == null) { - System.out.println("touching_side : dir2 not found"); + FRLogger.warn("touching_side : dir2 not found"); return new int[0]; } int side_no_1 = 0; diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java index 2c57a18..53b0a39 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java @@ -127,7 +127,7 @@ public class BoardFrame extends javax.swing.JFrame // the system-file jh.jar may be missing curr_help_system_used = false; curr_menubar = BoardMenuBar.get_instance(this, false, session_file_option); - System.out.println("Online-Help deactivated because system file jh.jar is missing"); + FRLogger.warn("Online-Help deactivated because system file jh.jar is missing"); } this.menubar = curr_menubar; this.help_system_used = curr_help_system_used; @@ -299,7 +299,7 @@ public class BoardFrame extends javax.swing.JFrame { return false; } - FRLogger.logger.info("Saving '"+design_file.get_output_file().getName()+"'..."); + FRLogger.info("Saving '"+design_file.get_output_file().getName()+"'..."); java.io.OutputStream output_stream = null; java.io.ObjectOutputStream object_stream = null; @@ -373,7 +373,7 @@ public class BoardFrame extends javax.swing.JFrame String help_id = "html_files." + p_help_id; javax.help.CSH.setHelpIDString(curr_component, help_id); if (help_broker==null) { - FRLogger.logger.warn("help_broker is null"); + FRLogger.warn("help_broker is null"); return; } help_broker.enableHelpKey(curr_component, help_id, help_set); diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuFile.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuFile.java index 71faf9e..fcef4f6 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuFile.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuFile.java @@ -274,7 +274,7 @@ public class BoardMenuFile extends javax.swing.JMenu { java.io.OutputStream output_stream = null; - FRLogger.logger.info("Saving '"+BoardFrame.GUI_DEFAULTS_FILE_NAME+"'..."); + FRLogger.info("Saving '"+BoardFrame.GUI_DEFAULTS_FILE_NAME+"'..."); java.io.File defaults_file = new java.io.File(board_frame.design_file.get_parent(), BoardFrame.GUI_DEFAULTS_FILE_NAME); if (defaults_file.exists()) { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java index eb7178d..93efee4 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java @@ -87,7 +87,7 @@ public class BoardMenuHelp extends BoardMenuHelpReduced URL hsURL = getClass().getResource(helpset_name); if (hsURL == null) { - FRLogger.logger.warn("HelpSet " + helpset_name + " not found."); + FRLogger.warn("HelpSet " + helpset_name + " not found."); } else { @@ -96,8 +96,7 @@ public class BoardMenuHelp extends BoardMenuHelpReduced } catch (HelpSetException ee) { - System.out.println("HelpSet " + helpset_name + " could not be opened."); - System.out.println(ee.getMessage()); + FRLogger.error("HelpSet " + helpset_name + " could not be opened.", ee); } if (BoardFrame.help_set != null) { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardPanel.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardPanel.java index 8135ddf..29a486d 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/BoardPanel.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardPanel.java @@ -26,6 +26,7 @@ package eu.mihosoft.freerouting.gui; import eu.mihosoft.freerouting.interactive.ActivityReplayFileScope; import eu.mihosoft.freerouting.interactive.BoardHandling; import eu.mihosoft.freerouting.interactive.ScreenMessages; +import eu.mihosoft.freerouting.logger.FRLogger; import java.awt.Dimension; import java.awt.Graphics; @@ -62,7 +63,7 @@ public class BoardPanel extends javax.swing.JPanel } catch (java.awt.AWTException e) { - System.out.println("unable to create robot"); + FRLogger.warn("unable to create robot"); } } board_frame = p_board_frame; diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardSavableSubWindow.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardSavableSubWindow.java index a77e876..8c7778b 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/BoardSavableSubWindow.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardSavableSubWindow.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Subwindow of the eu.mihosoft.freerouting.board frame, whose location and visibility can be saved and read from disc. * @@ -46,7 +48,7 @@ public abstract class BoardSavableSubWindow extends BoardSubWindow } catch (Exception e) { - System.out.println("SelectParameterWindow.read: read failed"); + FRLogger.error("SelectParameterWindow.read: read failed", e); return false; } } @@ -64,7 +66,7 @@ public abstract class BoardSavableSubWindow extends BoardSubWindow } catch (java.io.IOException e) { - System.out.println("BoardSubWindow.save: save failed"); + FRLogger.error("BoardSubWindow.save: save failed", e); } } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/DefaultExceptionHandler.java b/src/main/java/eu/mihosoft/freerouting/gui/DefaultExceptionHandler.java index da69e74..5c57b9b 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/DefaultExceptionHandler.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/DefaultExceptionHandler.java @@ -19,7 +19,7 @@ public class DefaultExceptionHandler implements Thread.UncaughtExceptionHandler public static void handleException(Throwable e) { // Here you should have a more robust, permanent record of problems JOptionPane.showMessageDialog(findActiveFrame(), e.toString(), "Exception Occurred", OK_OPTION); - FRLogger.logger.error(e); + FRLogger.error(e.getLocalizedMessage(), e); } private static Frame findActiveFrame() { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/DesignFile.java b/src/main/java/eu/mihosoft/freerouting/gui/DesignFile.java index 12e0ff9..7c94820 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/DesignFile.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/DesignFile.java @@ -110,7 +110,7 @@ public class DesignFile result = new java.io.FileInputStream(this.input_file); } catch (Exception e) { - FRLogger.logger.error(e.getLocalizedMessage(), e); + FRLogger.error(e.getLocalizedMessage(), e); result = null; } @@ -167,7 +167,7 @@ public class DesignFile return; } String new_file_name = new_file.getName(); - FRLogger.logger.info("Saving '"+new_file_name+"'..."); + FRLogger.info("Saving '"+new_file_name+"'..."); String[] new_name_parts = new_file_name.split("\\."); String found_file_extension = new_name_parts[new_name_parts.length - 1]; if (found_file_extension.compareToIgnoreCase(binary_file_extension) == 0) @@ -216,7 +216,7 @@ public class DesignFile { String output_file_name = design_name + ".ses"; - FRLogger.logger.info("Saving '"+output_file_name+"'..."); + FRLogger.info("Saving '"+output_file_name+"'..."); java.io.File curr_output_file = new java.io.File(get_parent(), output_file_name); java.io.OutputStream output_stream; try @@ -254,7 +254,7 @@ public class DesignFile String rules_file_name = p_design_name + RULES_FILE_EXTENSION; java.io.OutputStream output_stream; - FRLogger.logger.info("Saving '"+rules_file_name+"'..."); + FRLogger.info("Saving '"+rules_file_name+"'..."); java.io.File rules_file = new java.io.File(this.get_parent(), rules_file_name); try @@ -262,7 +262,7 @@ public class DesignFile output_stream = new java.io.FileOutputStream(rules_file); } catch (java.io.IOException e) { - System.out.println("unable to create rules file"); + FRLogger.error("unable to create rules file", e); return false; } @@ -282,7 +282,7 @@ public class DesignFile try { java.io.File rules_file = new java.io.File(p_parent_name, rule_file_name); - FRLogger.logger.info("Opening '"+rule_file_name+"'..."); + FRLogger.info("Opening '"+rule_file_name+"'..."); java.io.InputStream input_stream = new java.io.FileInputStream(rules_file); if (input_stream != null && dsn_file_generated_by_host && WindowMessage.confirm(p_confirm_message)) { @@ -326,7 +326,7 @@ public class DesignFile String[] file_name_parts = design_file_name.split("\\.", 2); String design_name = file_name_parts[0]; String output_file_name = design_name + ".scr"; - FRLogger.logger.info("Saving '"+output_file_name+"'..."); + FRLogger.info("Saving '"+output_file_name+"'..."); { java.io.File curr_output_file = new java.io.File(get_parent(), output_file_name); diff --git a/src/main/java/eu/mihosoft/freerouting/gui/GUIDefaultsFile.java b/src/main/java/eu/mihosoft/freerouting/gui/GUIDefaultsFile.java index 2e3cb11..910cb0d 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/GUIDefaultsFile.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/GUIDefaultsFile.java @@ -26,6 +26,7 @@ package eu.mihosoft.freerouting.gui; import eu.mihosoft.freerouting.datastructures.IndentFileWriter; import eu.mihosoft.freerouting.board.ItemSelectionFilter; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Description of a text file, where the eu.mihosoft.freerouting.board independent eu.mihosoft.freerouting.interactive settings are stored. @@ -75,7 +76,7 @@ public class GUIDefaultsFile } catch (java.io.IOException e) { - System.out.println("unable to write defaults file"); + FRLogger.warn("unable to write defaults file"); return false; } @@ -85,7 +86,7 @@ public class GUIDefaultsFile } catch (java.io.IOException e) { - System.out.println("unable to close defaults file"); + FRLogger.error("unable to close defaults file", e); return false; } return true; @@ -111,7 +112,7 @@ public class GUIDefaultsFile } catch (java.io.IOException e) { - System.out.println("unable to read defaults file"); + FRLogger.error("unable to read defaults file", e); result = false; } return result; @@ -223,7 +224,7 @@ public class GUIDefaultsFile { if (!(next_token instanceof Keyword)) { - System.out.println("GUIDefaultsFile.windows: Keyword expected"); + FRLogger.warn("GUIDefaultsFile.windows: Keyword expected"); return false; } if (!read_frame_scope((Keyword) next_token)) @@ -279,19 +280,19 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_frame_scope: visible or not_visible expected"); + FRLogger.warn("GUIDefaultsFile.read_frame_scope: visible or not_visible expected"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.OPEN_BRACKET) { - System.out.println("GUIDefaultsFile.read_frame_scope: open_bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_frame_scope: open_bracket expected"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.BOUNDS) { - System.out.println("GUIDefaultsFile.read_frame_scope: bounds expected"); + FRLogger.warn("GUIDefaultsFile.read_frame_scope: bounds expected"); return false; } java.awt.Rectangle bounds = read_rectangle(); @@ -304,7 +305,7 @@ public class GUIDefaultsFile next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_frame_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_frame_scope: closing bracket expected"); return false; } } @@ -399,7 +400,7 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_frame_scope: unknown frame"); + FRLogger.warn("GUIDefaultsFile.read_frame_scope: unknown frame"); return false; } curr_frame.setVisible(is_visible); @@ -424,7 +425,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (!(next_token instanceof Integer)) { - System.out.println("GUIDefaultsFile.read_rectangle: Integer expected"); + FRLogger.warn("GUIDefaultsFile.read_rectangle: Integer expected"); return null; } coor[i] = (Integer) next_token; @@ -727,7 +728,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_background_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_background_color: closing bracket expected"); return false; } return true; @@ -750,7 +751,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_higlight_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_higlight_color: closing bracket expected"); return false; } return true; @@ -773,7 +774,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_incompletes_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_incompletes_color: closing bracket expected"); return false; } return true; @@ -796,7 +797,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_length_matching_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_length_matching_color: closing bracket expected"); return false; } return true; @@ -813,7 +814,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_violations_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_violations_color: closing bracket expected"); return false; } return true; @@ -830,7 +831,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_outline_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_outline_color: closing bracket expected"); return false; } return true; @@ -847,7 +848,7 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_component_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_component_color: closing bracket expected"); return false; } return true; @@ -868,7 +869,7 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_color_intensity: Number expected"); + FRLogger.warn("GUIDefaultsFile.read_color_intensity: Number expected"); result = -1; } return result; @@ -888,7 +889,7 @@ public class GUIDefaultsFile { if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_color: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_color: closing bracket expected"); } return null; } @@ -1190,13 +1191,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_selection_layer_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_selection_layer_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_selection_layer_scop: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_selection_layer_scop: closing bracket expected"); return false; } this.board_handling.settings.set_select_on_all_visible_layers(select_on_all_layers); @@ -1217,13 +1218,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_shove_enabled_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_shove_enabled_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_shove_enabled_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_shove_enabled_scope: closing bracket expected"); return false; } this.board_handling.settings.set_push_enabled(shove_enabled); @@ -1244,13 +1245,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_drag_components_enabled_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_drag_components_enabled_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_drag_components_enabled_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_drag_components_enabled_scope: closing bracket expected"); return false; } this.board_handling.settings.set_drag_components_enabled(drag_components_enabled); @@ -1271,13 +1272,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_ignore_conduction_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_ignore_conduction_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_ignore_conduction_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_ignore_conduction_scope: closing bracket expected"); return false; } this.board_handling.set_ignore_conduction(ignore_conduction); @@ -1362,13 +1363,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_roude_mode_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_roude_mode_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_selection_layer_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_selection_layer_scope: closing bracket expected"); return false; } this.board_handling.settings.set_stitch_route(is_stitch_mode); @@ -1396,14 +1397,14 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (!(next_token instanceof Integer) ) { - System.out.println("GUIDefaultsFile.read_pull_tight_region_scope: Integer expected"); + FRLogger.warn("GUIDefaultsFile.read_pull_tight_region_scope: Integer expected"); return false; } int pull_tight_region = (Integer) next_token; next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_pull_tight_region_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_pull_tight_region_scope: closing bracket expected"); return false; } this.board_handling.settings.set_current_pull_tight_region_width(pull_tight_region); @@ -1425,14 +1426,14 @@ public class GUIDefaultsFile Object next_token = this.scanner.next_token(); if (!(next_token instanceof Integer) ) { - System.out.println("GUIDefaultsFile.read_pull_tight_accuracy_scope: Integer expected"); + FRLogger.warn("GUIDefaultsFile.read_pull_tight_accuracy_scope: Integer expected"); return false; } int pull_tight_accuracy = (Integer) next_token; next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_pull_tight_accuracy_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_pull_tight_accuracy_scope: closing bracket expected"); return false; } this.board_handling.settings.set_current_pull_tight_accuracy(pull_tight_accuracy); @@ -1463,13 +1464,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_automatic_layer_dimming_scope: Integer expected"); + FRLogger.warn("GUIDefaultsFile.read_automatic_layer_dimming_scope: Integer expected"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_automatic_layer_dimming_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_automatic_layer_dimming_scope: closing bracket expected"); return false; } this.board_handling.graphics_context.set_auto_layer_dim_factor(intensity); @@ -1500,13 +1501,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_hilight_routing_obstacle_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_hilight_routing_obstacle_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_hilight_routing_obstacle_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_hilight_routing_obstacle_scope: closing bracket expected"); return false; } this.board_handling.settings.set_hilight_routing_obstacle(hilight_obstacle); @@ -1544,13 +1545,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_clearance_compensation_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_clearance_compensation_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_clearance_compensation_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_clearance_compensation_scope: closing bracket expected"); return false; } this.board_handling.set_clearance_compensation(clearance_compensation); @@ -1587,13 +1588,13 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_via_snap_to_smd_center_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_via_snap_to_smd_center_scope: unexpected token"); return false; } next_token = this.scanner.next_token(); if (next_token != Keyword.CLOSED_BRACKET) { - System.out.println("GUIDefaultsFile.read_via_snap_to_smd_center_scope: closing bracket expected"); + FRLogger.warn("GUIDefaultsFile.read_via_snap_to_smd_center_scope: closing bracket expected"); return false; } this.board_handling.settings.set_via_snap_to_smd_center(snap); @@ -1665,7 +1666,7 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_selectable_item_scope: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_selectable_item_scope: unexpected token"); return false; } } @@ -1838,7 +1839,7 @@ public class GUIDefaultsFile } else { - System.out.println("GUIDefaultsFile.read_deselected_snapshot_attributes: unexpected token"); + FRLogger.warn("GUIDefaultsFile.read_deselected_snapshot_attributes: unexpected token"); return false; } } @@ -1861,8 +1862,7 @@ public class GUIDefaultsFile } catch (Exception e) { - System.out.println("GUIDefaultsFile.skip_scope: Error while scanning file"); - System.out.println(e); + FRLogger.error("GUIDefaultsFile.skip_scope: Error while scanning file", e); return false; } if (curr_token == null) @@ -1878,7 +1878,7 @@ public class GUIDefaultsFile --open_bracked_count; } } - System.out.println("GUIDefaultsFile.skip_spope: unknown scope skipped"); + FRLogger.warn("GUIDefaultsFile.skip_spope: unknown scope skipped"); return true; } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java b/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java index e606d23..8527a86 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java @@ -52,16 +52,16 @@ public class MainApplication extends javax.swing.JFrame try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { - FRLogger.logger.error(ex); + FRLogger.error(ex.getLocalizedMessage(), ex); } catch (InstantiationException ex) { - FRLogger.logger.error(ex); + FRLogger.error(ex.getLocalizedMessage(), ex); } catch (IllegalAccessException ex) { - FRLogger.logger.error(ex); + FRLogger.error(ex.getLocalizedMessage(), ex); } catch (UnsupportedLookAndFeelException ex) { - FRLogger.logger.error(ex); + FRLogger.error(ex.getLocalizedMessage(), ex); } - FRLogger.logger.info("Freerouting application is started."); + FRLogger.info("Freerouting application is started."); Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler()); StartupOptions startupOptions = StartupOptions.parse(args); @@ -80,11 +80,11 @@ public class MainApplication extends javax.swing.JFrame board_option = BoardFrame.Option.SINGLE_FRAME; } - FRLogger.logger.info("Opening '"+startupOptions.design_input_filename+"'..."); + FRLogger.info("Opening '"+startupOptions.design_input_filename+"'..."); DesignFile design_file = DesignFile.get_instance(startupOptions.design_input_filename, false); if (design_file == null) { - FRLogger.logger.error(resources.getString("message_6") + " " + startupOptions.design_input_filename + " " + resources.getString("message_7")); + FRLogger.warn(resources.getString("message_6") + " " + startupOptions.design_input_filename + " " + resources.getString("message_7")); return; } String message = resources.getString("loading_design") + " " @@ -97,7 +97,7 @@ public class MainApplication extends javax.swing.JFrame welcome_window.dispose(); if (new_frame == null) { - FRLogger.logger.error("Couldn't create window frame"); + FRLogger.warn("Couldn't create window frame"); System.exit(1); return; } @@ -128,7 +128,7 @@ public class MainApplication extends javax.swing.JFrame || (filename.toLowerCase().endsWith(".ses")) || (filename.toLowerCase().endsWith(".scr")))) { - FRLogger.logger.info("Saving '" + filename + "'..."); + FRLogger.info("Saving '" + filename + "'..."); try { String filename_only = new File(filename).getName(); String design_name = filename_only.substring(0, filename_only.length() - 4); @@ -148,10 +148,10 @@ public class MainApplication extends javax.swing.JFrame Runtime.getRuntime().exit(0); } catch (Exception e) { - FRLogger.logger.error(e); + FRLogger.error("Couldn't export board to file", e); } } else { - FRLogger.logger.error("Couldn't export board to '" + filename + "'."); + FRLogger.warn("Couldn't export board to '" + filename + "'."); } } }); @@ -284,7 +284,7 @@ public class MainApplication extends javax.swing.JFrame return; } - FRLogger.logger.info("Opening '"+design_file.get_name()+"'..."); + FRLogger.info("Opening '"+design_file.get_name()+"'..."); BoardFrame.Option option; if (this.is_webstart) diff --git a/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java b/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java index b70f862..c3b00cf 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java @@ -69,7 +69,7 @@ public class StartupOptions { } catch (Exception e) { - FRLogger.logger.error("There was a problem parsing the '"+p_args[i]+"' parameter", e); + FRLogger.error("There was a problem parsing the '"+p_args[i]+"' parameter", e); } } } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowAssignNetClass.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowAssignNetClass.java index b243d92..1236b14 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowAssignNetClass.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowAssignNetClass.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.Net; import eu.mihosoft.freerouting.rules.NetClass; @@ -200,7 +201,7 @@ public class WindowAssignNetClass extends BoardSavableSubWindow Object first_row_object = getValueAt(p_row, 0); if (!(first_row_object instanceof Net)) { - System.out.println("AssignNetRuLesVindow.setValueAt: Net expected"); + FRLogger.warn("AssignNetRuLesVindow.setValueAt: Net expected"); return; } Net curr_net = (Net) first_row_object; diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowClearanceMatrix.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowClearanceMatrix.java index 3ffe2fc..d279130 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowClearanceMatrix.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowClearanceMatrix.java @@ -23,6 +23,7 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ClearanceMatrix; import eu.mihosoft.freerouting.datastructures.UndoableObjects; @@ -231,7 +232,7 @@ public class WindowClearanceMatrix extends BoardSavableSubWindow routing_board.rules.change_clearance_class_no(i, j, board_items); if (!routing_board.rules.remove_clearance_class(i, board_items)) { - System.out.println("WindowClearanceMatrix.prune_clearance_matrix error removing clearance class"); + FRLogger.warn("WindowClearanceMatrix.prune_clearance_matrix error removing clearance class"); return; } routing_board.search_tree_manager.clearance_class_removed(i); diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowDisplayMisc.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowDisplayMisc.java index 758ff6e..5671deb 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowDisplayMisc.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowDisplayMisc.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Window for eu.mihosoft.freerouting.interactive changing of miscellanious display properties. * @@ -210,7 +212,7 @@ public class WindowDisplayMisc extends BoardSavableSubWindow } else { - System.out.println("DisplayMiscWindow: unexpected ninety_degree_rotation"); + FRLogger.warn("DisplayMiscWindow: unexpected ninety_degree_rotation"); rotation_none_checkbox.setSelected(true); } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowEditVias.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowEditVias.java index b82f14f..3bf0c30 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowEditVias.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowEditVias.java @@ -23,6 +23,7 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ViaInfo; import eu.mihosoft.freerouting.rules.ViaInfos; import eu.mihosoft.freerouting.rules.BoardRules; @@ -270,13 +271,13 @@ public class WindowEditVias extends BoardSavableSubWindow Object via_name = getValueAt(p_row, ColumnName.NAME.ordinal()); if (!(via_name instanceof String)) { - System.out.println("ViaVindow.setValueAt: String expected"); + FRLogger.warn("ViaVindow.setValueAt: String expected"); return; } ViaInfo via_info = board_rules.via_infos.get((String) via_name); if (via_info == null) { - System.out.println("ViaVindow.setValueAt: via_info not found"); + FRLogger.warn("ViaVindow.setValueAt: via_info not found"); return; } @@ -304,7 +305,7 @@ public class WindowEditVias extends BoardSavableSubWindow eu.mihosoft.freerouting.library.Padstack new_padstack = routing_board.library.get_via_padstack(new_name); if (new_padstack == null) { - System.out.println("ViaVindow.setValueAt: via padstack not found"); + FRLogger.warn("ViaVindow.setValueAt: via padstack not found"); return; } via_info.set_padstack(new_padstack); @@ -320,7 +321,7 @@ public class WindowEditVias extends BoardSavableSubWindow { if (new_cl_class_index < 0) { - System.out.println("ViaVindow.setValueAt: clearance class not found"); + FRLogger.warn("ViaVindow.setValueAt: clearance class not found"); return; } } @@ -330,7 +331,7 @@ public class WindowEditVias extends BoardSavableSubWindow { if (!(p_value instanceof Boolean)) { - System.out.println("ViaVindow.setValueAt: Boolean expected"); + FRLogger.warn("ViaVindow.setValueAt: Boolean expected"); return; } Boolean attach_smd = (Boolean) p_value; diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowNetClasses.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowNetClasses.java index 25fab1b..11d83e6 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowNetClasses.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowNetClasses.java @@ -22,6 +22,7 @@ */ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.NetClass; import eu.mihosoft.freerouting.rules.ViaRule; import eu.mihosoft.freerouting.rules.BoardRules; @@ -571,13 +572,13 @@ public class WindowNetClasses extends BoardSavableSubWindow Object net_class_name = getValueAt(p_row, ColumnName.NAME.ordinal()); if (!(net_class_name instanceof String)) { - System.out.println("EditNetRuLesVindow.setValueAt: String expected"); + FRLogger.warn("EditNetRuLesVindow.setValueAt: String expected"); return; } NetClass net_rule = board_rules.net_classes.get((String) net_class_name); if (net_rule == null) { - System.out.println("EditNetRuLesVindow.setValueAt: net_rule not found"); + FRLogger.warn("EditNetRuLesVindow.setValueAt: net_rule not found"); return; } @@ -605,7 +606,7 @@ public class WindowNetClasses extends BoardSavableSubWindow ViaRule new_via_rule = board_rules.get_via_rule(new_name); if (new_via_rule == null) { - System.out.println("EditNetRuLesVindow.setValueAt: via_rule not found"); + FRLogger.warn("EditNetRuLesVindow.setValueAt: via_rule not found"); return; } net_rule.set_via_rule(new_via_rule); @@ -702,7 +703,7 @@ public class WindowNetClasses extends BoardSavableSubWindow { if (new_cl_class_index < 0) { - System.out.println("EditNetRuLesVindow.setValueAt: clearance class not found"); + FRLogger.warn("EditNetRuLesVindow.setValueAt: clearance class not found"); return; } } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectInfo.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectInfo.java index 88a353f..54b62a5 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectInfo.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectInfo.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Collection; @@ -211,7 +213,7 @@ public class WindowObjectInfo extends BoardTemporarySubWindow implements eu.miho } catch (javax.swing.text.BadLocationException e) { - System.out.println("ObjectInfoWindow.append: unable to insert text into text pane."); + FRLogger.warn("ObjectInfoWindow.append: unable to insert text into text pane."); return false; } return true; diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectList.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectList.java index ffd5708..420bc27 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectList.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectList.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Abstract class for windows displaying a list of objects * @@ -263,7 +265,7 @@ public abstract class WindowObjectList extends BoardSavableSubWindow } catch (java.io.IOException e) { - System.out.println("WindowObjectList.save: save failed"); + FRLogger.error("WindowObjectList.save: save failed", e); } super.save(p_object_stream); } @@ -277,7 +279,7 @@ public abstract class WindowObjectList extends BoardSavableSubWindow } catch (Exception e) { - System.out.println("WindowObjectListWithFilter.read: read failed"); + FRLogger.error("WindowObjectListWithFilter.read: read failed", e); return false; } boolean result = super.read(p_object_stream); diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectListWithFilter.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectListWithFilter.java index 07277f8..2e4e1b6 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectListWithFilter.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowObjectListWithFilter.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Abstract class for windows displaying a list of objects * The object name can be filttered by an alphanumeric input string. * @author Alfons Wirtz @@ -109,7 +111,7 @@ public abstract class WindowObjectListWithFilter extends WindowObjectList } catch (java.io.IOException e) { - System.out.println("WindowObjectListWithFilter.save: save failed"); + FRLogger.warn("WindowObjectListWithFilter.save: save failed"); } super.save(p_object_stream); } @@ -123,7 +125,7 @@ public abstract class WindowObjectListWithFilter extends WindowObjectList } catch (Exception e) { - System.out.println("WindowObjectListWithFilter.read: read failed"); + FRLogger.warn("WindowObjectListWithFilter.read: read failed"); } return super.read(p_object_stream); } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowSelectParameter.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowSelectParameter.java index 7331c23..9b75440 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowSelectParameter.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowSelectParameter.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.gui; import eu.mihosoft.freerouting.board.ItemSelectionFilter; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Window for the handling of the eu.mihosoft.freerouting.interactive selection parameters, @@ -152,7 +153,7 @@ public class WindowSelectParameter extends BoardSavableSubWindow ItemSelectionFilter item_selection_filter = this.board_handling.settings.get_item_selection_filter(); if (item_selection_filter == null) { - System.out.println("SelectParameterWindow.refresh: item_selection_filter is null"); + FRLogger.warn("SelectParameterWindow.refresh: item_selection_filter is null"); } else { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowSnapshot.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowSnapshot.java index 1a84f2e..344be3a 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowSnapshot.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowSnapshot.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Window handling snapshots of the eu.mihosoft.freerouting.interactive situation. * @@ -163,7 +165,7 @@ public class WindowSnapshot extends BoardSavableSubWindow } catch (Exception e) { - System.out.println("VisibilityFrame.read_attriutes: read failed"); + FRLogger.error("VisibilityFrame.read_attriutes: read failed", e); return false; } } @@ -180,7 +182,7 @@ public class WindowSnapshot extends BoardSavableSubWindow } catch (java.io.IOException e) { - System.out.println("VisibilityFrame.save_attriutes: save failed"); + FRLogger.error("VisibilityFrame.save_attriutes: save failed", e); } this.settings_window.save(p_object_stream); } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowUnconnectedRoute.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowUnconnectedRoute.java index b84cbe7..2921191 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowUnconnectedRoute.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowUnconnectedRoute.java @@ -29,6 +29,7 @@ import java.util.Set; import java.util.SortedSet; import eu.mihosoft.freerouting.board.Item; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -91,7 +92,7 @@ public class WindowUnconnectedRoute extends WindowObjectListWithFilter } else { - System.out.println("WindowUnconnectedRoute.fill_list: net_count 1 expected"); + FRLogger.warn("WindowUnconnectedRoute.fill_list: net_count 1 expected"); } } } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowViaRule.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowViaRule.java index 24213dd..fb80f54 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowViaRule.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowViaRule.java @@ -23,6 +23,7 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ViaRule; import eu.mihosoft.freerouting.rules.ViaInfo; import eu.mihosoft.freerouting.rules.ViaInfos; @@ -153,7 +154,7 @@ public class WindowViaRule extends javax.swing.JFrame { if (curr_index >= possible_values.length) { - System.out.println("ViaRuleWindow.AppendListener.actionPerformed: index inconsistent"); + FRLogger.warn("ViaRuleWindow.AppendListener.actionPerformed: index inconsistent"); break; } possible_values[curr_index] = curr_via; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFile.java b/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFile.java index 6f0f655..a31fe58 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFile.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFile.java @@ -89,7 +89,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("Unable to close the file", e); + FRLogger.error("Unable to close the file", e); } } this.write_enabled = false; @@ -106,7 +106,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("Unable to create the file", e); + FRLogger.error("Unable to create the file", e); return false; } write_enabled = true; @@ -127,7 +127,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("ActivityReplayFile.start_scope: write failed", e); + FRLogger.error("ActivityReplayFile.start_scope: write failed", e); } } } @@ -186,7 +186,7 @@ public class ActivityReplayFile } if (!(curr_ob instanceof String)) { - FRLogger.logger.error("ActivityReplayFile.start_read_scope: String expected"); + FRLogger.warn("ActivityReplayFile.start_read_scope: String expected"); this.pending_token = curr_ob; return null; } @@ -209,7 +209,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("Unable to write integer to the file", e); + FRLogger.error("Unable to write integer to the file", e); } } } @@ -223,7 +223,7 @@ public class ActivityReplayFile Object curr_ob = this.next_token(); if (!(curr_ob instanceof Integer)) { - FRLogger.logger.error("ActivityReplayFile.read_int: Integer expected"); + FRLogger.warn("ActivityReplayFile.read_int: Integer expected"); this.pending_token = curr_ob; return -1; } @@ -239,7 +239,7 @@ public class ActivityReplayFile { if (p_corner == null) { - FRLogger.logger.error("ActivityReplayFile.add_corner: p_corner is null"); + FRLogger.warn("ActivityReplayFile.add_corner: p_corner is null"); return; } try @@ -251,7 +251,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("Unable to write to the file while adding corner", e); + FRLogger.error("Unable to write to the file while adding corner", e); } } } @@ -271,7 +271,7 @@ public class ActivityReplayFile } catch (IOException e) { - FRLogger.logger.error("ActivityReplayFile.next_token: IO error scanning file", e); + FRLogger.error("ActivityReplayFile.next_token: IO error scanning file", e); return null; } } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFileScope.java b/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFileScope.java index d02b6af..3047bbd 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFileScope.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/ActivityReplayFileScope.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.interactive; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; +import eu.mihosoft.freerouting.logger.FRLogger; /** @@ -353,7 +354,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("CopyItemScope.start_scope: unexpected p_return_state"); + FRLogger.warn("CopyItemScope.start_scope: unexpected p_return_state"); result = null; } @@ -379,7 +380,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("MoveComponent.start_scope: unexpected p_return_state"); + FRLogger.warn("MoveComponent.start_scope: unexpected p_return_state"); result = null; } @@ -414,8 +415,8 @@ public abstract class ActivityReplayFileScope ((MoveItemState)p_return_state).turn_90_degree(factor); return p_return_state; } - - System.out.println("Turn90DegreeScope.read_scope: unexpected p_return_state"); + + FRLogger.warn("Turn90DegreeScope.read_scope: unexpected p_return_state"); return null; } } @@ -436,8 +437,8 @@ public abstract class ActivityReplayFileScope ((MoveItemState)p_return_state).rotate(angle); return p_return_state; } - - System.out.println("RotateScope.read_scope: unexpected p_return_state"); + + FRLogger.warn("RotateScope.read_scope: unexpected p_return_state"); return null; } } @@ -457,8 +458,8 @@ public abstract class ActivityReplayFileScope ((MoveItemState)p_return_state).change_placement_side(); return p_return_state; } - - System.out.println("ChangePlacementSideScope.read_scope: unexpected p_return_state"); + + FRLogger.warn("ChangePlacementSideScope.read_scope: unexpected p_return_state"); return null; } } @@ -486,8 +487,8 @@ public abstract class ActivityReplayFileScope } return p_return_state; } - - System.out.println("SetRotateWithWheelScope.read_scope: unexpected p_return_state"); + + FRLogger.warn("SetRotateWithWheelScope.read_scope: unexpected p_return_state"); return null; } } @@ -520,13 +521,13 @@ public abstract class ActivityReplayFileScope { while (!(p_return_state instanceof MenuState)) { - System.out.println("StartSelectScope.read_scope: menu state expected"); + FRLogger.warn("StartSelectScope.read_scope: menu state expected"); p_return_state = p_return_state.return_state; } FloatPoint location = p_activityReplayFile.read_corner(); if (location == null) { - System.out.println("StartSelectScope.read_scope: unable to read corner"); + FRLogger.warn("StartSelectScope.read_scope: unable to read corner"); return null; } return ((MenuState) p_return_state).select_items(location); @@ -545,13 +546,13 @@ public abstract class ActivityReplayFileScope { if (!(p_return_state instanceof SelectedItemState)) { - System.out.println("ToggleSelectScope.read_scope: SelectedItemState expected"); + FRLogger.warn("ToggleSelectScope.read_scope: SelectedItemState expected"); return null; } FloatPoint location = p_activityReplayFile.read_corner(); if (location == null) { - System.out.println("ToggleSelectScope.read_scope: unable to read corner"); + FRLogger.warn("ToggleSelectScope.read_scope: unable to read corner"); return null; } return ((SelectedItemState)p_return_state).toggle_select(location); @@ -570,12 +571,12 @@ public abstract class ActivityReplayFileScope { if (!(p_return_state instanceof MenuState)) { - System.out.println("SelectRegionScope.read_scope: menu state expected"); + FRLogger.warn("SelectRegionScope.read_scope: menu state expected"); } FloatPoint lower_left = p_activityReplayFile.read_corner(); if (lower_left == null) { - System.out.println("SelectRegionScope.read_scope: unable to read corner"); + FRLogger.warn("SelectRegionScope.read_scope: unable to read corner"); return null; } InteractiveState curr_state = @@ -603,13 +604,13 @@ public abstract class ActivityReplayFileScope { if (!(p_return_state instanceof SelectedItemState)) { - System.out.println("CutoutRouteScope.read_scope: electedItemState expected"); + FRLogger.warn("CutoutRouteScope.read_scope: electedItemState expected"); } java.util.Collection item_list = ((SelectedItemState) p_return_state).get_item_list(); FloatPoint lower_left = p_activityReplayFile.read_corner(); if (lower_left == null) { - System.out.println("CutoutRouteScope.read_scope: unable to read corner"); + FRLogger.warn("CutoutRouteScope.read_scope: unable to read corner"); return null; } InteractiveState curr_state = @@ -642,7 +643,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("DeleteSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("DeleteSelectedScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -666,7 +667,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("DeleteSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("DeleteSelectedScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -690,7 +691,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("AutorouteSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("AutorouteSelectedScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -714,7 +715,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("FanoutSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("FanoutSelectedScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -742,7 +743,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("AssignSelectedToNewNetScope.read_scope: SelectedItemState expected"); + FRLogger.warn("AssignSelectedToNewNetScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -770,7 +771,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("AssignSelectedToNewNetScope.read_scope: SelectedItemState expected"); + FRLogger.warn("AssignSelectedToNewNetScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -797,7 +798,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("AssignSelectedToNewGroupScope.read_scope: SelectedItemState expected"); + FRLogger.warn("AssignSelectedToNewGroupScope.read_scope: SelectedItemState expected"); result = null; } return result; @@ -820,7 +821,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("ExtendToWholeConnectedSetsScope.read_scope: SelectedItemState expected"); + FRLogger.warn("ExtendToWholeConnectedSetsScope.read_scope: SelectedItemState expected"); } return return_state; } @@ -842,7 +843,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("ExtendToWholeGroupsScope.read_scope: SelectedItemState expected"); + FRLogger.warn("ExtendToWholeGroupsScope.read_scope: SelectedItemState expected"); } return return_state; } @@ -864,7 +865,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("ExtendToWholeNetsScope.read_scope: SelectedItemState expected"); + FRLogger.warn("ExtendToWholeNetsScope.read_scope: SelectedItemState expected"); } return return_state; } @@ -886,7 +887,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("ExtendToWholeConnectionsScope.read_scope: SelectedItemState expected"); + FRLogger.warn("ExtendToWholeConnectionsScope.read_scope: SelectedItemState expected"); } return return_state; } @@ -907,7 +908,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("FixSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("FixSelectedScope.read_scope: SelectedItemState expected"); } return p_return_state; } @@ -928,7 +929,7 @@ public abstract class ActivityReplayFileScope } else { - System.out.println("UnfixSelectedScope.read_scope: SelectedItemState expected"); + FRLogger.warn("UnfixSelectedScope.read_scope: SelectedItemState expected"); } return p_return_state; } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java b/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java index cc46ebe..c024d93 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java @@ -25,6 +25,7 @@ package eu.mihosoft.freerouting.interactive; import eu.mihosoft.freerouting.board.RoutingBoard; import eu.mihosoft.freerouting.autoroute.AutorouteControl.ExpansionCostFactor; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Contains the eu.mihosoft.freerouting.interactive settings for the autorouter. @@ -226,7 +227,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.set_layer_active: p_layer out of range"); + FRLogger.warn("AutorouteSettings.set_layer_active: p_layer out of range"); return; } layer_active_arr[p_layer] = p_value; @@ -236,7 +237,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_layer_active: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_layer_active: p_layer out of range"); return false; } return layer_active_arr[p_layer]; @@ -246,7 +247,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.set_preferred_direction_is_horizontal: p_layer out of range"); + FRLogger.warn("AutorouteSettings.set_preferred_direction_is_horizontal: p_layer out of range"); return; } preferred_direction_is_horizontal_arr[p_layer] = p_value; @@ -256,7 +257,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_preferred_direction_is_horizontal: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_preferred_direction_is_horizontal: p_layer out of range"); return false; } return preferred_direction_is_horizontal_arr[p_layer]; @@ -266,7 +267,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.set_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.set_preferred_direction_trace_costs: p_layer out of range"); return; } preferred_direction_trace_cost_arr[p_layer] = Math.max(p_value, 0.1); @@ -276,7 +277,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_preferred_direction_trace_costs: p_layer out of range"); return 0; } return preferred_direction_trace_cost_arr[p_layer]; @@ -286,7 +287,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_against_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_against_preferred_direction_trace_costs: p_layer out of range"); return 0; } return against_preferred_direction_trace_cost_arr[p_layer]; @@ -296,7 +297,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_preferred_direction_trace_costs: p_layer out of range"); return 0; } double result; @@ -315,7 +316,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.set_against_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.set_against_preferred_direction_trace_costs: p_layer out of range"); return; } against_preferred_direction_trace_cost_arr[p_layer] = Math.max(p_value, 0.1); @@ -325,7 +326,7 @@ public class AutorouteSettings implements java.io.Serializable { if (p_layer < 0 || p_layer >= layer_active_arr.length) { - System.out.println("AutorouteSettings.get_against_preferred_direction_trace_costs: p_layer out of range"); + FRLogger.warn("AutorouteSettings.get_against_preferred_direction_trace_costs: p_layer out of range"); return 0; } double result; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java b/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java index 1ba1f7c..5b5076b 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java @@ -132,7 +132,7 @@ public class BatchAutorouterThread extends InteractiveActionThread } } catch (Exception e) { - FRLogger.logger.error(e.getLocalizedMessage(),e); + FRLogger.error(e.getLocalizedMessage(),e); } FRLogger.traceExit("BatchAutorouterThread.thread_action()"); diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java index 1aa3dd9..a2b04a4 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java @@ -1009,7 +1009,7 @@ public class BoardHandling extends BoardHandlingImpl } /** - * Reads an existing eu.mihosoft.freerouting.board design from the input stream. + * Reads an existing board design from the input stream. * Returns false, if the input stream does not contains a legal eu.mihosoft.freerouting.board design. */ public boolean read_design(java.io.ObjectInputStream p_design, TestLevel p_test_level) @@ -1024,7 +1024,7 @@ public class BoardHandling extends BoardHandlingImpl } catch (Exception e) { - FRLogger.logger.error(e); + FRLogger.error("Couldn't read design file", e); return false; } board.set_test_level(p_test_level); diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandlingImpl.java b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandlingImpl.java index 728a4b8..442cdc5 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandlingImpl.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandlingImpl.java @@ -6,6 +6,7 @@ import eu.mihosoft.freerouting.board.RoutingBoard; import eu.mihosoft.freerouting.board.TestLevel; import eu.mihosoft.freerouting.geometry.planar.IntBox; import eu.mihosoft.freerouting.geometry.planar.PolylineShape; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.BoardRules; import java.util.Locale; @@ -60,7 +61,7 @@ public class BoardHandlingImpl implements IBoardHandling { public void create_board(IntBox p_bounding_box, LayerStructure p_layer_structure, PolylineShape[] p_outline_shapes, String p_outline_clearance_class_name, BoardRules p_rules, Communication p_board_communication, TestLevel p_test_level) { if (this.board != null) { - System.out.println(" BoardHandling.create_board: eu.mihosoft.freerouting.board already created"); + FRLogger.warn(" BoardHandling.create_board: eu.mihosoft.freerouting.board already created"); } int outline_cl_class_no = 0; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/CopyItemState.java b/src/main/java/eu/mihosoft/freerouting/interactive/CopyItemState.java index 6e97012..56e99ff 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/CopyItemState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/CopyItemState.java @@ -43,6 +43,7 @@ import eu.mihosoft.freerouting.board.ObstacleArea; import eu.mihosoft.freerouting.board.Via; import eu.mihosoft.freerouting.board.Component; import eu.mihosoft.freerouting.board.RoutingBoard; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Interactive copying of items. @@ -193,7 +194,7 @@ public class CopyItemState extends InteractiveState Component old_component = board.components.get(curr_cmp_no); if (old_component == null) { - System.out.println("CopyItemState: component not found"); + FRLogger.warn("CopyItemState: component not found"); continue; } Point new_location = old_component.get_location().translate_by(translate_vector); @@ -208,7 +209,7 @@ public class CopyItemState extends InteractiveState Padstack old_padstack = board.library.padstacks.get(old_pin.padstack_no); if (old_padstack == null) { - System.out.println("CopyItemState.insert: package padstack not found"); + FRLogger.warn("CopyItemState.insert: package padstack not found"); return; } Padstack new_padstack = change_padstack_layers( old_padstack, current_layer, board, padstack_pairs); diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/InteractiveActionThread.java b/src/main/java/eu/mihosoft/freerouting/interactive/InteractiveActionThread.java index 9a95972..b616bd1 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/InteractiveActionThread.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/InteractiveActionThread.java @@ -23,6 +23,8 @@ */ package eu.mihosoft.freerouting.interactive; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; @@ -204,7 +206,7 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos logfile_scope.read_scope(hdlg.activityReplayFile, hdlg.interactive_state, hdlg); if (new_state == null) { - System.out.println("BoardHandling:read_logfile: inconsistent logfile scope"); + FRLogger.warn("BoardHandling:read_logfile: inconsistent logfile scope"); new_state = previous_state; } hdlg.repaint(); @@ -222,7 +224,7 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos this.input_stream.close(); } catch (java.io.IOException e) { - System.out.println("ReadLogfileThread: unable to close input stream"); + FRLogger.error("ReadLogfileThread: unable to close input stream", e); } hdlg.get_panel().board_frame.refresh_windows(); hdlg.screen_messages.set_write_protected(false); diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/MenuState.java b/src/main/java/eu/mihosoft/freerouting/interactive/MenuState.java index c07eba1..5a05c31 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/MenuState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/MenuState.java @@ -30,6 +30,7 @@ import java.util.Collection; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.ItemSelectionFilter; import eu.mihosoft.freerouting.board.TestLevel; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Common base class for the main menus, which can be selected in the tool bar. @@ -89,7 +90,7 @@ public class MenuState extends InteractiveState Item first_item = picked_items.iterator().next(); if (!(first_item instanceof eu.mihosoft.freerouting.board.Pin)) { - System.out.println("MenuState.swap_pin: Pin expected"); + FRLogger.warn("MenuState.swap_pin: Pin expected"); return this; } eu.mihosoft.freerouting.board.Pin selected_pin = (eu.mihosoft.freerouting.board.Pin) first_item; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/MoveItemState.java b/src/main/java/eu/mihosoft/freerouting/interactive/MoveItemState.java index 115442b..b51cbe7 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/MoveItemState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/MoveItemState.java @@ -40,6 +40,7 @@ import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.Via; import eu.mihosoft.freerouting.board.ClearanceViolation; import eu.mihosoft.freerouting.board.LayerStructure; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -72,7 +73,7 @@ public class MoveItemState extends InteractiveState Component curr_component = routing_board.components.get(curr_item.get_component_no()); if (curr_component == null) { - System.out.println("MoveComponentState.get_instance inconsistant component number"); + FRLogger.warn("MoveComponentState.get_instance inconsistant component number"); return null; } if (grid_snap_component == null && diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/NetIncompletes.java b/src/main/java/eu/mihosoft/freerouting/interactive/NetIncompletes.java index d7b878e..08e9b5b 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/NetIncompletes.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/NetIncompletes.java @@ -35,6 +35,7 @@ import eu.mihosoft.freerouting.datastructures.PlanarDelaunayTriangulation; import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.geometry.planar.Point; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.Net; import eu.mihosoft.freerouting.board.Item; @@ -243,7 +244,7 @@ public class NetIncompletes Item curr_item = it.next(); if (curr_index >= result.length) { - System.out.println("NetIncompletes.calculate_net_items: to many items"); + FRLogger.warn("NetIncompletes.calculate_net_items: to many items"); return result; } result[curr_index] = new NetItem(curr_item, curr_connected_set); @@ -252,7 +253,7 @@ public class NetIncompletes } if (curr_index < result.length) { - System.out.println("NetIncompletes.calculate_net_items: to few items"); + FRLogger.warn("NetIncompletes.calculate_net_items: to few items"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/PinSwapState.java b/src/main/java/eu/mihosoft/freerouting/interactive/PinSwapState.java index d55e9e5..dac3fd1 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/PinSwapState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/PinSwapState.java @@ -28,6 +28,7 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint; import eu.mihosoft.freerouting.board.Pin; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.ItemSelectionFilter; +import eu.mihosoft.freerouting.logger.FRLogger; /** * @@ -88,7 +89,7 @@ public class PinSwapState extends InteractiveState } if (this.from_pin.net_count() > 1 || this.to_pin.net_count() > 1) { - System.out.println("PinSwapState.complete: pin swap not yet implemented for pins belonging to more than 1 net "); + FRLogger.warn("PinSwapState.complete: pin swap not yet implemented for pins belonging to more than 1 net "); return this.cancel(); } int from_net_no; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/Route.java b/src/main/java/eu/mihosoft/freerouting/interactive/Route.java index 2ba4f11..4ae26d1 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/Route.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/Route.java @@ -38,6 +38,7 @@ import java.util.Set; import eu.mihosoft.freerouting.library.Padstack; +import eu.mihosoft.freerouting.logger.FRLogger; import eu.mihosoft.freerouting.rules.ViaRule; import eu.mihosoft.freerouting.rules.ViaInfo; import eu.mihosoft.freerouting.rules.Net; @@ -259,7 +260,7 @@ public class Route } if (p_to_layer < 0 || p_to_layer >= this.layer_active.length) { - System.out.println("Route.change_layer: p_to_layer out of range"); + FRLogger.warn("Route.change_layer: p_to_layer out of range"); return false; } if (!this.layer_active[p_to_layer]) diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/RouteState.java b/src/main/java/eu/mihosoft/freerouting/interactive/RouteState.java index 35271cf..0e6bee6 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/RouteState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/RouteState.java @@ -36,6 +36,7 @@ import eu.mihosoft.freerouting.board.ConductionArea; import eu.mihosoft.freerouting.board.DrillItem; import eu.mihosoft.freerouting.board.Item; import eu.mihosoft.freerouting.board.ItemSelectionFilter; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Interactive routing state. @@ -55,7 +56,7 @@ public class RouteState extends InteractiveState { if (!(p_parent_state instanceof MenuState)) { - System.out.println("RouteState.get_instance: unexpected parent state"); + FRLogger.warn("RouteState.get_instance: unexpected parent state"); } p_board_handling.display_layer_messsage(); IntPoint location = p_location.round(); @@ -511,7 +512,7 @@ public class RouteState extends InteractiveState } else { - System.out.println("RouteState.change_layer_action: shove_failing_layer not set"); + FRLogger.warn("RouteState.change_layer_action: shove_failing_layer not set"); } result = false; } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/Settings.java b/src/main/java/eu/mihosoft/freerouting/interactive/Settings.java index bc54293..3e08072 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/Settings.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/Settings.java @@ -25,6 +25,7 @@ package eu.mihosoft.freerouting.interactive; import eu.mihosoft.freerouting.board.ItemSelectionFilter; import eu.mihosoft.freerouting.board.RoutingBoard; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Contains the values of the eu.mihosoft.freerouting.interactive settings of the eu.mihosoft.freerouting.board handling. @@ -219,7 +220,7 @@ public class Settings implements java.io.Serializable { if (p_layer_no < 0 || p_layer_no >= this.manual_trace_half_width_arr.length) { - System.out.println("Settings.get_manual_trace_half_width p_layer_no out of range"); + FRLogger.warn("Settings.get_manual_trace_half_width p_layer_no out of range"); return 0; } return this.manual_trace_half_width_arr[p_layer_no]; @@ -491,12 +492,12 @@ public class Settings implements java.io.Serializable p_stream.defaultReadObject(); if (this.item_selection_filter == null) { - System.out.println("Settings.readObject: item_selection_filter is null"); + FRLogger.warn("Settings.readObject: item_selection_filter is null"); this.item_selection_filter = new ItemSelectionFilter(); } if (this.snapshot_attributes == null) { - System.out.println("Settings.readObject: snapshot_attributes is null"); + FRLogger.warn("Settings.readObject: snapshot_attributes is null"); this.snapshot_attributes = new SnapShot.Attributes(); } this.read_only = false; diff --git a/src/main/java/eu/mihosoft/freerouting/library/LogicalPart.java b/src/main/java/eu/mihosoft/freerouting/library/LogicalPart.java index 2913f84..4b97bc5 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/LogicalPart.java +++ b/src/main/java/eu/mihosoft/freerouting/library/LogicalPart.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.library; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Contains contain information for gate swap and pin swap for a single component. * @@ -53,7 +55,7 @@ public class LogicalPart implements eu.mihosoft.freerouting.board.ObjectInfoPane { if (p_no < 0 || p_no >= part_pin_arr.length) { - System.out.println("LogicalPart.get_pin: p_no out of range"); + FRLogger.warn("LogicalPart.get_pin: p_no out of range"); return null; } return part_pin_arr[p_no]; diff --git a/src/main/java/eu/mihosoft/freerouting/library/LogicalParts.java b/src/main/java/eu/mihosoft/freerouting/library/LogicalParts.java index 77a0e24..51747bc 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/LogicalParts.java +++ b/src/main/java/eu/mihosoft/freerouting/library/LogicalParts.java @@ -23,6 +23,8 @@ package eu.mihosoft.freerouting.library; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Vector; /** @@ -64,7 +66,7 @@ public class LogicalParts implements java.io.Serializable LogicalPart result = part_arr.elementAt(p_part_no - 1); if (result != null && result.no != p_part_no) { - System.out.println("LogicalParts.get: inconsistent part number"); + FRLogger.warn("LogicalParts.get: inconsistent part number"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/library/Package.java b/src/main/java/eu/mihosoft/freerouting/library/Package.java index 5b4fa53..b9e8188 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/Package.java +++ b/src/main/java/eu/mihosoft/freerouting/library/Package.java @@ -26,6 +26,7 @@ package eu.mihosoft.freerouting.library; import eu.mihosoft.freerouting.geometry.planar.Vector; import eu.mihosoft.freerouting.geometry.planar.Shape; import eu.mihosoft.freerouting.geometry.planar.Area; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Component package templates describing the padstacks and @@ -71,7 +72,7 @@ public class Package implements Comparable, eu.mihosoft.freerouting.boa { if (p_no < 0 || p_no >= pin_arr.length) { - System.out.println("Package.get_pin: p_no out of range"); + FRLogger.warn("Package.get_pin: p_no out of range"); return null; } return pin_arr[p_no]; diff --git a/src/main/java/eu/mihosoft/freerouting/library/Packages.java b/src/main/java/eu/mihosoft/freerouting/library/Packages.java index 9452cf0..da8dcbc 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/Packages.java +++ b/src/main/java/eu/mihosoft/freerouting/library/Packages.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.Vector; import eu.mihosoft.freerouting.geometry.planar.Shape; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Describes a eu.mihosoft.freerouting.library of component packages. @@ -77,7 +78,7 @@ public class Packages implements java.io.Serializable Package result = package_arr.elementAt(p_package_no - 1); if (result != null && result.no != p_package_no) { - System.out.println("Padstacks.get: inconsistent padstack number"); + FRLogger.warn("Padstacks.get: inconsistent padstack number"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/library/Padstack.java b/src/main/java/eu/mihosoft/freerouting/library/Padstack.java index 9bb3d75..7254951 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/Padstack.java +++ b/src/main/java/eu/mihosoft/freerouting/library/Padstack.java @@ -27,6 +27,7 @@ import eu.mihosoft.freerouting.geometry.planar.ConvexShape; import eu.mihosoft.freerouting.geometry.planar.Direction; import eu.mihosoft.freerouting.geometry.planar.IntBox; import eu.mihosoft.freerouting.geometry.planar.IntOctagon; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Describes padstack masks for pins or vias located at the origin. @@ -69,7 +70,7 @@ public class Padstack implements Comparable, eu.mihosoft.freerouting.b { if (p_layer < 0 || p_layer >= shapes.length) { - System.out.println("Padstack.get_layer p_layer out of range"); + FRLogger.warn("Padstack.get_layer p_layer out of range"); return null; } return shapes[p_layer]; diff --git a/src/main/java/eu/mihosoft/freerouting/library/Padstacks.java b/src/main/java/eu/mihosoft/freerouting/library/Padstacks.java index c52ede6..2c704c4 100644 --- a/src/main/java/eu/mihosoft/freerouting/library/Padstacks.java +++ b/src/main/java/eu/mihosoft/freerouting/library/Padstacks.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.Vector; import eu.mihosoft.freerouting.geometry.planar.ConvexShape; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Describes a eu.mihosoft.freerouting.library of padstacks for pins or vias. @@ -76,13 +77,13 @@ public class Padstacks implements java.io.Serializable if (p_padstack_no <= 0 || p_padstack_no > padstack_arr.size()) { Integer padstack_count = padstack_arr.size(); - System.out.println("Padstacks.get: 1 <= p_padstack_no <= " + padstack_count.toString() + " expected"); + FRLogger.warn("Padstacks.get: 1 <= p_padstack_no <= " + padstack_count.toString() + " expected"); return null; } Padstack result = padstack_arr.elementAt(p_padstack_no - 1); if (result != null && result.no != p_padstack_no) { - System.out.println("Padstacks.get: inconsistent padstack number"); + FRLogger.warn("Padstacks.get: inconsistent padstack number"); } return result; } diff --git a/src/main/java/eu/mihosoft/freerouting/logger/FRLogger.java b/src/main/java/eu/mihosoft/freerouting/logger/FRLogger.java index 4fdf32a..6a05549 100644 --- a/src/main/java/eu/mihosoft/freerouting/logger/FRLogger.java +++ b/src/main/java/eu/mihosoft/freerouting/logger/FRLogger.java @@ -17,7 +17,7 @@ import java.time.Instant; import java.util.HashMap; public class FRLogger { - public static Logger logger = LogManager.getLogger(FreeRouting.class); + private static Logger logger = LogManager.getLogger(FreeRouting.class); private static DecimalFormat performanceFormat = new DecimalFormat("0.00"); @@ -43,4 +43,19 @@ public class FRLogger { } logger.trace("Method '" + perfId.replace("{}", result != null ? result.toString() : "(null)") + "' was performed in " + performanceFormat.format(timeElapsed/1000.0) + " seconds."); } + + public static void info(String msg) + { + logger.info(msg); + } + + public static void warn(String msg) + { + logger.warn(msg); + } + + public static void error(String msg, Throwable t) + { + logger.error(msg, t); + } } diff --git a/src/main/java/eu/mihosoft/freerouting/rules/BoardRules.java b/src/main/java/eu/mihosoft/freerouting/rules/BoardRules.java index 5e48bbc..839c63a 100644 --- a/src/main/java/eu/mihosoft/freerouting/rules/BoardRules.java +++ b/src/main/java/eu/mihosoft/freerouting/rules/BoardRules.java @@ -24,6 +24,7 @@ package eu.mihosoft.freerouting.rules; import eu.mihosoft.freerouting.geometry.planar.ConvexShape; +import eu.mihosoft.freerouting.logger.FRLogger; /** * Contains the rules and constraints required for items @@ -108,7 +109,7 @@ public class BoardRules implements java.io.Serializable { if (p_value <= 0) { - System.out.println("BoardRules.set_trace_half_widths: p_value out of range"); + FRLogger.warn("BoardRules.set_trace_half_widths: p_value out of range"); return; } this.get_default_net_class().set_trace_half_width(p_value); diff --git a/src/main/java/eu/mihosoft/freerouting/rules/ClearanceMatrix.java b/src/main/java/eu/mihosoft/freerouting/rules/ClearanceMatrix.java index cb58ee3..f533954 100644 --- a/src/main/java/eu/mihosoft/freerouting/rules/ClearanceMatrix.java +++ b/src/main/java/eu/mihosoft/freerouting/rules/ClearanceMatrix.java @@ -19,6 +19,8 @@ package eu.mihosoft.freerouting.rules; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * * NxN Matrix describing the spacing restrictions @@ -84,7 +86,7 @@ public class ClearanceMatrix implements java.io.Serializable { if (p_cl_class < 0 || p_cl_class >= row.length) { - System.out.println("CleatranceMatrix.get_name: p_cl_class out of range"); + FRLogger.warn("CleatranceMatrix.get_name: p_cl_class out of range"); return null; } return row[p_cl_class].name; @@ -236,7 +238,7 @@ public class ClearanceMatrix implements java.io.Serializable { if (p_no < 0 || p_no >= this.row.length) { - System.out.println("ClearanceMatrix.get_row: p_no out of range"); + FRLogger.warn("ClearanceMatrix.get_row: p_no out of range"); return null; } return this.row[p_no]; diff --git a/src/main/java/eu/mihosoft/freerouting/rules/NetClass.java b/src/main/java/eu/mihosoft/freerouting/rules/NetClass.java index 35520be..76e5c5a 100644 --- a/src/main/java/eu/mihosoft/freerouting/rules/NetClass.java +++ b/src/main/java/eu/mihosoft/freerouting/rules/NetClass.java @@ -22,6 +22,8 @@ */ package eu.mihosoft.freerouting.rules; +import eu.mihosoft.freerouting.logger.FRLogger; + /** * Describes routing rules for individual nets. * @@ -105,7 +107,7 @@ public class NetClass implements java.io.Serializable, eu.mihosoft.freerouting.b { if (p_layer < 0 || p_layer >= trace_half_width_arr.length) { - System.out.println(" NetClass.get_trace_half_width: p_layer out of range"); + FRLogger.warn(" NetClass.get_trace_half_width: p_layer out of range"); return 0; } return trace_half_width_arr[p_layer]; diff --git a/src/main/java/eu/mihosoft/freerouting/rules/Nets.java b/src/main/java/eu/mihosoft/freerouting/rules/Nets.java index c4ae921..4b4c5e7 100644 --- a/src/main/java/eu/mihosoft/freerouting/rules/Nets.java +++ b/src/main/java/eu/mihosoft/freerouting/rules/Nets.java @@ -22,6 +22,8 @@ */ package eu.mihosoft.freerouting.rules; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Vector; import java.util.Collection; @@ -91,7 +93,7 @@ public class Nets implements java.io.Serializable Net result = net_arr.elementAt(p_net_no - 1); if (result != null && result.net_number != p_net_no) { - System.out.println("Nets.get: inconsistent net_no"); + FRLogger.warn("Nets.get: inconsistent net_no"); } return result; } @@ -116,7 +118,7 @@ public class Nets implements java.io.Serializable int new_net_no = net_arr.size() + 1; if (new_net_no >= max_legal_net_no) { - System.out.println("Nets.add_net: max_net_no out of range"); + FRLogger.warn("Nets.add_net: max_net_no out of range"); } Net new_net = new Net(p_name, p_subnet_number, new_net_no, this, p_contains_plane); net_arr.add(new_net); diff --git a/src/main/java/eu/mihosoft/freerouting/tests/Validate.java b/src/main/java/eu/mihosoft/freerouting/tests/Validate.java index 23d3a22..9991707 100644 --- a/src/main/java/eu/mihosoft/freerouting/tests/Validate.java +++ b/src/main/java/eu/mihosoft/freerouting/tests/Validate.java @@ -38,14 +38,14 @@ import eu.mihosoft.freerouting.board.SearchTreeObject; /** - * Some consistancy checking on a routing eu.mihosoft.freerouting.board. + * Some consistancy checking on a routing board. * * @author Alfons Wirtz */ public class Validate { /** - * Does some consistancy checking on the routing eu.mihosoft.freerouting.board and may be some + * Does some consistency checking on the routing board and may be some * other actions. * Returns false, if problems were detected. */ @@ -67,7 +67,7 @@ public class Validate { if (first_time) { - System.out.println(" validate eu.mihosoft.freerouting.board is on "); + System.out.println(" validate board is on "); first_time = false; } Collection l = p_board.overlapping_objects(surr_oct, layer) ; @@ -80,7 +80,7 @@ public class Validate Item curr_ob = (Item) i.next(); if (!curr_ob.validate()) { - System.out.println(p_s) ; + System.out.println(p_s); } int cl_count = curr_ob.clearance_violation_count(); if (cl_count > 0)