KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_no_connect.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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#ifndef _SCH_NO_CONNECT_H_
26#define _SCH_NO_CONNECT_H_
27
28
29#include <sch_item.h>
30
31
32class NETLIST_OBJECT_LIST;
33
35{
36public:
37 SCH_NO_CONNECT( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
38
39 // Do not create a copy constructor. The one generated by the compiler is adequate.
40
42
43 void Serialize( google::protobuf::Any& aContainer ) const override;
44 bool Deserialize( const google::protobuf::Any& aContainer ) override;
45
46 static inline bool ClassOf( const EDA_ITEM* aItem )
47 {
48 return aItem && SCH_NO_CONNECT_T == aItem->Type();
49 }
50
51 wxString GetClass() const override
52 {
53 return wxT( "SCH_NO_CONNECT" );
54 }
55
56 int GetSize() const
57 {
58 return m_size;
59 }
60
61 int GetPenWidth() const override;
62
63 std::vector<int> ViewGetLayers() const override;
64
65 void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
66
67 const BOX2I GetBoundingBox() const override;
68
69 // Geometric transforms (used in block operations):
70
71 void Move( const VECTOR2I& aMoveVector ) override
72 {
73 m_pos += aMoveVector;
74 }
75
76 void MirrorHorizontally( int aCenter ) override;
77 void MirrorVertically( int aCenter ) override;
78 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
79
80 bool IsConnectable() const override { return true; }
81
82 bool HasConnectivityChanges( const SCH_ITEM* aItem,
83 const SCH_SHEET_PATH* aInstance = nullptr ) const override;
84
85 bool CanConnect( const SCH_ITEM* aItem ) const override
86 {
87 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE )
88 || aItem->Type() == SCH_SYMBOL_T || aItem->Type() == SCH_SHEET_T;
89 }
90
91 std::vector<VECTOR2I> GetConnectionPoints() const override;
92
93 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
94 {
95 return wxString( _( "No Connect" ) );
96 }
97
98 BITMAPS GetMenuImage() const override;
99
100 VECTOR2I GetPosition() const override { return m_pos; }
101 void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
102
103 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
104 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
105 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
106
107 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
108 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
109
110 EDA_ITEM* Clone() const override;
111
112 double Similarity( const SCH_ITEM& aOther ) const override;
113
114 bool operator==( const SCH_ITEM& aOther ) const override;
115
116#if defined(DEBUG)
117 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
118#endif
119
120protected:
121 void swapData( SCH_ITEM* aItem ) override;
122
123private:
124 bool doIsConnected( const VECTOR2I& aPosition ) const override;
125
127 int m_size;
128};
129
130
131#endif // _SCH_NO_CONNECT_H_
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
Base plotter engine class.
Definition plotter.h:133
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition sch_item.h:338
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:52
bool operator==(const SCH_ITEM &aOther) const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this 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.
static bool ClassOf(const EDA_ITEM *aItem)
SCH_NO_CONNECT(const VECTOR2I &pos=VECTOR2I(0, 0))
int m_size
Size of the no connect object.
int GetSize() const
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
VECTOR2I m_pos
Position of the no connect object.
bool IsConnectable() const override
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const override
Check if aItem has connectivity changes against this object.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool doIsConnected(const VECTOR2I &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
wxString GetClass() const override
Return the class name.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Add the schematic item end points to aItemList if the item has end points.
VECTOR2I GetPosition() const override
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
int GetPenWidth() const override
void SetPosition(const VECTOR2I &aPosition) override
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
bool CanConnect(const SCH_ITEM *aItem) const override
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
#define _(s)
@ LAYER_WIRE
Definition layer_ids.h:450
@ SCH_LINE_T
Definition typeinfo.h:160
@ SCH_NO_CONNECT_T
Definition typeinfo.h:157
@ SCH_SYMBOL_T
Definition typeinfo.h:169
@ SCH_SHEET_T
Definition typeinfo.h:172
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683