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 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
182{
183 std::vector<std::vector<BOX2I>> extents;
184
185 for( int row = 0; row < GetRowCount(); ++row )
186 {
187 extents.push_back( std::vector<BOX2I>() );
188
189 for( int col = 0; col < GetColCount(); ++col )
190 {
191 SHAPE_POLY_SET textPoly;
192 GetCell( row, col )->TransformTextToPolySet( textPoly, 0, ARC_LOW_DEF, ERROR_INSIDE );
193 extents[row].push_back( textPoly.BBox() );
194 }
195 }
196
197 for( int col = 0; col < GetColCount(); ++col )
198 {
199 int colWidth = 0;
200
201 for( int row = 0; row < GetRowCount(); ++row )
202 {
203 PCB_TABLECELL* cell = GetCell( row, col );
204 int margins = cell->GetMarginLeft() + cell->GetMarginRight();
205 colWidth = std::max<int>( colWidth, extents[row][col].GetWidth() + ( margins * 1.5 ) );
206 }
207
208 SetColWidth( col, colWidth );
209 }
210
211 for( int row = 0; row < GetRowCount(); ++row )
212 {
213 int rowHeight = 0;
214
215 for( int col = 0; col < GetColCount(); ++col )
216 {
217 PCB_TABLECELL* cell = GetCell( row, col );
218 int margins = cell->GetMarginLeft() + cell->GetMarginRight();
219 rowHeight = std::max( rowHeight, (int) extents[row][col].GetHeight() + margins );
220 }
221
222 SetRowHeight( row, rowHeight );
223 }
224
225 Normalize();
226}
227
228
229void PCB_TABLE::Move( const VECTOR2I& aMoveVector )
230{
231 for( PCB_TABLECELL* cell : m_cells )
232 cell->Move( aMoveVector );
233}
234
235
236void PCB_TABLE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
237{
238 if( GetCells().empty() )
239 return;
240
241 for( PCB_TABLECELL* cell : m_cells )
242 cell->Rotate( aRotCentre, aAngle );
243
244 Normalize();
245}
246
247
248void PCB_TABLE::Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
249{
250 EDA_ANGLE originalAngle = m_cells[0]->GetTextAngle();
251
252 Rotate( aCentre, -originalAngle );
253 Normalize();
254
255 for( PCB_TABLECELL* cell : m_cells )
256 cell->Flip( aCentre, aFlipDirection );
257
258 std::vector<PCB_TABLECELL*> oldCells = m_cells;
259 int rowOffset = 0;
260
261 for( int row = 0; row < GetRowCount(); ++row )
262 {
263 for( int col = 0; col < GetColCount(); ++col )
264 m_cells[ rowOffset + col ] = oldCells[ rowOffset + GetColCount() - 1 - col ];
265
266 rowOffset += GetColCount();
267 }
268
269 VECTOR2I currentPos = GetPosition();
270
271 int firstWidth = m_colWidths.begin()->second;
272 VECTOR2I translationVector = VECTOR2I( firstWidth, 0 );
273
274 VECTOR2I position = currentPos - translationVector;
275 SetPosition( position );
276
277 std::map<int, int> newColWidths;
278 for( int col = 0; col < GetColCount(); ++col )
279 {
280 newColWidths[col] = m_colWidths[GetColCount() - 1 - col];
281 }
282
283 m_colWidths = std::move( newColWidths );
284
286 Normalize();
287
288 Rotate( aCentre, originalAngle );
289 Normalize();
290}
291
292
293void PCB_TABLE::RunOnChildren( const std::function<void( BOARD_ITEM* )>& aFunction, RECURSE_MODE aMode ) const
294{
295 for( PCB_TABLECELL* cell : m_cells )
296 {
297 aFunction( cell );
298
299 if( aMode == RECURSE_MODE::RECURSE )
300 cell->RunOnChildren( aFunction, aMode );
301 }
302}
303
304
306{
307 // Note: a table with no cells is not allowed
308 BOX2I bbox = m_cells[0]->GetBoundingBox();
309
310 bbox.Merge( m_cells[ m_cells.size() - 1 ]->GetBoundingBox() );
311
312 return bbox;
313}
314
315
316void PCB_TABLE::DrawBorders( const std::function<void( const VECTOR2I& aPt1, const VECTOR2I& aPt2,
317 const STROKE_PARAMS& aStroke )>& aCallback ) const
318{
319 EDA_ANGLE drawAngle = GetCell( 0, 0 )->GetDrawRotation();
320 std::vector<VECTOR2I> topLeft = GetCell( 0, 0 )->GetCornersInSequence( drawAngle );
321 std::vector<VECTOR2I> bottomLeft = GetCell( GetRowCount() - 1, 0 )->GetCornersInSequence( drawAngle );
322 std::vector<VECTOR2I> topRight = GetCell( 0, GetColCount() - 1 )->GetCornersInSequence( drawAngle );
323 std::vector<VECTOR2I> bottomRight =
324 GetCell( GetRowCount() - 1, GetColCount() - 1 )->GetCornersInSequence( drawAngle );
325 STROKE_PARAMS stroke;
326
327 for( int col = 0; col < GetColCount() - 1; ++col )
328 {
329 if( StrokeColumns() )
330 stroke = GetSeparatorsStroke();
331 else
332 continue;
333
334 for( int row = 0; row < GetRowCount(); ++row )
335 {
336 PCB_TABLECELL* cell = GetCell( row, col );
337
338 if( cell->GetColSpan() == 0 )
339 continue;
340
341 if( col + cell->GetColSpan() == GetColCount() )
342 continue;
343
344 std::vector<VECTOR2I> corners = cell->GetCornersInSequence( drawAngle );
345
346 if( corners.size() == 4 )
347 aCallback( corners[1], corners[2], stroke );
348 }
349 }
350
351 for( int row = 0; row < GetRowCount() - 1; ++row )
352 {
353 if( row == 0 && StrokeHeaderSeparator() )
354 stroke = GetBorderStroke();
355 else if( StrokeRows() )
356 stroke = GetSeparatorsStroke();
357 else
358 continue;
359
360 for( int col = 0; col < GetColCount(); ++col )
361 {
362 PCB_TABLECELL* cell = GetCell( row, col );
363
364 if( cell->GetRowSpan() == 0 )
365 continue;
366
367 if( row + cell->GetRowSpan() == GetRowCount() )
368 continue;
369
370 std::vector<VECTOR2I> corners = cell->GetCornersInSequence( drawAngle );
371
372 if( corners.size() == 4 )
373 aCallback( corners[2], corners[3], stroke );
374 }
375 }
376
377 if( StrokeExternal() && GetBorderStroke().GetWidth() >= 0 )
378 {
379 aCallback( topLeft[0], topRight[1], GetBorderStroke() );
380 aCallback( topRight[1], bottomRight[2], GetBorderStroke() );
381 aCallback( bottomRight[2], bottomLeft[3], GetBorderStroke() );
382 aCallback( bottomLeft[3], topLeft[0], GetBorderStroke() );
383 }
384}
385
386
387std::shared_ptr<SHAPE> PCB_TABLE::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
388{
389 EDA_ANGLE drawAngle = GetCell( 0, 0 )->GetDrawRotation();
390 std::vector<VECTOR2I> topLeft = GetCell( 0, 0 )->GetCornersInSequence( drawAngle );
391 std::vector<VECTOR2I> bottomLeft = GetCell( GetRowCount() - 1, 0 )->GetCornersInSequence( drawAngle );
392 std::vector<VECTOR2I> topRight = GetCell( 0, GetColCount() - 1 )->GetCornersInSequence( drawAngle );
393 std::vector<VECTOR2I> bottomRight =
394 GetCell( GetRowCount() - 1, GetColCount() - 1 )->GetCornersInSequence( drawAngle );
395
396 std::shared_ptr<SHAPE_COMPOUND> shape = std::make_shared<SHAPE_COMPOUND>();
397
398 std::vector<VECTOR2I> pts;
399
400 pts.emplace_back( topLeft[3] );
401 pts.emplace_back( topRight[2] );
402 pts.emplace_back( bottomRight[2] );
403 pts.emplace_back( bottomLeft[3] );
404
405 shape->AddShape( new SHAPE_SIMPLE( pts ) );
406
408 [&shape]( const VECTOR2I& ptA, const VECTOR2I& ptB, const STROKE_PARAMS& stroke )
409 {
410 shape->AddShape( new SHAPE_SEGMENT( ptA, ptB, stroke.GetWidth() ) );
411 } );
412
413 return shape;
414}
415
416
418 int aClearance, int aMaxError, ERROR_LOC aErrorLoc,
419 bool aIgnoreLineWidth ) const
420{
421 int gap = aClearance;
422
423 if( StrokeColumns() || StrokeRows() )
424 gap = std::max( gap, aClearance + GetSeparatorsStroke().GetWidth() / 2 );
425
427 gap = std::max( gap, aClearance + GetBorderStroke().GetWidth() / 2 );
428
429 for( PCB_TABLECELL* cell : m_cells )
430 cell->TransformShapeToPolygon( aBuffer, aLayer, gap, aMaxError, aErrorLoc, false );
431}
432
433
434INSPECT_RESULT PCB_TABLE::Visit( INSPECTOR aInspector, void* aTestData,
435 const std::vector<KICAD_T>& aScanTypes )
436{
437 for( KICAD_T scanType : aScanTypes )
438 {
439 if( scanType == PCB_TABLE_T )
440 {
441 if( INSPECT_RESULT::QUIT == aInspector( this, aTestData ) )
442 return INSPECT_RESULT::QUIT;
443 }
444
445 if( scanType == PCB_TABLECELL_T )
446 {
447 for( PCB_TABLECELL* cell : m_cells )
448 {
449 if( INSPECT_RESULT::QUIT == aInspector( cell, (void*) this ) )
450 return INSPECT_RESULT::QUIT;
451 }
452 }
453 }
454
455 return INSPECT_RESULT::CONTINUE;
456}
457
458
459wxString PCB_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
460{
461 return wxString::Format( _( "%d Column Table" ), m_colCount );
462}
463
464
466{
467 return BITMAPS::table;
468}
469
470
471bool PCB_TABLE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
472{
473 BOX2I rect = GetBoundingBox();
474
475 rect.Inflate( aAccuracy );
476
477 return rect.Contains( aPosition );
478}
479
480
481bool PCB_TABLE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
482{
483 BOX2I rect = aRect;
484
485 rect.Inflate( aAccuracy );
486
487 if( aContained )
488 return rect.Contains( GetBoundingBox() );
489
490 return rect.Intersects( GetBoundingBox() );
491}
492
493
494void PCB_TABLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
495{
496 // Don't use GetShownText() here; we want to show the user the variable references
497 aList.emplace_back( _( "Table" ), wxString::Format( _( "%d Columns" ), m_colCount ) );
498}
499
500
501int PCB_TABLE::Compare( const PCB_TABLE* aTable, const PCB_TABLE* aOther )
502{
503 int diff;
504
505 if( ( diff = (int) aTable->GetCells().size() - (int) aOther->GetCells().size() ) != 0 )
506 return diff;
507
508 if( ( diff = aTable->GetColCount() - aOther->GetColCount() ) != 0 )
509 return diff;
510
511 for( int col = 0; col < aTable->GetColCount(); ++col )
512 {
513 if( ( diff = aTable->GetColWidth( col ) - aOther->GetColWidth( col ) ) != 0 )
514 return diff;
515 }
516
517 for( int row = 0; row < aTable->GetRowCount(); ++row )
518 {
519 if( ( diff = aTable->GetRowHeight( row ) - aOther->GetRowHeight( row ) ) != 0 )
520 return diff;
521 }
522
523 for( int row = 0; row < aTable->GetRowCount(); ++row )
524 {
525 for( int col = 0; col < aTable->GetColCount(); ++col )
526 {
527 PCB_TABLECELL* cell = aTable->GetCell( row, col );
528 PCB_TABLECELL* other = aOther->GetCell( row, col );
529
530 if( ( diff = cell->PCB_SHAPE::Compare( other ) ) != 0 )
531 return diff;
532
533 if( ( diff = cell->EDA_TEXT::Compare( other ) ) != 0 )
534 return diff;
535 }
536 }
537
538 return 0;
539}
540
541
542bool PCB_TABLE::operator==( const BOARD_ITEM& aBoardItem ) const
543{
544 if( Type() != aBoardItem.Type() )
545 return false;
546
547 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aBoardItem );
548
549 return *this == other;
550}
551
552
553bool PCB_TABLE::operator==( const PCB_TABLE& aOther ) const
554{
555 if( m_cells.size() != aOther.m_cells.size() )
556 return false;
557
558 if( m_strokeExternal != aOther.m_strokeExternal )
559 return false;
560
562 return false;
563
564 if( m_borderStroke != aOther.m_borderStroke )
565 return false;
566
567 if( m_strokeRows != aOther.m_strokeRows )
568 return false;
569
570 if( m_strokeColumns != aOther.m_strokeColumns )
571 return false;
572
574 return false;
575
576 if( m_colWidths != aOther.m_colWidths )
577 return false;
578
579 if( m_rowHeights != aOther.m_rowHeights )
580 return false;
581
582 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
583 {
584 if( !( *m_cells[ii] == *aOther.m_cells[ii] ) )
585 return false;
586 }
587
588 return true;
589}
590
591
592double PCB_TABLE::Similarity( const BOARD_ITEM& aOther ) const
593{
594 if( aOther.Type() != Type() )
595 return 0.0;
596
597 const PCB_TABLE& other = static_cast<const PCB_TABLE&>( aOther );
598
599 if( m_cells.size() != other.m_cells.size() )
600 return 0.1;
601
602 double similarity = 1.0;
603
605 similarity *= 0.9;
606
608 similarity *= 0.9;
609
610 if( m_borderStroke != other.m_borderStroke )
611 similarity *= 0.9;
612
613 if( m_strokeRows != other.m_strokeRows )
614 similarity *= 0.9;
615
616 if( m_strokeColumns != other.m_strokeColumns )
617 similarity *= 0.9;
618
620 similarity *= 0.9;
621
622 if( m_colWidths != other.m_colWidths )
623 similarity *= 0.9;
624
625 if( m_rowHeights != other.m_rowHeights )
626 similarity *= 0.9;
627
628 for( int ii = 0; ii < (int) m_cells.size(); ++ii )
629 similarity *= m_cells[ii]->Similarity( *other.m_cells[ii] );
630
631 return similarity;
632}
633
634
635static struct PCB_TABLE_DESC
636{
638 {
640
641 if( lineStyleEnum.Choices().GetCount() == 0 )
642 {
643 lineStyleEnum.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
644 .Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
645 .Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
646 .Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
647 .Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
648 }
649
652
657
658 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start X" ),
659 &PCB_TABLE::SetPositionX, &PCB_TABLE::GetPositionX, PROPERTY_DISPLAY::PT_COORD,
661 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Start Y" ),
662 &PCB_TABLE::SetPositionY, &PCB_TABLE::GetPositionY, PROPERTY_DISPLAY::PT_COORD,
664
665 const wxString tableProps = _( "Table Properties" );
666
667 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "External Border" ),
669 tableProps );
670
671 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Header Border" ),
673 tableProps );
674
675 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Border Width" ),
677 PROPERTY_DISPLAY::PT_SIZE ),
678 tableProps );
679
680 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Border Style" ),
682 tableProps );
683
684 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Border Color" ),
686 tableProps );
687
688 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Row Separators" ),
690 tableProps );
691
692 propMgr.AddProperty( new PROPERTY<PCB_TABLE, bool>( _HKI( "Cell Separators" ),
694 tableProps );
695
696 propMgr.AddProperty( new PROPERTY<PCB_TABLE, int>( _HKI( "Separators Width" ),
698 PROPERTY_DISPLAY::PT_SIZE ),
699 tableProps );
700
701 propMgr.AddProperty( new PROPERTY_ENUM<PCB_TABLE, LINE_STYLE>( _HKI( "Separators Style" ),
703 tableProps );
704
705 propMgr.AddProperty( new PROPERTY<PCB_TABLE, COLOR4D>( _HKI( "Separators Color" ),
707 tableProps );
708 }
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
@ ERROR_INSIDE
Definition: approximation.h:34
constexpr int ARC_LOW_DEF
Definition: base_units.h:126
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:229
PCB_LAYER_ID m_layer
Definition: board_item.h:445
bool m_isLocked
Definition: board_item.h:448
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:280
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:48
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:108
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:111
std::vector< VECTOR2I > GetCornersInSequence(EDA_ANGLE angle) const
Definition: eda_shape.cpp:1610
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:215
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:219
const EDA_ANGLE & GetTextAngle() const
Definition: eda_text.h:144
virtual EDA_ANGLE GetDrawRotation() const
Definition: eda_text.h:373
virtual void ClearRenderCache()
Definition: eda_text.cpp:658
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:687
static ENUM_MAP< T > & Instance()
Definition: property.h:681
wxPGChoices & Choices()
Definition: property.h:730
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:71
int GetColSpan() const
Definition: pcb_tablecell.h:68
VECTOR2I GetEnd() const
Definition: pcb_table.cpp:116
STROKE_PARAMS m_separatorsStroke
Definition: pcb_table.h:264
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:305
std::vector< PCB_TABLECELL * > m_cells
Definition: pcb_table.h:269
void SetColWidth(int aCol, int aWidth)
Definition: pcb_table.h:120
int m_colCount
Definition: pcb_table.h:266
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:471
bool m_strokeRows
Definition: pcb_table.h:262
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_table.cpp:229
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:259
STROKE_PARAMS m_borderStroke
Definition: pcb_table.h:261
bool m_strokeColumns
Definition: pcb_table.h:263
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_table.cpp:459
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:387
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_table.cpp:248
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
void Autosize()
Definition: pcb_table.cpp:181
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:553
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:434
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:267
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:465
void SetStrokeRows(bool aDoStroke)
Definition: pcb_table.h:97
bool m_StrokeHeaderSeparator
Definition: pcb_table.h:260
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const override
Invoke a function on all children.
Definition: pcb_table.cpp:293
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:592
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:417
void DrawBorders(const std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const STROKE_PARAMS &aStroke)> &aCallback) const
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:501
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:236
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:494
void SetRowHeight(int aRow, int aHeight)
Definition: pcb_table.h:130
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:268
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
int GetMarginLeft() const
Definition: pcb_textbox.h:89
int GetMarginRight() const
Definition: pcb_textbox.h:91
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.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
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:89
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:72
#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