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 std::vector<int> ViewGetLayers() 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 PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
335 const VECTOR2I& aOffset, bool aDimmed ) override {}
336
337 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
338 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
339
344 bool AutoRotateOnPlacement() const;
345
351 void SetAutoRotateOnPlacement( bool autoRotate = true );
352
358 virtual bool AutoRotateOnPlacementSupported() const = 0;
359
360 double Similarity( const SCH_ITEM& aItem ) const override;
361
362 bool operator==( const SCH_ITEM& aItem ) const override;
363
364protected:
365 void cacheShownText() override;
366
367protected:
368 std::vector<SCH_FIELD> m_fields;
369
371
375
377
379};
380
381
383{
384public:
385 SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
386
387 // Do not create a copy constructor. The one generated by the compiler is adequate.
388
390
391 void Serialize( google::protobuf::Any &aContainer ) const override;
392 bool Deserialize( const google::protobuf::Any &aContainer ) override;
393
394 static inline bool ClassOf( const EDA_ITEM* aItem )
395 {
396 return aItem && SCH_LABEL_T == aItem->Type();
397 }
398
399 wxString GetClass() const override
400 {
401 return wxT( "SCH_LABEL" );
402 }
403
404 const BOX2I GetBodyBoundingBox() const override;
405
406 bool IsConnectable() const override { return true; }
407
408 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
409
410 BITMAPS GetMenuImage() const override;
411
412 bool IsReplaceable() const override { return true; }
413
414 EDA_ITEM* Clone() const override
415 {
416 return new SCH_LABEL( *this );
417 }
418
419 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
420 {
421 return m_isDangling && GetPosition() == aPos;
422 }
423
424 bool AutoRotateOnPlacementSupported() const override { return false; }
425
426private:
427 bool doIsConnected( const VECTOR2I& aPosition ) const override
428 {
429 return EDA_TEXT::GetTextPos() == aPosition;
430 }
431};
432
433
435{
436public:
437 SCH_DIRECTIVE_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
438
439 SCH_DIRECTIVE_LABEL( const SCH_DIRECTIVE_LABEL& aClassLabel );
440
442
443 void Serialize( google::protobuf::Any &aContainer ) const override;
444 bool Deserialize( const google::protobuf::Any &aContainer ) override;
445
446 static inline bool ClassOf( const EDA_ITEM* aItem )
447 {
448 return aItem && SCH_DIRECTIVE_LABEL_T == aItem->Type();
449 }
450
451 wxString GetClass() const override
452 {
453 return wxT( "SCH_DIRECTIVE_LABEL" );
454 }
455
456 EDA_ITEM* Clone() const override
457 {
458 return new SCH_DIRECTIVE_LABEL( *this );
459 }
460
461 void SwapData( SCH_ITEM* aItem ) override;
462
464 void SetFlagShape( FLAG_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
465
466 int GetPinLength() const { return m_pinLength; }
467 void SetPinLength( int aLength ) { m_pinLength = aLength; }
468
469 int GetPenWidth() const override;
470
471 void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
472 std::vector<VECTOR2I>& aPoints,
473 const VECTOR2I& aPos ) const override;
474
475 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
476
477 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
478
479 bool IsConnectable() const override { return true; }
480
481 bool AutoRotateOnPlacementSupported() const override { return false; }
482
483 void MirrorSpinStyle( bool aLeftRight ) override;
484
485 void MirrorHorizontally( int aCenter ) override;
486 void MirrorVertically( int aCenter ) override;
487
489 void AddConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
490
493
495 void RemoveConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
496
498 virtual bool IsDangling() const override;
499
500private:
503
505 std::unordered_set<SCH_RULE_AREA*> m_connected_rule_areas;
506};
507
508
510{
511public:
512 SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
513 const wxString& aText = wxEmptyString );
514
515 SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
516
518
519 void Serialize( google::protobuf::Any &aContainer ) const override;
520 bool Deserialize( const google::protobuf::Any &aContainer ) override;
521
522 static inline bool ClassOf( const EDA_ITEM* aItem )
523 {
524 return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
525 }
526
527 wxString GetClass() const override
528 {
529 return wxT( "SCH_GLOBALLABEL" );
530 }
531
532 EDA_ITEM* Clone() const override
533 {
534 return new SCH_GLOBALLABEL( *this );
535 }
536
537 int GetMandatoryFieldCount() override { return 1; }
538
539 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
540
541 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
542
543 void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
544 std::vector<VECTOR2I>& aPoints,
545 const VECTOR2I& aPos ) const override;
546
547 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
548
549 bool IsConnectable() const override { return true; }
550
551 std::vector<int> ViewGetLayers() const override;
552
553 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
554
555 BITMAPS GetMenuImage() const override;
556
557 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
558 {
559 return m_isDangling && GetPosition() == aPos;
560 }
561
562 bool AutoRotateOnPlacementSupported() const override { return true; }
563
564private:
565 bool doIsConnected( const VECTOR2I& aPosition ) const override
566 {
567 return EDA_TEXT::GetTextPos() == aPosition;
568 }
569};
570
571
573{
574public:
575 SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
576 KICAD_T aType = SCH_HIER_LABEL_T );
577
578 // Do not create a copy constructor. The one generated by the compiler is adequate.
579
581
582 void Serialize( google::protobuf::Any &aContainer ) const override;
583 bool Deserialize( const google::protobuf::Any &aContainer ) override;
584
585 static inline bool ClassOf( const EDA_ITEM* aItem )
586 {
587 return aItem && SCH_HIER_LABEL_T == aItem->Type();
588 }
589
590 wxString GetClass() const override
591 {
592 return wxT( "SCH_HIERLABEL" );
593 }
594
595 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
596
597 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
598
599 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
600 const VECTOR2I& aPos ) const override;
601 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
602 const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
603
604 const BOX2I GetBodyBoundingBox() const override;
605
606 bool IsConnectable() const override { return true; }
607
608 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
609
610 BITMAPS GetMenuImage() const override;
611
612 EDA_ITEM* Clone() const override
613 {
614 return new SCH_HIERLABEL( *this );
615 }
616
617 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
618 {
619 return m_isDangling && GetPosition() == aPos;
620 }
621
622 bool AutoRotateOnPlacementSupported() const override { return true; }
623
624private:
625 bool doIsConnected( const VECTOR2I& aPosition ) const override
626 {
627 return EDA_TEXT::GetTextPos() == aPosition;
628 }
629};
630
631#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:257
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
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:156
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1520
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:1544
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:1501
void RemoveConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Removes a specific rule area from the cache.
Definition: sch_label.cpp:1775
void ClearConnectedRuleAreas()
Removes all rule areas from the cache.
Definition: sch_label.cpp:1769
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:1602
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:1575
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:1694
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1747
bool IsConnectable() const override
Definition: sch_label.h:479
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:446
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1526
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:1624
FLAG_SHAPE GetFlagShape() const
Definition: sch_label.h:463
int GetPenWidth() const override
Definition: sch_label.cpp:1533
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:505
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:481
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:451
void SetPinLength(int aLength)
Definition: sch_label.h:467
virtual bool IsDangling() const override
Determines dangling state from connectivity and cached connected rule areas.
Definition: sch_label.cpp:1781
void AddConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Adds an entry to the connected rule area cache.
Definition: sch_label.cpp:1763
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:456
void SetFlagShape(FLAG_SHAPE aShape)
Definition: sch_label.h:464
int GetPinLength() const
Definition: sch_label.h:466
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
Definition: sch_field.h:51
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:1921
bool IsConnectable() const override
Definition: sch_label.h:549
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:1928
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:1862
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:522
int GetMandatoryFieldCount() override
Definition: sch_label.h:537
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:565
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:1823
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1855
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1816
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1810
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:562
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:532
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:557
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:527
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2003
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1996
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:625
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:585
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:590
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:2024
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:2070
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:2031
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:2038
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:612
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2150
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:2018
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:617
bool IsConnectable() const override
Definition: sch_label.h:606
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:2143
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:2123
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:622
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
COLOR4D m_lastResolvedColor
Definition: sch_label.h:376
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:1356
bool m_isDangling
Definition: sch_label.h:373
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
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
Definition: sch_label.cpp:902
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:967
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:1402
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
Definition: sch_label.cpp:193
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:368
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:372
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:1229
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:1134
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:942
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:374
wxString m_cached_driver_name
Definition: sch_label.h:378
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:909
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:1408
void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Print just the background fills.
Definition: sch_label.h:334
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:1171
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:370
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:924
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:1028
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:424
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1434
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:399
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:427
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:414
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:419
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1448
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1484
~SCH_LABEL()
Definition: sch_label.h:389
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1477
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_label.h:412
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:394
bool IsConnectable() const override
Definition: sch_label.h:406
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1423
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