/** * 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; }
/** * Checks, if the a trace line with shape p_shape and net numbers p_net_no_arr and clearance class * p_cl_class can be inserted on layer p_layer without clearance violation. If p_contact_pins != * null, all pins not contained in p_contact_pins are regarded as obstacles, even if they are of * the own net. */ public boolean check_trace_shape( TileShape p_shape, int p_layer, int[] p_net_no_arr, int p_cl_class, Set<Pin> p_contact_pins) { if (!p_shape.is_contained_in(bounding_box)) { return false; } ShapeSearchTree default_tree = this.search_tree_manager.get_default_tree(); Collection<TreeEntry> tree_entries = new LinkedList<TreeEntry>(); int[] ignore_net_nos = new int[0]; if (default_tree.is_clearance_compensation_used()) { default_tree.overlapping_tree_entries(p_shape, p_layer, ignore_net_nos, tree_entries); } else { default_tree.overlapping_tree_entries_with_clearance( p_shape, p_layer, ignore_net_nos, p_cl_class, tree_entries); } for (TreeEntry curr_tree_entry : tree_entries) { if (!(curr_tree_entry.object instanceof Item)) { continue; } Item curr_item = (Item) curr_tree_entry.object; if (p_contact_pins != null) { if (p_contact_pins.contains(curr_item)) { continue; } if (curr_item instanceof Pin) { // The contact pins of the trace should be contained in p_ignore_items. // Other pins are handled as obstacles to avoid acid traps. return false; } } boolean is_obstacle = true; for (int i = 0; i < p_net_no_arr.length; ++i) { if (!curr_item.is_trace_obstacle(p_net_no_arr[i])) { is_obstacle = false; } } if (is_obstacle && (curr_item instanceof PolylineTrace) && p_contact_pins != null) { // check for traces of foreign nets at tie pins, which will be ignored inside the pin shape TileShape intersection = null; for (Pin curr_contact_pin : p_contact_pins) { if (curr_contact_pin.net_count() <= 1 || !curr_contact_pin.shares_net(curr_item)) { continue; } if (intersection == null) { TileShape obstacle_trace_shape = curr_item.get_tile_shape(curr_tree_entry.shape_index_in_object); intersection = p_shape.intersection(obstacle_trace_shape); } TileShape pin_shape = curr_contact_pin.get_tile_shape_on_layer(p_layer); if (pin_shape.contains_approx(intersection)) { is_obstacle = false; break; } } } if (is_obstacle) { return false; } } return true; }
/** * Returns the half with enlarged by the clearance compensation value for the tree with id number * p_ttree_id_no Equals get_half_width(), if no clearance compensation is used in this tree. * * @param p_search_tree a {@link board.ShapeSearchTree} object. * @return a int. */ public int get_compensated_half_width(ShapeSearchTree p_search_tree) { int result = this.half_width + p_search_tree.clearance_compensation_value(clearance_class_no(), this.layer); return result; }
/** * Returns items, which overlap with p_shape on layer p_layer inclusive clearance. * p_clearance_class is the index in the clearance matrix, which describes the required clearance * restrictions to other items. The function may also return items, which are nearly overlapping, * but do not overlap with exact calculation. If p_layer < 0, the layer is ignored. */ public Set<Item> overlapping_items_with_clearance( ConvexShape p_shape, int p_layer, int[] p_ignore_net_nos, int p_clearance_class) { ShapeSearchTree default_tree = this.search_tree_manager.get_default_tree(); return default_tree.overlapping_items_with_clearance( p_shape, p_layer, p_ignore_net_nos, p_clearance_class); }