KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_junction.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) 2009 Jean-Pierre Charras, [email protected]
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_JUNCTION_H
26#define SCH_JUNCTION_H
27
28
29#include <sch_item.h>
30#include <gal/color4d.h>
32
33class NETLIST_OBJECT_LIST;
34
35class SCH_JUNCTION : public SCH_ITEM
36{
37public:
38 SCH_JUNCTION( const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), int aDiameter = 0,
40
41 // Do not create a copy constructor. The one generated by the compiler is adequate.
42
44
45 static inline bool ClassOf( const EDA_ITEM* aItem )
46 {
47 return aItem && SCH_JUNCTION_T == aItem->Type();
48 }
49
50 wxString GetClass() const override
51 {
52 return wxT( "SCH_JUNCTION" );
53 }
54
55 void SwapData( SCH_ITEM* aItem ) override;
56
57 void SetLastResolvedState( const SCH_ITEM* aItem ) override
58 {
59 const SCH_JUNCTION* aJunction = dynamic_cast<const SCH_JUNCTION*>( aItem );
60
61 if( aJunction )
62 {
65 }
66 }
67
68 void ViewGetLayers( int aLayers[], int& aCount ) const override;
69
70 const BOX2I GetBoundingBox() const override;
71
72 void Move( const VECTOR2I& aMoveVector ) override
73 {
74 m_pos += aMoveVector;
75 }
76
77 void MirrorHorizontally( int aCenter ) override;
78 void MirrorVertically( int aCenter ) override;
79 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
80
81 void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
82
83 bool IsConnectable() const override { return true; }
84
85 bool HasConnectivityChanges( const SCH_ITEM* aItem,
86 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
87
88 std::vector<VECTOR2I> GetConnectionPoints() const override;
89
90 bool CanConnect( const SCH_ITEM* aItem ) const override
91 {
92 return aItem->IsConnectable() && ( aItem->Type() == SCH_LINE_T
93 || aItem->Type() == SCH_SYMBOL_T
94 || aItem->Type() == SCH_LABEL_T
95 || aItem->Type() == SCH_GLOBAL_LABEL_T
96 || aItem->Type() == SCH_HIER_LABEL_T
97 || aItem->Type() == SCH_DIRECTIVE_LABEL_T );
98 }
99
100 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
101 {
102 return wxString( _( "Junction" ) );
103 }
104
105 BITMAPS GetMenuImage() const override;
106
107 VECTOR2I GetPosition() const override { return m_pos; }
108 void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
109
110 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return false; }
111
112 int GetEffectiveDiameter() const;
113
114 int GetDiameter() const { return m_diameter; }
115 void SetDiameter( int aDiameter );
116
118
119 COLOR4D GetColor() const { return m_color; }
120 void SetColor( const COLOR4D& aColor );
121
122 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
123 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
124
125 void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
126 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
127
128 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
129 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
130
131 EDA_ITEM* Clone() const override;
132
133 virtual bool operator <( const SCH_ITEM& aItem ) const override;
134
135 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
136
137 double Similarity( const SCH_ITEM& aOther ) const override;
138
139 bool operator==( const SCH_ITEM& aOther ) const override;
140
141#if defined(DEBUG)
142 void Show( int nestLevel, std::ostream& os ) const override;
143#endif
144
145private:
146 bool doIsConnected( const VECTOR2I& aPosition ) const override;
147
149
150private:
154
155 // If real-time connectivity gets disabled (due to being too slow on a particular design),
156 // we can no longer rely on getting the NetClass to find netclass-specific linestyles,
157 // linewidths and colors.
160};
161
162
163#endif // SCH_JUNCTION_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
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Base plotter engine class.
Definition: plotter.h:105
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
virtual bool IsConnectable() const
Definition: sch_item.h:449
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
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.
VECTOR2I m_pos
Definition: sch_junction.h:151
virtual bool operator<(const SCH_ITEM &aItem) const override
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_junction.h:72
int GetEffectiveDiameter() const
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_junction.h:90
SHAPE_CIRCLE getEffectiveShape() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
COLOR4D m_lastResolvedColor
Definition: sch_junction.h:159
int m_diameter
Zero is user default.
Definition: sch_junction.h:152
bool operator==(const SCH_ITEM &aOther) const override
void SetDiameter(int aDiameter)
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
COLOR4D m_color
#COLOR4D::UNSPECIFIED is user default.
Definition: sch_junction.h:153
bool IsConnectable() const override
Definition: sch_junction.h:83
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_junction.h:100
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
COLOR4D GetColor() const
Definition: sch_junction.h:119
int GetDiameter() const
Definition: sch_junction.h:114
COLOR4D GetJunctionColor() const
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_junction.h:110
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.
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void SetLastResolvedState(const SCH_ITEM *aItem) override
Definition: sch_junction.h:57
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_junction.h:45
VECTOR2I GetPosition() const override
Definition: sch_junction.h:107
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_junction.h:108
void SetColor(const COLOR4D &aColor)
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
int m_lastResolvedDiameter
Definition: sch_junction.h:158
wxString GetClass() const override
Return the class name.
Definition: sch_junction.h:50
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
#define _(s)
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:353
@ LAYER_JUNCTION
Definition: layer_ids.h:358
@ 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_GLOBAL_LABEL_T
Definition: typeinfo.h:168
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691