private static void write_via_scope(WriteScopeParameter p_par, Via p_via) throws java.io.IOException { library.Padstack via_padstack = p_via.get_padstack(); FloatPoint via_location = p_via.get_center().to_float(); double[] via_coor = p_par.coordinate_transform.board_to_dsn(via_location); int net_no; rules.Net via_net; if (p_via.net_count() > 0) { net_no = p_via.get_net_no(0); via_net = p_par.board.rules.nets.get(net_no); } else { net_no = 0; via_net = null; } p_par.file.start_scope(); p_par.file.write("via "); p_par.identifier_type.write(via_padstack.name, p_par.file); for (int i = 0; i < via_coor.length; ++i) { p_par.file.write(" "); p_par.file.write((new Double(via_coor[i])).toString()); } if (via_net != null) { write_net(via_net, p_par.file, p_par.identifier_type); } Rule.write_item_clearance_class( p_par.board.rules.clearance_matrix.get_name(p_via.clearance_class_no()), p_par.file, p_par.identifier_type); write_fixed_state(p_par.file, p_via.get_fixed_state()); p_par.file.end_scope(); }
private static void write_wire_scope(WriteScopeParameter p_par, Trace p_wire) throws java.io.IOException { if (!(p_wire instanceof PolylineTrace)) { System.out.println("Wiring.write_wire_scope: trace type not yet implemented"); return; } PolylineTrace curr_wire = (PolylineTrace) p_wire; int layer_no = curr_wire.get_layer(); board.Layer board_layer = p_par.board.layer_structure.arr[layer_no]; Layer curr_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal); double wire_width = p_par.coordinate_transform.board_to_dsn(2 * curr_wire.get_half_width()); rules.Net wire_net = null; if (curr_wire.net_count() > 0) { wire_net = p_par.board.rules.nets.get(curr_wire.get_net_no(0)); } if (wire_net == null) { System.out.println("Wiring.write_wire_scope: net not found"); return; } p_par.file.start_scope(); p_par.file.write("wire"); if (p_par.compat_mode) { Point[] corner_arr = curr_wire.polyline().corner_arr(); FloatPoint[] float_corner_arr = new FloatPoint[corner_arr.length]; for (int i = 0; i < corner_arr.length; ++i) { float_corner_arr[i] = corner_arr[i].to_float(); } double[] coors = p_par.coordinate_transform.board_to_dsn(float_corner_arr); PolygonPath curr_path = new PolygonPath(curr_layer, wire_width, coors); curr_path.write_scope(p_par.file, p_par.identifier_type); } else { double[] coors = p_par.coordinate_transform.board_to_dsn(curr_wire.polyline().arr); PolylinePath curr_path = new PolylinePath(curr_layer, wire_width, coors); curr_path.write_scope(p_par.file, p_par.identifier_type); } write_net(wire_net, p_par.file, p_par.identifier_type); Rule.write_item_clearance_class( p_par.board.rules.clearance_matrix.get_name(p_wire.clearance_class_no()), p_par.file, p_par.identifier_type); write_fixed_state(p_par.file, curr_wire.get_fixed_state()); p_par.file.end_scope(); }
private static void write_conduction_area_scope( WriteScopeParameter p_par, board.ConductionArea p_conduction_area) throws java.io.IOException { int net_count = p_conduction_area.net_count(); if (net_count <= 0 || net_count > 1) { System.out.println("Plane.write_scope: unexpected net count"); return; } rules.Net curr_net = p_par.board.rules.nets.get(p_conduction_area.get_net_no(0)); geometry.planar.Area curr_area = p_conduction_area.get_area(); int layer_no = p_conduction_area.get_layer(); board.Layer board_layer = p_par.board.layer_structure.arr[layer_no]; Layer conduction_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal); geometry.planar.Shape boundary_shape; geometry.planar.Shape[] holes; if (curr_area instanceof geometry.planar.Shape) { boundary_shape = (geometry.planar.Shape) curr_area; holes = new geometry.planar.Shape[0]; } else { boundary_shape = curr_area.get_border(); holes = curr_area.get_holes(); } p_par.file.start_scope(); p_par.file.write("wire "); Shape dsn_shape = p_par.coordinate_transform.board_to_dsn(boundary_shape, conduction_layer); if (dsn_shape != null) { dsn_shape.write_scope(p_par.file, p_par.identifier_type); } for (int i = 0; i < holes.length; ++i) { Shape dsn_hole = p_par.coordinate_transform.board_to_dsn(holes[i], conduction_layer); dsn_hole.write_hole_scope(p_par.file, p_par.identifier_type); } write_net(curr_net, p_par.file, p_par.identifier_type); Rule.write_item_clearance_class( p_par.board.rules.clearance_matrix.get_name(p_conduction_area.clearance_class_no()), p_par.file, p_par.identifier_type); p_par.file.end_scope(); }