/** * write_scope. * * @param p_par a {@link designformats.specctra.WriteScopeParameter} object. * @throws java.io.IOException if any. */ public static void write_scope(WriteScopeParameter p_par) throws java.io.IOException { p_par.file.start_scope(); p_par.file.write("wiring"); // write the wires Collection<Trace> board_wires = p_par.board.get_traces(); Iterator<Trace> it = board_wires.iterator(); while (it.hasNext()) { write_wire_scope(p_par, it.next()); } Collection<Via> board_vias = p_par.board.get_vias(); for (Via curr_via : board_vias) { write_via_scope(p_par, curr_via); } // write the conduction areas Iterator<UndoableObjects.UndoableObjectNode> it2 = p_par.board.item_list.start_read_object(); for (; ; ) { Object curr_ob = p_par.board.item_list.read_object(it2); if (curr_ob == null) { break; } if (!(curr_ob instanceof board.ConductionArea)) { continue; } board.ConductionArea curr_area = (board.ConductionArea) curr_ob; if (!(p_par.board.layer_structure.arr[curr_area.get_layer()].is_signal)) { // This conduction areas arw written in the structure scope. continue; } write_conduction_area_scope(p_par, (board.ConductionArea) curr_ob); } 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(); }