KiCad PCB EDA Suite
class_track.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
32 #include <fctsys.h>
33 #include <gr_basic.h>
34 #include <common.h>
35 #include <trigo.h>
36 #include <macros.h>
37 #include <class_drawpanel.h>
38 #include <class_pcb_screen.h>
39 #include <drawtxt.h>
40 #include <colors_selection.h>
41 #include <wxstruct.h>
42 #include <wxBasePcbFrame.h>
43 #include <class_board.h>
44 #include <class_track.h>
45 #include <pcbnew.h>
46 #include <base_units.h>
47 #include <msgpanel.h>
48 #include <bitmaps.h>
49 
55 static bool ShowClearance( DISPLAY_OPTIONS* aDisplOpts, const TRACK* aTrack )
56 {
57  // maybe return true for tracks and vias, not for zone segments
58  return IsCopperLayer( aTrack->GetLayer() )
59  && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
61  && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
63  );
64 
65 }
66 
67 
68 TRACK* GetTrack( TRACK* aStartTrace, const TRACK* aEndTrace,
69  const wxPoint& aPosition, LSET aLayerMask )
70 {
71  for( TRACK* seg = aStartTrace; seg; seg = seg->Next() )
72  {
73  if( seg->GetState( IS_DELETED | BUSY ) == 0 )
74  {
75  if( aPosition == seg->GetStart() )
76  {
77  if( ( aLayerMask & seg->GetLayerSet() ).any() )
78  return seg;
79  }
80 
81  if( aPosition == seg->GetEnd() )
82  {
83  if( ( aLayerMask & seg->GetLayerSet() ).any() )
84  return seg;
85  }
86  }
87 
88  if( seg == aEndTrace )
89  break;
90  }
91 
92  return NULL;
93 }
94 
95 
96 TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
97  BOARD_CONNECTED_ITEM( aParent, idtype )
98 {
99  m_Width = Millimeter2iu( 0.2 );
100  start = end = NULL;
101  m_Param = 0;
102 }
103 
104 
106 {
107  return new TRACK( *this );
108 }
109 
110 
111 wxString TRACK::ShowWidth() const
112 {
113  wxString msg = ::CoordinateToString( m_Width );
114  return msg;
115 }
116 
117 
119  TRACK( aParent, PCB_ZONE_T )
120 {
121 }
122 
123 
125 {
126  return new SEGZONE( *this );
127 }
128 
129 
131 {
132  wxString text, nettxt;
133  BOARD* board = GetBoard();
134 
135  if( board )
136  {
137  nettxt = GetNetname();
138  }
139  else
140  {
141  wxFAIL_MSG( wxT( "SEGZONE::GetSelectMenuText: BOARD is NULL" ) );
142  nettxt = wxT( "???" );
143  }
144 
145  text.Printf( _( "Zone (%08lX) [%s] on %s" ),
146  m_TimeStamp, GetChars( nettxt ), GetChars( GetLayerName() ) );
147 
148  return text;
149 }
150 
151 
153 {
154  return add_zone_xpm;
155 }
156 
157 
158 VIA::VIA( BOARD_ITEM* aParent ) :
159  TRACK( aParent, PCB_VIA_T )
160 {
163  SetDrillDefault();
164 }
165 
166 
168 {
169  return new VIA( *this );
170 }
171 
172 
173 wxString VIA::GetSelectMenuText() const
174 {
175  wxString text;
176  wxString format;
177  BOARD* board = GetBoard();
178 
179  switch( GetViaType() )
180  {
181  case VIA_BLIND_BURIED:
182  format = _( "Blind/Buried Via %s, net[%s] (%d) on layers %s/%s" );
183  break;
184  case VIA_MICROVIA:
185  format = _( "Micro Via %s, Net [%s] (%d) on layers %s/%s" );
186  break;
187  // else say nothing about normal (through) vias
188  default:
189  format = _( "Via %s net [%s] (%d) on layers %s/%s" );
190  break;
191  }
192 
193 
194  if( board )
195  {
196  wxString netname = GetNetname();
197 
198  // say which layers, only two for now
199  PCB_LAYER_ID topLayer;
200  PCB_LAYER_ID botLayer;
201  LayerPair( &topLayer, &botLayer );
202  text.Printf( format.GetData(), GetChars( ShowWidth() ),
203  GetChars( netname ), GetNetCode(),
204  GetChars( board->GetLayerName( topLayer ) ),
205  GetChars( board->GetLayerName( botLayer ) ) );
206 
207  }
208  else
209  {
210  wxFAIL_MSG( wxT( "VIA::GetSelectMenuText: BOARD is NULL" ) );
211  text.Printf( format.GetData(), GetChars( ShowWidth() ),
212  wxT( "???" ), 0,
213  wxT( "??" ), wxT( "??" ) );
214  }
215 
216  return text;
217 }
218 
219 
221 {
222  return via_sketch_xpm;
223 }
224 
225 
227 {
228  // Currently tracks have no specific clearance parameter on a per track or per
229  // segment basis. The NETCLASS clearance is used.
230  return BOARD_CONNECTED_ITEM::GetClearance( aItem );
231 }
232 
233 
235 {
236  if( m_Drill > 0 ) // Use the specific value.
237  return m_Drill;
238 
239  // Use the default value from the Netclass
240  NETCLASSPTR netclass = GetNetClass();
241 
242  if( GetViaType() == VIA_MICROVIA )
243  return netclass->GetuViaDrill();
244 
245  return netclass->GetViaDrill();
246 }
247 
248 
250 {
251  if( ( Type() != PCB_VIA_T ) && ( m_Start == m_End ) )
252  return true;
253  else
254  return false;
255 }
256 
257 
258 STATUS_FLAGS TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
259 {
260  STATUS_FLAGS result = 0;
261 
262  if( min_dist < 0 )
263  min_dist = m_Width / 2;
264 
265  if( min_dist == 0 )
266  {
267  if( m_Start == point )
268  result |= STARTPOINT;
269 
270  if( m_End == point )
271  result |= ENDPOINT;
272  }
273  else
274  {
275  double dist = GetLineLength( m_Start, point );
276 
277  if( min_dist >= KiROUND( dist ) )
278  result |= STARTPOINT;
279 
280  dist = GetLineLength( m_End, point );
281 
282  if( min_dist >= KiROUND( dist ) )
283  result |= ENDPOINT;
284  }
285 
286  return result;
287 }
288 
289 
291 {
292  // end of track is round, this is its radius, rounded up
293  int radius;
294 
295  int ymax;
296  int xmax;
297 
298  int ymin;
299  int xmin;
300 
301  if( Type() == PCB_VIA_T )
302  {
303  // Because vias are sometimes drawn larger than their m_Width would
304  // provide, erasing them using a dirty rect must also compensate for this
305  // possibility (that the via is larger on screen than its m_Width would provide).
306  // Because it is cheap to return a larger BoundingBox, do it so that
307  // the via gets erased properly. Do not divide width by 2 for this reason.
308  radius = m_Width;
309 
310  ymax = m_Start.y;
311  xmax = m_Start.x;
312 
313  ymin = m_Start.y;
314  xmin = m_Start.x;
315  }
316  else
317  {
318  radius = ( m_Width + 1 ) / 2;
319 
320  ymax = std::max( m_Start.y, m_End.y );
321  xmax = std::max( m_Start.x, m_End.x );
322 
323  ymin = std::min( m_Start.y, m_End.y );
324  xmin = std::min( m_Start.x, m_End.x );
325  }
326 
327  // + 1 is for the clearance line itself.
328  radius += GetClearance() + 1;
329 
330  ymax += radius;
331  xmax += radius;
332 
333  ymin -= radius;
334  xmin -= radius;
335 
336  // return a rectangle which is [pos,dim) in nature. therefore the +1
337  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
338 
339  return ret;
340 }
341 
342 
343 void TRACK::Rotate( const wxPoint& aRotCentre, double aAngle )
344 {
345  RotatePoint( &m_Start, aRotCentre, aAngle );
346  RotatePoint( &m_End, aRotCentre, aAngle );
347 }
348 
349 
350 void TRACK::Flip( const wxPoint& aCentre )
351 {
352  m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
353  m_End.y = aCentre.y - (m_End.y - aCentre.y);
354  int copperLayerCount = GetBoard()->GetCopperLayerCount();
355  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
356 }
357 
358 
359 void VIA::Flip( const wxPoint& aCentre )
360 {
361  m_Start.y = aCentre.y - (m_Start.y - aCentre.y);
362  m_End.y = aCentre.y - (m_End.y - aCentre.y);
363 
364  if( GetViaType() != VIA_THROUGH )
365  {
366  int copperLayerCount = GetBoard()->GetCopperLayerCount();
367  PCB_LAYER_ID top_layer;
368  PCB_LAYER_ID bottom_layer;
369  LayerPair( &top_layer, &bottom_layer );
370  top_layer = FlipLayer( top_layer, copperLayerCount );
371  bottom_layer = FlipLayer( bottom_layer, copperLayerCount );
372  SetLayerPair( top_layer, bottom_layer );
373  }
374 }
375 
376 
377 // see class_track.h
378 SEARCH_RESULT TRACK::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
379 {
380  KICAD_T stype = *scanTypes;
381 
382  // If caller wants to inspect my type
383  if( stype == Type() )
384  {
385  if( SEARCH_QUIT == inspector( this, testData ) )
386  return SEARCH_QUIT;
387  }
388 
389  return SEARCH_CONTINUE;
390 }
391 
392 
393 bool VIA::IsOnLayer( PCB_LAYER_ID layer_number ) const
394 {
395  PCB_LAYER_ID bottom_layer, top_layer;
396 
397  LayerPair( &top_layer, &bottom_layer );
398 
399  wxASSERT( top_layer <= bottom_layer );
400 
401  if( top_layer <= layer_number && layer_number <= bottom_layer )
402  return true;
403  else
404  return false;
405 }
406 
407 
409 {
410  if( GetViaType() == VIA_THROUGH )
411  return LSET::AllCuMask();
412 
413  // VIA_BLIND_BURIED or VIA_MICRVIA:
414 
415  LSET layermask;
416 
417  wxASSERT( m_Layer <= m_BottomLayer );
418 
419  // PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
420  for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id )
421  {
422  layermask.set( id );
423  }
424 
425  return layermask;
426 }
427 
428 
429 void VIA::SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer )
430 {
431  if( GetViaType() == VIA_THROUGH )
432  {
433  aTopLayer = F_Cu;
434  aBottomLayer = B_Cu;
435  }
436 
437  if( aBottomLayer < aTopLayer )
438  std::swap( aBottomLayer, aTopLayer );
439 
440  m_Layer = aTopLayer;
441  m_BottomLayer = aBottomLayer;
442 }
443 
444 
445 void VIA::LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const
446 {
447  PCB_LAYER_ID t_layer = F_Cu;
448  PCB_LAYER_ID b_layer = B_Cu;
449 
450  if( GetViaType() != VIA_THROUGH )
451  {
452  b_layer = m_BottomLayer;
453  t_layer = m_Layer;
454 
455  if( b_layer < t_layer )
456  std::swap( b_layer, t_layer );
457  }
458 
459  if( top_layer )
460  *top_layer = t_layer;
461 
462  if( bottom_layer )
463  *bottom_layer = b_layer;
464 }
465 
466 
468 {
469  TRACK* track;
470 
471  if( Type() == PCB_ZONE_T )
472  track = aPcb->m_Zone;
473  else
474  track = aPcb->m_Track;
475 
476  for( ; track; track = track->Next() )
477  {
478  if( GetNetCode() <= track->GetNetCode() )
479  return track;
480  }
481 
482  return NULL;
483 }
484 
485 
487 {
488  TRACK* Track = this;
489  int ii = 0;
490 
491  if( NetCode == -1 )
492  NetCode = GetNetCode();
493 
494  while( Track != NULL )
495  {
496  if( Track->GetNetCode() > NetCode )
497  break;
498 
499  if( Track->GetNetCode() == NetCode )
500  {
501  ii++;
502  break;
503  }
504 
505  Track = (TRACK*) Track->Pnext;
506  }
507 
508  if( ii )
509  return Track;
510  else
511  return NULL;
512 }
513 
514 
516 {
517  TRACK* NextS, * Track = this;
518  int ii = 0;
519 
520  if( Track == NULL )
521  return NULL;
522 
523  if( NetCode == -1 )
524  NetCode = GetNetCode();
525 
526  while( Track != NULL )
527  {
528  NextS = (TRACK*) Track->Pnext;
529 
530  if( Track->GetNetCode() == NetCode )
531  ii++;
532 
533  if( NextS == NULL )
534  break;
535 
536  if( NextS->GetNetCode() > NetCode )
537  break;
538 
539  Track = NextS;
540  }
541 
542  if( ii )
543  return Track;
544  else
545  return NULL;
546 }
547 
549  wxDC* aDC, GR_DRAWMODE aDrawMode, COLOR4D aBgColor )
550 {
551  if( ! panel )
552  return;
553 
554  /* we must filter tracks, to avoid a lot of texts.
555  * - only tracks with a length > 10 * thickness are eligible
556  * and, of course, if we are not printing the board
557  */
558  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
559 
560  if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 )
561  return;
562 
563  #define THRESHOLD 10
564 
565  int len = KiROUND( GetLineLength( m_Start, m_End ) );
566 
567  if( len < THRESHOLD * m_Width )
568  return;
569 
570  // no room to display a text inside track
571  if( aDC->LogicalToDeviceXRel( m_Width ) < MIN_TEXT_SIZE )
572  return;
573 
575  return;
576 
577  NETINFO_ITEM* net = GetNet();
578 
579  if( net == NULL )
580  return;
581 
582  int textlen = net->GetShortNetname().Len();
583 
584  if( textlen > 0 )
585  {
586  // calculate a good size for the text
587  int tsize = std::min( m_Width, len / textlen );
588  int dx = m_End.x - m_Start.x ;
589  int dy = m_End.y - m_Start.y ;
590  wxPoint tpos = m_Start + m_End;
591  tpos.x /= 2;
592  tpos.y /= 2;
593 
594  // Calculate angle: if the track segment is vertical, angle = 90 degrees
595  // If horizontal 0 degrees, otherwise compute it
596  double angle; // angle is in 0.1 degree
597 
598  if( dy == 0 ) // Horizontal segment
599  {
600  angle = 0;
601  }
602  else
603  {
604  if( dx == 0 ) // Vertical segment
605  {
606  angle = 900;
607  }
608  else
609  {
610  /* atan2 is *not* the solution here, since it can give upside
611  down text. We want to work only in the first and fourth quadrant */
612  angle = RAD2DECIDEG( -atan( double( dy ) / double( dx ) ) );
613  }
614  }
615 
616  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
617 
618  if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
619  && ( !(!IsOnLayer( curr_layer )&& displ_opts->m_ContrastModeDisplay) ) )
620  {
621  if( (aDrawMode & GR_XOR) == 0 )
622  GRSetDrawMode( aDC, GR_COPY );
623 
624  tsize = (tsize * 7) / 10; // small reduction to give a better look
625  DrawGraphicHaloText( panel->GetClipBox(), aDC, tpos,
626  aBgColor, BLACK, WHITE, net->GetShortNetname(), angle,
627  wxSize( tsize, tsize ),
629  tsize / 7,
630  false, false );
631  }
632  }
633 }
634 
635 
636 void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
637  const wxPoint& aOffset )
638 {
639  BOARD* brd = GetBoard();
641 
642  if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
643  return;
644 
645 #ifdef USE_WX_OVERLAY
646  // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay
647  if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))
648  return;
649 #endif
650 
651  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) panel->GetDisplayOptions();
652 
653  if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
654  {
655  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
656 
657  if( !IsOnLayer( curr_layer ) )
658  color = COLOR4D( DARKDARKGRAY );
659  }
660 
661  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
662  color.SetToLegacyHighlightColor();
663 
664  color.a = 0.588;
665 
666  GRSetDrawMode( aDC, aDrawMode );
667 
668  // Draw track as line if width <= 1pixel:
669  if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
670  {
671  GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
672  return;
673  }
674 
675  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
676  {
677  GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
678  }
679  else
680  {
681  GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
682  m_Start.y + aOffset.y,
683  m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
684  }
685 
686  if( panel->GetScreen()->m_IsPrinting )
687  return;
688 
689  // Show clearance for tracks, not for zone segments
690  if( ShowClearance( displ_opts, this ) )
691  {
692  GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset,
693  m_Width + (GetClearance() * 2), color );
694  }
695 
696  DrawShortNetname( panel, aDC, aDrawMode, color );
697 }
698 
699 
700 void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
701  const wxPoint& aOffset )
702 {
703  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
704 
705  if( displ_opts->m_DisplayZonesMode != 0 )
706  return;
707 
708  BOARD* brd = GetBoard();
710 
711  if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
712  return;
713 
714 #ifdef USE_WX_OVERLAY
715  // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay
716  if( (m_Flags & IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC)))
717  return;
718 #endif
719 
720  if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && displ_opts->m_ContrastModeDisplay )
721  {
722  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
723 
724  if( !IsOnLayer( curr_layer ) )
725  color = COLOR4D( DARKDARKGRAY );
726  }
727 
728  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
729  color.SetToLegacyHighlightColor();
730 
731  color.a = 0.588;
732 
733  GRSetDrawMode( aDC, aDrawMode );
734 
735  // Draw track as line if width <= 1pixel:
736  if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
737  {
738  GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
739  return;
740  }
741 
742  if( !displ_opts->m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
743  {
744  GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
745  }
746  else
747  {
748  GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
749  m_Start.y + aOffset.y,
750  m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
751  }
752 
753  // No clearance or netnames for zones
754 }
755 
756 
757 void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
758 {
759  // Show the track and its netname on different layers
760  aLayers[0] = GetLayer();
761  aLayers[1] = GetNetnameLayer( aLayers[0] );
762  aCount = 2;
763 }
764 
765 
766 unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
767 {
768  // Netnames will be shown only if zoom is appropriate
769  if( IsNetnameLayer( aLayer ) )
770  {
771  return ( 40000000 / ( m_Width + 1 ) );
772  }
773 
774  // Other layers are shown without any conditions
775  return 0;
776 }
777 
778 
779 void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset )
780 {
781  wxCHECK_RET( panel != NULL, wxT( "VIA::Draw panel cannot be NULL." ) );
782 
783  int radius;
784  PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
785 
786  int fillvia = 0;
787  PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
788  PCB_SCREEN* screen = frame->GetScreen();
789  DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)frame->GetDisplayOptions();
790 
791  if( displ_opts->m_DisplayViaFill == FILLED )
792  fillvia = 1;
793 
794  GRSetDrawMode( aDC, aDrawMode );
795 
796  BOARD * brd = GetBoard();
798 
799  if( brd->IsElementVisible( LAYER_VIAS + GetViaType() ) == false
800  && !( aDrawMode & GR_HIGHLIGHT ) )
801  return;
802 
803  // Only draw the via if at least one of the layers it crosses is being displayed
804  if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
805  return;
806 
807  if( displ_opts->m_ContrastModeDisplay )
808  {
809  if( !IsOnLayer( curr_layer ) )
810  color = COLOR4D( DARKDARKGRAY );
811  }
812 
813  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
814  color.SetToLegacyHighlightColor();
815 
816  color.a = 0.588;
817 
818 
819  radius = m_Width >> 1;
820  // for small via size on screen (radius < 4 pixels) draw a simplified shape
821 
822  int radius_in_pixels = aDC->LogicalToDeviceXRel( radius );
823 
824  bool fast_draw = false;
825 
826  // Vias are drawn as a filled circle or a double circle. The hole will be drawn later
827  int drill_radius = GetDrillValue() / 2;
828 
829  int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 );
830 
831  if( radius_in_pixels < MIN_VIA_DRAW_SIZE )
832  {
833  fast_draw = true;
834  fillvia = false;
835  }
836 
837  if( fillvia )
838  {
839  GRFilledCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, color );
840  }
841  else
842  {
843  GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, 0, color );
844 
845  if ( fast_draw )
846  return;
847 
848  GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, inner_radius, 0, color );
849  }
850 
851  if( fillvia )
852  {
853  bool blackpenstate = false;
854 
855  if( screen->m_IsPrinting )
856  {
857  blackpenstate = GetGRForceBlackPenState();
858  GRForceBlackPen( false );
859  color = WHITE;
860  }
861  else
862  {
863  color = BLACK; // or DARKGRAY;
864  }
865 
866  if( (aDrawMode & GR_XOR) == 0)
867  GRSetDrawMode( aDC, GR_COPY );
868 
869  // Draw hole if the radius is > 1pixel.
870  if( aDC->LogicalToDeviceXRel( drill_radius ) > 1 )
871  GRFilledCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x,
872  m_Start.y + aOffset.y, drill_radius, 0, color, color );
873 
874  if( screen->m_IsPrinting )
875  GRForceBlackPen( blackpenstate );
876  }
877  else
878  {
879  if( drill_radius < inner_radius ) // We can show the via hole
880  GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, drill_radius, 0, color );
881  }
882 
883  if( ShowClearance( displ_opts, this ) )
884  {
885  GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius + GetClearance(), 0, color );
886  }
887 
888  // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
889  // (so we can see 2 superimposed microvias ):
890  if( GetViaType() == VIA_MICROVIA )
891  {
892  int ax, ay, bx, by;
893 
894  if( IsOnLayer( B_Cu ) )
895  {
896  ax = radius; ay = 0;
897  bx = drill_radius; by = 0;
898  }
899  else
900  {
901  ax = ay = (radius * 707) / 1000;
902  bx = by = (drill_radius * 707) / 1000;
903  }
904 
905  // lines '|' or '\'
906  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax,
907  m_Start.y + aOffset.y - ay,
908  m_Start.x + aOffset.x - bx,
909  m_Start.y + aOffset.y - by, 0, color );
910  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x + bx,
911  m_Start.y + aOffset.y + by,
912  m_Start.x + aOffset.x + ax,
913  m_Start.y + aOffset.y + ay, 0, color );
914 
915  // lines - or '/'
916  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x + ay,
917  m_Start.y + aOffset.y - ax,
918  m_Start.x + aOffset.x + by,
919  m_Start.y + aOffset.y - bx, 0, color );
920  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - by,
921  m_Start.y + aOffset.y + bx,
922  m_Start.x + aOffset.x - ay,
923  m_Start.y + aOffset.y + ax, 0, color );
924  }
925 
926  // for Buried Vias, draw a partial line : orient depending on layer pair
927  // (so we can see superimposed buried vias ):
928  if( GetViaType() == VIA_BLIND_BURIED )
929  {
930  int ax = 0, ay = radius, bx = 0, by = drill_radius;
931  PCB_LAYER_ID layer_top, layer_bottom;
932 
933  LayerPair( &layer_top, &layer_bottom );
934 
935  // lines for the top layer
936  RotatePoint( &ax, &ay, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
937  RotatePoint( &bx, &by, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
938  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax,
939  m_Start.y + aOffset.y - ay,
940  m_Start.x + aOffset.x - bx,
941  m_Start.y + aOffset.y - by, 0, color );
942 
943  // lines for the bottom layer
944  ax = 0; ay = radius; bx = 0; by = drill_radius;
945  RotatePoint( &ax, &ay, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
946  RotatePoint( &bx, &by, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
947  GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax,
948  m_Start.y + aOffset.y - ay,
949  m_Start.x + aOffset.x - bx,
950  m_Start.y + aOffset.y - by, 0, color );
951  }
952 
953  // Display the short netname:
955  return;
956 
957  if( displ_opts->m_DisplayNetNamesMode == 0 || displ_opts->m_DisplayNetNamesMode == 1 )
958  return;
959 
960  NETINFO_ITEM* net = GetNet();
961 
962  if( net == NULL )
963  return;
964 
965  int len = net->GetShortNetname().Len();
966 
967  if( len > 0 )
968  {
969  // calculate a good size for the text
970  int tsize = m_Width / len;
971 
972  if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
973  {
974  tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via
975 
976  if( (aDrawMode & GR_XOR) == 0 )
977  GRSetDrawMode( aDC, GR_COPY );
978 
979  EDA_RECT* clipbox = panel->GetClipBox();
980  DrawGraphicHaloText( clipbox, aDC, m_Start,
981  color, WHITE, BLACK, net->GetShortNetname(), 0,
982  wxSize( tsize, tsize ),
984  tsize / 7, false, false );
985  }
986  }
987 }
988 
989 
990 void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
991 {
992  aLayers[0] = LAYER_VIAS_HOLES;
993  aCount = 2;
994 
995  // Just show it on common via & via holes layers
996  switch( GetViaType() )
997  {
998  case VIA_THROUGH:
999  aLayers[1] = LAYER_VIA_THROUGH;
1000  break;
1001 
1002  case VIA_BLIND_BURIED:
1003  aLayers[1] = LAYER_VIA_BBLIND;
1004  aLayers[2] = m_Layer;
1005  aLayers[3] = m_BottomLayer;
1006  aCount += 2;
1007  break;
1008 
1009  case VIA_MICROVIA:
1010  aLayers[1] = LAYER_VIA_MICROVIA;
1011  break;
1012 
1013  default:
1014  assert( false );
1015  break;
1016  }
1017 }
1018 
1019 
1020 unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
1021 {
1022  BOARD* board = GetBoard();
1023 
1024  // Only draw the via if at least one of the layers it crosses is being displayed
1025  if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any() )
1026  return 0;
1027 
1029 }
1030 
1031 
1032 // see class_track.h
1033 void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
1034 {
1035  wxString msg;
1036  BOARD* board = GetBoard();
1037 
1038  // Display basic infos
1039  GetMsgPanelInfoBase( aList );
1040 
1041  // Display full track length (in Pcbnew)
1042  if( board )
1043  {
1044  double trackLen = 0;
1045  double lenPadToDie = 0;
1046  board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false );
1047  msg = ::LengthDoubleToString( trackLen );
1048  aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKCYAN ) );
1049 
1050  if( lenPadToDie != 0 )
1051  {
1052  msg = ::LengthDoubleToString( trackLen + lenPadToDie );
1053  aList.push_back( MSG_PANEL_ITEM( _( "Full Length" ), msg, DARKCYAN ) );
1054 
1055  msg = ::LengthDoubleToString( lenPadToDie );
1056  aList.push_back( MSG_PANEL_ITEM( _( "Pad To Die Length" ), msg, DARKCYAN ) );
1057  }
1058  }
1059 
1060  NETCLASSPTR netclass = GetNetClass();
1061 
1062  if( netclass )
1063  {
1064  aList.push_back( MSG_PANEL_ITEM( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ) );
1065  aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ),
1066  ::CoordinateToString( netclass->GetClearance(), true ),
1067  DARKMAGENTA ) );
1068  aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ),
1069  ::CoordinateToString( netclass->GetTrackWidth(), true ),
1070  DARKMAGENTA ) );
1071  aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ),
1072  ::CoordinateToString( netclass->GetViaDiameter(), true ),
1073  DARKMAGENTA ) );
1074  aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"),
1075  ::CoordinateToString( netclass->GetViaDrill(), true ),
1076  DARKMAGENTA ) );
1077  }
1078 }
1079 
1080 void TRACK::GetMsgPanelInfoBase_Common( std::vector< MSG_PANEL_ITEM >& aList )
1081 {
1082  wxString msg;
1083 
1084  // Display Net Name
1085  if( GetBoard() )
1086  {
1087  NETINFO_ITEM* net = GetNet();
1088 
1089  if( net )
1090  msg = net->GetNetname();
1091  else
1092  msg = wxT( "<noname>" );
1093 
1094  aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
1095 
1096  // Display net code : (useful in test or debug)
1097  msg.Printf( wxT( "%d.%d" ), GetNetCode(), GetSubNet() );
1098  aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
1099  }
1100 
1101 #if defined(DEBUG)
1102 
1103  // Display the flags
1104  msg.Printf( wxT( "0x%08X" ), m_Flags );
1105  aList.push_back( MSG_PANEL_ITEM( wxT( "Flags" ), msg, BLUE ) );
1106 
1107 #if 0
1108  // Display start and end pointers:
1109  msg.Printf( wxT( "%p" ), start );
1110  aList.push_back( MSG_PANEL_ITEM( wxT( "start ptr" ), msg, BLUE ) );
1111  msg.Printf( wxT( "%p" ), end );
1112  aList.push_back( MSG_PANEL_ITEM( wxT( "end ptr" ), msg, BLUE ) );
1113  // Display this ptr
1114  msg.Printf( wxT( "%p" ), this );
1115  aList.push_back( MSG_PANEL_ITEM( wxT( "this" ), msg, BLUE ) );
1116 #endif
1117 
1118 #if 0
1119  // Display start and end positions:
1120  msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y );
1121  aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg, BLUE ) );
1122  msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y );
1123  aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg, BLUE ) );
1124 #endif
1125 
1126 #endif // defined(DEBUG)
1127 
1128  // Display the State member
1129  msg = wxT( ". . " );
1130 
1131  if( GetState( TRACK_LOCKED ) )
1132  msg[0] = 'L';
1133 
1134  if( GetState( TRACK_AR ) )
1135  msg[2] = 'A';
1136 
1137  aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
1138 }
1139 
1140 void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
1141 {
1142  wxString msg;
1143  BOARD* board = GetBoard();
1144 
1145  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Track" ), DARKCYAN ) );
1146 
1147  GetMsgPanelInfoBase_Common( aList );
1148 
1149  // Display layer
1150  if( board )
1151  msg = board->GetLayerName( m_Layer );
1152  else
1153  msg.Printf(wxT("%d"), m_Layer );
1154 
1155  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
1156 
1157  // Display width
1158  msg = ::CoordinateToString( (unsigned) m_Width );
1159 
1160  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
1161 
1162  // Display segment length
1163  msg = ::LengthDoubleToString( GetLength() );
1164  aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
1165 }
1166 
1167 void SEGZONE::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
1168 {
1169  wxString msg;
1170  BOARD* board = GetBoard();
1171 
1172  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Zone " ), DARKCYAN ) );
1173 
1174  GetMsgPanelInfoBase_Common( aList );
1175 
1176  // Display layer
1177  if( board )
1178  msg = board->GetLayerName( m_Layer );
1179  else
1180  msg.Printf( wxT( "%d" ), m_Layer );
1181 
1182  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
1183 
1184  // Display width
1185  msg = ::CoordinateToString( (unsigned) m_Width );
1186 
1187  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) );
1188 
1189  // Display segment length
1190  msg = ::LengthDoubleToString( GetLength() );
1191  aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) );
1192 }
1193 
1194 void VIA::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
1195 {
1196  wxString msg;
1197  BOARD* board = GetBoard();
1198 
1199  switch( GetViaType() )
1200  {
1201  default:
1202  case VIA_NOT_DEFINED:
1203  msg = wxT( "???" ); // Not used yet, does not exist currently
1204  break;
1205 
1206  case VIA_MICROVIA:
1207  msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from
1208  // the near neighbor inner layer only
1209  break;
1210 
1211  case VIA_BLIND_BURIED:
1212  msg = _( "Blind/Buried Via" ); // from inner or external to inner
1213  // or external layer (no restriction)
1214  break;
1215 
1216  case VIA_THROUGH:
1217  msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
1218  break;
1219  }
1220 
1221  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
1222 
1223  GetMsgPanelInfoBase_Common( aList );
1224 
1225 
1226  // Display layer pair
1227  PCB_LAYER_ID top_layer, bottom_layer;
1228 
1229  LayerPair( &top_layer, &bottom_layer );
1230 
1231  if( board )
1232  msg = board->GetLayerName( top_layer ) + wxT( "/" )
1233  + board->GetLayerName( bottom_layer );
1234  else
1235  msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
1236 
1237  aList.push_back( MSG_PANEL_ITEM( _( "Layers" ), msg, BROWN ) );
1238 
1239  // Display width
1240  msg = ::CoordinateToString( (unsigned) m_Width );
1241 
1242  // Display diameter value:
1243  aList.push_back( MSG_PANEL_ITEM( _( "Diameter" ), msg, DARKCYAN ) );
1244 
1245  // Display drill value
1246  int drill_value = GetDrillValue();
1247 
1248  msg = ::CoordinateToString( drill_value );
1249 
1250  wxString title = _( "Drill" );
1251  title += wxT( " " );
1252 
1253  bool drl_specific = true;
1254 
1255  if( GetBoard() )
1256  {
1257  NETINFO_ITEM* net = GetNet();
1258  int drill_class_value = 0;
1259 
1260  if( net )
1261  {
1262  if( GetViaType() == VIA_MICROVIA )
1263  drill_class_value = net->GetMicroViaDrillSize();
1264  else
1265  drill_class_value = net->GetViaDrillSize();
1266  }
1267 
1268  drl_specific = drill_value != drill_class_value;
1269  }
1270 
1271 
1272  if( drl_specific )
1273  title += _( "(Specific)" );
1274  else
1275  title += _( "(NetClass)" );
1276 
1277  aList.push_back( MSG_PANEL_ITEM( title, msg, RED ) );
1278 }
1279 
1280 
1281 bool TRACK::HitTest( const wxPoint& aPosition ) const
1282 {
1283  return TestSegmentHit( aPosition, m_Start, m_End, m_Width / 2 );
1284 }
1285 
1286 bool VIA::HitTest( const wxPoint& aPosition ) const
1287 {
1288  int max_dist = m_Width / 2;
1289 
1290  // rel_pos is aPosition relative to m_Start (or the center of the via)
1291  wxPoint rel_pos = aPosition - m_Start;
1292  double dist = (double) rel_pos.x * rel_pos.x + (double) rel_pos.y * rel_pos.y;
1293  return dist <= (double) max_dist * max_dist;
1294 }
1295 
1296 
1297 bool TRACK::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
1298 {
1299  EDA_RECT arect = aRect;
1300  arect.Inflate( aAccuracy );
1301 
1302  if( aContained )
1303  /* Tracks are a special case:
1304  * they are considered inside the rect if one end is inside the rect */
1305  return arect.Contains( GetStart() ) || arect.Contains( GetEnd() );
1306  else
1307  return arect.Intersects( GetStart(), GetEnd() );
1308 }
1309 
1310 bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
1311 {
1312  EDA_RECT box;
1313  EDA_RECT arect = aRect;
1314  arect.Inflate( aAccuracy );
1315 
1316  box.SetOrigin( GetStart() );
1317  box.Inflate( GetWidth() / 2 );
1318 
1319  if( aContained )
1320  return arect.Contains( box );
1321  else
1322  return arect.Intersects( box );
1323 }
1324 
1325 
1326 VIA* TRACK::GetVia( const wxPoint& aPosition, PCB_LAYER_ID aLayer)
1327 {
1328  for( VIA* via = GetFirstVia( this ); via; via = GetFirstVia( via->Next() ) )
1329  {
1330  if( via->HitTest( aPosition ) &&
1331  !via->GetState( BUSY | IS_DELETED ) &&
1332  ((aLayer == UNDEFINED_LAYER) || (via->IsOnLayer( aLayer ))) )
1333  return via;
1334  }
1335 
1336  return NULL;
1337 }
1338 
1339 
1340 VIA* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LSET aLayerMask )
1341 {
1342  for( VIA* via = GetFirstVia( this, aEndTrace ); via; via = GetFirstVia( via->Next() ) )
1343  {
1344  if( via->HitTest( aPosition ) &&
1345  !via->GetState( BUSY | IS_DELETED ) &&
1346  ( aLayerMask & via->GetLayerSet() ).any()
1347  )
1348  {
1349  return via;
1350  }
1351  }
1352 
1353  return NULL;
1354 }
1355 
1356 
1357 TRACK* TRACK::GetTrack( TRACK* aStartTrace, TRACK* aEndTrace, ENDPOINT_T aEndPoint,
1358  bool aSameNetOnly, bool aSequential )
1359 {
1360  const wxPoint& position = GetEndPoint( aEndPoint );
1361  LSET refLayers = GetLayerSet();
1362  TRACK* previousSegment;
1363  TRACK* nextSegment;
1364 
1365  if( aSequential )
1366  {
1367  // Simple sequential search: from aStartTrace forward to aEndTrace
1368  previousSegment = NULL;
1369  nextSegment = aStartTrace;
1370  }
1371  else
1372  {
1373  /* Local bidirectional search: from this backward to aStartTrace
1374  * AND forward to aEndTrace. The idea is that nearest segments
1375  * are found (on average) faster in this way. In fact same-net
1376  * segments are almost guaranteed to be found faster, in a global
1377  * search, since they are grouped together in the track list */
1378  previousSegment = this;
1379  nextSegment = this;
1380  }
1381 
1382  while( nextSegment || previousSegment )
1383  {
1384  // Terminate the search in the direction if the netcode mis-matches
1385  if( aSameNetOnly )
1386  {
1387  if( nextSegment && (nextSegment->GetNetCode() != GetNetCode()) )
1388  nextSegment = NULL;
1389  if( previousSegment && (previousSegment->GetNetCode() != GetNetCode()) )
1390  previousSegment = NULL;
1391  }
1392 
1393  if( nextSegment )
1394  {
1395  if ( (nextSegment != this) &&
1396  !nextSegment->GetState( BUSY | IS_DELETED ) &&
1397  ( refLayers & nextSegment->GetLayerSet() ).any() )
1398  {
1399  if( (position == nextSegment->m_Start) ||
1400  (position == nextSegment->m_End) )
1401  return nextSegment;
1402  }
1403 
1404  // Keep looking forward
1405  if( nextSegment == aEndTrace )
1406  nextSegment = NULL;
1407  else
1408  nextSegment = nextSegment->Next();
1409  }
1410 
1411  // Same as above, looking back. During sequential search this branch is inactive
1412  if( previousSegment )
1413  {
1414  if( (previousSegment != this) &&
1415  !previousSegment->GetState( BUSY | IS_DELETED ) &&
1416  ( refLayers & previousSegment->GetLayerSet() ).any()
1417  )
1418  {
1419  if( (position == previousSegment->m_Start) ||
1420  (position == previousSegment->m_End) )
1421  return previousSegment;
1422  }
1423 
1424  if( previousSegment == aStartTrace )
1425  previousSegment = NULL;
1426  else
1427  previousSegment = previousSegment->Back();
1428  }
1429  }
1430 
1431  return NULL;
1432 }
1433 
1434 
1435 int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
1436 {
1437  TRACK* Track, * via, * segm, * TrackListEnd;
1438  int NbEnds, ii, ok = 0;
1439  LSET layerMask;
1440 
1441  if( aCount <= 1 )
1442  {
1443  *aStartTrace = *aEndTrace = this;
1444  return 1;
1445  }
1446 
1447  // Calculation of the limit analysis.
1448  *aStartTrace = *aEndTrace = NULL;
1449  TrackListEnd = Track = this;
1450  ii = 0;
1451 
1452  for( ; ( Track != NULL ) && ( ii < aCount ); ii++, Track = Track->Next() )
1453  {
1454  TrackListEnd = Track;
1455  Track->m_Param = 0;
1456  }
1457 
1458  // Calculate the extremes.
1459  NbEnds = 0;
1460  Track = this;
1461  ii = 0;
1462 
1463  for( ; ( Track != NULL ) && ( ii < aCount ); ii++, Track = Track->Next() )
1464  {
1465  if( Track->Type() == PCB_VIA_T )
1466  continue;
1467 
1468  layerMask = Track->GetLayerSet();
1469  via = GetVia( TrackListEnd, Track->m_Start, layerMask );
1470 
1471  if( via )
1472  {
1473  layerMask |= via->GetLayerSet();
1474  via->SetState( BUSY, true );
1475  }
1476 
1477  Track->SetState( BUSY, true );
1478  segm = ::GetTrack( this, TrackListEnd, Track->m_Start, layerMask );
1479  Track->SetState( BUSY, false );
1480 
1481  if( via )
1482  via->SetState( BUSY, false );
1483 
1484  if( segm == NULL )
1485  {
1486  switch( NbEnds )
1487  {
1488  case 0:
1489  *aStartTrace = Track; NbEnds++;
1490  break;
1491 
1492  case 1:
1493  int BeginPad, EndPad;
1494  *aEndTrace = Track;
1495 
1496  // Swap ox, oy with fx, fy
1497  BeginPad = Track->GetState( BEGIN_ONPAD );
1498  EndPad = Track->GetState( END_ONPAD );
1499 
1500  Track->SetState( BEGIN_ONPAD | END_ONPAD, false );
1501 
1502  if( BeginPad )
1503  Track->SetState( END_ONPAD, true );
1504 
1505  if( EndPad )
1506  Track->SetState( BEGIN_ONPAD, true );
1507 
1508  std::swap( Track->m_Start, Track->m_End );
1509  std::swap( Track->start, Track->end );
1510  ok = 1;
1511  return ok;
1512  }
1513  }
1514 
1515  layerMask = Track->GetLayerSet();
1516  via = GetVia( TrackListEnd, Track->m_End, layerMask );
1517 
1518  if( via )
1519  {
1520  layerMask |= via->GetLayerSet();
1521  via->SetState( BUSY, true );
1522  }
1523 
1524  Track->SetState( BUSY, true );
1525  segm = ::GetTrack( this, TrackListEnd, Track->m_End, layerMask );
1526  Track->SetState( BUSY, false );
1527 
1528  if( via )
1529  via->SetState( BUSY, false );
1530 
1531  if( segm == NULL )
1532  {
1533  switch( NbEnds )
1534  {
1535  case 0:
1536  int BeginPad, EndPad;
1537  *aStartTrace = Track;
1538  NbEnds++;
1539 
1540  // Swap ox, oy with fx, fy
1541  BeginPad = Track->GetState( BEGIN_ONPAD );
1542  EndPad = Track->GetState( END_ONPAD );
1543 
1544  Track->SetState( BEGIN_ONPAD | END_ONPAD, false );
1545 
1546  if( BeginPad )
1547  Track->SetState( END_ONPAD, true );
1548 
1549  if( EndPad )
1550  Track->SetState( BEGIN_ONPAD, true );
1551 
1552  std::swap( Track->m_Start, Track->m_End );
1553  std::swap( Track->start, Track->end );
1554  break;
1555 
1556  case 1:
1557  *aEndTrace = Track;
1558  ok = 1;
1559  return ok;
1560  }
1561  }
1562  }
1563 
1564  return ok;
1565 }
1566 
1567 
1569 {
1570  wxString text;
1571  wxString netname;
1572  NETINFO_ITEM* net;
1573  BOARD* board = GetBoard();
1574 
1575  // deleting tracks requires all the information we can get to
1576  // disambiguate all the choices under the cursor!
1577  if( board )
1578  {
1579  net = GetNet();
1580 
1581  if( net )
1582  netname = net->GetNetname();
1583  else
1584  netname = _("Not found");
1585  }
1586  else
1587  {
1588  wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) );
1589  netname = wxT( "???" );
1590  }
1591 
1592  text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ),
1593  GetChars( ShowWidth() ), GetChars( netname ),
1596 
1597  return text;
1598 }
1599 
1600 
1602 {
1603  return showtrack_xpm;
1604 }
1605 
1606 
1607 #if defined(DEBUG)
1608 
1609 wxString TRACK::ShowState( int stateBits )
1610 {
1611  wxString ret;
1612 
1613  if( stateBits & IS_LINKED )
1614  ret << wxT( " | IS_LINKED" );
1615 
1616  if( stateBits & TRACK_AR )
1617  ret << wxT( " | TRACK_AR" );
1618 
1619  if( stateBits & TRACK_LOCKED )
1620  ret << wxT( " | TRACK_LOCKED" );
1621 
1622  if( stateBits & IN_EDIT )
1623  ret << wxT( " | IN_EDIT" );
1624 
1625  if( stateBits & IS_DRAGGED )
1626  ret << wxT( " | IS_DRAGGED" );
1627 
1628  if( stateBits & DO_NOT_DRAW )
1629  ret << wxT( " | DO_NOT_DRAW" );
1630 
1631  if( stateBits & IS_DELETED )
1632  ret << wxT( " | IS_DELETED" );
1633 
1634  if( stateBits & BUSY )
1635  ret << wxT( " | BUSY" );
1636 
1637  if( stateBits & END_ONPAD )
1638  ret << wxT( " | END_ONPAD" );
1639 
1640  if( stateBits & BEGIN_ONPAD )
1641  ret << wxT( " | BEGIN_ONPAD" );
1642 
1643  if( stateBits & FLAG0 )
1644  ret << wxT( " | FLAG0" );
1645 
1646  if( stateBits & FLAG1 )
1647  ret << wxT( " | FLAG1" );
1648 
1649  return ret;
1650 }
1651 
1652 #endif
#define MIN_VIA_DRAW_SIZE
Definition: class_track.h:60
Definition: colors.h:57
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:639
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:110
wxString CoordinateToString(int aValue, bool aConvertToMils)
Function CoordinateToString is a helper to convert the integer coordinate aValue to a string in inche...
Definition: base_units.cpp:117
COLOR4D GetLayerColor(PCB_LAYER_ID aLayer) const
Function GetLayerColor gets a layer color for any valid layer, including non-copper ones...
#define FLAG1
Pcbnew: flag used in local computations.
Definition: base_struct.h:130
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
void DrawGraphicHaloText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1, COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf), PLOTTER *aPlotter)
Draw graphic text with a border, so that it can be read on different backgrounds. ...
Definition: drawtxt.cpp:176
to draw blind/buried vias
TRACK * GetTrack(TRACK *aStartTrace, TRACK *aEndTrace, ENDPOINT_T aEndPoint, bool aSameNetOnly, bool aSequential)
Function GetTrack returns the trace segment connected to the segment at aEndPoint from aStartTrace to...
bool IsNull()
Function IsNull returns true if segment length is zero.
TRACK * GetTrack(TRACK *aStartTrace, const TRACK *aEndTrace, const wxPoint &aPosition, LSET aLayerMask)
Function GetTrack is a helper function to locate a trace segment having an end point at aPosition on ...
Definition: class_track.cpp:68
bool IsElementVisible(GAL_LAYER_ID LAYER_aPCB) const
Function IsElementVisible tests whether a given element category is visible.
bool IsMoving() const
Definition: base_struct.h:218
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:111
static bool ShowClearance(DISPLAY_OPTIONS *aDisplOpts, const TRACK *aTrack)
Function ShowClearance tests to see if the clearance border is drawn on the given track...
Definition: class_track.cpp:55
wxPoint m_Start
Line start point.
Definition: class_track.h:339
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB...
Definition: trigo.h:183
PNG memory record (file in memory).
Definition: bitmap_types.h:38
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:133
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
void SetViaType(VIATYPE_T aViaType)
Definition: class_track.h:447
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Function IsOnLayer tests to see if this object is on the given layer.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
Implementation of conversion functions that require both schematic and board internal units...
bool IsNew() const
Definition: base_struct.h:216
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:169
bool Contains(const wxPoint &aPoint) const
Function Contains.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
virtual void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Class BOARD to handle a board.
Definition: colors.h:61
STATUS_FLAGS IsPointOnEnds(const wxPoint &point, int min_dist=0)
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point...
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:445
int GetCopperLayerCount() const
Function GetCopperLayerCount.
static const int dist[10][10]
Definition: dist.cpp:57
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
virtual EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
to draw via holes (pad holes do not use this layer)
double RAD2DECIDEG(double rad)
Definition: trigo.h:196
void SetOrigin(const wxPoint &pos)
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:481
int GetEndSegments(int NbSegm, TRACK **StartTrack, TRACK **EndTrack)
Function GetEndSegments get the segments connected to the end point of the track. ...
DLIST< SEGZONE > m_Zone
Definition: class_board.h:245
void GetMsgPanelInfo(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
COLOR4D GetVisibleElementColor(GAL_LAYER_ID LAYER_aPCB)
Function GetVisibleElementColor returns the color of a pcb visible element.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
VIA(BOARD_ITEM *aParent)
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
int GetState(int type) const
Definition: base_struct.h:237
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:833
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:132
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
TRACK * Back() const
Definition: class_track.h:99
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
const wxPoint & GetEnd() const
Definition: class_track.h:118
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
double m_Param
Definition: class_track.h:92
int m_Width
Thickness of track, or via diameter.
Definition: class_track.h:338
This file contains miscellaneous commonly used macros and functions.
ENDPOINT_T
Flag used in locate routines (from which endpoint work)
Definition: pcbnew.h:54
virtual void GetMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfoBase Display info about the track segment only, and does not calculate the fu...
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
#define THRESHOLD
const INSPECTOR_FUNC & INSPECTOR
Definition: base_struct.h:104
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:115
PCB_LAYER_ID m_Layer
const wxString & GetShortNetname() const
Function GetShortNetname.
VIA * GetVia(const wxPoint &aPosition, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Function GetVia finds the first VIA object at aPosition on aLayer starting at the trace...
bool m_DisplayPcbTrackFill
Definition: pcbstruct.h:71
PCB_LAYER_ID
A quick note on layer IDs:
virtual bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
double a
Alpha component.
Definition: color4d.h:284
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Class LSET is a set of PCB_LAYER_IDs.
Classes used in Pcbnew, CvPcb and GerbView.
VIATYPE_T GetViaType() const
Definition: class_track.h:446
#define MIN_TEXT_SIZE
Definition: drawtxt.h:43
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:271
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:41
Base window classes and related definitions.
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:584
#define IS_DELETED
Definition: base_struct.h:116
virtual bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
const wxPoint & GetStart() const
Definition: class_track.h:121
virtual void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
wxPoint m_End
Line end point.
Definition: class_track.h:340
to draw usual through hole vias
int m_Drill
Definition: class_track.h:492
void DrawShortNetname(EDA_DRAW_PANEL *panel, wxDC *aDC, GR_DRAWMODE aDrawMode, COLOR4D aBgColor)
Helper for drawing the short netname in tracks.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
const wxPoint & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: class_track.h:125
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
virtual LSET GetLayerSet() const
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
unsigned STATUS_FLAGS
Definition: base_struct.h:144
SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
PCB_LAYER_ID m_BottomLayer
The bottom layer of the via (the top layer is in m_Layer)
Definition: class_track.h:488
EDA_RECT * GetClipBox()
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
TRACK * GetEndNetCode(int NetCode)
wxString LengthDoubleToString(double aValue, bool aConvertToMils)
Function LengthDoubleToString is a helper to convert the double length aValue to a string in inches...
Definition: base_units.cpp:122
int m_DisplayZonesMode
Definition: pcbstruct.h:77
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:128
Definition: colors.h:60
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
Function SetLayerPair For a via m_Layer contains the top layer, the other layer is in m_BottomLayer...
class SEGZONE, a segment used to fill a zone area (segment on a copper layer)
Definition: typeinfo.h:109
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
TRACK * MarkTrace(TRACK *aTrace, int *aCount, double *aTraceLength, double *aInPackageLength, bool aReorder)
Function MarkTrace marks a chain of trace segments, connected to aTrace.
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in 1/10000 inches.
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
virtual wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:131
SEGZONE(BOARD_ITEM *aParent)
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetDrillDefault()
Function SetDrillDefault sets the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER...
Definition: class_track.h:475
#define TRACK_AR
Pcbnew: autorouted track.
Definition: base_struct.h:129
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
int GetNetCode() const
Function GetNetCode.
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
Definition: pcbstruct.h:74
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class NETINFO_ITEM handles the data for a net.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
wxString ShowWidth() const
Function ShowWidth returns the width of the track in displayable user units.
TRACK * GetBestInsertPoint(BOARD *aPcb)
Function GetBestInsertPoint searches the "best" insertion point within the track linked list...
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
TRACK * Next() const
Definition: class_track.h:98
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
const wxString & GetNetname() const
Function GetNetname.
void SetState(int type, int state)
Definition: base_struct.h:242
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
TRACK * GetStartNetCode(int NetCode)
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
void GetMsgPanelInfoBase_Common(std::vector< MSG_PANEL_ITEM > &aList)
Helper function for the common panel info.
int GetWidth() const
Definition: class_track.h:115
int GetSubNet() const
Function GetSubNet.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:791
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define ENDPOINT
Definition: base_struct.h:119
Class EDA_RECT handles the component boundary box.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
The common library.
int m_DisplayNetNamesMode
Definition: pcbstruct.h:78
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
virtual void GetMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfoBase Display info about the track segment only, and does not calculate the fu...
Definition: colors.h:49
int GetMicroViaDrillSize()
Function GetViaDrillSize returns the size of via drills used to route this net.
double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
Definition: class_track.h:171
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
This file is part of the common libary.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition: class_track.cpp:96
DLIST< TRACK > m_Track
Definition: class_board.h:244
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: colors.h:45
const wxString & GetNetname() const
Function GetNetname.
void * GetDisplayOptions()
Function GetDisplayOptions A way to pass info to draw functions.
Definition: draw_panel.cpp:182
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
Class VIEW.
Definition: view.h:58
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:142
SEARCH_RESULT
Definition: base_struct.h:68
bool GetGRForceBlackPenState(void)
Function GetGRForceBlackPenState.
Definition: gr_basic.cpp:281
int GetViaDrillSize()
Function GetViaDrillSize returns the size of via drills used to route this net.
Message panel definition file.
bool m_DisplayViaFill
Definition: pcbstruct.h:66
#define FORCE_SKETCH
Definition: pcbnew.h:68
BOARD_CONNECTED_ITEM * end
Definition: class_track.h:90
virtual void GetMsgPanelInfoBase(std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfoBase Display info about the track segment only, and does not calculate the fu...
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
BOARD_CONNECTED_ITEM * start
Definition: class_track.h:89
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:164
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:125
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
bool IsNetnameLayer(LAYER_NUM aLayer)
Function IsNetnameLayer tests whether a layer is a netname layer.
#define min(a, b)
Definition: auxiliary.h:85
#define STARTPOINT
Definition: base_struct.h:118
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
Function IsLayerVisible is a proxy function that calls the correspondent function in m_BoardSettings ...
Definition: class_board.h:440
bool IsDragging() const
Definition: base_struct.h:219
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62
VIA * GetFirstVia(TRACK *aTrk, const TRACK *aStopPoint=NULL)
Scan a track list for the first VIA o NULL if not found (or NULL passed)
Definition: class_track.h:497