KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
pcb_table.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <pcb_edit_frame.h>
25#include <footprint.h>
26#include <pcb_table.h>
27#include <board.h>
31
32
33PCB_TABLE::PCB_TABLE( BOARD_ITEM* aParent, int aLineWidth ) :
35 m_strokeExternal( true ),
36 m_StrokeHeaderSeparator( true ),
37 m_borderStroke( aLineWidth, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
38 m_strokeRows( true ),
39 m_strokeColumns( true ),
40 m_separatorsStroke( aLineWidth, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
41 m_colCount( 0 )
42{
43}
44
45
47 BOARD_ITEM_CONTAINER( aTable )
48{
55
56 m_colCount = aTable.m_colCount;
57 m_colWidths = aTable.m_colWidths;
59
60 for( PCB_TABLECELL* src : aTable.m_cells )
61 AddCell( new PCB_TABLECELL( *src ) );
62}
63
64
66{
67 // We own our cells; delete them
68 for( PCB_TABLECELL* cell : m_cells )
69 delete cell;
70}
71
72
74{
75 wxCHECK_RET( aImage != nullptr && aImage->Type() == PCB_TABLE_T,
76 wxT( "Cannot swap data with invalid table." ) );
77
78 PCB_TABLE* table = static_cast<PCB_TABLE*>( aImage );
79
80 std::swap( m_layer, table->m_layer );
81 std::swap( m_isLocked, table->m_isLocked );
82
83 std::swap( m_strokeExternal, table->m_strokeExternal );
84 std::swap( m_StrokeHeaderSeparator, table->m_StrokeHeaderSeparator );
85 std::swap( m_borderStroke, table->m_borderStroke );
86 std::swap( m_strokeRows, table->m_strokeRows );
87 std::swap( m_strokeColumns, table->m_strokeColumns );
88 std::swap( m_separatorsStroke, table->m_separatorsStroke );
89
90 std::swap( m_colCount, table->m_colCount );
91 std::swap( m_colWidths, table->m_colWidths );
92 std::swap( m_rowHeights, table->m_rowHeights );
93
94 std::swap( m_cells, table->m_cells );
95
96 for( PCB_TABLECELL* cell : m_cells )
97 cell->SetParent( this );
98
99 for( PCB_TABLECELL* cell : table->m_cells )
100 cell->SetParent( table );
101}
102
103
105{
106 Move( aPos - GetPosition() );
107}
108
109
111{
112 return m_cells[0]->GetPosition();
113}
114
115
117{
118 VECTOR2I tableSize;
119
120 for( int ii = 0; ii < GetColCount(); ++ii )
121 tableSize.x += GetColWidth( ii );
122
123 for( int ii = 0; ii < GetRowCount(); ++ii )
124 tableSize.y += GetRowHeight( ii );
125
126 return GetPosition() + tableSize;
127}
128
129
131{
132 int y = GetPosition().y;
133
134 for( int row = 0; row < GetRowCount(); ++row )
135 {
136 int x = GetPosition().x;
137 int rowHeight = m_rowHeights[ row ];
138
139 for( int col = 0; col < GetColCount(); ++col )
140 {
141 int colWidth = m_colWidths[ col ];
142
143 PCB_TABLECELL* cell = GetCell( row, col );
144 VECTOR2I pos( x, y );
145
146 RotatePoint( pos, GetPosition(), cell->GetTextAngle() );
147
148 if( cell->GetPosition() != pos )
149 {
150 cell->SetPosition( pos );
151 cell->ClearRenderCache();
152 }
153
154 VECTOR2I end = VECTOR2I( x + colWidth, y + rowHeight );
155
156 if( cell->GetColSpan() > 1 || cell->GetRowSpan() > 1 )
157 {
158 for( int ii = col + 1; ii < col + cell->GetColSpan(); ++ii )
159 end.x += m_colWidths[ii];
160
161 for( int ii = row + 1; ii < row + cell->GetRowSpan(); ++ii )
162 end.y += m_rowHeights[ii];
163 }
164
166
167 if( cell->GetEnd() != end )
168 {
169 cell->SetEnd( end );
170 cell->ClearRenderCache();
171 }
172
173 x += colWidth;
174 }
175
176 y += rowHeight;
177 }
178}
179
180
181void PCB_TABLE::Move( const VECTOR2I& aMoveVector )
182{
183 for( PCB_TABLECELL* cell : m_cells )
184 cell->Move( aMoveVector );
185}
186
187
188void PCB_TABLE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
189{
190 if( GetCells().empty() )
191 return;
192
193 for( PCB_TABLECELL* cell : m_cells )
194 cell->Rotate( aRotCentre, aAngle );
195
196 Normalize();
197}
198
199
200void PCB_TABLE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
201{
202 for( PCB_TABLECELL* cell : m_cells )
203 cell->Flip( aCentre, aFlipDirection );
204
205 std::vector<PCB_TABLECELL*> oldCells = m_cells;
206 int rowOffset = 0;
207
208 for( int row = 0; row < GetRowCount(); ++row )
209 {
210 for( int col = 0; col < GetColCount(); ++col )
211 m_cells[ rowOffset + col ] = oldCells[ rowOffset + GetColCount() - 1 - col ];
212
213 rowOffset += GetColCount();
214 }
215
217 Normalize();
218}
219
220
221void PCB_TABLE::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const
222{
223 for( PCB_TABLECELL* cell : m_cells )
224 aFunction( cell );
225}
226
227
229{
230 // Note: a table with no cells is not allowed
231 BOX2I bbox = m_cells[0]->GetBoundingBox();
232
233 bbox.Merge( m_cells[ m_cells.size() - 1 ]->GetBoundingBox() );
234
235 return bbox;
236}
237
238
239void PCB_TABLE::DrawBorders( const std::function<void( const VECTOR2I& aPt1, const VECTOR2I& aPt2,
240 const STROKE_PARAMS& aStroke )>& aCallback ) const
241{
242 std::vector<VECTOR2I> topLeft = GetCell( 0, 0 )->GetCornersInSequence();
243 std::vector<VECTOR2I> bottomLeft = GetCell( GetRowCount() - 1, 0 )->GetCornersInSequence();
244 std::vector<VECTOR2I> topRight = GetCell( 0, GetColCount() - 1 )->GetCornersInSequence();
245 std::vector<VECTOR2I> bottomRight = GetCell( GetRowCount() - 1, GetColCount() - 1 )->GetCornersInSequence();
246 STROKE_PARAMS stroke;
247
248 for( int col = 0; col < GetColCount() - 1; ++col )
249 {
250 if( StrokeColumns() )
251 stroke = GetSeparatorsStroke();
252 else
253 continue;
254
255 for( int row = 0; row < GetRowCount(); ++row )
256 {
257 PCB_TABLECELL* cell = GetCell( row, col );
258
259 if( cell->GetColSpan() == 0 )
260 continue;
261
262 if( col + cell->GetColSpan() == GetColCount() )
263 continue;
264
265 std::vector<VECTOR2I> corners = cell->GetCornersInSequence();
266
267 if( corners.size() == 4 )
268 aCallback( corners[1], corners[2], stroke );
269 }
270 }
271
272 for( int row = 0; row < GetRowCount() - 1; ++row )
273 {
274 if( row == 0 && StrokeHeaderSeparator() )
275 stroke = GetBorderStroke();
276 else if( StrokeRows() )
277 stroke = GetSeparatorsStroke();
278 else
279 continue;
280
281 for( int col = 0; col < GetColCount(); ++col )
282 {
283 PCB_TABLECELL* cell = GetCell( row, col );
284
285 if( cell->GetRowSpan() == 0 )
286 continue;
287
288 if( row + cell->GetRowSpan() == GetRowCount() )
289 continue;
290
291 std::vector<VECTOR2I> corners = cell->GetCornersInSequence();
292
293 if( corners.size() == 4 )
294 aCallback( corners[2], corners[3], stroke );
295 }
296 }
297
298 if( StrokeExternal() && GetBorderStroke().GetWidth() >= 0 )
299 {
300 aCallback( topLeft[0], topRight[1], GetBorderStroke() );
301 aCallback( topRight[1], bottomRight[2], GetBorderStroke() );
302 aCallback( bottomRight[2], bottomLeft[3], GetBorderStroke() );
303 aCallback( bottomLeft[3], topLeft[0], GetBorderStroke() );
304 }
305}
306
307
308std::shared_ptr<SHAPE> PCB_TABLE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
309{
310 std::vector<VECTOR2I> topLeft = GetCell( 0, 0 )->GetCornersInSequence();
311 std::vector<VECTOR2I> bottomLeft = GetCell( GetRowCount() - 1, 0 )->GetCornersInSequence();
312 std::vector<VECTOR2I> topRight = GetCell( 0, GetColCount() - 1 )->GetCornersInSequence();
313 std::vector<VECTOR2I> bottomRight = GetCell( GetRowCount() - 1, GetColCount() - 1 )->GetCornersInSequence();
314
315 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
316
317 std::vector<VECTOR2I> pts;
318
319 pts.emplace_back( topLeft[3] );
320 pts.emplace_back( topRight[2] );
321 pts.emplace_back( bottomRight[2] );
322 pts.emplace_back( bottomLeft[3] );
323
324 shape->AddShape( new SHAPE_SIMPLE( pts ) );
325
327 [&shape]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
328 {
329 shape->AddShape( new SHAPE_SEGMENT( ptA, ptB, stroke.GetWidth() ) );
330 } );
331
332 return shape;
333}
334
335
337 int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
338 bool aIgnoreLineWidth ) const
339{
340 int gap = aClearance;
341
342 if( StrokeColumns() || StrokeRows() )
343 gap = std::max( gap, aClearance + GetSeparatorsStroke().GetWidth() / 2 );
344
346 gap = std::max( gap, aClearance + GetBorderStroke().GetWidth() / 2 );
347
348 for( PCB_TABLECELL* cell : m_cells )
349 cell->TransformShapeToPolygon( aBuffer, aLayer, gap, aMaxError, aErrorLoc, false );
350}
351
352
353INSPECT_RESULT PCB_TABLE::Visit( INSPECTOR aInspector, void* aTestData,
354 const std::vector<KICAD_T>& aScanTypes )
355{
356 for( KICAD_T scanType : aScanTypes )
357 {
358 if( scanType == PCB_TABLE_T )
359 {
360 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
361 return INSPECT_RESULT::QUIT;
362 }
363
364 if( scanType == PCB_TABLECELL_T )
365 {
366 for( PCB_TABLECELL* cell : m_cells )
367 {
368 if( INSPECT_RESULT::QUIT == aInspector( cell, (void*) this ) )
369 return INSPECT_RESULT::QUIT;
370 }
371 }
372 }
373
374 return INSPECT_RESULT::CONTINUE;
375}
376
377
378wxString PCB_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
379{
380 return wxString::Format( _( "%d Column Table" ), m_colCount );
381}
382
383
385{
386 return BITMAPS::table;
387}
388
389
390bool PCB_TABLE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
391{
392 BOX2I rect = GetBoundingBox();
393
394 rect.Inflate( aAccuracy );
395
396 return rect.Contains( aPosition );
397}
398
399
400bool PCB_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
401{
402 BOX2I rect = aRect;
403
404 rect.Inflate( aAccuracy );
405
406 if( aContained )
407 return rect.Contains( GetBoundingBox() );
408
409 return rect.Intersects( GetBoundingBox() );
410}
411
412
413void PCB_TABLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
414{
415 // Don't use GetShownText() here; we want to show the user the variable references
416 aList.emplace_back( _( "Table" ), wxString::Format( _( "%d Columns" ), m_colCount ) );
417}
418
419
420int PCB_TABLE::Compare( const PCB_TABLE* aTable, const PCB_TABLE* aOther )
421{
422 int diff;
423
424 if( ( diff = (int) aTable->GetCells().size() - (int) aOther->GetCells().size() ) != 0 )
425 return diff;
426
427 if( ( diff = aTable->GetColCount() - aOther->GetColCount() ) != 0 )
428 return diff;
429
430 for( int col = 0; col < aTable->GetColCount(); ++col )
431 {
432 if( ( diff = aTable->GetColWidth( col ) - aOther->GetColWidth( col ) ) != 0 )
433 return diff;
434 }
435
436 for( int row = 0; row < aTable->GetRowCount(); ++row )
437 {
438 if( ( diff = aTable->GetRowHeight( row ) - aOther->GetRowHeight( row ) ) != 0 )
439 return diff;
440 }
441
442 for( int row = 0; row < aTable->GetRowCount(); ++row )
443 {
444 for( int col = 0; col < aTable->GetColCount(); ++col )
445 {
446 PCB_TABLECELL* cell = aTable->GetCell( row, col );
447 PCB_TABLECELL* other = aOther->GetCell( row, col );
448
449 if( ( diff = cell->PCB_SHAPE::Compare( other ) ) != 0 )
450 return diff;
451
452 if( ( diff = cell->EDA_TEXT::Compare( other ) ) != 0 )
453 return diff;
454 }
455 }
456
457 return 0;
458}
459
460
461bool PCB_TABLE::operator==( const BOARD_ITEM& aBoardItem ) const
462{
463 if( Type() != aBoardItem.Type() )
464 return false;
465
466 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aBoardItem );
467
468 return *this == other;
469}
470
471
472bool PCB_TABLE::operator==( const PCB_TABLE& aOther ) const
473{
474 if( m_cells.size() != aOther.m_cells.size() )
475 return false;
476
477 if( m_strokeExternal != aOther.m_strokeExternal )
478 return false;
479
481 return false;
482
483 if( m_borderStroke != aOther.m_borderStroke )
484 return false;
485
486 if( m_strokeRows != aOther.m_strokeRows )
487 return false;
488
489 if( m_strokeColumns != aOther.m_strokeColumns )
490 return false;
491
493 return false;
494
495 if( m_colWidths != aOther.m_colWidths )
496 return false;
497
498 if( m_rowHeights != aOther.m_rowHeights )
499 return false;
500
501 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
502 {
503 if( !( *m_cells[ii] == *aOther.m_cells[ii] ) )
504 return false;
505 }
506
507 return true;
508}
509
510
511double PCB_TABLE::Similarity( const BOARD_ITEM& aOther ) const
512{
513 if( aOther.Type() != Type() )
514 return 0.0;
515
516 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aOther );
517
518 if( m_cells.size() != other.m_cells.size() )
519 return 0.1;
520
521 double similarity = 1.0;
522
524 similarity *= 0.9;
525
527 similarity *= 0.9;
528
529 if( m_borderStroke != other.m_borderStroke )
530 similarity *= 0.9;
531
532 if( m_strokeRows != other.m_strokeRows )
533 similarity *= 0.9;
534
535 if( m_strokeColumns != other.m_strokeColumns )
536 similarity *= 0.9;
537
539 similarity *= 0.9;
540
541 if( m_colWidths != other.m_colWidths )
542 similarity *= 0.9;
543
544 if( m_rowHeights != other.m_rowHeights )
545 similarity *= 0.9;
546
547 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
548 similarity *= m_cells[ii]->Similarity( *other.m_cells[ii] );
549
550 return similarity;
551}
552
553
554static struct PCB_TABLE_DESC
555{
557 {
559
560 if( lineStyleEnum.Choices().GetCount() == 0 )
561 {
562 lineStyleEnum.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
563 .Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
564 .Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
565 .Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
566 .Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
567 }
568
571
576
577 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start X" ),
578 &PCB_TABLE::SetPositionX, &PCB_TABLE::GetPositionX, PROPERTY_DISPLAY::PT_COORD,
580 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start Y" ),
581 &PCB_TABLE::SetPositionY, &PCB_TABLE::GetPositionY, PROPERTY_DISPLAY::PT_COORD,
583
584 const wxString tableProps = _( "Table Properties" );
585
586 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "External Border" ),
588 tableProps );
589
590 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Header Border" ),
592 tableProps );
593
594 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Border Width" ),
596 PROPERTY_DISPLAY::PT_SIZE ),
597 tableProps );
598
599 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Border Style" ),
601 tableProps );
602
603 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Border Color" ),
605 tableProps );
606
607 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Row Separators" ),
609 tableProps );
610
611 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Cell Separators" ),
613 tableProps );
614
615 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Separators Width" ),
617 PROPERTY_DISPLAY::PT_SIZE ),
618 tableProps );
619
620 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Separators Style" ),
622 tableProps );
623
624 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Separators Color" ),
626 tableProps );
627 }
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:78
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:235
PCB_LAYER_ID m_layer
Definition: board_item.h:451
bool m_isLocked
Definition: board_item.h:454
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:286
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:54
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:658
constexpr bool Contains(const Vec &aPoint) const
Definition: box2.h:168
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:311
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:107
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:110
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:215
std::vector< VECTOR2I > GetCornersInSequence() const
Definition: eda_shape.cpp:1559
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:219
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:134
virtual void ClearRenderCache()
Definition: eda_text.cpp:651
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:686
static ENUM_MAP< T > & Instance()
Definition: property.h:680
wxPGChoices & Choices()
Definition: property.h:729
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_shape.h:78
VECTOR2I GetPosition() const override
Definition: pcb_shape.h:79
int GetRowSpan() const
Definition: pcb_tablecell.h:65
int GetColSpan() const
Definition: pcb_tablecell.h:62
VECTOR2I GetEnd() const
Definition: pcb_table.cpp:116
STROKE_PARAMS m_separatorsStroke
Definition: pcb_table.h:262
bool StrokeRows() const
Definition: pcb_table.h:98
int GetRowCount() const
Definition: pcb_table.h:115
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_table.cpp:228
std::vector< PCB_TABLECELL * > m_cells
Definition: pcb_table.h:267
int m_colCount
Definition: pcb_table.h:264
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_table.cpp:390
bool m_strokeRows
Definition: pcb_table.h:260
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_table.cpp:181
int GetPositionY() const
Definition: pcb_table.h:110
bool StrokeHeaderSeparator() const
Definition: pcb_table.h:56
bool StrokeColumns() const
Definition: pcb_table.h:95
void SetBorderStyle(const LINE_STYLE aStyle)
Definition: pcb_table.h:64
void SetStrokeHeaderSeparator(bool aDoStroke)
Definition: pcb_table.h:55
void SetSeparatorsColor(const COLOR4D &aColor)
Definition: pcb_table.h:91
bool m_strokeExternal
Definition: pcb_table.h:257
STROKE_PARAMS m_borderStroke
Definition: pcb_table.h:259
bool m_strokeColumns
Definition: pcb_table.h:261
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_table.cpp:378
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcb_table.cpp:308
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_table.cpp:200
bool StrokeExternal() const
Definition: pcb_table.h:53
int GetSeparatorsWidth() const
Definition: pcb_table.h:80
void SetPositionX(int x)
Definition: pcb_table.h:107
void SetStrokeExternal(bool aDoStroke)
Definition: pcb_table.h:52
PCB_TABLECELL * GetCell(int aRow, int aCol) const
Definition: pcb_table.h:140
std::vector< PCB_TABLECELL * > GetCells() const
Definition: pcb_table.h:150
int GetBorderWidth() const
Definition: pcb_table.h:62
COLOR4D GetBorderColor() const
Definition: pcb_table.h:74
bool operator==(const PCB_TABLE &aOther) const
Definition: pcb_table.cpp:472
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: pcb_table.cpp:353
int GetColCount() const
Definition: pcb_table.h:113
void SetStrokeColumns(bool aDoStroke)
Definition: pcb_table.h:94
const STROKE_PARAMS & GetSeparatorsStroke() const
Definition: pcb_table.h:77
std::map< int, int > m_colWidths
Definition: pcb_table.h:265
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_table.cpp:73
int GetPositionX() const
Definition: pcb_table.h:109
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
Definition: pcb_table.cpp:130
void AddCell(PCB_TABLECELL *aCell)
Definition: pcb_table.h:155
const STROKE_PARAMS & GetBorderStroke() const
Definition: pcb_table.h:59
void SetPositionY(int y)
Definition: pcb_table.h:108
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_table.cpp:384
void SetStrokeRows(bool aDoStroke)
Definition: pcb_table.h:97
bool m_StrokeHeaderSeparator
Definition: pcb_table.h:258
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: pcb_table.cpp:221
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_table.cpp:511
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
Definition: pcb_table.cpp:336
void DrawBorders(const std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const STROKE_PARAMS &aStroke)> &aCallback) const
Definition: pcb_table.cpp:239
LINE_STYLE GetBorderStyle() const
Definition: pcb_table.h:65
static int Compare(const PCB_TABLE *aTable, const PCB_TABLE *aOther)
Definition: pcb_table.cpp:420
int GetColWidth(int aCol) const
Definition: pcb_table.h:122
VECTOR2I GetPosition() const override
Definition: pcb_table.cpp:110
void SetSeparatorsWidth(int aWidth)
Definition: pcb_table.h:79
COLOR4D GetSeparatorsColor() const
Definition: pcb_table.h:92
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_table.cpp:188
LINE_STYLE GetSeparatorsStyle() const
Definition: pcb_table.h:83
void SetBorderColor(const COLOR4D &aColor)
Definition: pcb_table.h:73
PCB_TABLE(BOARD_ITEM *aParent, int aLineWidth)
Definition: pcb_table.cpp:33
void SetSeparatorsStyle(const LINE_STYLE aStyle)
Definition: pcb_table.h:82
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcb_table.cpp:413
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_table.cpp:104
void SetBorderWidth(int aWidth)
Definition: pcb_table.h:61
int GetRowHeight(int aRow) const
Definition: pcb_table.h:132
std::map< int, int > m_rowHeights
Definition: pcb_table.h:266
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:85
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:87
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
Represent a set of closed polygons.
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Definition: shape_simple.h:42
Simple container to manage line stroke parameters.
Definition: stroke_params.h:94
int GetWidth() const
#define _HKI(x)
static bool empty(const wxTextEntryBase *aCtrl)
#define _(s)
RECURSE_MODE
Definition: eda_item.h:49
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:88
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: layer_id.cpp:169
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:184
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
FLIP_DIRECTION
Definition: mirror.h:27
static struct PCB_TABLE_DESC _PCB_TABLE_DESC
#define TYPE_HASH(x)
Definition: property.h:71
#define REGISTER_TYPE(x)
Definition: property_mgr.h:371
LINE_STYLE
Dashed line types.
Definition: stroke_params.h:46
VECTOR2I end
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition: trigo.cpp:229
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition: typeinfo.h:95
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition: typeinfo.h:94
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695