KiCad PCB EDA Suite
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,
5  * Copyright (C) 1992-2019 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
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  *
20  * or you may search the 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  */
29 #ifndef _SCH_NO_CONNECT_H_
30 #define _SCH_NO_CONNECT_H_
33 #include <sch_item.h>
34 #include <math/util.h> // for KiROUND
39 class SCH_NO_CONNECT : public SCH_ITEM
40 {
42  int m_size;
44 public:
45  SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
47  // Do not create a copy constructor. The one generated by the compiler is adequate.
51  static inline bool ClassOf( const EDA_ITEM* aItem )
52  {
53  return aItem && SCH_NO_CONNECT_T == aItem->Type();
54  }
56  wxString GetClass() const override
57  {
58  return wxT( "SCH_NO_CONNECT" );
59  }
61  int GetSize() const
62  {
63  return std::max( m_size, KiROUND( GetDefaultLineThickness() * 3 ) );
64  }
66  int GetPenSize() const override;
68  void SwapData( SCH_ITEM* aItem ) override;
70  void ViewGetLayers( int aLayers[], int& aCount ) const override;
72  void Print( wxDC* aDC, const wxPoint& aOffset ) override;
74  void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
76  const EDA_RECT GetBoundingBox() const override;
78  // Geometric transforms (used in block operations):
80  void Move( const wxPoint& aMoveVector ) override
81  {
82  m_pos += aMoveVector;
83  }
85  void MirrorY( int aYaxis_position ) override;
86  void MirrorX( int aXaxis_position ) override;
87  void Rotate( wxPoint aPosition ) override;
89  bool IsConnectable() const override { return true; }
91  bool CanConnect( const SCH_ITEM* aItem ) const override
92  {
93  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
94  aItem->Type() == SCH_COMPONENT_T;
95  }
97  void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
99  wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
100  {
101  return wxString( _( "No Connect" ) );
102  }
104  BITMAP_DEF GetMenuImage() const override;
106  void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
108  wxPoint GetPosition() const override { return m_pos; }
109  void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
111  bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
112  bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
114  void Plot( PLOTTER* aPlotter ) override;
116  EDA_ITEM* Clone() const override;
118 #if defined(DEBUG)
119  void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
120 #endif
122 private:
123  bool doIsConnected( const wxPoint& aPosition ) const override;
124 };
127 #endif // _SCH_NO_CONNECT_H_
Definition: common.h:184
void MirrorY(int aYaxis_position) override
Function MirrorY mirrors item relative to the Y axis about aYaxis_position.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
wxPoint GetPosition() const override
Function GetPosition.
wxPoint m_pos
Position of the no connect object.
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
void MirrorX(int aXaxis_position) override
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
wxString GetClass() const override
Function GetClass returns the class name.
void GetConnectionPoints(std::vector< wxPoint > &aPoints) const override
Function GetConnectionPoints add all the connection points for this item to aPoints.
void GetNetListItem(NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetList...
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Function GetEndPoints adds 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
Function SwapData swap the internal data structures aItem with the schematic item.
NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected items in a...
void Print(wxDC *aDC, const wxPoint &aOffset) override
Function Print Print a schematic item.
bool HitTest(const wxPoint &aPosition, int aAccuracy=0) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item.
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
wxString GetSelectMenuText(EDA_UNITS aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
bool IsConnectable() const override
Function IsConnectable returns true if the schematic item can connect to another schematic item.
int GetSize() const
bool CanConnect(const SCH_ITEM *aItem) const override
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
void Plot(PLOTTER *aPlotter) override
Function Plot plots the schematic item to aPlotter.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
Definition: sch_item.h:224
Base plotter engine class.
Definition: plotter.h:104
#define _(s)
Definition: 3d_actions.cpp:33
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:166
void ViewGetLayers(int aLayers[], int &aCount) const override
Function ViewGetLayers returns the layers the item is drawn on (which may be more than its "home" lay...
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
int GetPenSize() const override
Function GetPenSize virtual pure.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
static bool ClassOf(const EDA_ITEM *aItem)
bool doIsConnected(const wxPoint &aPosition) const override
Function doIsConnected provides 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
Function Type()
Definition: base_struct.h:212