/** * Inserts a via into the board. p_attach_allowed indicates, if the via may overlap with smd pins * of the same net. */ public Via insert_via( Padstack p_padstack, Point p_center, int[] p_net_no_arr, int p_clearance_class, FixedState p_fixed_state, boolean p_attach_allowed) { Via new_via = new Via( p_padstack, p_center, p_net_no_arr, p_clearance_class, 0, 0, p_fixed_state, p_attach_allowed, this); insert_item(new_via); int from_layer = p_padstack.from_layer(); int to_layer = p_padstack.to_layer(); for (int i = from_layer; i < to_layer; ++i) { for (int curr_net_no : p_net_no_arr) { split_traces(p_center, i, curr_net_no); } } return new_via; }
private static boolean via_exists( IntPoint p_location, library.Padstack p_padstack, int[] p_net_no_arr, board.BasicBoard p_board) { ItemSelectionFilter filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.VIAS); int from_layer = p_padstack.from_layer(); int to_layer = p_padstack.to_layer(); Collection<Item> picked_items = p_board.pick_items(p_location, p_padstack.from_layer(), filter); for (Item curr_item : picked_items) { Via curr_via = (Via) curr_item; if (curr_via.nets_equal(p_net_no_arr) && curr_via.get_center().equals(p_location) && curr_via.first_layer() == from_layer && curr_via.last_layer() == to_layer) { return true; } } return false; }