KiCad PCB EDA Suite
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 (C) 1992-2021 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
29#ifndef _SCH_NO_CONNECT_H_
30#define _SCH_NO_CONNECT_H_
31
32
33#include <sch_item.h>
34
35
36class NETLIST_OBJECT_LIST;
37
39{
40public:
41 SCH_NO_CONNECT( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
42
43 // Do not create a copy constructor. The one generated by the compiler is adequate.
44
46
47 static inline bool ClassOf( const EDA_ITEM* aItem )
48 {
49 return aItem && SCH_NO_CONNECT_T == aItem->Type();
50 }
51
52 wxString GetClass() const override
53 {
54 return wxT( "SCH_NO_CONNECT" );
55 }
56
57 int GetSize() const
58 {
59 return m_size;
60 }
61
62 int GetPenWidth() const override;
63
64 void SwapData( SCH_ITEM* aItem ) override;
65
66 void ViewGetLayers( int aLayers[], int& aCount ) const override;
67
68 void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
69
70 void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
71
72 const BOX2I GetBoundingBox() const override;
73
74 // Geometric transforms (used in block operations):
75
76 void Move( const VECTOR2I& aMoveVector ) override
77 {
78 m_pos += aMoveVector;
79 }
80
81 void MirrorHorizontally( int aCenter ) override;
82 void MirrorVertically( int aCenter ) override;
83 void Rotate( const VECTOR2I& aCenter ) override;
84
85 bool IsConnectable() const override { return true; }
86
87 bool CanConnect( const SCH_ITEM* aItem ) const override
88 {
89 return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
90 aItem->Type() == SCH_SYMBOL_T;
91 }
92
93 std::vector<VECTOR2I> GetConnectionPoints() const override;
94
95 wxString GetSelectMenuText( UNITS_PROVIDER* aUnitsProvider ) const override
96 {
97 return wxString( _( "No Connect" ) );
98 }
99
100 BITMAPS GetMenuImage() const override;
101
102 VECTOR2I GetPosition() const override { return m_pos; }
103 void SetPosition( const VECTOR2I& aPosition ) override { m_pos = aPosition; }
104
105 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
106 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
107
108 void Plot( PLOTTER* aPlotter, bool aBackground ) const override;
109
110 EDA_ITEM* Clone() const override;
111
112#if defined(DEBUG)
113 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
114#endif
115
116private:
117 bool doIsConnected( const VECTOR2I& aPosition ) const override;
118
120 int m_size;
121};
122
123
124#endif // _SCH_NO_CONNECT_H_
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
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
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Base plotter engine class.
Definition: plotter.h:110
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
wxString GetSelectMenuText(UNITS_PROVIDER *aUnitsProvider) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
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.
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
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) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
wxString GetClass() const override
Return the class name.
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.
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.
void Print(const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
Print a schematic item.
void Plot(PLOTTER *aPlotter, bool aBackground) const override
Plot the schematic item to aPlotter.
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.
#define _(s)
@ LAYER_WIRE
Definition: layer_ids.h:344
@ SCH_LINE_T
Definition: typeinfo.h:146
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618