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-2022 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 Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
73
74 void Move( const VECTOR2I& aMoveVector ) override
75 {
76 m_pos += aMoveVector;
77 }
78
79 void MirrorHorizontally( int aCenter ) override;
80 void MirrorVertically( int aCenter ) override;
81 void Rotate( const VECTOR2I& aCenter ) override;
82
83 void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
84
85 bool IsConnectable() const override { return true; }
86
87 std::vector<VECTOR2I> GetConnectionPoints() const override;
88
89 bool CanConnect( const SCH_ITEM* aItem ) const override
90 {
91 return aItem->IsConnectable() && ( aItem->Type() == SCH_LINE_T
92 || aItem->Type() == SCH_SYMBOL_T
93 || aItem->Type() == SCH_LABEL_T
94 || aItem->Type() == SCH_GLOBAL_LABEL_T
95 || aItem->Type() == SCH_HIER_LABEL_T
96 || aItem->Type() == SCH_DIRECTIVE_LABEL_T );
97 }
98
99 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
100 {
101 return wxString( _( "Junction" ) );
102 }
103
104 BITMAPS GetMenuImage() const override;
105
106 VECTOR2I GetPosition() const override { return m_pos; }
107 void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
108
109 bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override { return false; }
110
111 int GetEffectiveDiameter() const;
112
113 int GetDiameter() const { return m_diameter; }
114 void SetDiameter( int aDiameter );
115
117
118 COLOR4D GetColor() const { return m_color; }
119 void SetColor( const COLOR4D& aColor );
120
121 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
122 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
123
124 void Plot( PLOTTER* aPlotter, bool aBackground,
125 const SCH_PLOT_SETTINGS& aPlotSettings ) const override;
126
127 EDA_ITEM* Clone() const override;
128
129 virtual bool operator <( const SCH_ITEM& aItem ) const override;
130
131 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
132
133 double Similarity( const SCH_ITEM& aOther ) const override;
134
135 bool operator==( const SCH_ITEM& aOther ) const override;
136
137#if defined(DEBUG)
138 void Show( int nestLevel, std::ostream& os ) const override;
139#endif
140
141private:
142 bool doIsConnected( const VECTOR2I& aPosition ) const override;
143
145
146private:
150
151 // If real-time connectivity gets disabled (due to being too slow on a particular design),
152 // we can no longer rely on getting the NetClass to find netclass-specific linestyles,
153 // linewidths and colors.
156};
157
158
159#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:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
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
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:151
virtual bool IsConnectable() const
Definition: sch_item.h:372
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
VECTOR2I m_pos
Definition: sch_junction.h:147
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:74
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:89
void Rotate(const VECTOR2I &aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
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:155
int m_diameter
Zero is user default.
Definition: sch_junction.h:148
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:149
bool IsConnectable() const override
Definition: sch_junction.h:85
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
COLOR4D GetColor() const
Definition: sch_junction.h:118
int GetDiameter() const
Definition: sch_junction.h:113
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_SETTINGS &aPlotSettings) const override
Plot the schematic item to aPlotter.
COLOR4D GetJunctionColor() const
bool IsPointClickableAnchor(const VECTOR2I &aPos) const override
Definition: sch_junction.h:109
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.
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.
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_junction.h:45
VECTOR2I GetPosition() const override
Definition: sch_junction.h:106
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_junction.h:107
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)
int m_lastResolvedDiameter
Definition: sch_junction.h:154
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.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: sch_junction.h:99
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.
#define _(s)
SCH_LAYER_ID
Eeschema drawing layers.
Definition: layer_ids.h:346
@ LAYER_JUNCTION
Definition: layer_ids.h:351
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_JUNCTION_T
Definition: typeinfo.h:142
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588