示例#1
0
 /**
  * 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;
 }