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
84private:
86};
87
88
89/*
90 * Label and flag shapes used with text objects.
91 */
93{
99
106
107/*
108 * Specific enums for property manager (not used elsewhere)
109 */
111{
118
120{
126
127
129{
130public:
131 SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
132
133 SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
134
135 SCH_LABEL_BASE& operator=( const SCH_LABEL_BASE& aLabel );
136
137 // Abstract class
138 virtual wxString GetClass() const override = 0;
139
140 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override;
141
142 void SwapData( SCH_ITEM* aItem ) override;
143
144 bool CanConnect( const SCH_ITEM* aItem ) const override
145 {
146 switch( aItem->Type() )
147 {
148 case SCH_LINE_T:
149 return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
150
152 return true;
153
154 case SCH_SYMBOL_T:
155 return true;
156
157 case SCH_LABEL_T:
159 case SCH_HIER_LABEL_T:
161 case SCH_SHEET_PIN_T:
162 return true;
163
164 default:
165 return false;
166 }
167 }
168
169 bool HasConnectivityChanges( const SCH_ITEM* aItem,
170 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
171
173 void SetShape( LABEL_FLAG_SHAPE aShape ) { m_shape = aShape; }
174
175 // Type-specific versions for property manager
177 void SetLabelShape( LABEL_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
178
179 COLOR4D GetLabelColor() const;
180
181 virtual void SetSpinStyle( SPIN_STYLE aSpinStyle );
182 SPIN_STYLE GetSpinStyle() const;
183
184 void SetLastResolvedState( const SCH_ITEM* aItem ) override
185 {
186 const SCH_LABEL_BASE* aLabel = dynamic_cast<const SCH_LABEL_BASE*>( aItem );
187
188 if( aLabel )
190 }
191
192 static const wxString GetDefaultFieldName( const wxString& aName, bool aUseDefaultName );
193
194 virtual int GetMandatoryFieldCount() { return 0; }
195
196 std::vector<SCH_FIELD>& GetFields() { return m_fields; }
197 const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
198
204 void SetFields( const std::vector<SCH_FIELD>& aFields )
205 {
206 m_fields = aFields; // vector copying, length is changed possibly
207 }
208
209 void AddFields( const std::vector<SCH_FIELD>& aFields )
210 {
211 m_fields.insert( m_fields.end(), aFields.begin(), aFields.end() );
212 }
213
214 void AddField( const SCH_FIELD& aField )
215 {
216 m_fields.push_back( aField );
217 }
218
224 bool IncrementLabel( int aIncrement );
225
226 void Move( const VECTOR2I& aMoveVector ) override;
227 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
228 void Rotate90( bool aClockwise ) override;
229
230 void MirrorSpinStyle( bool aLeftRight ) override;
231
232 void MirrorHorizontally( int aCenter ) override;
233 void MirrorVertically( int aCenter ) override;
234
235 void SetPosition( const VECTOR2I& aPosition ) override;
236
237 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
238
243 void GetIntersheetRefs( const SCH_SHEET_PATH* aPath,
244 std::vector<std::pair<wxString, wxString>>* pages );
245
249 void GetContextualTextVars( wxArrayString* aVars ) const;
250
256 virtual bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const;
257
258 wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
259 int aDepth = 0 ) const override;
260
261 wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
262 {
263 SCHEMATIC* schematic = Schematic();
264
265 if( schematic )
266 return GetShownText( &schematic->CurrentSheet(), aAllowExtraText, aDepth );
267 else
268 return GetText();
269 }
270
271 bool HasCachedDriverName() const override;
272 const wxString& GetCachedDriverName() const override;
273
274 void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
275
276 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
277 const std::vector<KICAD_T>& scanTypes ) override;
278
279 bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
280 bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override;
281
282 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
283
290 virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
291 std::vector<VECTOR2I>& aPoints, const VECTOR2I& Pos ) const
292 {
293 aPoints.clear();
294 }
295
296 int GetLabelBoxExpansion( const RENDER_SETTINGS* aSettings = nullptr ) const;
297
301 virtual const BOX2I GetBodyBoundingBox() const;
302
306 const BOX2I GetBoundingBox() const override;
307
308 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
309 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
310
311 std::vector<VECTOR2I> GetConnectionPoints() const override;
312
313 void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
314
315 bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
316 std::vector<DANGLING_END_ITEM>& aItemListByPos,
317 const SCH_SHEET_PATH* aPath = nullptr ) override;
318
319 bool IsDangling() const override { return m_isDangling; }
320 void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
321
322 void ViewGetLayers( int aLayers[], int& aCount ) const override;
323
324 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
325
326 void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
327 const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
328
329 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
330 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
331
336 bool AutoRotateOnPlacement() const;
337
343 void SetAutoRotateOnPlacement( bool autoRotate = true );
344
350 virtual bool AutoRotateOnPlacementSupported() const = 0;
351
352 double Similarity( const SCH_ITEM& aItem ) const override;
353
354 bool operator==( const SCH_ITEM& aItem ) const override;
355
356protected:
357 void cacheShownText() override;
358
359protected:
360 std::vector<SCH_FIELD> m_fields;
361
363
367
369
371};
372
373
375{
376public:
377 SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
378
379 // Do not create a copy constructor. The one generated by the compiler is adequate.
380
382
383 void Serialize( google::protobuf::Any &aContainer ) const override;
384 bool Deserialize( const google::protobuf::Any &aContainer ) override;
385
386 static inline bool ClassOf( const EDA_ITEM* aItem )
387 {
388 return aItem && SCH_LABEL_T == aItem->Type();
389 }
390
391 wxString GetClass() const override
392 {
393 return wxT( "SCH_LABEL" );
394 }
395
396 const BOX2I GetBodyBoundingBox() const override;
397
398 bool IsConnectable() const override { return true; }
399
400 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
401
402 BITMAPS GetMenuImage() const override;
403
404 bool IsReplaceable() const override { return true; }
405
406 EDA_ITEM* Clone() const override
407 {
408 return new SCH_LABEL( *this );
409 }
410
411 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
412 {
413 return m_isDangling && GetPosition() == aPos;
414 }
415
416 bool AutoRotateOnPlacementSupported() const override { return false; }
417
418private:
419 bool doIsConnected( const VECTOR2I& aPosition ) const override
420 {
421 return EDA_TEXT::GetTextPos() == aPosition;
422 }
423};
424
425
427{
428public:
429 SCH_DIRECTIVE_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
430
431 SCH_DIRECTIVE_LABEL( const SCH_DIRECTIVE_LABEL& aClassLabel );
432
434
435 void Serialize( google::protobuf::Any &aContainer ) const override;
436 bool Deserialize( const google::protobuf::Any &aContainer ) override;
437
438 static inline bool ClassOf( const EDA_ITEM* aItem )
439 {
440 return aItem && SCH_DIRECTIVE_LABEL_T == aItem->Type();
441 }
442
443 wxString GetClass() const override
444 {
445 return wxT( "SCH_DIRECTIVE_LABEL" );
446 }
447
448 EDA_ITEM* Clone() const override
449 {
450 return new SCH_DIRECTIVE_LABEL( *this );
451 }
452
453 void SwapData( SCH_ITEM* aItem ) override;
454
456 void SetFlagShape( FLAG_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
457
458 int GetPinLength() const { return m_pinLength; }
459 void SetPinLength( int aLength ) { m_pinLength = aLength; }
460
461 int GetPenWidth() const override;
462
463 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
464 const VECTOR2I& aPos ) const override;
465
466 void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
467
468 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
469
470 bool IsConnectable() const override { return true; }
471
472 bool AutoRotateOnPlacementSupported() const override { return false; }
473
474 void MirrorSpinStyle( bool aLeftRight ) override;
475
476 void MirrorHorizontally( int aCenter ) override;
477 void MirrorVertically( int aCenter ) override;
478
480 void AddConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
481
484
486 void RemoveConnectedRuleArea( SCH_RULE_AREA* aRuleArea );
487
489 virtual bool IsDangling() const override;
490
491private:
494
496 std::unordered_set<SCH_RULE_AREA*> m_connected_rule_areas;
497};
498
499
501{
502public:
503 SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ),
504 const wxString& aText = wxEmptyString );
505
506 SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
507
509
510 void Serialize( google::protobuf::Any &aContainer ) const override;
511 bool Deserialize( const google::protobuf::Any &aContainer ) override;
512
513 static inline bool ClassOf( const EDA_ITEM* aItem )
514 {
515 return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
516 }
517
518 wxString GetClass() const override
519 {
520 return wxT( "SCH_GLOBALLABEL" );
521 }
522
523 EDA_ITEM* Clone() const override
524 {
525 return new SCH_GLOBALLABEL( *this );
526 }
527
528 int GetMandatoryFieldCount() override { return 1; }
529
530 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
531
532 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
533
534 void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
535 const VECTOR2I& aPos ) const override;
536
537 bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
538
539 bool IsConnectable() const override { return true; }
540
541 void ViewGetLayers( int aLayers[], int& aCount ) const override;
542
543 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
544
545 BITMAPS GetMenuImage() const override;
546
547 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
548 {
549 return m_isDangling && GetPosition() == aPos;
550 }
551
552 bool AutoRotateOnPlacementSupported() const override { return true; }
553
554private:
555 bool doIsConnected( const VECTOR2I& aPosition ) const override
556 {
557 return EDA_TEXT::GetTextPos() == aPosition;
558 }
559};
560
561
563{
564public:
565 SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
566 KICAD_T aType = SCH_HIER_LABEL_T );
567
568 // Do not create a copy constructor. The one generated by the compiler is adequate.
569
571
572 void Serialize( google::protobuf::Any &aContainer ) const override;
573 bool Deserialize( const google::protobuf::Any &aContainer ) override;
574
575 static inline bool ClassOf( const EDA_ITEM* aItem )
576 {
577 return aItem && SCH_HIER_LABEL_T == aItem->Type();
578 }
579
580 wxString GetClass() const override
581 {
582 return wxT( "SCH_HIERLABEL" );
583 }
584
585 void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
586
587 VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
588
589 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
590 const VECTOR2I& aPos ) const override;
591 void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
592 const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
593
594 const BOX2I GetBodyBoundingBox() const override;
595
596 bool IsConnectable() const override { return true; }
597
598 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
599
600 BITMAPS GetMenuImage() const override;
601
602 EDA_ITEM* Clone() const override
603 {
604 return new SCH_HIERLABEL( *this );
605 }
606
607 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
608 {
609 return m_isDangling && GetPosition() == aPos;
610 }
611
612 bool AutoRotateOnPlacementSupported() const override { return true; }
613
614private:
615 bool doIsConnected( const VECTOR2I& aPosition ) const override
616 {
617 return EDA_TEXT::GetTextPos() == aPosition;
618 }
619};
620
621#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:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:234
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:104
Holds all the data relating to one schematic.
Definition: schematic.h:75
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:136
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1572
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:1596
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:1553
void RemoveConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Removes a specific rule area from the cache.
Definition: sch_label.cpp:1823
void ClearConnectedRuleAreas()
Removes all rule areas from the cache.
Definition: sch_label.cpp:1817
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:1654
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:1627
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:1746
bool IsConnectable() const override
Definition: sch_label.h:470
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:438
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1578
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:1676
FLAG_SHAPE GetFlagShape() const
Definition: sch_label.h:455
int GetPenWidth() const override
Definition: sch_label.cpp:1585
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:496
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:472
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:443
void SetPinLength(int aLength)
Definition: sch_label.h:459
virtual bool IsDangling() const override
Determines dangling state from connectivity and cached connected rule areas.
Definition: sch_label.cpp:1829
void AddConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Adds an entry to the connected rule area cache.
Definition: sch_label.cpp:1811
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:448
void SetFlagShape(FLAG_SHAPE aShape)
Definition: sch_label.h:456
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1796
int GetPinLength() const
Definition: sch_label.h:458
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:539
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:1969
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:1981
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:1910
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:513
int GetMandatoryFieldCount() override
Definition: sch_label.h:528
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:555
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:1871
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:1903
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:2049
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1864
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1858
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:552
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:523
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:547
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:518
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2056
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:615
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:575
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:580
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:2077
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:2123
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Definition: sch_label.cpp:2084
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:2091
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:602
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:2203
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:2071
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:607
bool IsConnectable() const override
Definition: sch_label.h:596
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:2176
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:2196
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:612
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:174
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:139
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:289
bool operator==(const SCH_ITEM &aItem) const override
Definition: sch_label.cpp:576
void SetLastResolvedState(const SCH_ITEM *aItem) override
Definition: sch_label.h:184
const wxString & GetCachedDriverName() const override
Definition: sch_label.cpp:877
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:978
COLOR4D m_lastResolvedColor
Definition: sch_label.h:368
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const override
Definition: sch_label.cpp:892
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_label.cpp:419
void AddFields(const std::vector< SCH_FIELD > &aFields)
Definition: sch_label.h:209
void SetFields(const std::vector< SCH_FIELD > &aFields)
Set multiple schematic fields.
Definition: sch_label.h:204
void SetIsDangling(bool aIsDangling)
Definition: sch_label.h:320
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:1409
bool m_isDangling
Definition: sch_label.h:365
void AddField(const SCH_FIELD &aField)
Definition: sch_label.h:214
bool IsDangling() const override
Definition: sch_label.h:319
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:940
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const override
Compare the item against the search criteria in aSearchData.
Definition: sch_label.cpp:924
bool HasCachedDriverName() const override
Definition: sch_label.cpp:871
const std::vector< SCH_FIELD > & GetFields() const
Definition: sch_label.h:197
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:1047
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:965
bool AutoRotateOnPlacement() const
autoRotateOnPlacement
Definition: sch_label.cpp:1454
SCH_LABEL_BASE & operator=(const SCH_LABEL_BASE &aLabel)
Definition: sch_label.cpp:237
std::vector< SCH_FIELD > m_fields
Definition: sch_label.h:360
CONNECTION_TYPE m_connectionType
Definition: sch_label.h:364
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_label.cpp:524
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:1309
void SetLabelShape(LABEL_SHAPE aShape)
Definition: sch_label.h:177
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:1214
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_label.h:261
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_label.cpp:305
SPIN_STYLE GetSpinStyle() const
Definition: sch_label.cpp:373
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:710
void MirrorSpinStyle(bool aLeftRight) override
Definition: sch_label.cpp:496
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Definition: sch_label.cpp:972
COLOR4D GetLabelColor() const
Definition: sch_label.cpp:327
void SetShape(LABEL_FLAG_SHAPE aShape)
Definition: sch_label.h:173
LABEL_FLAG_SHAPE GetShape() const
Definition: sch_label.h:172
const BOX2I GetBoundingBox() const override
Return the bounding box of the label including its fields.
Definition: sch_label.cpp:1022
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_label.cpp:260
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_label.cpp:543
virtual bool AutoRotateOnPlacementSupported() const =0
AutoRotateOnPlacementSupported.
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_label.cpp:412
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:760
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_label.h:144
LABEL_SHAPE GetLabelShape() const
Definition: sch_label.h:176
bool m_autoRotateOnPlacement
Definition: sch_label.h:366
wxString m_cached_driver_name
Definition: sch_label.h:370
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_label.cpp:428
int GetLabelBoxExpansion(const RENDER_SETTINGS *aSettings=nullptr) const
Definition: sch_label.cpp:989
bool IncrementLabel(int aIncrement)
Increment the label text, if it ends with a number.
Definition: sch_label.cpp:562
void SetAutoRotateOnPlacement(bool autoRotate=true)
setAutoRotateOnPlacement
Definition: sch_label.cpp:1460
void cacheShownText() override
Definition: sch_label.cpp:883
void Rotate90(bool aClockwise) override
Definition: sch_label.cpp:443
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:1251
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Definition: sch_label.cpp:247
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Definition: sch_label.cpp:639
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction) override
Definition: sch_label.cpp:917
virtual int GetMandatoryFieldCount()
Definition: sch_label.h:194
LABEL_FLAG_SHAPE m_shape
Definition: sch_label.h:362
void GetContextualTextVars(wxArrayString *aVars) const
Return the list of system text vars & fields for this label.
Definition: sch_label.cpp:747
virtual const BOX2I GetBodyBoundingBox() const
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1004
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:290
std::vector< SCH_FIELD > & GetFields()
Definition: sch_label.h:196
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:1108
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:392
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Definition: sch_label.cpp:338
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:930
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:602
bool AutoRotateOnPlacementSupported() const override
AutoRotateOnPlacementSupported.
Definition: sch_label.h:416
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: sch_label.cpp:1486
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_label.cpp:1529
wxString GetClass() const override
Return the class name.
Definition: sch_label.h:391
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_label.h:419
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_label.h:406
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_label.h:411
const BOX2I GetBodyBoundingBox() const override
Return the bounding box of the label only, without taking in account its fields.
Definition: sch_label.cpp:1500
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_label.cpp:1536
~SCH_LABEL()
Definition: sch_label.h:381
bool IsReplaceable() const override
Override this method in any derived object that supports test find and replace.
Definition: sch_label.h:404
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_label.h:386
bool IsConnectable() const override
Definition: sch_label.h:398
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: sch_label.cpp:1475
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:173
SPIN m_spin
Definition: sch_label.h:85
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:189
SPIN_STYLE RotateCCW()
Definition: sch_label.cpp:157
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:81
@ LAYER_WIRE
Definition: layer_ids.h:356
@ LAYER_BUS
Definition: layer_ids.h:357
CONNECTION_TYPE
FLAG_SHAPE
Definition: sch_label.h:120
@ FLAG_CIRCLE
Definition: sch_label.h:122
@ FLAG_RECTANGLE
Definition: sch_label.h:124
@ FLAG_DOT
Definition: sch_label.h:121
@ FLAG_DIAMOND
Definition: sch_label.h:123
LABEL_FLAG_SHAPE
Definition: sch_label.h:93
@ L_BIDI
Definition: sch_label.h:96
@ L_TRISTATE
Definition: sch_label.h:97
@ L_UNSPECIFIED
Definition: sch_label.h:98
@ F_DOT
Definition: sch_label.h:101
@ F_ROUND
Definition: sch_label.h:102
@ F_FIRST
Definition: sch_label.h:100
@ L_OUTPUT
Definition: sch_label.h:95
@ F_DIAMOND
Definition: sch_label.h:103
@ L_INPUT
Definition: sch_label.h:94
@ F_RECTANGLE
Definition: sch_label.h:104
LABEL_SHAPE
Definition: sch_label.h:111
@ LABEL_BIDI
Definition: sch_label.h:114
@ LABEL_INPUT
Definition: sch_label.h:112
@ LABEL_OUTPUT
Definition: sch_label.h:113
@ LABEL_PASSIVE
Definition: sch_label.h:116
@ LABEL_TRISTATE
Definition: sch_label.h:115
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< int > VECTOR2I
Definition: vector2d.h:588