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 
27 #include <fctsys.h>
28 #include <gr_basic.h>
29 #include <common.h>
30 #include <trigo.h>
31 #include <macros.h>
32 #include <pcb_screen.h>
33 #include <gr_text.h>
34 #include <pcb_base_frame.h>
35 #include <class_board.h>
36 #include <class_track.h>
37 #include <pcbnew.h>
38 #include <base_units.h>
39 #include <msgpanel.h>
40 #include <bitmaps.h>
41 #include <view/view.h>
42 #include <math/util.h> // for KiROUND
43 
49 static bool ShowClearance( const PCB_DISPLAY_OPTIONS& aDisplOpts, const TRACK* aTrack )
50 {
51  // maybe return true for tracks and vias, not for zone segments
52  return IsCopperLayer( aTrack->GetLayer() )
53  && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
55  && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
57  );
58 
59 }
60 
61 
62 TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
63  BOARD_CONNECTED_ITEM( aParent, idtype )
64 {
65  m_Width = Millimeter2iu( 0.2 );
66 }
67 
68 
70 {
71  return new TRACK( *this );
72 }
73 
74 
75 VIA::VIA( BOARD_ITEM* aParent ) : TRACK( aParent, PCB_VIA_T )
76 {
80 }
81 
82 
84 {
85  return new VIA( *this );
86 }
87 
88 
89 wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const
90 {
91  wxString format;
92  BOARD* board = GetBoard();
93 
94  switch( GetViaType() )
95  {
97  format = _( "Blind/Buried Via %s %s on %s - %s" );
98  break;
99  case VIATYPE::MICROVIA:
100  format = _( "Micro Via %s %s on %s - %s" );
101  break;
102  // else say nothing about normal (through) vias
103  default:
104  format = _( "Via %s %s on %s - %s" );
105  break;
106  }
107 
108  if( board )
109  {
110  // say which layers, only two for now
111  PCB_LAYER_ID topLayer;
112  PCB_LAYER_ID botLayer;
113  LayerPair( &topLayer, &botLayer );
114  return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
115  GetNetnameMsg(), board->GetLayerName( topLayer ), board->GetLayerName( botLayer ) );
116  }
117  else
118  {
119  return wxString::Format( format.GetData(), MessageTextFromValue( aUnits, m_Width ),
120  GetNetnameMsg(), wxT( "??" ), wxT( "??" ) );
121  }
122 }
123 
124 
126 {
127  return via_xpm;
128 }
129 
130 
132 {
133  // Currently tracks have no specific clearance parameter on a per track or per
134  // segment basis. The NETCLASS clearance is used.
135  return BOARD_CONNECTED_ITEM::GetClearance( aItem );
136 }
137 
138 
140 {
141  if( m_Drill > 0 ) // Use the specific value.
142  return m_Drill;
143 
144  // Use the default value from the Netclass
145  NETCLASSPTR netclass = GetNetClass();
146 
147  if( GetViaType() == VIATYPE::MICROVIA )
148  return netclass->GetuViaDrill();
149 
150  return netclass->GetViaDrill();
151 }
152 
153 
154 STATUS_FLAGS TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) const
155 {
156  STATUS_FLAGS result = 0;
157 
158  if( min_dist < 0 )
159  min_dist = m_Width / 2;
160 
161  if( min_dist == 0 )
162  {
163  if( m_Start == point )
164  result |= STARTPOINT;
165 
166  if( m_End == point )
167  result |= ENDPOINT;
168  }
169  else
170  {
171  double dist = GetLineLength( m_Start, point );
172 
173  if( min_dist >= KiROUND( dist ) )
174  result |= STARTPOINT;
175 
176  dist = GetLineLength( m_End, point );
177 
178  if( min_dist >= KiROUND( dist ) )
179  result |= ENDPOINT;
180  }
181 
182  return result;
183 }
184 
185 
187 {
188  // end of track is round, this is its radius, rounded up
189  int radius = ( m_Width + 1 ) / 2;
190  int ymax, xmax, ymin, xmin;
191 
192  if( Type() == PCB_VIA_T )
193  {
194  ymax = m_Start.y;
195  xmax = m_Start.x;
196 
197  ymin = m_Start.y;
198  xmin = m_Start.x;
199  }
200  else
201  {
202  ymax = std::max( m_Start.y, m_End.y );
203  xmax = std::max( m_Start.x, m_End.x );
204 
205  ymin = std::min( m_Start.y, m_End.y );
206  xmin = std::min( m_Start.x, m_End.x );
207  }
208 
209  ymax += radius;
210  xmax += radius;
211 
212  ymin -= radius;
213  xmin -= radius;
214 
215  // return a rectangle which is [pos,dim) in nature. therefore the +1
216  EDA_RECT ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
217 
218  return ret;
219 }
220 
221 
222 void TRACK::Rotate( const wxPoint& aRotCentre, double aAngle )
223 {
224  RotatePoint( &m_Start, aRotCentre, aAngle );
225  RotatePoint( &m_End, aRotCentre, aAngle );
226 }
227 
228 
229 void TRACK::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
230 {
231  if( aFlipLeftRight )
232  {
233  m_Start.x = aCentre.x - ( m_Start.x - aCentre.x );
234  m_End.x = aCentre.x - ( m_End.x - aCentre.x );
235  }
236  else
237  {
238  m_Start.y = aCentre.y - ( m_Start.y - aCentre.y );
239  m_End.y = aCentre.y - ( m_End.y - aCentre.y );
240  }
241 
242  int copperLayerCount = GetBoard()->GetCopperLayerCount();
243  SetLayer( FlipLayer( GetLayer(), copperLayerCount ) );
244 }
245 
246 
247 void VIA::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
248 {
249  if( aFlipLeftRight )
250  {
251  m_Start.x = aCentre.x - ( m_Start.x - aCentre.x );
252  m_End.x = aCentre.x - ( m_End.x - aCentre.x );
253  }
254  else
255  {
256  m_Start.y = aCentre.y - ( m_Start.y - aCentre.y );
257  m_End.y = aCentre.y - ( m_End.y - aCentre.y );
258  }
259 
260  if( GetViaType() != VIATYPE::THROUGH )
261  {
262  int copperLayerCount = GetBoard()->GetCopperLayerCount();
263  PCB_LAYER_ID top_layer;
264  PCB_LAYER_ID bottom_layer;
265  LayerPair( &top_layer, &bottom_layer );
266  top_layer = FlipLayer( top_layer, copperLayerCount );
267  bottom_layer = FlipLayer( bottom_layer, copperLayerCount );
268  SetLayerPair( top_layer, bottom_layer );
269  }
270 }
271 
272 
273 // see class_track.h
274 SEARCH_RESULT TRACK::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
275 {
276  KICAD_T stype = *scanTypes;
277 
278  // If caller wants to inspect my type
279  if( stype == Type() )
280  {
281  if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
282  return SEARCH_RESULT::QUIT;
283  }
284 
286 }
287 
288 
289 bool VIA::IsOnLayer( PCB_LAYER_ID layer_number ) const
290 {
291  PCB_LAYER_ID bottom_layer, top_layer;
292 
293  LayerPair( &top_layer, &bottom_layer );
294 
295  wxASSERT( top_layer <= bottom_layer );
296 
297  if( top_layer <= layer_number && layer_number <= bottom_layer )
298  return true;
299  else
300  return false;
301 }
302 
303 
305 {
306  if( GetViaType() == VIATYPE::THROUGH )
307  return LSET::AllCuMask();
308 
309  // VIA_BLIND_BURIED or VIA_MICRVIA:
310 
311  LSET layermask;
312 
313  wxASSERT( m_Layer <= m_BottomLayer );
314 
315  // PCB_LAYER_IDs are numbered from front to back, this is top to bottom.
316  for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id )
317  {
318  layermask.set( id );
319  }
320 
321  return layermask;
322 }
323 
324 
325 void VIA::SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer )
326 {
327 
328  m_Layer = aTopLayer;
329  m_BottomLayer = aBottomLayer;
330  SanitizeLayers();
331 }
332 
333 
335 {
336  m_Layer = aLayer;
337 }
338 
339 
341 {
342  m_BottomLayer = aLayer;
343 }
344 
345 
346 void VIA::LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const
347 {
348  PCB_LAYER_ID t_layer = F_Cu;
349  PCB_LAYER_ID b_layer = B_Cu;
350 
351  if( GetViaType() != VIATYPE::THROUGH )
352  {
353  b_layer = m_BottomLayer;
354  t_layer = m_Layer;
355 
356  if( b_layer < t_layer )
357  std::swap( b_layer, t_layer );
358  }
359 
360  if( top_layer )
361  *top_layer = t_layer;
362 
363  if( bottom_layer )
364  *bottom_layer = b_layer;
365 }
366 
367 
369 {
370  return m_Layer;
371 }
372 
373 
375 {
376  return m_BottomLayer;
377 }
378 
379 
381 {
382  if( GetViaType() == VIATYPE::THROUGH )
383  {
384  m_Layer = F_Cu;
386  }
387 
388  if( m_BottomLayer < m_Layer )
389  std::swap( m_BottomLayer, m_Layer );
390 }
391 
392 
393 void TRACK::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
394 {
395  BOARD* brd = GetBoard();
396  auto color = aFrame->Settings().Colors().GetLayerColor( m_Layer );
397 
398  if( !brd->IsLayerVisible( m_Layer ) || !brd->IsElementVisible( LAYER_TRACKS ) )
399  return;
400 
401  auto displ_opts = aFrame->GetDisplayOptions();
402 
403  color.a = 0.588;
404 
405  // Draw track as line if width <= 1pixel:
406  if( aDC->LogicalToDeviceXRel( m_Width ) <= 1 )
407  {
408  GRLine( nullptr, aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
409  return;
410  }
411 
412  if( !displ_opts.m_DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
413  {
414  GRCSegm( nullptr, aDC, m_Start + aOffset, m_End + aOffset, m_Width, color );
415  }
416  else
417  {
418  GRFillCSegm( nullptr, aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y,
419  m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
420  }
421 }
422 
423 
424 void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
425 {
426  // Show the track and its netname on different layers
427  aLayers[0] = GetLayer();
428  aLayers[1] = GetNetnameLayer( aLayers[0] );
429  aCount = 2;
430 }
431 
432 
433 unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
434 {
435  const int HIDE = std::numeric_limits<unsigned int>::max();
436 
437  if( !aView->IsLayerVisible( LAYER_TRACKS ) )
438  return HIDE;
439 
440  // Netnames will be shown only if zoom is appropriate
441  if( IsNetnameLayer( aLayer ) )
442  {
443  return ( Millimeter2iu( 4 ) / ( m_Width + 1 ) );
444  }
445 
446  // Other layers are shown without any conditions
447  return 0;
448 }
449 
450 
451 const BOX2I TRACK::ViewBBox() const
452 {
453  BOX2I bbox = GetBoundingBox();
454  bbox.Inflate( 2 * GetClearance() );
455  return bbox;
456 }
457 
458 
459 void VIA::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
460 {
461  int radius;
462  int fillvia = 0;
463  PCB_SCREEN* screen = aFrame->GetScreen();
464  auto& displ_opts = aFrame->GetDisplayOptions();
465  BOARD* brd = GetBoard();
466  COLOR4D color = aFrame->Settings().Colors().GetItemColor(
467  LAYER_VIAS + static_cast<int>( GetViaType() ) );
468 
469  if( displ_opts.m_DisplayViaFill == FILLED )
470  fillvia = 1;
471 
472  if( !brd->IsElementVisible( LAYER_VIAS + static_cast<int>( GetViaType() ) ) )
473  return;
474 
475  // Only draw the via if at least one of the layers it crosses is being displayed
476  if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
477  return;
478 
479  color.a = 0.588;
480 
481  radius = m_Width >> 1;
482  // for small via size on screen (radius < 4 pixels) draw a simplified shape
483 
484  int radius_in_pixels = aDC->LogicalToDeviceXRel( radius );
485  bool fast_draw = false;
486 
487  // Vias are drawn as a filled circle or a double circle. The hole will be drawn later
488  int drill_radius = GetDrillValue() / 2;
489  int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 );
490 
491  if( radius_in_pixels < MIN_VIA_DRAW_SIZE )
492  {
493  fast_draw = true;
494  fillvia = false;
495  }
496 
497  if( fillvia )
498  {
499  GRFilledCircle( nullptr, aDC, m_Start + aOffset, radius, color );
500  }
501  else
502  {
503  GRCircle( nullptr, aDC, m_Start + aOffset, radius, 0, color );
504 
505  if ( fast_draw )
506  return;
507 
508  GRCircle( nullptr, aDC, m_Start + aOffset, inner_radius, 0, color );
509  }
510 
511  if( fillvia )
512  {
513  bool blackpenstate = false;
514 
515  if( screen->m_IsPrinting )
516  {
517  blackpenstate = GetGRForceBlackPenState();
518  GRForceBlackPen( false );
519  color = WHITE;
520  }
521  else
522  {
523  color = BLACK; // or DARKGRAY;
524  }
525 
526  // Draw hole if the radius is > 1pixel.
527  if( aDC->LogicalToDeviceXRel( drill_radius ) > 1 )
528  GRFilledCircle( nullptr, aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y,
529  drill_radius, 0, color, color );
530 
531  if( screen->m_IsPrinting )
532  GRForceBlackPen( blackpenstate );
533  }
534  else
535  {
536  if( drill_radius < inner_radius ) // We can show the via hole
537  GRCircle( nullptr, aDC, m_Start + aOffset, drill_radius, 0, color );
538  }
539 
540  if( ShowClearance( displ_opts, this ) )
541  {
542  GRCircle( nullptr, aDC, m_Start + aOffset, radius + GetClearance(), 0, color );
543  }
544 
545  // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
546  // (so we can see 2 superimposed microvias ):
547  if( GetViaType() == VIATYPE::MICROVIA )
548  {
549  int ax, ay, bx, by;
550 
551  if( IsOnLayer( B_Cu ) )
552  {
553  ax = radius; ay = 0;
554  bx = drill_radius; by = 0;
555  }
556  else
557  {
558  ax = ay = (radius * 707) / 1000;
559  bx = by = (drill_radius * 707) / 1000;
560  }
561 
562  // lines '|' or '\'
563  GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
564  m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
565  GRLine( nullptr, aDC, m_Start.x + aOffset.x + bx, m_Start.y + aOffset.y + by,
566  m_Start.x + aOffset.x + ax, m_Start.y + aOffset.y + ay, 0, color );
567 
568  // lines - or '/'
569  GRLine( nullptr, aDC, m_Start.x + aOffset.x + ay, m_Start.y + aOffset.y - ax,
570  m_Start.x + aOffset.x + by, m_Start.y + aOffset.y - bx, 0, color );
571  GRLine( nullptr, aDC, m_Start.x + aOffset.x - by, m_Start.y + aOffset.y + bx,
572  m_Start.x + aOffset.x - ay, m_Start.y + aOffset.y + ax, 0, color );
573  }
574 
575  // for Buried Vias, draw a partial line : orient depending on layer pair
576  // (so we can see superimposed buried vias ):
578  {
579  int ax = 0, ay = radius, bx = 0, by = drill_radius;
580  PCB_LAYER_ID layer_top, layer_bottom;
581 
582  LayerPair( &layer_top, &layer_bottom );
583 
584  // lines for the top layer
585  RotatePoint( &ax, &ay, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
586  RotatePoint( &bx, &by, layer_top * 3600.0 / brd->GetCopperLayerCount( ) );
587  GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
588  m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
589 
590  // lines for the bottom layer
591  ax = 0; ay = radius; bx = 0; by = drill_radius;
592  RotatePoint( &ax, &ay, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
593  RotatePoint( &bx, &by, layer_bottom * 3600.0 / brd->GetCopperLayerCount( ) );
594  GRLine( nullptr, aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay,
595  m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color );
596  }
597 
598  // Display the short netname:
600  return;
601 
602  if( displ_opts.m_DisplayNetNamesMode == 0 || displ_opts.m_DisplayNetNamesMode == 1 )
603  return;
604 
605  NETINFO_ITEM* net = GetNet();
606 
607  if( net == NULL )
608  return;
609 
610  wxString text = UnescapeString( net->GetShortNetname() );
611  int len = text.Len();
612 
613  if( len > 0 )
614  {
615  // calculate a good size for the text
616  int tsize = m_Width / len;
617 
618  if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE )
619  {
620  tsize = (tsize * 7) / 10; // small reduction to give a better look, inside via
621 
622  GRHaloText( aDC, m_Start, color, WHITE, BLACK, text, 0, wxSize( tsize, tsize ),
623  GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize/7, false, false );
624  }
625  }
626 }
627 
628 
629 void VIA::ViewGetLayers( int aLayers[], int& aCount ) const
630 {
631  aLayers[0] = LAYER_VIAS_HOLES;
632  aLayers[1] = LAYER_VIAS_NETNAMES;
633  aCount = 3;
634 
635  // Just show it on common via & via holes layers
636  switch( GetViaType() )
637  {
638  case VIATYPE::THROUGH:
639  aLayers[2] = LAYER_VIA_THROUGH;
640  break;
641 
643  aLayers[2] = LAYER_VIA_BBLIND;
644  aLayers[3] = m_Layer;
645  aLayers[4] = m_BottomLayer;
646  aCount += 2;
647  break;
648 
649  case VIATYPE::MICROVIA:
650  aLayers[2] = LAYER_VIA_MICROVIA;
651  break;
652 
653  default:
654  aLayers[2] = LAYER_GP_OVERLAY;
655  wxASSERT( false );
656  break;
657  }
658 }
659 
660 
661 unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
662 {
663  constexpr unsigned int HIDE = std::numeric_limits<unsigned int>::max();
664 
665  // Netnames will be shown only if zoom is appropriate
666  if( IsNetnameLayer( aLayer ) )
667  return m_Width == 0 ? HIDE : ( Millimeter2iu( 10 ) / m_Width );
668 
669 
670  BOARD* board = GetBoard();
671 
672  // Only draw the via if at least one of the layers it crosses is being displayed
673  if( board && ( board->GetVisibleLayers() & GetLayerSet() ).any()
674  && aView->IsLayerVisible( LAYER_VIAS ) )
675  {
676  switch( m_ViaType )
677  {
678  case VIATYPE::THROUGH:
679  if( !aView->IsLayerVisible( LAYER_VIA_THROUGH ) )
680  return HIDE;
681 
682  break;
683 
685  if( !aView->IsLayerVisible( LAYER_VIA_BBLIND ) )
686  return HIDE;
687 
688  break;
689 
690  case VIATYPE::MICROVIA:
691  if( !aView->IsLayerVisible( LAYER_VIA_MICROVIA ) )
692  return HIDE;
693 
694  break;
695 
696  default:
697  break;
698  }
699 
700  return 0;
701  }
702 
703  return HIDE;
704 }
705 
706 
707 // see class_track.h
708 void TRACK::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
709 {
710  wxString msg;
711  BOARD* board = GetBoard();
712 
713  // Display basic infos
714  GetMsgPanelInfoBase( aUnits, aList );
715 
716  // Display full track length (in Pcbnew)
717  if( board )
718  {
719  int count;
720  double trackLen;
721  double lenPadToDie;
722 
723  std::tie( count, trackLen, lenPadToDie ) = board->GetTrackLength( *this );
724 
725  msg = MessageTextFromValue( aUnits, trackLen );
726  aList.emplace_back( _( "Length" ), msg, DARKCYAN );
727 
728  if( lenPadToDie != 0 )
729  {
730  msg = MessageTextFromValue( aUnits, trackLen + lenPadToDie );
731  aList.emplace_back( _( "Full Length" ), msg, DARKCYAN );
732 
733  msg = MessageTextFromValue( aUnits, lenPadToDie, true );
734  aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN );
735  }
736  }
737 
738  NETCLASSPTR netclass = GetNetClass();
739 
740  if( netclass )
741  {
742  aList.emplace_back( _( "NC Name" ), netclass->GetName(), DARKMAGENTA );
743 
744  msg = MessageTextFromValue( aUnits, netclass->GetClearance(), true );
745  aList.emplace_back( _( "NC Clearance" ), msg, DARKMAGENTA );
746 
747  msg = MessageTextFromValue( aUnits, netclass->GetTrackWidth(), true );
748  aList.emplace_back( _( "NC Width" ), msg, DARKMAGENTA );
749 
750  msg = MessageTextFromValue( aUnits, netclass->GetViaDiameter(), true );
751  aList.emplace_back( _( "NC Via Size" ), msg, DARKMAGENTA );
752 
753  msg = MessageTextFromValue( aUnits, netclass->GetViaDrill(), true );
754  aList.emplace_back( _( "NC Via Drill"), msg, DARKMAGENTA );
755  }
756 }
757 
758 void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
759 {
760  wxString msg;
761 
762  // Display Net Name
763  if( GetBoard() )
764  {
765  NETINFO_ITEM* net = GetNet();
766 
767  if( net )
768  msg = UnescapeString( net->GetNetname() );
769  else
770  msg = wxT( "<no name>" );
771 
772  aList.emplace_back( _( "NetName" ), msg, RED );
773 
774  // Display net code : (useful in test or debug)
775  msg.Printf( wxT( "%d" ), GetNetCode() );
776  aList.emplace_back( _( "NetCode" ), msg, RED );
777  }
778 
779 #if defined(DEBUG)
780 
781  // Display the flags
782  msg.Printf( wxT( "0x%08X" ), m_Flags );
783  aList.emplace_back( wxT( "Flags" ), msg, BLUE );
784 
785 #if 0
786  // Display start and end pointers:
787  msg.Printf( wxT( "%p" ), start );
788  aList.push_back( MSG_PANEL_ITEM( wxT( "start ptr" ), msg, BLUE ) );
789  msg.Printf( wxT( "%p" ), end );
790  aList.push_back( MSG_PANEL_ITEM( wxT( "end ptr" ), msg, BLUE ) );
791  // Display this ptr
792  msg.Printf( wxT( "%p" ), this );
793  aList.push_back( MSG_PANEL_ITEM( wxT( "this" ), msg, BLUE ) );
794 #endif
795 
796 #if 0
797  // Display start and end positions:
798  msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y );
799  aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg, BLUE ) );
800  msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y );
801  aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg, BLUE ) );
802 #endif
803 
804 #endif // defined(DEBUG)
805 
806  // Display the State member
807  msg = wxT( ". . " );
808 
809  if( GetState( TRACK_LOCKED ) )
810  msg[0] = 'L';
811 
812  if( GetState( TRACK_AR ) )
813  msg[2] = 'A';
814 
815  aList.emplace_back( _( "Status" ), msg, MAGENTA );
816 }
817 
818 
819 void TRACK::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
820 {
821  wxString msg;
822  BOARD* board = GetBoard();
823 
824  aList.emplace_back( _( "Type" ), _( "Track" ), DARKCYAN );
825 
826  GetMsgPanelInfoBase_Common( aUnits, aList );
827 
828  // Display layer
829  if( board )
830  msg = board->GetLayerName( m_Layer );
831  else
832  msg.Printf(wxT("%d"), m_Layer );
833 
834  aList.emplace_back( _( "Layer" ), msg, BROWN );
835 
836  // Display width
837  msg = MessageTextFromValue( aUnits, m_Width, true );
838 
839  aList.emplace_back( _( "Width" ), msg, DARKCYAN );
840 
841  // Display segment length
842  msg = ::MessageTextFromValue( aUnits, GetLength() );
843  aList.emplace_back( _( "Segment Length" ), msg, DARKCYAN );
844 }
845 
846 
847 void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList )
848 {
849  wxString msg;
850  BOARD* board = GetBoard();
851 
852  switch( GetViaType() )
853  {
854  default:
856  msg = wxT( "???" ); // Not used yet, does not exist currently
857  break;
858 
859  case VIATYPE::MICROVIA:
860  msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from
861  // the near neighbor inner layer only
862  break;
863 
865  msg = _( "Blind/Buried Via" ); // from inner or external to inner
866  // or external layer (no restriction)
867  break;
868 
869  case VIATYPE::THROUGH:
870  msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only )
871  break;
872  }
873 
874  aList.emplace_back( _( "Type" ), msg, DARKCYAN );
875 
876  GetMsgPanelInfoBase_Common( aUnits, aList );
877 
878 
879  // Display layer pair
880  PCB_LAYER_ID top_layer, bottom_layer;
881 
882  LayerPair( &top_layer, &bottom_layer );
883 
884  if( board )
885  msg = board->GetLayerName( top_layer ) + wxT( "/" )
886  + board->GetLayerName( bottom_layer );
887  else
888  msg.Printf( wxT( "%d/%d" ), top_layer, bottom_layer );
889 
890  aList.emplace_back( _( "Layers" ), msg, BROWN );
891 
892  // Display width
893  msg = MessageTextFromValue( aUnits, m_Width, true );
894 
895  // Display diameter value:
896  aList.emplace_back( _( "Diameter" ), msg, DARKCYAN );
897 
898  // Display drill value
899  msg = MessageTextFromValue( aUnits, GetDrillValue() );
900 
901  wxString title = _( "Drill" );
902  title += wxT( " " );
903 
904  bool drl_specific = true;
905 
906  if( GetBoard() )
907  {
908  NETINFO_ITEM* net = GetNet();
909  int drill_class_value = 0;
910 
911  if( net )
912  {
913  if( GetViaType() == VIATYPE::MICROVIA )
914  drill_class_value = net->GetMicroViaDrillSize();
915  else
916  drill_class_value = net->GetViaDrillSize();
917  }
918 
919  drl_specific = GetDrillValue() != drill_class_value;
920  }
921 
922 
923  if( drl_specific )
924  title += _( "(Specific)" );
925  else
926  title += _( "(NetClass)" );
927 
928  aList.emplace_back( title, msg, RED );
929 }
930 
931 
932 bool TRACK::HitTest( const wxPoint& aPosition, int aAccuracy ) const
933 {
934  return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) );
935 }
936 
937 
938 bool VIA::HitTest( const wxPoint& aPosition, int aAccuracy ) const
939 {
940  int max_dist = aAccuracy + ( m_Width / 2 );
941 
942  // rel_pos is aPosition relative to m_Start (or the center of the via)
943  wxPoint rel_pos = aPosition - m_Start;
944  double dist = (double) rel_pos.x * rel_pos.x + (double) rel_pos.y * rel_pos.y;
945  return dist <= (double) max_dist * max_dist;
946 }
947 
948 
949 bool TRACK::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
950 {
951  EDA_RECT arect = aRect;
952  arect.Inflate( aAccuracy );
953 
954  if( aContained )
955  /* Tracks are a special case:
956  * they are considered inside the rect if one end is inside the rect */
957  return arect.Contains( GetStart() ) || arect.Contains( GetEnd() );
958  else
959  return arect.Intersects( GetStart(), GetEnd() );
960 }
961 
962 
963 bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
964 {
965  EDA_RECT box;
966  EDA_RECT arect = aRect;
967  arect.Inflate( aAccuracy );
968 
969  box.SetOrigin( GetStart() );
970  box.Inflate( GetWidth() / 2 );
971 
972  if( aContained )
973  {
974  return arect.Contains( box );
975  }
976  else
977  {
978  return arect.IntersectsCircle( GetStart(), GetWidth() / 2 );
979  }
980 }
981 
982 
983 wxString TRACK::GetSelectMenuText( EDA_UNITS aUnits ) const
984 {
985  return wxString::Format( _("Track %s %s on %s, length: %s" ),
986  MessageTextFromValue( aUnits, m_Width ),
987  GetNetnameMsg(),
988  GetLayerName(),
989  MessageTextFromValue( aUnits, GetLength() ) );
990 }
991 
992 
994 {
995  return add_tracks_xpm;
996 }
997 
999 {
1000  assert( aImage->Type() == PCB_TRACE_T );
1001 
1002  std::swap( *((TRACK*) this), *((TRACK*) aImage) );
1003 }
1004 
1005 void VIA::SwapData( BOARD_ITEM* aImage )
1006 {
1007  assert( aImage->Type() == PCB_VIA_T );
1008 
1009  std::swap( *((VIA*) this), *((VIA*) aImage) );
1010 }
1011 
1012 #if defined(DEBUG)
1013 
1014 wxString TRACK::ShowState( int stateBits )
1015 {
1016  wxString ret;
1017 
1018  if( stateBits & IS_LINKED )
1019  ret << wxT( " | IS_LINKED" );
1020 
1021  if( stateBits & TRACK_AR )
1022  ret << wxT( " | TRACK_AR" );
1023 
1024  if( stateBits & TRACK_LOCKED )
1025  ret << wxT( " | TRACK_LOCKED" );
1026 
1027  if( stateBits & IN_EDIT )
1028  ret << wxT( " | IN_EDIT" );
1029 
1030  if( stateBits & IS_DRAGGED )
1031  ret << wxT( " | IS_DRAGGED" );
1032 
1033  if( stateBits & DO_NOT_DRAW )
1034  ret << wxT( " | DO_NOT_DRAW" );
1035 
1036  if( stateBits & IS_DELETED )
1037  ret << wxT( " | IS_DELETED" );
1038 
1039  if( stateBits & BUSY )
1040  ret << wxT( " | BUSY" );
1041 
1042  if( stateBits & END_ONPAD )
1043  ret << wxT( " | END_ONPAD" );
1044 
1045  if( stateBits & BEGIN_ONPAD )
1046  ret << wxT( " | BEGIN_ONPAD" );
1047 
1048  if( stateBits & FLAG0 )
1049  ret << wxT( " | FLAG0" );
1050 
1051  if( stateBits & FLAG1 )
1052  ret << wxT( " | FLAG1" );
1053 
1054  return ret;
1055 }
1056 
1057 #endif
#define MIN_VIA_DRAW_SIZE
Definition: class_track.h:71
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:686
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
EDA_UNITS
Definition: common.h:72
#define FLAG1
Pcbnew: flag used in local computations.
Definition: base_struct.h:136
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...
to draw blind/buried vias
VIATYPE m_ViaType
Definition: class_track.h:389
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:118
int GetNetCode() const
Function GetNetCode.
wxPoint m_Start
Line start point.
Definition: class_track.h:254
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:202
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
static const int dist[10][10]
Definition: ar_matrix.cpp:326
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
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.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
NETINFO_ITEM * GetNet() const
Function GetNet Returns NET_INFO object for a given item.
const wxPoint & GetStart() const
Definition: class_track.h:109
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aUseMils)
Definition: base_units.cpp:127
Definition: colors.h:61
void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
bool IsMoving() const
Definition: base_struct.h:220
int color
Definition: DXF_plotter.cpp:61
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
virtual EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_track.cpp:69
to draw via holes (pad holes do not use this layer)
LSET GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
bool IntersectsCircle(const wxPoint &aCenter, const int aRadius) const
Function IntersectsCircle tests for a common area between a circle and this rectangle.
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &aOffset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
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:312
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:140
const BITMAP_OPAQUE add_tracks_xpm[1]
Definition: add_tracks.cpp:31
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
VIA(BOARD_ITEM *aParent)
Definition: class_track.cpp:75
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:619
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
bool Contains(const wxPoint &aPoint) const
Function Contains.
const wxString & GetShortNetname() const
Function GetShortNetname.
Definition: netinfo.h:239
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
bool IsDragging() const
Definition: base_struct.h:221
Definitions for tracks, vias and zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
Definition: class_track.h:139
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
int m_Width
Thickness of track, or via diameter.
Definition: class_track.h:253
This file contains miscellaneous commonly used macros and functions.
bool IsNew() const
Definition: base_struct.h:218
Classes used in Pcbnew, CvPcb and GerbView.
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:129
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
const INSPECTOR_FUNC & INSPECTOR
Definition: base_struct.h:108
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
PCB_LAYER_ID m_Layer
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor.
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
PCB_LAYER_ID
A quick note on layer IDs:
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
LSET is a set of PCB_LAYER_IDs.
#define NULL
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
void GRForceBlackPen(bool flagforce)
Function GRForceBlackPen.
Definition: gr_basic.cpp:201
virtual void GetMsgPanelInfoBase(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfoBase Display info about the track segment only, and does not calculate the fu...
void GRFillCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:415
#define IS_DELETED
Definition: base_struct.h:123
PCB_GENERAL_SETTINGS & Settings()
wxPoint m_End
Line end point.
Definition: class_track.h:255
to draw usual through hole vias
int m_Drill
Definition: class_track.h:391
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_track.cpp:89
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:233
unsigned STATUS_FLAGS
Definition: base_struct.h:156
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:387
unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Function ViewGetLOD() Returns the level of detail (LOD) of the item.
#define MIN_TEXT_SIZE
Definition: gr_text.h:43
#define TRACK_LOCKED
Pcbnew: track locked: protected from global deletion.
Definition: base_struct.h:134
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.
const BOX2I ViewBBox() const override
Function ViewBBox() returns the bounding box of the item covering all its layers.
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:230
virtual void SwapData(BOARD_ITEM *aImage) override
Swap data between aItem and aImage.
bool m_IsPrinting
Definition: base_screen.h:139
#define FLAG0
Pcbnew: flag used in local computations.
Definition: base_struct.h:137
void SetDrillDefault()
Function SetDrillDefault sets the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: class_track.h:372
COLORS_DESIGN_SETTINGS & Colors()
#define TRACK_AR
Pcbnew: autorouted track.
Definition: base_struct.h:135
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
wxString GetNetnameMsg() const
Function GetNetnameMsg.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Function IsElementVisible tests whether a given element category is visible.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301
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:449
void GRHaloText(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, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Draw graphic text with a border, so that it can be read on different backgrounds.
Definition: gr_text.cpp:188
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
int GetWidth() const
Definition: class_track.h:103
STATUS_FLAGS IsPointOnEnds(const wxPoint &point, int min_dist=0) const
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point,...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
#define _(s)
Definition: 3d_actions.cpp:31
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in internal units.
void SetTopLayer(PCB_LAYER_ID aLayer)
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:596
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184
int GetCopperLayerCount() const
Function GetCopperLayerCount.
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
VIATYPE GetViaType() const
Definition: class_track.h:336
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
The common library.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_LAYER_ID TopLayer() const
const wxPoint & GetEnd() const
Definition: class_track.h:106
Definition: colors.h:49
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
int GetMicroViaDrillSize()
Function GetViaDrillSize returns the size of via drills used to route this net.
Definition: netinfo.h:182
void SetBottomLayer(PCB_LAYER_ID aLayer)
static bool ShowClearance(const PCB_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:49
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void GetMsgPanelInfoBase_Common(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList)
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition: class_track.cpp:62
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
EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
VIEW.
Definition: view.h:61
SEARCH_RESULT
Definition: base_struct.h:54
bool GetGRForceBlackPenState(void)
Function GetGRForceBlackPenState.
Definition: gr_basic.cpp:211
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via,...
int GetViaDrillSize()
Function GetViaDrillSize returns the size of via drills used to route this net.
Definition: netinfo.h:172
std::tuple< int, double, double > GetTrackLength(const TRACK &aTrack) const
Returns data on the length and number of track segments connected to a given track.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
Message panel definition file.
void GetMsgPanelInfoBase(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfoBase Display info about the track segment only, and does not calculate the fu...
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.
void SetViaType(VIATYPE aViaType)
Definition: class_track.h:341
#define FORCE_SKETCH
Definition: pcbnew.h:44
PCB_LAYER_ID BottomLayer() const
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
Definition: netinfo.h:463
int GetState(int type) const
Definition: base_struct.h:239
void Flip(const wxPoint &aCentre, bool aFlipLeftRight) override
Function Flip Flip this object, i.e.
const BITMAP_OPAQUE via_xpm[1]
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
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.
Definition: class_track.cpp:83
bool IsNetnameLayer(LAYER_NUM aLayer)
Function IsNetnameLayer tests whether a layer is a netname layer.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible() Returns information about visibility of a particular layer.
Definition: view.h:416
void Print(PCB_BASE_FRAME *aFrame, wxDC *DC, const wxPoint &aOffset=ZeroOffset) override
Function Print BOARD_ITEMs have their own color information.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62