KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 (C) 2024 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_strokeHeader( 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
57 m_colCount = aTable.m_colCount;
58 m_colWidths = aTable.m_colWidths;
60
61 for( PCB_TABLECELL* src : aTable.m_cells )
62 AddCell( new PCB_TABLECELL( *src ) );
63}
64
65
67{
68 // We own our cells; delete them
69 for( PCB_TABLECELL* cell : m_cells )
70 delete cell;
71}
72
73
75{
76 wxCHECK_RET( aImage != nullptr && aImage->Type() == PCB_TABLE_T,
77 wxT( "Cannot swap data with invalid table." ) );
78
79 PCB_TABLE* table = static_cast<PCB_TABLE*>( aImage );
80
81 std::swap( m_layer, table->m_layer );
82 std::swap( m_isLocked, table->m_isLocked );
83
84 std::swap( m_strokeExternal, table->m_strokeExternal );
85 std::swap( m_strokeHeader, table->m_strokeHeader );
86 std::swap( m_borderStroke, table->m_borderStroke );
87 std::swap( m_strokeRows, table->m_strokeRows );
88 std::swap( m_strokeColumns, table->m_strokeColumns );
89 std::swap( m_separatorsStroke, table->m_separatorsStroke );
90
91 std::swap( m_orientation, table->m_orientation );
92 std::swap( m_colCount, table->m_colCount );
93 std::swap( m_colWidths, table->m_colWidths );
94 std::swap( m_rowHeights, table->m_rowHeights );
95
96 std::swap( m_cells, table->m_cells );
97
98 for( PCB_TABLECELL* cell : m_cells )
99 cell->SetParent( this );
100
101 for( PCB_TABLECELL* cell : table->m_cells )
102 cell->SetParent( table );
103}
104
105
107{
108 Move( aPos - GetPosition() );
109}
110
111
113{
114 return m_cells[0]->GetPosition();
115}
116
117
119{
120 VECTOR2I tableSize;
121
122 for( int ii = 0; ii < GetColCount(); ++ii )
123 tableSize.x += GetColWidth( ii );
124
125 for( int ii = 0; ii < GetRowCount(); ++ii )
126 tableSize.y += GetRowHeight( ii );
127
128 return GetPosition() + tableSize;
129}
130
131
133{
134 VECTOR2I origin = GetPosition();
135
136 auto setCellStart =
137 [&]( PCB_TABLECELL* cell, VECTOR2I pt )
138 {
139 RotatePoint( pt, origin, m_orientation );
140
141 if( cell->GetPosition() != pt )
142 {
143 cell->SetPosition( pt );
144 cell->ClearRenderCache();
145 }
146 };
147
148 auto setCellEnd =
149 [&]( PCB_TABLECELL* cell, VECTOR2I pt )
150 {
151 RotatePoint( pt, origin, m_orientation );
152
153 if( cell->GetEnd() != pt )
154 {
155 cell->SetEnd( pt );
156 cell->ClearRenderCache();
157 }
158 };
159
160 int y = origin.y;
161
162 for( int row = 0; row < GetRowCount(); ++row )
163 {
164 int x = origin.x;
165 int rowHeight = m_rowHeights[ row ];
166
167 for( int col = 0; col < GetColCount(); ++col )
168 {
169 int colWidth = m_colWidths[ col ];
170
171 PCB_TABLECELL* cell = GetCell( row, col );
172 VECTOR2I pos( x, y );
173
174 setCellStart( cell, pos );
175
176 VECTOR2I end = pos + VECTOR2I( colWidth, rowHeight );
177
178 if( cell->GetColSpan() > 1 || cell->GetRowSpan() > 1 )
179 {
180 for( int ii = col + 1; ii < col + cell->GetColSpan(); ++ii )
181 end.x += m_colWidths[ii];
182
183 for( int ii = row + 1; ii < row + cell->GetRowSpan(); ++ii )
184 end.y += m_rowHeights[ii];
185 }
186
187 setCellEnd( cell, end );
188 x += colWidth;
189 }
190
191 y += rowHeight;
192 }
193}
194
195
196void PCB_TABLE::Move( const VECTOR2I& aMoveVector )
197{
198 for( PCB_TABLECELL* cell : m_cells )
199 cell->Move( aMoveVector );
200}
201
202
203void PCB_TABLE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
204{
205 m_orientation = ( m_orientation + aAngle ).Normalized();
206
207 for( PCB_TABLECELL* cell : m_cells )
208 cell->Rotate( aRotCentre, aAngle );
209
210 Normalize();
211}
212
213
214void PCB_TABLE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
215{
216 for( PCB_TABLECELL* cell : m_cells )
217 cell->Flip( aCentre, aFlipLeftRight );
218
219 std::vector<PCB_TABLECELL*> oldCells = m_cells;
220 int rowOffset = 0;
221
222 for( int row = 0; row < GetRowCount(); ++row )
223 {
224 for( int col = 0; col < GetColCount(); ++col )
225 m_cells[ rowOffset + col ] = oldCells[ rowOffset + GetColCount() - 1 - col ];
226
227 rowOffset += GetColCount();
228 }
229
231 Normalize();
232}
233
234
235void PCB_TABLE::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction ) const
236{
237 for( PCB_TABLECELL* cell : m_cells )
238 aFunction( cell );
239}
240
241
243{
244 // Note: a table with no cells is not allowed
245 BOX2I bbox = m_cells[0]->GetBoundingBox();
246
247 bbox.Merge( m_cells[ m_cells.size() - 1 ]->GetBoundingBox() );
248
249 return bbox;
250}
251
252
253std::shared_ptr<SHAPE> PCB_TABLE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
254{
255 VECTOR2I origin = GetPosition();
256 VECTOR2I end = GetEnd();
257 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
258
259 std::vector<VECTOR2I> pts;
260
261 pts.emplace_back( origin );
262 pts.emplace_back( end.x, origin.y );
263 pts.emplace_back( end );
264 pts.emplace_back( origin.x, end.y );
265
266 shape->AddShape( new SHAPE_SIMPLE( pts ) );
267
268 auto addSeg =
269 [&shape]( const VECTOR2I& ptA, const VECTOR2I& ptB, int width )
270 {
271 shape->AddShape( new SHAPE_SEGMENT( ptA, ptB, width ) );
272 };
273
275 {
276 for( int col = 0; col < GetColCount() - 1; ++col )
277 {
278 for( int row = 0; row < GetRowCount(); ++row )
279 {
280 PCB_TABLECELL* cell = GetCell( row, col );
281 VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
282
283 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
284 addSeg( topRight, cell->GetEnd(), GetSeparatorsStroke().GetWidth() );
285 }
286 }
287 }
288
289 if( StrokeRows() && GetSeparatorsStroke().GetWidth() >= 0 )
290 {
291 for( int row = 0; row < GetRowCount() - 1; ++row )
292 {
293 for( int col = 0; col < GetColCount(); ++col )
294 {
295 PCB_TABLECELL* cell = GetCell( row, col );
296 VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
297
298 if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
299 addSeg( botLeft, cell->GetEnd(), GetSeparatorsStroke().GetWidth() );
300 }
301 }
302 }
303
304 if( StrokeExternal() && GetBorderStroke().GetWidth() >= 0 )
305 {
306 addSeg( pts[0], pts[1], GetBorderStroke().GetWidth() );
307 addSeg( pts[1], pts[2], GetBorderStroke().GetWidth() );
308 addSeg( pts[2], pts[3], GetBorderStroke().GetWidth() );
309 addSeg( pts[3], pts[0], GetBorderStroke().GetWidth() );
310 }
311
312 return shape;
313}
314
315
317 int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
318 bool aIgnoreLineWidth ) const
319{
320 int gap = aClearance;
321
322 if( StrokeColumns() || StrokeRows() )
323 gap = std::max( gap, aClearance + GetSeparatorsStroke().GetWidth() / 2 );
324
325 if( StrokeExternal() || StrokeHeader() )
326 gap = std::max( gap, aClearance + GetBorderStroke().GetWidth() / 2 );
327
328 for( PCB_TABLECELL* cell : m_cells )
329 cell->TransformShapeToPolygon( aBuffer, aLayer, gap, aMaxError, aErrorLoc, false );
330}
331
332
333INSPECT_RESULT PCB_TABLE::Visit( INSPECTOR aInspector, void* aTestData,
334 const std::vector<KICAD_T>& aScanTypes )
335{
336 for( KICAD_T scanType : aScanTypes )
337 {
338 if( scanType == PCB_TABLE_T )
339 {
340 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
341 return INSPECT_RESULT::QUIT;
342 }
343
344 if( scanType == PCB_TABLECELL_T )
345 {
346 for( PCB_TABLECELL* cell : m_cells )
347 {
348 if( INSPECT_RESULT::QUIT == aInspector( cell, (void*) this ) )
349 return INSPECT_RESULT::QUIT;
350 }
351 }
352 }
353
354 return INSPECT_RESULT::CONTINUE;
355}
356
357
358wxString PCB_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
359{
360 return wxString::Format( _( "%d Column Table" ), m_colCount );
361}
362
363
365{
366 return BITMAPS::spreadsheet; // JEY TODO
367}
368
369
370bool PCB_TABLE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
371{
372 BOX2I rect = GetBoundingBox();
373
374 rect.Inflate( aAccuracy );
375
376 return rect.Contains( aPosition );
377}
378
379
380bool PCB_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
381{
382 BOX2I rect = aRect;
383
384 rect.Inflate( aAccuracy );
385
386 if( aContained )
387 return rect.Contains( GetBoundingBox() );
388
389 return rect.Intersects( GetBoundingBox() );
390}
391
392
393void PCB_TABLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
394{
395 // Don't use GetShownText() here; we want to show the user the variable references
396 aList.emplace_back( _( "Table" ), wxString::Format( _( "%d Columns" ), m_colCount ) );
397}
398
399
400int PCB_TABLE::Compare( const PCB_TABLE* aTable, const PCB_TABLE* aOther )
401{
402 int diff;
403
404 if( ( diff = (int) aTable->GetCells().size() - (int) aOther->GetCells().size() ) != 0 )
405 return diff;
406
407 if( ( diff = aTable->GetColCount() - aOther->GetColCount() ) != 0 )
408 return diff;
409
410 for( int col = 0; col < aTable->GetColCount(); ++col )
411 {
412 if( ( diff = aTable->GetColWidth( col ) - aOther->GetColWidth( col ) ) != 0 )
413 return diff;
414 }
415
416 for( int row = 0; row < aTable->GetRowCount(); ++row )
417 {
418 if( ( diff = aTable->GetRowHeight( row ) - aOther->GetRowHeight( row ) ) != 0 )
419 return diff;
420 }
421
422 for( int row = 0; row < aTable->GetRowCount(); ++row )
423 {
424 for( int col = 0; col < aTable->GetColCount(); ++col )
425 {
426 PCB_TABLECELL* cell = aTable->GetCell( row, col );
427 PCB_TABLECELL* other = aOther->GetCell( row, col );
428
429 if( ( diff = cell->PCB_SHAPE::Compare( other ) ) != 0 )
430 return diff;
431
432 if( ( diff = cell->EDA_TEXT::Compare( other ) ) != 0 )
433 return diff;
434 }
435 }
436
437 return 0;
438}
439
440
441bool PCB_TABLE::operator==( const BOARD_ITEM& aBoardItem ) const
442{
443 if( Type() != aBoardItem.Type() )
444 return false;
445
446 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aBoardItem );
447
448 return *this == other;
449}
450
451
452bool PCB_TABLE::operator==( const PCB_TABLE& aOther ) const
453{
454 if( m_cells.size() != aOther.m_cells.size() )
455 return false;
456
457 if( m_strokeExternal != aOther.m_strokeExternal )
458 return false;
459
460 if( m_strokeHeader != aOther.m_strokeHeader )
461 return false;
462
463 if( m_borderStroke != aOther.m_borderStroke )
464 return false;
465
466 if( m_strokeRows != aOther.m_strokeRows )
467 return false;
468
469 if( m_strokeColumns != aOther.m_strokeColumns )
470 return false;
471
473 return false;
474
475 if( m_orientation != aOther.m_orientation )
476 return false;
477
478 if( m_colWidths != aOther.m_colWidths )
479 return false;
480
481 if( m_rowHeights != aOther.m_rowHeights )
482 return false;
483
484 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
485 {
486 if( !( *m_cells[ii] == *aOther.m_cells[ii] ) )
487 return false;
488 }
489
490 return true;
491}
492
493
494double PCB_TABLE::Similarity( const BOARD_ITEM& aOther ) const
495{
496 if( aOther.Type() != Type() )
497 return 0.0;
498
499 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aOther );
500
501 if( m_cells.size() != other.m_cells.size() )
502 return 0.1;
503
504 double similarity = 1.0;
505
507 similarity *= 0.9;
508
509 if( m_strokeHeader != other.m_strokeHeader )
510 similarity *= 0.9;
511
512 if( m_borderStroke != other.m_borderStroke )
513 similarity *= 0.9;
514
515 if( m_strokeRows != other.m_strokeRows )
516 similarity *= 0.9;
517
518 if( m_strokeColumns != other.m_strokeColumns )
519 similarity *= 0.9;
520
522 similarity *= 0.9;
523
524 if( m_orientation != other.m_orientation )
525 similarity *= 0.9;
526
527 if( m_colWidths != other.m_colWidths )
528 similarity *= 0.9;
529
530 if( m_rowHeights != other.m_rowHeights )
531 similarity *= 0.9;
532
533 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
534 similarity *= m_cells[ii]->Similarity( *other.m_cells[ii] );
535
536 return similarity;
537}
538
539
540static struct PCB_TABLE_DESC
541{
543 {
545
546 if( plotDashTypeEnum.Choices().GetCount() == 0 )
547 {
548 plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
549 .Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
550 .Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
551 .Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
552 .Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
553 .Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
554 }
555
558
563
564 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start X" ),
565 &PCB_TABLE::SetPositionX, &PCB_TABLE::GetPositionX, PROPERTY_DISPLAY::PT_COORD,
567 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start Y" ),
568 &PCB_TABLE::SetPositionY, &PCB_TABLE::GetPositionY, PROPERTY_DISPLAY::PT_COORD,
570
571 propMgr.AddProperty( new PROPERTY<PCB_TABLE, EDA_ANGLE>( _HKI( "Orientation" ),
573 PROPERTY_DISPLAY::PT_DEGREE ) );
574
575 const wxString tableProps = _( "Table Properties" );
576
577 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "External Border" ),
579 tableProps );
580
581 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Header Border" ),
583 tableProps );
584
585 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Border Width" ),
587 PROPERTY_DISPLAY::PT_SIZE ),
588 tableProps );
589
590 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Border Style" ),
592 tableProps );
593
594 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Border Color" ),
596 tableProps );
597
598 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Row Separators" ),
600 tableProps );
601
602 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Cell Separators" ),
604 tableProps );
605
606 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Separators Width" ),
608 PROPERTY_DISPLAY::PT_SIZE ),
609 tableProps );
610
611 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Separators Style" ),
613 tableProps );
614
615 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Separators Color" ),
617 tableProps );
618 }
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:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:240
PCB_LAYER_ID m_layer
Definition: board_item.h:409
bool m_isLocked
Definition: board_item.h:412
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:276
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:47
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:294
bool Contains(const Vec &aPoint) const
Definition: box2.h:158
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:541
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:623
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
int GetStartY() const
Definition: eda_shape.h:131
int GetEndX() const
Definition: eda_shape.h:169
int GetEndY() const
Definition: eda_shape.h:168
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:167
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:171
int GetStartX() const
Definition: eda_shape.h:132
virtual void ClearRenderCache()
Definition: eda_text.cpp:498
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:669
static ENUM_MAP< T > & Instance()
Definition: property.h:663
wxPGChoices & Choices()
Definition: property.h:712
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_shape.h:72
VECTOR2I GetPosition() const override
Definition: pcb_shape.h:73
int GetRowSpan() const
Definition: pcb_tablecell.h:65
int GetColSpan() const
Definition: pcb_tablecell.h:62
VECTOR2I GetEnd() const
Definition: pcb_table.cpp:118
STROKE_PARAMS m_separatorsStroke
Definition: pcb_table.h:250
bool StrokeRows() const
Definition: pcb_table.h:86
int GetRowCount() const
Definition: pcb_table.h:106
void SetOrientation(const EDA_ANGLE &aAngle)
Definition: pcb_table.h:100
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_table.cpp:242
std::vector< PCB_TABLECELL * > m_cells
Definition: pcb_table.h:256
int m_colCount
Definition: pcb_table.h:253
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:370
bool m_strokeRows
Definition: pcb_table.h:248
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_table.cpp:196
int GetPositionY() const
Definition: pcb_table.h:98
bool StrokeColumns() const
Definition: pcb_table.h:83
void SetBorderStyle(const LINE_STYLE aStyle)
Definition: pcb_table.h:64
void SetStrokeHeader(bool aDoStroke)
Definition: pcb_table.h:55
void SetSeparatorsColor(const COLOR4D &aColor)
Definition: pcb_table.h:79
bool m_strokeExternal
Definition: pcb_table.h:245
STROKE_PARAMS m_borderStroke
Definition: pcb_table.h:247
bool m_strokeColumns
Definition: pcb_table.h:249
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_table.cpp:358
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:253
bool StrokeExternal() const
Definition: pcb_table.h:53
int GetSeparatorsWidth() const
Definition: pcb_table.h:74
EDA_ANGLE m_orientation
Definition: pcb_table.h:252
void SetPositionX(int x)
Definition: pcb_table.h:95
void SetStrokeExternal(bool aDoStroke)
Definition: pcb_table.h:52
bool StrokeHeader() const
Definition: pcb_table.h:56
PCB_TABLECELL * GetCell(int aRow, int aCol) const
Definition: pcb_table.h:131
std::vector< PCB_TABLECELL * > GetCells() const
Definition: pcb_table.h:141
int GetBorderWidth() const
Definition: pcb_table.h:62
COLOR4D GetBorderColor() const
Definition: pcb_table.h:68
bool operator==(const PCB_TABLE &aOther) const
Definition: pcb_table.cpp:452
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:333
int GetColCount() const
Definition: pcb_table.h:104
void SetStrokeColumns(bool aDoStroke)
Definition: pcb_table.h:82
const STROKE_PARAMS & GetSeparatorsStroke() const
Definition: pcb_table.h:71
std::map< int, int > m_colWidths
Definition: pcb_table.h:254
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_table.cpp:74
int GetPositionX() const
Definition: pcb_table.h:97
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
Definition: pcb_table.cpp:132
void AddCell(PCB_TABLECELL *aCell)
Definition: pcb_table.h:146
const STROKE_PARAMS & GetBorderStroke() const
Definition: pcb_table.h:59
void SetPositionY(int y)
Definition: pcb_table.h:96
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_table.cpp:364
void SetStrokeRows(bool aDoStroke)
Definition: pcb_table.h:85
bool m_strokeHeader
Definition: pcb_table.h:246
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:494
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:316
LINE_STYLE GetBorderStyle() const
Definition: pcb_table.h:65
static int Compare(const PCB_TABLE *aTable, const PCB_TABLE *aOther)
Definition: pcb_table.cpp:400
int GetColWidth(int aCol) const
Definition: pcb_table.h:113
VECTOR2I GetPosition() const override
Definition: pcb_table.cpp:112
void SetSeparatorsWidth(int aWidth)
Definition: pcb_table.h:73
COLOR4D GetSeparatorsColor() const
Definition: pcb_table.h:80
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_table.cpp:214
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const override
Invoke a function on all children.
Definition: pcb_table.cpp:235
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_table.cpp:203
LINE_STYLE GetSeparatorsStyle() const
Definition: pcb_table.h:77
void SetBorderColor(const COLOR4D &aColor)
Definition: pcb_table.h:67
PCB_TABLE(BOARD_ITEM *aParent, int aLineWidth)
Definition: pcb_table.cpp:33
EDA_ANGLE GetOrientation() const
Definition: pcb_table.h:101
void SetSeparatorsStyle(const LINE_STYLE aStyle)
Definition: pcb_table.h:76
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:393
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_table.cpp:106
void SetBorderWidth(int aWidth)
Definition: pcb_table.h:61
int GetRowHeight(int aRow) const
Definition: pcb_table.h:123
std::map< int, int > m_rowHeights
Definition: pcb_table.h:255
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
int GetWidth() const
Definition: stroke_params.h:91
#define _HKI(x)
#define _(s)
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:82
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: layer_id.cpp:202
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:149
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
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:48
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:228
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:673