KiCad PCB EDA Suite
class_pad.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
31 #include <fctsys.h>
32 #include <PolyLine.h>
33 #include <trigo.h>
34 #include <wxstruct.h>
35 #include <macros.h>
36 #include <msgpanel.h>
37 #include <base_units.h>
38 #include <bitmaps.h>
39 
40 #include <pcbnew.h>
41 
42 #include <class_board.h>
43 #include <class_module.h>
45 #include <convert_to_biu.h>
47 
48 
55 static wxString LayerMaskDescribe( const BOARD* aBoard, LSET aMask );
56 
57 int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
58 
59 
60 D_PAD::D_PAD( MODULE* parent ) :
62 {
63  m_NumPadName = 0;
64  m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
65  m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
66  m_Orient = 0; // Pad rotation in 1/10 degrees.
67  m_LengthPadToDie = 0;
68 
69  if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
70  {
72  }
73 
74  SetShape( PAD_SHAPE_CIRCLE ); // Default pad shape is PAD_CIRCLE.
75  SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
76  m_Attribute = PAD_ATTRIB_STANDARD; // Default pad type is NORMAL (thru hole)
77  m_LocalClearance = 0;
81  // Parameters for round rect only:
82  m_padRoundRectRadiusScale = 0.25; // from IPC-7351C standard
83 
84  m_ZoneConnection = PAD_ZONE_CONN_INHERITED; // Use parent setting by default
85  m_ThermalWidth = 0; // Use parent setting by default
86  m_ThermalGap = 0; // Use parent setting by default
87 
88  // Set layers mask to default for a standard thru hole pad.
90 
91  SetSubRatsnest( 0 ); // used in ratsnest calculations
92 
93  m_boundingRadius = -1;
94 }
95 
96 
98 {
99  static LSET saved = LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask );
100  return saved;
101 }
102 
103 
105 {
106  static LSET saved( 3, F_Cu, F_Paste, F_Mask );
107  return saved;
108 }
109 
110 
112 {
113  static LSET saved( 2, F_Cu, F_Mask );
114  return saved;
115 }
116 
117 
119 {
120  static LSET saved = LSET::AllCuMask() | LSET( 2, B_Mask, F_Mask );
121  return saved;
122 }
123 
124 bool D_PAD::IsFlipped() const
125 {
126  if( GetParent() && GetParent()->GetLayer() == B_Cu )
127  return true;
128  return false;
129 }
130 
132 {
133  int x, y;
134  int radius;
135 
136  switch( GetShape() )
137  {
138  case PAD_SHAPE_CIRCLE:
139  radius = m_Size.x / 2;
140  break;
141 
142  case PAD_SHAPE_OVAL:
143  radius = std::max( m_Size.x, m_Size.y ) / 2;
144  break;
145 
146  case PAD_SHAPE_RECT:
147  radius = 1 + KiROUND( EuclideanNorm( m_Size ) / 2 );
148  break;
149 
150  case PAD_SHAPE_TRAPEZOID:
151  x = m_Size.x + std::abs( m_DeltaSize.y ); // Remember: m_DeltaSize.y is the m_Size.x change
152  y = m_Size.y + std::abs( m_DeltaSize.x ); // Remember: m_DeltaSize.x is the m_Size.y change
153  radius = 1 + KiROUND( hypot( x, y ) / 2 );
154  break;
155 
156  case PAD_SHAPE_ROUNDRECT:
157  radius = GetRoundRectCornerRadius();
158  x = m_Size.x >> 1;
159  y = m_Size.y >> 1;
160  radius += 1 + KiROUND( EuclideanNorm( wxSize( x - radius, y - radius )));
161  break;
162 
163  default:
164  radius = 0;
165  }
166 
167  return radius;
168 }
169 
170 
171 int D_PAD::GetRoundRectCornerRadius( const wxSize& aSize ) const
172 {
173  // radius of rounded corners, usually 25% of shorter pad edge for now
174  int r = aSize.x > aSize.y ? aSize.y : aSize.x;
175  r = int( r * m_padRoundRectRadiusScale );
176 
177  return r;
178 }
179 
180 
182 {
183  EDA_RECT area;
184  wxPoint quadrant1, quadrant2, quadrant3, quadrant4;
185  int x, y, dx, dy;
186 
187  switch( GetShape() )
188  {
189  case PAD_SHAPE_CIRCLE:
190  area.SetOrigin( m_Pos );
191  area.Inflate( m_Size.x / 2 );
192  break;
193 
194  case PAD_SHAPE_OVAL:
195  // Calculate the position of each rounded ent
196  quadrant1.x = m_Size.x/2;
197  quadrant1.y = 0;
198  quadrant2.x = 0;
199  quadrant2.y = m_Size.y/2;
200 
201  RotatePoint( &quadrant1, m_Orient );
202  RotatePoint( &quadrant2, m_Orient );
203 
204  // Calculate the max position of each end, relative to the pad position
205  // (the min position is symetrical)
206  dx = std::max( std::abs( quadrant1.x ) , std::abs( quadrant2.x ) );
207  dy = std::max( std::abs( quadrant1.y ) , std::abs( quadrant2.y ) );
208 
209  // Set the bbox
210  area.SetOrigin( m_Pos );
211  area.Inflate( dx, dy );
212  break;
213 
214  case PAD_SHAPE_RECT:
215  case PAD_SHAPE_ROUNDRECT:
216  // Use two opposite corners and track their rotation
217  // (use symmetry for other points)
218  quadrant1.x = m_Size.x/2;
219  quadrant1.y = m_Size.y/2;
220  quadrant2.x = -m_Size.x/2;
221  quadrant2.y = m_Size.y/2;
222 
223  RotatePoint( &quadrant1, m_Orient );
224  RotatePoint( &quadrant2, m_Orient );
225  dx = std::max( std::abs( quadrant1.x ) , std::abs( quadrant2.x ) );
226  dy = std::max( std::abs( quadrant1.y ) , std::abs( quadrant2.y ) );
227 
228  // Set the bbox
229  area.SetOrigin( m_Pos );
230  area.Inflate( dx, dy );
231  break;
232 
233  case PAD_SHAPE_TRAPEZOID:
234  //Use the four corners and track their rotation
235  // (Trapezoids will not be symmetric)
236  quadrant1.x = (m_Size.x + m_DeltaSize.y)/2;
237  quadrant1.y = (m_Size.y - m_DeltaSize.x)/2;
238  quadrant2.x = -(m_Size.x + m_DeltaSize.y)/2;
239  quadrant2.y = (m_Size.y + m_DeltaSize.x)/2;
240  quadrant3.x = -(m_Size.x - m_DeltaSize.y)/2;
241  quadrant3.y = -(m_Size.y + m_DeltaSize.x)/2;
242  quadrant4.x = (m_Size.x - m_DeltaSize.y)/2;
243  quadrant4.y = -(m_Size.y - m_DeltaSize.x)/2;
244 
245  RotatePoint( &quadrant1, m_Orient );
246  RotatePoint( &quadrant2, m_Orient );
247  RotatePoint( &quadrant3, m_Orient );
248  RotatePoint( &quadrant4, m_Orient );
249 
250  x = std::min( quadrant1.x, std::min( quadrant2.x, std::min( quadrant3.x, quadrant4.x) ) );
251  y = std::min( quadrant1.y, std::min( quadrant2.y, std::min( quadrant3.y, quadrant4.y) ) );
252  dx = std::max( quadrant1.x, std::max( quadrant2.x, std::max( quadrant3.x, quadrant4.x) ) );
253  dy = std::max( quadrant1.y, std::max( quadrant2.y, std::max( quadrant3.y, quadrant4.y) ) );
254  area.SetOrigin( m_Pos.x+x, m_Pos.y+y );
255  area.SetSize( dx-x, dy-y );
256  break;
257 
258  default:
259  break;
260  }
261 
262  return area;
263 }
264 
265 
267 {
268  MODULE* module = (MODULE*) m_Parent;
269 
270  m_Pos = m_Pos0;
271 
272  if( module == NULL )
273  return;
274 
275  double angle = module->GetOrientation();
276 
277  RotatePoint( &m_Pos.x, &m_Pos.y, angle );
278  m_Pos += module->GetPosition();
279 }
280 
281 
283 {
284  MODULE* module = (MODULE*) m_Parent;
285 
286  if( module == NULL )
287  {
288  m_Pos0 = m_Pos;
289  return;
290  }
291 
292  m_Pos0 = m_Pos - module->GetPosition();
293  RotatePoint( &m_Pos0.x, &m_Pos0.y, -module->GetOrientation() );
294 }
295 
296 
297 void D_PAD::SetAttribute( PAD_ATTR_T aAttribute )
298 {
299  m_Attribute = aAttribute;
300 
301  if( aAttribute == PAD_ATTRIB_SMD )
302  m_Drill = wxSize( 0, 0 );
303 }
304 
305 
306 void D_PAD::SetOrientation( double aAngle )
307 {
308  NORMALIZE_ANGLE_POS( aAngle );
309  m_Orient = aAngle;
310 }
311 
312 
313 void D_PAD::Flip( const wxPoint& aCentre )
314 {
315  int y = GetPosition().y;
316  MIRROR( y, aCentre.y ); // invert about x axis.
317  SetY( y );
318 
319  MIRROR( m_Pos0.y, 0 );
320  MIRROR( m_Offset.y, 0 );
321  MIRROR( m_DeltaSize.y, 0 );
322 
324 
325  // flip pads layers
326  // PADS items are currently on all copper layers, or
327  // currently, only on Front or Back layers.
328  // So the copper layers count is not taken in account
330 
331  // m_boundingRadius = -1; the shape has not been changed
332 }
333 
334 
336 {
337  // Parameters stored in config are only significant parameters
338  // for a template.
339  // So not all parameters are stored, just few.
340  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrill" ),
341  &m_Drill.x,
342  Millimeter2iu( 0.6 ),
343  Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ),
344  NULL, MM_PER_IU ) );
345 
346  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadDrillOvalY" ),
347  &m_Drill.y,
348  Millimeter2iu( 0.6 ),
349  Millimeter2iu( 0.1 ), Millimeter2iu( 10.0 ),
350  NULL, MM_PER_IU ) );
351 
352  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeH" ),
353  &m_Size.x,
354  Millimeter2iu( 1.4 ),
355  Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
356  NULL, MM_PER_IU ) );
357 
358  aResult->push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "PadSizeV" ),
359  &m_Size.y,
360  Millimeter2iu( 1.4 ),
361  Millimeter2iu( 0.1 ), Millimeter2iu( 20.0 ),
362  NULL, MM_PER_IU ) );
363 }
364 
365 
366 // Returns the position of the pad.
368 {
369  if( m_Offset.x == 0 && m_Offset.y == 0 )
370  return m_Pos;
371 
372  wxPoint loc_offset = m_Offset;
373 
374  RotatePoint( &loc_offset, m_Orient );
375 
376  wxPoint shape_pos = m_Pos + loc_offset;
377 
378  return shape_pos;
379 }
380 
381 
382 wxString D_PAD::GetPadName() const
383 {
384  wxString name;
385 
386  StringPadName( name );
387  return name;
388 }
389 
390 
391 void D_PAD::StringPadName( wxString& text ) const
392 {
393  text.Empty();
394 
395  for( int ii = 0; ii < PADNAMEZ && m_Padname[ii]; ii++ )
396  {
397  // m_Padname is 8 bit KiCad font junk, do not sign extend
398  text.Append( (unsigned char) m_Padname[ii] );
399  }
400 }
401 
402 
403 // Change pad name
404 void D_PAD::SetPadName( const wxString& name )
405 {
406  int ii, len;
407 
408  len = name.Length();
409 
410  if( len > PADNAMEZ )
411  len = PADNAMEZ;
412 
413  // m_Padname[] is not UTF8, it is an 8 bit character that matches the KiCad font,
414  // so only copy the lower 8 bits of each character.
415 
416  for( ii = 0; ii < len; ii++ )
417  m_Padname[ii] = (char) name.GetChar( ii );
418 
419  for( ii = len; ii < PADNAMEZ; ii++ )
420  m_Padname[ii] = '\0';
421 }
422 
423 
424 bool D_PAD::IncrementPadName( bool aSkipUnconnectable, bool aFillSequenceGaps )
425 {
426  bool skip = aSkipUnconnectable && ( GetAttribute() == PAD_ATTRIB_HOLE_NOT_PLATED );
427 
428  if( !skip )
429  SetPadName( GetParent()->GetNextPadName( aFillSequenceGaps ) );
430 
431  return !skip;
432 }
433 
434 
435 void D_PAD::CopyNetlistSettings( D_PAD* aPad, bool aCopyLocalSettings )
436 {
437  // Don't do anything foolish like trying to copy to yourself.
438  wxCHECK_RET( aPad != NULL && aPad != this, wxT( "Cannot copy to NULL or yourself." ) );
439 
440  aPad->SetNetCode( GetNetCode() );
441 
442  if( aCopyLocalSettings )
443  {
450  aPad->SetThermalGap( m_ThermalGap );
451  }
452 }
453 
454 
456 {
457  // A pad can have specific clearance parameters that
458  // overrides its NETCLASS clearance value
459  int clearance = m_LocalClearance;
460 
461  if( clearance == 0 )
462  {
463  // If local clearance is 0, use the parent footprint clearance value
464  if( GetParent() && GetParent()->GetLocalClearance() )
465  clearance = GetParent()->GetLocalClearance();
466  }
467 
468  if( clearance == 0 ) // If the parent footprint clearance value = 0, use NETCLASS value
469  return BOARD_CONNECTED_ITEM::GetClearance( aItem );
470 
471  // We have a specific clearance.
472  // if aItem, return the biggest clearance
473  if( aItem )
474  {
475  int hisClearance = aItem->GetClearance();
476  return std::max( hisClearance, clearance );
477  }
478 
479  // Return the specific clearance.
480  return clearance;
481 }
482 
483 
484 // Mask margins handling:
485 
487 {
488  int margin = m_LocalSolderMaskMargin;
489  MODULE* module = GetParent();
490 
491  if( module )
492  {
493  if( margin == 0 )
494  {
495  if( module->GetLocalSolderMaskMargin() )
496  margin = module->GetLocalSolderMaskMargin();
497  }
498 
499  if( margin == 0 )
500  {
501  BOARD* brd = GetBoard();
502  margin = brd->GetDesignSettings().m_SolderMaskMargin;
503  }
504  }
505 
506  // ensure mask have a size always >= 0
507  if( margin < 0 )
508  {
509  int minsize = -std::min( m_Size.x, m_Size.y ) / 2;
510 
511  if( margin < minsize )
512  margin = minsize;
513  }
514 
515  return margin;
516 }
517 
518 
520 {
521  int margin = m_LocalSolderPasteMargin;
522  double mratio = m_LocalSolderPasteMarginRatio;
523  MODULE* module = GetParent();
524 
525  if( module )
526  {
527  if( margin == 0 )
528  margin = module->GetLocalSolderPasteMargin();
529 
530  BOARD * brd = GetBoard();
531 
532  if( margin == 0 )
533  margin = brd->GetDesignSettings().m_SolderPasteMargin;
534 
535  if( mratio == 0.0 )
536  mratio = module->GetLocalSolderPasteMarginRatio();
537 
538  if( mratio == 0.0 )
539  {
541  }
542  }
543 
544  wxSize pad_margin;
545  pad_margin.x = margin + KiROUND( m_Size.x * mratio );
546  pad_margin.y = margin + KiROUND( m_Size.y * mratio );
547 
548  // ensure mask have a size always >= 0
549  if( pad_margin.x < -m_Size.x / 2 )
550  pad_margin.x = -m_Size.x / 2;
551 
552  if( pad_margin.y < -m_Size.y / 2 )
553  pad_margin.y = -m_Size.y / 2;
554 
555  return pad_margin;
556 }
557 
558 
560 {
561  MODULE* module = GetParent();
562 
563  if( m_ZoneConnection == PAD_ZONE_CONN_INHERITED && module )
564  return module->GetZoneConnection();
565  else
566  return m_ZoneConnection;
567 }
568 
569 
571 {
572  MODULE* module = GetParent();
573 
574  if( m_ThermalWidth == 0 && module )
575  return module->GetThermalWidth();
576  else
577  return m_ThermalWidth;
578 }
579 
580 
582 {
583  MODULE* module = GetParent();
584 
585  if( m_ThermalGap == 0 && module )
586  return module->GetThermalGap();
587  else
588  return m_ThermalGap;
589 }
590 
591 
592 void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
593 {
594  MODULE* module;
595  wxString Line;
596  BOARD* board;
597 
598  module = (MODULE*) m_Parent;
599 
600  if( module )
601  {
602  wxString msg = module->GetReference();
603  aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), msg, DARKCYAN ) );
604  StringPadName( Line );
605  aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) );
606  }
607 
608  aList.push_back( MSG_PANEL_ITEM( _( "Net" ), GetNetname(), DARKCYAN ) );
609 
610  /* For test and debug only: display m_physical_connexion and
611  * m_logical_connexion */
612 #if 1 // Used only to debug connectivity calculations
613  Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), GetZoneSubNet() );
614  aList.push_back( MSG_PANEL_ITEM( wxT( "L-P-Z" ), Line, DARKGREEN ) );
615 #endif
616 
617  board = GetBoard();
618 
619  aList.push_back( MSG_PANEL_ITEM( _( "Layer" ),
620  LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) );
621 
622  aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) );
623 
624  Line = ::CoordinateToString( m_Size.x );
625  aList.push_back( MSG_PANEL_ITEM( _( "Width" ), Line, RED ) );
626 
627  Line = ::CoordinateToString( m_Size.y );
628  aList.push_back( MSG_PANEL_ITEM( _( "Height" ), Line, RED ) );
629 
630  Line = ::CoordinateToString( (unsigned) m_Drill.x );
631 
633  {
634  aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), Line, RED ) );
635  }
636  else
637  {
638  Line = ::CoordinateToString( (unsigned) m_Drill.x );
639  wxString msg;
640  msg = ::CoordinateToString( (unsigned) m_Drill.y );
641  Line += wxT( "/" ) + msg;
642  aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), Line, RED ) );
643  }
644 
645  double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
646 
647  if( module_orient_degrees != 0.0 )
648  Line.Printf( wxT( "%3.1f(+%3.1f)" ),
649  GetOrientationDegrees() - module_orient_degrees,
650  module_orient_degrees );
651  else
652  Line.Printf( wxT( "%3.1f" ), GetOrientationDegrees() );
653 
654  aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), Line, LIGHTBLUE ) );
655 
656  Line = ::CoordinateToString( m_Pos.x ) + wxT( ", " ) + ::CoordinateToString( m_Pos.y );
657  aList.push_back( MSG_PANEL_ITEM( _( "Position" ), Line, LIGHTBLUE ) );
658 
659  if( GetPadToDieLength() )
660  {
662  aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), Line, CYAN ) );
663  }
664 }
665 
666 
668  wxPoint& aEndPoint, int& aWidth ) const
669 {
670  // calculates the start point, end point and width
671  // of an equivalent segment which have the same position and width as the hole
672  int delta_cx, delta_cy;
673 
674  wxSize halfsize = GetDrillSize();
675  halfsize.x /= 2;
676  halfsize.y /= 2;
677 
678  if( m_Drill.x > m_Drill.y ) // horizontal
679  {
680  delta_cx = halfsize.x - halfsize.y;
681  delta_cy = 0;
682  aWidth = m_Drill.y;
683  }
684  else // vertical
685  {
686  delta_cx = 0;
687  delta_cy = halfsize.y - halfsize.x;
688  aWidth = m_Drill.x;
689  }
690 
691  RotatePoint( &delta_cx, &delta_cy, m_Orient );
692 
693  aStartPoint.x = delta_cx;
694  aStartPoint.y = delta_cy;
695 
696  aEndPoint.x = - delta_cx;
697  aEndPoint.y = - delta_cy;
698 }
699 
700 bool D_PAD::HitTest( const wxPoint& aPosition ) const
701 {
702  int dx, dy;
703 
704  wxPoint shape_pos = ShapePos();
705 
706  wxPoint delta = aPosition - shape_pos;
707 
708  // first test: a test point must be inside a minimum sized bounding circle.
709  int radius = GetBoundingRadius();
710 
711  if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
712  return false;
713 
714  dx = m_Size.x >> 1; // dx also is the radius for rounded pads
715  dy = m_Size.y >> 1;
716 
717  switch( GetShape() )
718  {
719  case PAD_SHAPE_CIRCLE:
720  if( KiROUND( EuclideanNorm( delta ) ) <= dx )
721  return true;
722 
723  break;
724 
725  case PAD_SHAPE_TRAPEZOID:
726  {
727  wxPoint poly[4];
728  BuildPadPolygon( poly, wxSize(0,0), 0 );
729  RotatePoint( &delta, -m_Orient );
730  return TestPointInsidePolygon( poly, 4, delta );
731  }
732 
733  case PAD_SHAPE_OVAL:
734  {
735  RotatePoint( &delta, -m_Orient );
736  // An oval pad has the same shape as a segment with rounded ends
737  // After rotation, the test point is relative to an horizontal pad
738  int dist;
739  wxPoint offset;
740  if( dy > dx ) // shape is a vertical oval
741  {
742  offset.y = dy - dx;
743  dist = dx;
744  }
745  else //if( dy <= dx ) shape is an horizontal oval
746  {
747  offset.x = dy - dx;
748  dist = dy;
749  }
750  return TestSegmentHit( delta, - offset, offset, dist );
751  }
752  break;
753 
754  case PAD_SHAPE_RECT:
755  RotatePoint( &delta, -m_Orient );
756 
757  if( (abs( delta.x ) <= dx ) && (abs( delta.y ) <= dy) )
758  return true;
759 
760  break;
761 
762  case PAD_SHAPE_ROUNDRECT:
763  {
764  // Check for hit in polygon
765  SHAPE_POLY_SET outline;
766  const int segmentToCircleCount = 32;
768  GetRoundRectCornerRadius(), segmentToCircleCount );
769 
770  const SHAPE_LINE_CHAIN &poly = outline.COutline( 0 );
771  return TestPointInsidePolygon( (const wxPoint*)&poly.CPoint(0), poly.PointCount(), delta );
772  }
773  break;
774  }
775 
776  return false;
777 }
778 
779 
780 int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
781 {
782  int diff;
783 
784  if( ( diff = padref->GetShape() - padcmp->GetShape() ) != 0 )
785  return diff;
786 
787  if( ( diff = padref->GetDrillShape() - padcmp->GetDrillShape() ) != 0)
788  return diff;
789 
790  if( ( diff = padref->m_Drill.x - padcmp->m_Drill.x ) != 0 )
791  return diff;
792 
793  if( ( diff = padref->m_Drill.y - padcmp->m_Drill.y ) != 0 )
794  return diff;
795 
796  if( ( diff = padref->m_Size.x - padcmp->m_Size.x ) != 0 )
797  return diff;
798 
799  if( ( diff = padref->m_Size.y - padcmp->m_Size.y ) != 0 )
800  return diff;
801 
802  if( ( diff = padref->m_Offset.x - padcmp->m_Offset.x ) != 0 )
803  return diff;
804 
805  if( ( diff = padref->m_Offset.y - padcmp->m_Offset.y ) != 0 )
806  return diff;
807 
808  if( ( diff = padref->m_DeltaSize.x - padcmp->m_DeltaSize.x ) != 0 )
809  return diff;
810 
811  if( ( diff = padref->m_DeltaSize.y - padcmp->m_DeltaSize.y ) != 0 )
812  return diff;
813 
814 // TODO: test custom shapes
815 
816  // Dick: specctra_export needs this
817  // Lorenzo: gencad also needs it to implement padstacks!
818 
819 #if __cplusplus >= 201103L
820  long long d = padref->m_layerMask.to_ullong() - padcmp->m_layerMask.to_ullong();
821  if( d < 0 )
822  return -1;
823  else if( d > 0 )
824  return 1;
825 
826  return 0;
827 #else
828  // these strings are not typically constructed, since we don't get here often.
829  std::string s1 = padref->m_layerMask.to_string();
830  std::string s2 = padcmp->m_layerMask.to_string();
831  return s1.compare( s2 );
832 #endif
833 }
834 
835 
836 void D_PAD::Rotate( const wxPoint& aRotCentre, double aAngle )
837 {
838  RotatePoint( &m_Pos, aRotCentre, aAngle );
839 
840  m_Orient = NormalizeAngle360( m_Orient + aAngle );
841 
842  SetLocalCoord();
843 }
844 
845 
846 wxString D_PAD::ShowPadShape() const
847 {
848  switch( GetShape() )
849  {
850  case PAD_SHAPE_CIRCLE:
851  return _( "Circle" );
852 
853  case PAD_SHAPE_OVAL:
854  return _( "Oval" );
855 
856  case PAD_SHAPE_RECT:
857  return _( "Rect" );
858 
859  case PAD_SHAPE_TRAPEZOID:
860  return _( "Trap" );
861 
862  case PAD_SHAPE_ROUNDRECT:
863  return _( "Roundrect" );
864 
865  default:
866  return wxT( "???" );
867  }
868 }
869 
870 
871 wxString D_PAD::ShowPadAttr() const
872 {
873  switch( GetAttribute() )
874  {
875  case PAD_ATTRIB_STANDARD:
876  return _( "Std" );
877 
878  case PAD_ATTRIB_SMD:
879  return _( "SMD" );
880 
881  case PAD_ATTRIB_CONN:
882  return _( "Conn" );
883 
885  return _( "Not Plated" );
886 
887  default:
888  return wxT( "???" );
889  }
890 }
891 
892 
893 wxString D_PAD::GetSelectMenuText() const
894 {
895  wxString text;
896  wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) );
897  wxString padname( GetPadName() );
898 
899  if( padname.IsEmpty() )
900  {
901  text.Printf( _( "Pad on %s of %s" ),
902  GetChars( padlayers ),
903  GetChars(GetParent()->GetReference() ) );
904  }
905  else
906  {
907  text.Printf( _( "Pad %s on %s of %s" ),
908  GetChars(GetPadName() ), GetChars( padlayers ),
909  GetChars(GetParent()->GetReference() ) );
910  }
911 
912  return text;
913 }
914 
915 
917 {
918  return pad_xpm;
919 }
920 
921 
923 {
924  return new D_PAD( *this );
925 }
926 
927 
928 void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
929 {
930  aCount = 0;
931 
932  // These types of pads contain a hole
934  aLayers[aCount++] = LAYER_PADS_HOLES;
935 
936  if( IsOnLayer( F_Cu ) && IsOnLayer( B_Cu ) )
937  {
938  // Multi layer pad
939  aLayers[aCount++] = LAYER_PADS;
940  aLayers[aCount++] = LAYER_PADS_NETNAMES;
941  }
942  else if( IsOnLayer( F_Cu ) )
943  {
944  aLayers[aCount++] = LAYER_PAD_FR;
945  aLayers[aCount++] = LAYER_PAD_FR_NETNAMES;
946  }
947  else if( IsOnLayer( B_Cu ) )
948  {
949  aLayers[aCount++] = LAYER_PAD_BK;
950  aLayers[aCount++] = LAYER_PAD_BK_NETNAMES;
951  }
952 
953  // Check non-copper layers. This list should include all the layers that the
954  // footprint editor allows a pad to be placed on.
955  static const PCB_LAYER_ID layers_mech[] = { F_Mask, B_Mask, F_Paste, B_Paste,
957 
958  for( PCB_LAYER_ID each_layer : layers_mech )
959  {
960  if( IsOnLayer( each_layer ) )
961  aLayers[aCount++] = each_layer;
962  }
963 
964 #ifdef __WXDEBUG__
965  if( aCount == 0 ) // Should not occur
966  {
967  wxString msg;
968  msg.Printf( wxT( "footprint %s, pad %s: could not find valid layer for pad" ),
969  GetParent() ? GetParent()->GetReference() : "<null>",
970  GetPadName().IsEmpty() ? "(unnamed)" : GetPadName() );
971  wxLogWarning( msg );
972  }
973 #endif
974 }
975 
976 
977 unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
978 {
979  // Netnames will be shown only if zoom is appropriate
980  if( IsNetnameLayer( aLayer ) )
981  {
982  int divisor = std::max( m_Size.x, m_Size.y );
983 
984  // Pad sizes can be zero briefly when someone is typing a number like "0.5"
985  // in the pad properties dialog
986  if( divisor == 0 )
987  return UINT_MAX;
988 
989  return ( Millimeter2iu( 100 ) / divisor );
990  }
991 
992  // Other layers are shown without any conditions
993  return 0;
994 }
995 
996 
997 const BOX2I D_PAD::ViewBBox() const
998 {
999  // Bounding box includes soldermask too
1000  int solderMaskMargin = GetSolderMaskMargin();
1001  VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
1002  EDA_RECT bbox = GetBoundingBox();
1003 
1004  // Look for the biggest possible bounding box
1005  int xMargin = std::max( solderMaskMargin, solderPasteMargin.x );
1006  int yMargin = std::max( solderMaskMargin, solderPasteMargin.y );
1007 
1008  return BOX2I( VECTOR2I( bbox.GetOrigin() ) - VECTOR2I( xMargin, yMargin ),
1009  VECTOR2I( bbox.GetSize() ) + VECTOR2I( 2 * xMargin, 2 * yMargin ) );
1010 }
1011 
1012 
1013 wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
1014 {
1015  // Try the single or no- layer case (easy)
1016  PCB_LAYER_ID layer = aMask.ExtractLayer();
1017 
1018  switch( (int) layer )
1019  {
1020  case UNSELECTED_LAYER:
1021  return _( "No layers" );
1022 
1023  case UNDEFINED_LAYER:
1024  break;
1025 
1026  default:
1027  return aBoard->GetLayerName( layer );
1028  }
1029 
1030  // Try to be smart and useful, starting with outer copper
1031  // (which are more important than internal ones)
1032  wxString layerInfo;
1033 
1034  if( aMask[F_Cu] )
1035  AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
1036 
1037  if( aMask[B_Cu] )
1038  AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
1039 
1040  if( ( aMask & LSET::InternalCuMask() ).any() )
1041  AccumulateDescription( layerInfo, _("Internal" ) );
1042 
1043  if( ( aMask & LSET::AllNonCuMask() ).any() )
1044  AccumulateDescription( layerInfo, _("Non-copper" ) );
1045 
1046  return layerInfo;
1047 }
1048 
1049 
1050 void D_PAD::ImportSettingsFromMaster( const D_PAD& aMasterPad )
1051 {
1052  SetShape( aMasterPad.GetShape() );
1053  SetLayerSet( aMasterPad.GetLayerSet() );
1054  SetAttribute( aMasterPad.GetAttribute() );
1055 
1056  // The pad orientation, for historical reasons is the
1057  // pad rotation + parent rotation.
1058  // So we have to manage this parent rotation
1059  double pad_rot = aMasterPad.GetOrientation();
1060 
1061  if( aMasterPad.GetParent() )
1062  pad_rot -= aMasterPad.GetParent()->GetOrientation();
1063 
1064  if( GetParent() )
1065  pad_rot += GetParent()->GetOrientation();
1066 
1067  SetOrientation( pad_rot );
1068 
1069  SetSize( aMasterPad.GetSize() );
1070  SetDelta( wxSize( 0, 0 ) );
1071  SetOffset( aMasterPad.GetOffset() );
1072  SetDrillSize( aMasterPad.GetDrillSize() );
1073  SetDrillShape( aMasterPad.GetDrillShape() );
1075 
1076  switch( aMasterPad.GetShape() )
1077  {
1078  case PAD_SHAPE_TRAPEZOID:
1079  SetDelta( aMasterPad.GetDelta() );
1080  break;
1081 
1082  case PAD_SHAPE_CIRCLE:
1083  // ensure size.y == size.x
1084  SetSize( wxSize( GetSize().x, GetSize().x ) );
1085  break;
1086 
1087  default:
1088  ;
1089  }
1090 
1091  switch( aMasterPad.GetAttribute() )
1092  {
1093  case PAD_ATTRIB_SMD:
1094  case PAD_ATTRIB_CONN:
1095  // These pads do not have hole (they are expected to be only on one
1096  // external copper layer)
1097  SetDrillSize( wxSize( 0, 0 ) );
1098  break;
1099 
1100  default:
1101  ;
1102  }
1103 }
int m_LocalClearance
Local clearance.
Definition: class_pad.h:659
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:104
int m_ThermalGap
Definition: class_pad.h:672
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
int m_LocalSolderMaskMargin
Local mask margins: when 0, the parent footprint design values are used.
Definition: class_pad.h:663
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Definition: class_pad.cpp:916
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
bool IncrementPadName(bool aSkipUnconnectable, bool aFillSequenceGaps)
Function IncrementPadName.
Definition: class_pad.cpp:424
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
static int m_PadSketchModePenSize
Pen size used to draw pads in sketch mode (mode used to print pads on silkscreen layer) ...
Definition: class_pad.h:83
int m_SolderMaskMargin
Solder mask margin.
double m_padRoundRectRadiusScale
scaling factor from smallest m_Size coord to corner radius, default 0.25
Definition: class_pad.h:622
A list of parameters type.
int m_boundingRadius
radius of the circle containing the pad shape
Definition: class_pad.h:592
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: class_pad.cpp:922
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:168
LSET FlipLayerMask(LSET aMask, int aCopperLayersCount)
Calculate the mask layer when flipping a footprint BACK and FRONT copper layers, mask, paste, solder layers are swapped internal layers are flipped only if the copper layers count is known.
Definition: lset.cpp:491
int GetThermalGap() const
Definition: class_module.h:183
static LSET StandardMask()
layer set for a through hole pad
Definition: class_pad.cpp:97
#define PADNAMEZ
Definition: class_pad.h:599
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: class_pad.cpp:893
PNG memory record (file in memory).
Definition: bitmap_types.h:38
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:238
bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
Definition: class_pad.cpp:700
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
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:63
int m_SolderPasteMargin
Solder paste margin absolute value.
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
Definition: class_pad.cpp:836
PAD_ATTR_T
Enum PAD_ATTR_T is the set of pad shapes, used with D_PAD::{Set,Get}Attribute() The double name is fo...
Definition: pad_shapes.h:56
int m_LocalSolderPasteMargin
Local solder paste margin absolute value.
Definition: class_pad.h:664
Implementation of conversion functions that require both schematic and board internal units...
static LSET UnplatedHoleMask()
layer set for a mechanical unplated through hole pad
Definition: class_pad.cpp:118
int GetLocalClearance() const
Definition: class_module.h:167
void BuildPadPolygon(wxPoint aCoord[4], wxSize aInflateValue, double aRotation) const
Function BuildPadPolygon Has meaning only for polygonal pads (trapezoid and rectangular) Build the Co...
static LSET SMDMask()
layer set for a SMD pad on Front layer
Definition: class_pad.cpp:104
int PointCount() const
Function PointCount()
int GetPadToDieLength() const
Definition: class_pad.h:241
Class BOARD to handle a board.
const wxPoint & GetPosition() const override
Definition: class_module.h:144
D_PAD(MODULE *parent)
Definition: class_pad.cpp:60
void TransformRoundRectToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, int aCircleToSegmentsCount)
Function TransformRoundRectToPolygon convert a rectangle with rounded corners to a polygon Convert ar...
int GetRoundRectCornerRadius() const
Function GetRoundRectCornerRadius Has meaning only for rounded rect pads.
Definition: class_pad.h:351
ZoneConnection
How pads are covered by copper in zone.
Definition: zones.h:55
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:662
wxSize m_Size
X and Y size ( relative to orient 0)
Definition: class_pad.h:618
MODULE * GetParent() const
Definition: class_pad.h:108
Smd pad, appears on the solder paste layer (default)
Definition: pad_shapes.h:59
static const int dist[10][10]
Definition: dist.cpp:57
void SetOrigin(const wxPoint &pos)
int boundingRadius() const
Function boundingRadius returns a calculated radius of a bounding circle for this pad...
Definition: class_pad.cpp:131
wxString ShowPadAttr() const
Function ShowPadAttr.
Definition: class_pad.cpp:871
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: class_pad.h:221
class D_PAD, a pad in a footprint
Definition: typeinfo.h:102
void SetSubRatsnest(int aSubRatsnest)
Definition: class_pad.h:475
void SetDrillSize(const wxSize &aSize)
Definition: class_pad.h:187
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
ZoneConnection GetZoneConnection() const
Definition: class_module.h:177
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:222
const wxSize & GetDrillSize() const
Definition: class_pad.h:188
void SetRoundRectRadiusRatio(double aRadiusScale)
has meaning only for rounded rect pads Set the scaling factor between the smaller Y or Y size and the...
Definition: class_pad.h:462
static wxString GetNextPadName(wxString aPadName)
Compute the 'next' pad number for autoincrement aPadName is the last pad name used.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590
PAD_SHAPE_T GetShape() const
Function GetShape.
Definition: class_pad.h:166
#define abs(a)
Definition: auxiliary.h:84
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
Configuration parameter - Integer Class with unit conversion.
smd pads, back layer
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:173
static const int delta[8][2]
Definition: solve.cpp:112
void SetLocalCoord()
Set relative coordinates.
Definition: class_pad.cpp:282
This file contains miscellaneous commonly used macros and functions.
wxUint32 m_NumPadName
Definition: class_pad.h:601
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
Definition: lset.cpp:578
const wxPoint & GetOrigin() const
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
class MODULE, a footprint
Definition: typeinfo.h:101
PCB_LAYER_ID
A quick note on layer IDs:
virtual const BOX2I ViewBBox() const override
Definition: class_pad.cpp:997
Class LSET is a set of PCB_LAYER_IDs.
bool TestPointInsidePolygon(const CPOLYGONS_LIST &aPolysList, int aIdxstart, int aIdxend, int aRefx, int aRefy)
Function TestPointInsidePolygon test if a point is inside or outside a polygon.
double GetOrientationDegrees() const
Definition: class_module.h:149
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589
void SetZoneConnection(ZoneConnection aType)
Definition: class_pad.h:309
int GetBoundingRadius() const
Function GetBoundingRadius returns the radius of a minimum sized circle which fully encloses this pad...
Definition: class_pad.h:428
double GetOrientation() const
Definition: class_module.h:148
Class SHAPE_POLY_SET.
Base window classes and related definitions.
int GetSubRatsnest() const
Function GetSubRatsnest.
Definition: class_pad.h:474
int GetSolderMaskMargin() const
Function GetSolderMaskMargin.
Definition: class_pad.cpp:486
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
int GetZoneSubNet() const
Function GetZoneSubNet.
static int Compare(const D_PAD *padref, const D_PAD *padcmp)
Function Compare compares two pads and return 0 if they are equal.
Definition: class_pad.cpp:780
multilayer pads, usually with holes
ZoneConnection GetZoneConnection() const
Definition: class_pad.cpp:559
LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_pad.h:235
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer given by aLayer.
Definition: colors.h:59
int GetThermalWidth() const
Definition: class_pad.cpp:570
int GetThermalGap() const
Definition: class_pad.cpp:581
static LSET InternalCuMask()
Function InternalCuMask() returns a complete set of internal copper layers, which is all Cu layers ex...
Definition: lset.cpp:599
void SetThermalWidth(int aWidth)
Definition: class_pad.h:312
const wxSize & GetSize() const
Definition: class_pad.h:182
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
void SetSize(const wxSize &aSize)
Definition: class_pad.h:181
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int m_ThermalWidth
Definition: class_pad.h:671
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Definition: class_pad.cpp:928
Definition: colors.h:60
void ImportSettingsFromMaster(const D_PAD &aMasterPad)
Imports the pad settings from aMasterPad.
Definition: class_pad.cpp:1050
virtual unsigned int ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Definition: class_pad.cpp:977
virtual int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const
Function GetClearance returns the clearance in 1/10000 inches.
int GetLocalSolderMaskMargin() const
Definition: class_module.h:164
void SetDrawCoord()
Set absolute coordinates.
Definition: class_pad.cpp:266
wxSize m_DeltaSize
delta on rectangular shapes
Definition: class_pad.h:645
Like smd, does not appear on the solder paste layer (default) note also has a special attribute in Ge...
Definition: pad_shapes.h:60
to draw pad holes (plated or not plated)
void SetAttribute(PAD_ATTR_T aAttribute)
Definition: class_pad.cpp:297
bool IsFlipped() const
Definition: class_pad.cpp:124
int GetLocalClearance() const
Definition: class_pad.h:246
void SetLocalClearance(int aClearance)
Definition: class_pad.h:247
int GetLocalSolderPasteMargin() const
Definition: class_module.h:170
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_pad.h:253
int GetNetCode() const
Function GetNetCode.
LSET m_layerMask
Bitwise layer :1= copper layer, 15= cmp, 2..14 = internal layers 16 .
Definition: class_pad.h:641
void AccumulateDescription(wxString &aDesc, const wxString &aItem)
Utility to build comma separated lists in messages.
Definition: macros.h:65
void SetSize(const wxSize &size)
void SetLayerSet(LSET aLayerMask)
Definition: class_pad.h:234
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void SetY(int y)
Definition: class_pad.h:172
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
smd pads, front layer
const wxString & GetNetname() const
Function GetNetname.
double GetRoundRectRadiusRatio() const
has meaning only for rounded rect pads
Definition: class_pad.h:450
void SetDrillShape(PAD_DRILL_SHAPE_T aDrillShape)
Definition: class_pad.h:218
wxPoint m_Pos0
Initial Pad position (i.e.
Definition: class_pad.h:647
void GetOblongDrillGeometry(wxPoint &aStartPoint, wxPoint &aEndPoint, int &aWidth) const
Function GetOblongDrillGeometry calculates the start point, end point and width of an equivalent segm...
Definition: class_pad.cpp:667
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
const wxString & GetReference() const
Function GetReference.
Definition: class_module.h:412
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_pad.h:244
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
Definition: class_pad.cpp:313
Class SHAPE_LINE_CHAIN.
int m_LengthPadToDie
Length net from pad to die, inside the package.
Definition: class_pad.h:654
wxString ShowPadShape() const
Function ShowPadShape.
Definition: class_pad.cpp:846
int GetSubNet() const
Function GetSubNet.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:214
Class EDA_RECT handles the component boundary box.
const wxSize & GetDelta() const
Definition: class_pad.h:185
Usual pad.
Definition: pad_shapes.h:58
wxSize GetSolderPasteMargin() const
Function GetSolderPasteMargin.
Definition: class_pad.cpp:519
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_pad.cpp:455
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:167
wxPoint ShapePos() const
Definition: class_pad.cpp:367
char m_Padname[PADNAMEZ]
Definition: class_pad.h:600
void SetPadName(const wxString &name)
Set the pad name (sometimes called pad number, although it can be an array ref like AA12 the pad name...
Definition: class_pad.cpp:404
const char * name
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:306
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
PAD_ATTR_T m_Attribute
PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN, PAD_ATTRIB_HOLE_NOT_PLATED.
Definition: class_pad.h:650
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_pad.h:250
static LSET ConnSMDMask()
layer set for a SMD pad on Front layer used for edge board connectors
Definition: class_pad.cpp:111
wxString GetPadName() const
Definition: class_pad.cpp:382
wxSize m_Drill
Drill diam (drill shape = PAD_CIRCLE) or drill size (shape = OVAL) for drill shape = PAD_CIRCLE...
Definition: class_pad.h:614
Module description (excepted pads)
double m_Orient
in 1/10 degrees
Definition: class_pad.h:652
double m_LocalSolderPasteMarginRatio
Local solder mask margin ratio value of pad size The final margin is the sum of these 2 values...
Definition: class_pad.h:666
wxPoint m_Offset
m_Offset is useful only for oblong and rect pads (it can be used for other shapes, but without any interest).
Definition: class_pad.h:639
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
void StringPadName(wxString &text) const
Definition: class_pad.cpp:391
double m_SolderPasteMarginRatio
Solder pask margin ratio value of pad size The final margin is the sum of these 2 values...
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Function IsOnLayer tests to see if this object is on the given layer.
Definition: class_pad.h:479
Message panel definition file.
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
const wxSize & GetSize() const
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
void SetThermalGap(int aGap)
Definition: class_pad.h:315
double GetOrientationDegrees() const
Definition: class_pad.h:215
void CopyNetlistSettings(D_PAD *aPad, bool aCopyLocalSettings)
Function CopyNetlistSettings copies the netlist settings to aPad, and the net name.
Definition: class_pad.cpp:435
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: class_pad.cpp:181
const wxPoint & GetOffset() const
Definition: class_pad.h:191
static wxString LayerMaskDescribe(const BOARD *aBoard, LSET aMask)
Helper function Return a string (to be shown to the user) describing a layer mask.
Definition: class_pad.cpp:1013
int GetThermalWidth() const
Definition: class_module.h:180
Additional netnames layers (not associated with a PCB layer)
ZoneConnection m_ZoneConnection
how the connection to zone is made: no connection, thermal relief ...
Definition: class_pad.h:669
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
T NormalizeAngle360(T Angle)
Normalize angle to be in the -360.0 .. 360.0:
Definition: trigo.h:202
bool IsNetnameLayer(LAYER_NUM aLayer)
Function IsNetnameLayer tests whether a layer is a netname layer.
#define min(a, b)
Definition: auxiliary.h:85
wxPoint m_Pos
pad Position on board
Definition: class_pad.h:605
void AppendConfigs(PARAM_CFG_ARRAY *aResult)
Function AppendConfigs appends to aResult the configuration setting accessors which will later allow ...
Definition: class_pad.cpp:335
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...
Definition: class_pad.cpp:592
Definition: colors.h:62