KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_label.h
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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef SCH_LABEL_H
26#define SCH_LABEL_H
27
28#include <sch_text.h>
29#include <sch_item.h>
30#include <sch_field.h>
31#include <sch_connection.h> // for CONNECTION_TYPE
32
33class SCH_RULE_AREA;
34
35
36/*
37 * Spin style for labels of all kinds on schematics
38 * Basically a higher level abstraction of rotation and justification of text
39 */
41{
42public:
43 enum SPIN : int
44 {
45 LEFT = 0,
46 UP = 1,
47 RIGHT = 2,
48 BOTTOM = 3
49 };
50
51
52 SPIN_STYLE() = default;
53 constexpr SPIN_STYLE( SPIN aSpin ) : m_spin( aSpin )
54 {
55 }
56
57 constexpr bool operator==( SPIN a ) const
58 {
59 return m_spin == a;
60 }
61
62 constexpr bool operator!=( SPIN a ) const
63 {
64 return m_spin != a;
65 }
66
67 operator int() const
68 {
69 return static_cast<int>( m_spin );
70 }
71
73
78
83
87 unsigned CCWRotationsTo( const SPIN_STYLE& aOther ) const;
88
89private:
91};
92
93
94/*
95 * Label and flag shapes used with text objects.
96 */
97enum LABEL_FLAG_SHAPE : unsigned int
98{
104
111
112/*
113 * Specific enums for property manager (not used elsewhere)
114 */
115enum LABEL_SHAPE : unsigned int
116{
123
124enum FLAG_SHAPE : unsigned int
125{
131
132
134{
135public:
136 SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
137
138 SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
139
140 SCH_LABEL_BASE& operator=( const SCH_LABEL_BASE& aLabel );
141
142 // Abstract class
143 virtual wxString GetClass() const override = 0;
144
145 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override;
146
147 void SwapData( SCH_ITEM* aItem ) override;
148
149 bool CanConnect( const SCH_ITEM* aItem ) const override
150 {
151 switch( aItem->Type() )
152 {
153 case SCH_LINE_T:
154 return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
155
157 return true;
158
159 case SCH_SYMBOL_T:
160 return true;
161
162 case SCH_LABEL_T:
164 case SCH_HIER_LABEL_T:
166 case SCH_SHEET_PIN_T:
167 return true;
168
169 default:
170 return false;
171 }
172 }
173
174 bool HasConnectivityChanges( const SCH_ITEM* aItem,
175 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
176
178 void SetShape( LABEL_FLAG_SHAPE aShape ) { m_shape = aShape; }
179
180 // Type-specific versions for property manager
182 void SetLabelShape( LABEL_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
183
184 COLOR4D GetLabelColor() const;
185
186 virtual void SetSpinStyle( SPIN_STYLE aSpinStyle );
187 SPIN_STYLE GetSpinStyle() const;
188
189 void SetLastResolvedState( const SCH_ITEM* aItem ) override
190 {
191 const SCH_LABEL_BASE* aLabel = dynamic_cast<const SCH_LABEL_BASE*>( aItem );
192
193 if( aLabel )
195 }
196
197 static const wxString GetDefaultFieldName( const wxString& aName, bool aUseDefaultName );
198
199 virtual int GetMandatoryFieldCount() { return 0; }
200
201 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
202 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
203
209 void SetFields( const std::vector<SCH_FIELD>& aFields )
210 {
211 m_fields = aFields; // vector copying, length is changed possibly
212 }
213
214 void AddFields( const std::vector<SCH_FIELD>& aFields )
215 {
216 m_fields.insert( m_fields.end(), aFields.begin(), aFields.end() );
217 }
218
219 void AddField( const SCH_FIELD& aField )
220 {
221 m_fields.push_back( aField );
222 }
223
229 bool IncrementLabel( int aIncrement );
230
231 void Move( const VECTOR2I& aMoveVector ) override;
232 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
233 void Rotate90( bool aClockwise ) override;
234
235 void MirrorSpinStyle( bool aLeftRight ) override;
236
237 void MirrorHorizontally( int aCenter ) override;
238 void MirrorVertically( int aCenter ) override;
239
240 void SetPosition( const VECTOR2I& aPosition ) override;
241
242 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
243
248 void GetIntersheetRefs( const SCH_SHEET_PATH* aPath,
249 std::vector<std::pair<wxString, wxString>>* pages );
250
254 void GetContextualTextVars( wxArrayString* aVars ) const;
255
261 virtual bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const;
262
263 wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
264 int aDepth = 0 ) const override;
265
266 wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
267 {
268 SCHEMATIC* schematic = Schematic();
269
270 if( schematic )
271 return GetShownText( &schematic->CurrentSheet(), aAllowExtraText, aDepth );
272 else
273 return GetText();
274 }
275
276 bool HasCachedDriverName() const override;
277 const wxString& GetCachedDriverName() const override;
278
279 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
280
281 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
282 const std::vector<KICAD_T>& scanTypes ) override;
283
284 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
285 bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override;
286
287 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
288
295 virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
296 std::vector<VECTOR2I>& aPoints, const VECTOR2I& Pos ) const
297 {
298 aPoints.clear();
299 }
300
301 int GetLabelBoxExpansion( const RENDER_SETTINGS* aSettings = nullptr ) const;
302
306 virtual const BOX2I GetBodyBoundingBox() const;
307
311 const BOX2I GetBoundingBox() const override;
312
313 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
314 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
315
316 std::vector<VECTOR2I> GetConnectionPoints() const override;
317
318 void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
319
320 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
321 std::vector<DANGLING_END_ITEM>& aItemListByPos,
322 const SCH_SHEET_PATH* aPath = nullptr ) override;
323
324 bool IsDangling() const override { return m_isDangling; }
325 void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
326
327 void ViewGetLayers( int aLayers[], int& aCount ) const override;
328
329 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
330
331 void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
332 const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
333
334 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
335 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
336
341 bool AutoRotateOnPlacement() const;
342
348 void SetAutoRotateOnPlacement( bool autoRotate = true );
349
355 virtual bool AutoRotateOnPlacementSupported() const = 0;
356
357 double Similarity( const SCH_ITEM& aItem ) const override;
358
359 bool operator==( const SCH_ITEM& aItem ) const override;
360
361protected:
362 void cacheShownText() override;
363
364protected:
365 std::vector<SCH_FIELD> m_fields;
366
368
372
374
376};
377
378
380{
381public:
382 SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
383
384 // Do not create a copy constructor. The one generated by the compiler is adequate.
385
387
388 void Serialize( google::protobuf::Any &aContainer ) const override;
389 bool Deserialize( const google::protobuf::Any &aContainer ) override;
390
391 static inline bool ClassOf( const EDA_ITEM* aItem )
392 {
393 return aItem && SCH_LABEL_T == aItem->Type();
394 }
395
396 wxString GetClass() const override
397 {
398 return wxT( "SCH_LABEL" );
399 }
400
401 const BOX2I GetBodyBoundingBox() const override;
402
403 bool IsConnectable() const override { return true; }
404
405 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
406
407 BITMAPS GetMenuImage() const override;
408
409 bool IsReplaceable() const override { return true; }
410
411 EDA_ITEM* Clone() const override
412 {
413 return new SCH_LABEL( *this );
414 }
415
416 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
417 {
418 return m_isDangling && GetPosition() == aPos;
419 }
420
421 bool AutoRotateOnPlacementSupported() const override { return false; }
422
423private:
424 bool doIsConnected( const VECTOR2I& aPosition ) const override
425 {
426 return EDA_TEXT::GetTextPos() == aPosition;
427 }
428};
429
430
432{
433public:
434 SCH_DIRECTIVE_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
435
436 SCH_DIRECTIVE_LABEL( const SCH_DIRECTIVE_LABEL& aClassLabel );
437
439
440 void Serialize( google::protobuf::Any &aContainer ) const override;
441 bool Deserialize( const google::protobuf::Any &aContainer ) override;
442
443 static inline bool ClassOf( const EDA_ITEM* aItem )
444 {
445 return aItem && SCH_DIRECTIVE_LABEL_T == aItem->Type();
446 }
447
448 wxString GetClass() const override
449 {
450 return wxT( "SCH_DIRECTIVE_LABEL" );
451 }
452
453 EDA_ITEM* Clone() const override
454 {
455 return new SCH_DIRECTIVE_LABEL( *this );
456 }
457
458 void SwapData( SCH_ITEM* aItem ) override;
459
461 void SetFlagShape( FLAG_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
462
463 int GetPinLength() const { return m_pinLength; }
464 void SetPinLength( int aLength ) { m_pinLength = aLength; }
465
466 int GetPenWidth() const override;
467
468 void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
469 std::vector<VECTOR2I>& aPoints,
470 const VECTOR2I& aPos ) const override;
471
472 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
473
474 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
475
476 bool IsConnectable() const override { return true; }
477
478 bool AutoRotateOnPlacementSupported() const override { return false; }
479
480 void MirrorSpinStyle( bool aLeftRight ) override;
481
482 void MirrorHorizontally( int aCenter ) override;
483 void MirrorVertically( int aCenter ) override;
484
486 void AddConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
487
490
492 void RemoveConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
493
495 virtual bool IsDangling() const override;
496
497private:
500
502 std::unordered_set<SCH_RULE_AREA*> m_connected_rule_areas;
503};
504
505
507{
508public:
509 SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
510 const wxString& aText = wxEmptyString );
511
512 SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
513
515
516 void Serialize( google::protobuf::Any &aContainer ) const override;
517 bool Deserialize( const google::protobuf::Any &aContainer ) override;
518
519 static inline bool ClassOf( const EDA_ITEM* aItem )
520 {
521 return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
522 }
523
524 wxString GetClass() const override
525 {
526 return wxT( "SCH_GLOBALLABEL" );
527 }
528
529 EDA_ITEM* Clone() const override
530 {
531 return new SCH_GLOBALLABEL( *this );
532 }
533
534 int GetMandatoryFieldCount() override { return 1; }
535
536 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
537
538 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
539
540 void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
541 std::vector<VECTOR2I>& aPoints,
542 const VECTOR2I& aPos ) const override;
543
544 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
545
546 bool IsConnectable() const override { return true; }
547
548 void ViewGetLayers( int aLayers[], int& aCount ) const override;
549
550 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
551
552 BITMAPS GetMenuImage() const override;
553
554 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
555 {
556 return m_isDangling && GetPosition() == aPos;
557 }
558
559 bool AutoRotateOnPlacementSupported() const override { return true; }
560
561private:
562 bool doIsConnected( const VECTOR2I& aPosition ) const override
563 {
564 return EDA_TEXT::GetTextPos() == aPosition;
565 }
566};
567
568
570{
571public:
572 SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
573 KICAD_T aType = SCH_HIER_LABEL_T );
574
575 // Do not create a copy constructor. The one generated by the compiler is adequate.
576
578
579 void Serialize( google::protobuf::Any &aContainer ) const override;
580 bool Deserialize( const google::protobuf::Any &aContainer ) override;
581
582 static inline bool ClassOf( const EDA_ITEM* aItem )
583 {
584 return aItem && SCH_HIER_LABEL_T == aItem->Type();
585 }
586
587 wxString GetClass() const override
588 {
589 return wxT( "SCH_HIERLABEL" );
590 }
591
592 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
593
594 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
595
596 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
597 const VECTOR2I& aPos ) const override;
598 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
599 const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
600
601 const BOX2I GetBodyBoundingBox() const override;
602
603 bool IsConnectable() const override { return true; }
604
605 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
606
607 BITMAPS GetMenuImage() const override;
608
609 EDA_ITEM* Clone() const override
610 {
611 return new SCH_HIERLABEL( *this );
612 }
613
614 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
615 {
616 return m_isDangling && GetPosition() == aPos;
617 }
618
619 bool AutoRotateOnPlacementSupported() const override { return true; }
620
621private:
622 bool doIsConnected( const VECTOR2I& aPosition ) const override
623 {
624 return EDA_TEXT::GetTextPos() == aPosition;
625 }
626};
627
628#endif /* SCH_LABEL_H */
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:253
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:94
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Base plotter engine class.
Definition: plotter.h:105
Holds all the data relating to one schematic.
Definition: schematic.h:77
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:152
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1522
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:1546
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:1503
void RemoveConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Removes a specific rule area from the cache.
Definition: sch_label.cpp:1777
void ClearConnectedRuleAreas()
Removes all rule areas from the cache.
Definition: sch_label.cpp:1771
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:1604
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:1577
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:1696
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1749
bool IsConnectable() const override
Definition: sch_label.h:476
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:443
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1528
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1626
FLAG_SHAPE GetFlagShape() const
Definition: sch_label.h:460
int GetPenWidth() const override
Definition: sch_label.cpp:1535
std::unordered_set< SCH_RULE_AREA * > m_connected_rule_areas
Cache of any rule areas with borders which this label connects to.
Definition: sch_label.h:502
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:478
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:448
void SetPinLength(int aLength)
Definition: sch_label.h:464
virtual bool IsDangling() const override
Determines dangling state from connectivity and cached connected rule areas.
Definition: sch_label.cpp:1783
void AddConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Adds an entry to the connected rule area cache.
Definition: sch_label.cpp:1765
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:453
void SetFlagShape(FLAG_SHAPE aShape)
Definition: sch_label.h:461
int GetPinLength() const
Definition: sch_label.h:463
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
bool IsConnectable() const override
Definition: sch_label.h:546
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:1923
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:1935
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const override
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:1864
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:519
int GetMandatoryFieldCount() override
Definition: sch_label.h:534
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:562
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:1825
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1857
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1818
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1812
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:559
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:529
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:554
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:524
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2010
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:2003
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:622
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:582
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:587
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:2031
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:2077
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:2038
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.cpp:2045
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:609
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2157
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:2025
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:614
bool IsConnectable() const override
Definition: sch_label.h:603
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:2150
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:2130
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:619
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:150
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:281
bool operator==(const SCH_ITEM &aItem) const override
Definition: sch_label.cpp:500
void SetLastResolvedState(const SCH_ITEM *aItem) override
Definition: sch_label.h:189
const wxString & GetCachedDriverName() const override
Definition: sch_label.cpp:801
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:902
COLOR4D m_lastResolvedColor
Definition: sch_label.h:373
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
Definition: sch_label.cpp:816
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_label.cpp:378
void AddFields(const std::vector< SCH_FIELD > &aFields)
Definition: sch_label.h:214
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_label.h:209
void SetIsDangling(bool aIsDangling)
Definition: sch_label.h:325
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &offset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: sch_label.cpp:1359
bool m_isDangling
Definition: sch_label.h:370
void AddField(const SCH_FIELD &aField)
Definition: sch_label.h:219
bool IsDangling() const override
Definition: sch_label.h:324
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: sch_label.cpp:864
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: sch_label.cpp:848
bool HasCachedDriverName() const override
Definition: sch_label.cpp:795
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_label.h:202
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_label.cpp:971
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
Definition: sch_label.cpp:889
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1404
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
Definition: sch_label.cpp:193
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:365
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:369
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:448
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
Definition: sch_label.cpp:1233
void SetLabelShape(LABEL_SHAPE aShape)
Definition: sch_label.h:182
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
Definition: sch_label.cpp:1138
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_label.h:266
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:264
SPIN_STYLE GetSpinStyle() const
Definition: sch_label.cpp:332
void GetIntersheetRefs(const SCH_SHEET_PATH *aPath, std::vector< std::pair< wxString, wxString > > *pages)
Builds an array of { pageNumber, pageName } pairs.
Definition: sch_label.cpp:634
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:420
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_label.cpp:896
COLOR4D GetLabelColor() const
Definition: sch_label.cpp:286
void SetShape(LABEL_FLAG_SHAPE aShape)
Definition: sch_label.h:178
LABEL_FLAG_SHAPE GetShape() const
Definition: sch_label.h:177
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:946
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_label.cpp:216
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:467
virtual bool AutoRotateOnPlacementSupported() const =0
AutoRotateOnPlacementSupported.
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_label.cpp:371
virtual bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth) const
Resolve any references to system tokens supported by the label.
Definition: sch_label.cpp:684
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_label.h:149
LABEL_SHAPE GetLabelShape() const
Definition: sch_label.h:181
bool m_autoRotateOnPlacement
Definition: sch_label.h:371
wxString m_cached_driver_name
Definition: sch_label.h:375
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_label.cpp:387
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_label.cpp:913
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_label.cpp:486
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
Definition: sch_label.cpp:1410
void cacheShownText() override
Definition: sch_label.cpp:807
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:402
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: sch_label.cpp:1175
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:203
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:563
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_label.cpp:841
virtual int GetMandatoryFieldCount()
Definition: sch_label.h:199
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:367
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
Definition: sch_label.cpp:671
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:928
virtual void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &Pos) const
Calculate the graphic shape (a polygon) associated to the text.
Definition: sch_label.h:295
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:201
virtual wxString GetClass() const override=0
Return the class name.
bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aPath=nullptr) override
Test the schematic item to aItemList to check if it's dangling state has changed.
Definition: sch_label.cpp:1032
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Definition: sch_label.cpp:351
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Definition: sch_label.cpp:297
bool Replace(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) override
Perform a text replace using the find and replace criteria in aSearchData on items that support text ...
Definition: sch_label.cpp:854
double Similarity(const SCH_ITEM &aItem) const override
Return a measure of how likely the other object is to represent the same object.
Definition: sch_label.cpp:526
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:421
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1436
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:396
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:424
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:411
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:416
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1450
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1486
~SCH_LABEL()
Definition: sch_label.h:386
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1479
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_label.h:409
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:391
bool IsConnectable() const override
Definition: sch_label.h:403
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1425
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
VECTOR2I GetPosition() const override
Definition: sch_text.h:141
constexpr SPIN_STYLE(SPIN aSpin)
Definition: sch_label.h:53
SPIN_STYLE MirrorX()
Mirror the label spin style across the X axis or simply swaps up and bottom.
Definition: sch_label.cpp:123
SPIN m_spin
Definition: sch_label.h:90
SPIN_STYLE()=default
constexpr bool operator!=(SPIN a) const
Definition: sch_label.h:62
constexpr bool operator==(SPIN a) const
Definition: sch_label.h:57
SPIN_STYLE MirrorY()
Mirror the label spin style across the Y axis or simply swaps left and right.
Definition: sch_label.cpp:139
unsigned CCWRotationsTo(const SPIN_STYLE &aOther) const
Get CCW rotation needed to get to the given spin style.
Definition: sch_label.cpp:155
SPIN_STYLE RotateCCW()
Definition: sch_label.cpp:107
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:82
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_BUS
Definition: layer_ids.h:357
CONNECTION_TYPE
FLAG_SHAPE
Definition: sch_label.h:125
@ FLAG_CIRCLE
Definition: sch_label.h:127
@ FLAG_RECTANGLE
Definition: sch_label.h:129
@ FLAG_DOT
Definition: sch_label.h:126
@ FLAG_DIAMOND
Definition: sch_label.h:128
LABEL_FLAG_SHAPE
Definition: sch_label.h:98
@ L_BIDI
Definition: sch_label.h:101
@ L_TRISTATE
Definition: sch_label.h:102
@ L_UNSPECIFIED
Definition: sch_label.h:103
@ F_DOT
Definition: sch_label.h:106
@ F_ROUND
Definition: sch_label.h:107
@ F_FIRST
Definition: sch_label.h:105
@ L_OUTPUT
Definition: sch_label.h:100
@ F_DIAMOND
Definition: sch_label.h:108
@ L_INPUT
Definition: sch_label.h:99
@ F_RECTANGLE
Definition: sch_label.h:109
LABEL_SHAPE
Definition: sch_label.h:116
@ LABEL_BIDI
Definition: sch_label.h:119
@ LABEL_INPUT
Definition: sch_label.h:117
@ LABEL_OUTPUT
Definition: sch_label.h:118
@ LABEL_PASSIVE
Definition: sch_label.h:121
@ LABEL_TRISTATE
Definition: sch_label.h:120
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_LINE_T
Definition: typeinfo.h:163
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:171
@ SCH_LABEL_T
Definition: typeinfo.h:167
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:169
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:173
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691