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, jaen-pierre.charras@gipsa-lab.inpg.com
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 #include <math/util.h> // for KiROUND
35 
36 
37 class NETLIST_OBJECT_LIST;
38 
39 class SCH_NO_CONNECT : public SCH_ITEM
40 {
41 public:
42  SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
43 
44  // Do not create a copy constructor. The one generated by the compiler is adequate.
45 
47 
48  static inline bool ClassOf( const EDA_ITEM* aItem )
49  {
50  return aItem && SCH_NO_CONNECT_T == aItem->Type();
51  }
52 
53  wxString GetClass() const override
54  {
55  return wxT( "SCH_NO_CONNECT" );
56  }
57 
58  int GetSize() const
59  {
60  return m_size;
61  }
62 
63  int GetPenWidth() const override;
64 
65  void SwapData( SCH_ITEM* aItem ) override;
66 
67  void ViewGetLayers( int aLayers[], int& aCount ) const override;
68 
69  void Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
70 
71  void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
72 
73  const EDA_RECT GetBoundingBox() const override;
74 
75  // Geometric transforms (used in block operations):
76 
77  void Move( const wxPoint& aMoveVector ) override
78  {
79  m_pos += aMoveVector;
80  }
81 
82  void MirrorHorizontally( int aCenter ) override;
83  void MirrorVertically( int aCenter ) override;
84  void Rotate( wxPoint aCenter ) override;
85 
86  bool IsConnectable() const override { return true; }
87 
88  bool CanConnect( const SCH_ITEM* aItem ) const override
89  {
90  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
91  aItem->Type() == SCH_COMPONENT_T;
92  }
93 
94  std::vector<wxPoint> GetConnectionPoints() const override;
95 
96  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
97  {
98  return wxString( _( "No Connect" ) );
99  }
100 
101  BITMAPS GetMenuImage() const override;
102 
103  wxPoint GetPosition() const override { return m_pos; }
104  void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
105 
106  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
107  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
108 
109  void Plot( PLOTTER* aPlotter ) const override;
110 
111  EDA_ITEM* Clone() const override;
112 
113 #if defined(DEBUG)
114  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
115 #endif
116 
117 private:
118  bool doIsConnected( const wxPoint& aPosition ) const override;
119 
120  wxPoint m_pos;
121  int m_size;
122 };
123 
124 
125 #endif // _SCH_NO_CONNECT_H_
std::vector< wxPoint > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
int GetPenWidth() const override
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
wxPoint GetPosition() const override
wxPoint m_pos
Position of the no connect object.
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.
SCH_NO_CONNECT(const wxPoint &pos=wxPoint(0, 0))
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Test if aPosition is contained within or on the bounding box of an item.
void SetPosition(const wxPoint &aPosition) override
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Return the text to display to be used in the selection clarification context menu when multiple items...
bool IsConnectable() const override
int GetSize() const
bool CanConnect(const SCH_ITEM *aItem) const override
void Rotate(wxPoint aCenter) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
void Move(const wxPoint &aMoveVector) override
Move the item by aMoveVector to a new position.
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:272
EDA_UNITS
Definition: eda_units.h:38
Base plotter engine class.
Definition: plotter.h:121
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
#define _(s)
Definition: 3d_actions.cpp:33
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Handle the component boundary box.
Definition: eda_rect.h:42
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
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 Plot(PLOTTER *aPlotter) const override
Plot the schematic item to aPlotter.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
static bool ClassOf(const EDA_ITEM *aItem)
void Print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset) override
Print a schematic item.
bool doIsConnected(const wxPoint &aPosition) const override
Provide the object specific test to see if it is connected to aPosition.
int m_size
Size of the no connect object.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163