/** * Checks, if the an object with shape p_shape and net nos p_net_no_arr and clearance class * p_cl_class can be inserted on layer p_layer without clearance violation. */ public boolean check_shape(Area p_shape, int p_layer, int[] p_net_no_arr, int p_cl_class) { TileShape[] tiles = p_shape.split_to_convex(); ShapeSearchTree default_tree = this.search_tree_manager.get_default_tree(); for (int i = 0; i < tiles.length; ++i) { TileShape curr_shape = tiles[i]; if (!curr_shape.is_contained_in(bounding_box)) { return false; } Set<SearchTreeObject> obstacles = new TreeSet<SearchTreeObject>(); default_tree.overlapping_objects_with_clearance( curr_shape, p_layer, p_net_no_arr, p_cl_class, obstacles); for (SearchTreeObject curr_ob : obstacles) { boolean is_obstacle = true; for (int j = 0; j < p_net_no_arr.length; ++j) { if (!curr_ob.is_obstacle(p_net_no_arr[j])) { is_obstacle = false; } } if (is_obstacle) { return false; } } } return true; }
/** Inserts a component ouline into the board. */ public ComponentOutline insert_component_outline( Area p_area, boolean p_is_front, Vector p_translation, double p_rotation_in_degree, int p_component_no, FixedState p_fixed_state) { if (p_area == null) { System.out.println("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"); return null; } ComponentOutline outline = new ComponentOutline( p_area, p_is_front, p_translation, p_rotation_in_degree, p_component_no, p_fixed_state, this); insert_item(outline); return outline; }
/** * Returns all items on layer p_layer, which overlap with p_area. If p_layer < 0, the layer is * ignored */ public Set<Item> overlapping_items(Area p_area, int p_layer) { Set<Item> result = new TreeSet<Item>(); TileShape[] tile_shapes = p_area.split_to_convex(); for (int i = 0; i < tile_shapes.length; ++i) { Set<SearchTreeObject> curr_overlaps = overlapping_objects(tile_shapes[i], p_layer); for (SearchTreeObject curr_overlap : curr_overlaps) { if (curr_overlap instanceof Item) { result.add((Item) curr_overlap); } } } return result; }
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(); }