Пример #1
0
 /** Normalizes the traces of this net */
 public boolean normalize_traces(int p_net_no) {
   boolean result = false;
   boolean something_changed = true;
   Item curr_item = null;
   while (something_changed) {
     something_changed = false;
     Iterator<UndoableObjects.UndoableObjectNode> it = item_list.start_read_object();
     for (; ; ) {
       try {
         curr_item = (Item) item_list.read_object(it);
       } catch (java.util.ConcurrentModificationException e) {
         something_changed = true;
         break;
       }
       if (curr_item == null) {
         break;
       }
       if (curr_item.contains_net(p_net_no)
           && curr_item instanceof PolylineTrace
           && curr_item.is_on_the_board()) {
         PolylineTrace curr_trace = (PolylineTrace) curr_item;
         if (curr_trace.normalize(null)) {
           something_changed = true;
           result = true;
         } else if (!curr_trace.is_user_fixed() && this.remove_if_cycle(curr_trace)) {
           something_changed = true;
           result = true;
         }
       }
     }
   }
   return result;
 }
Пример #2
0
 /**
  * Inserts a trace into the board, whose geometry is described by a Polyline. p_clearance_class is
  * the index in the clearance_matix, which describes the required clearance restrictions to other
  * items. Because no internal cleaning of items is done, the new inserted item can be returned.
  */
 public PolylineTrace insert_trace_without_cleaning(
     Polyline p_polyline,
     int p_layer,
     int p_half_width,
     int[] p_net_no_arr,
     int p_clearance_class,
     FixedState p_fixed_state) {
   if (p_polyline.corner_count() < 2) {
     return null;
   }
   PolylineTrace new_trace =
       new PolylineTrace(
           p_polyline,
           p_layer,
           p_half_width,
           p_net_no_arr,
           p_clearance_class,
           0,
           0,
           p_fixed_state,
           this);
   if (new_trace.first_corner().equals(new_trace.last_corner())) {
     if (p_fixed_state.ordinal() < FixedState.USER_FIXED.ordinal()) {
       return null;
     }
   }
   insert_item(new_trace);
   if (new_trace.nets_normal()) {
     max_trace_half_width = Math.max(max_trace_half_width, p_half_width);
     min_trace_half_width = Math.min(min_trace_half_width, p_half_width);
   }
   return new_trace;
 }
Пример #3
0
 /**
  * Inserts a trace into the board, whose geometry is described by a Polyline. p_clearance_class is
  * the index in the clearance_matix, which describes the required clearance restrictions to other
  * items.
  */
 public void insert_trace(
     Polyline p_polyline,
     int p_layer,
     int p_half_width,
     int[] p_net_no_arr,
     int p_clearance_class,
     FixedState p_fixed_state) {
   PolylineTrace new_trace =
       insert_trace_without_cleaning(
           p_polyline, p_layer, p_half_width, p_net_no_arr, p_clearance_class, p_fixed_state);
   if (new_trace == null) {
     return;
   }
   IntOctagon clip_shape = null;
   if (this instanceof RoutingBoard) {
     ChangedArea changed_area = ((RoutingBoard) this).changed_area;
     if (changed_area != null) {
       clip_shape = changed_area.get_area(p_layer);
     }
   }
   new_trace.normalize(clip_shape);
 }