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-2017 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_JUNCTION_H_
30 #define _SCH_JUNCTION_H_
33 #include <sch_item_struct.h>
36 class SCH_JUNCTION : public SCH_ITEM
37 {
38  wxPoint m_pos; // Position of the junction.
39  static int m_symbolSize; // diameter of the junction graphic symbol
41 public:
42  SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
44  // Do not create a copy constructor. The one generated by the compiler is adequate.
48  wxString GetClass() const override
49  {
50  return wxT( "SCH_JUNCTION" );
51  }
53  static int GetSymbolSize() { return m_symbolSize; }
54  static void SetSymbolSize( int aSize ) { m_symbolSize = aSize; }
56  // Return the size the symbol should be drawn at. This is GetSymbolSize() clamped to be
57  // no less than 1.5 X the current wire width.
58  static int GetEffectiveSymbolSize();
60  void SwapData( SCH_ITEM* aItem ) override;
62  void ViewGetLayers( int aLayers[], int& aCount ) const override;
64  const EDA_RECT GetBoundingBox() const override;
66  void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
67  GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override;
69  void Move( const wxPoint& aMoveVector ) override
70  {
71  m_pos += aMoveVector;
72  }
74  void MirrorY( int aYaxis_position ) override;
76  void MirrorX( int aXaxis_position ) override;
78  void Rotate( wxPoint aPosition ) override;
80  void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
82  bool IsSelectStateChanged( const wxRect& aRect ) override;
84  bool IsConnectable() const override { return true; }
86  void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
88  bool CanConnect( const SCH_ITEM* aItem ) const override
89  {
90  return aItem->Type() == SCH_LINE_T &&
91  ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
92  }
94  wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
95  {
96  return wxString( _( "Junction" ) );
97  }
99  BITMAP_DEF GetMenuImage() const override;
101  void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
103  wxPoint GetPosition() const override { return m_pos; }
105  void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
107  bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
109  bool HitTest( const EDA_RECT& aRect, bool aContained = false,
110  int aAccuracy = 0 ) const override;
111  void Plot( PLOTTER* aPlotter ) override;
113  EDA_ITEM* Clone() const override;
115 #if defined(DEBUG)
116  void Show( int nestLevel, std::ostream& os ) const override;
117 #endif
119 private:
120  bool doIsConnected( const wxPoint& aPosition ) const override;
121 };
124 #endif // _SCH_JUNCTION_H_
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_junction.h:69
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_junction.h:48
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
Function Draw Draw a schematic item.
bool IsSelectStateChanged(const wxRect &aRect) override
Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed...
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_types.h:43
void MirrorX(int aXaxis_position) override
Function MirrorX mirrors item relative to the X axis about aXaxis_position.
Base schematic object class definition.
void GetConnectionPoints(std::vector< wxPoint > &aPoints) const override
Function GetConnectionPoints add all the connection points for this item to aPoints.
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
void Rotate(wxPoint aPosition) override
Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.
void SwapData(SCH_ITEM *aItem) override
Function SwapData swap the internal data structures aItem with the schematic item.
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
bool HitTest(const wxPoint &aPosition, int aAccuracy) const override
Function HitTest tests if aPosition is contained within or on the bounding box of an item...
bool doIsConnected(const wxPoint &aPosition) const override
Function doIsConnected provides the object specific test to see if it is connected to aPosition...
static void SetSymbolSize(int aSize)
Definition: sch_junction.h:54
static int m_symbolSize
Definition: sch_junction.h:39
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
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...
wxString GetSelectMenuText(EDA_UNITS_T aUnits) const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_junction.h:94
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_junction.h:103
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_junction.h:105
bool CanConnect(const SCH_ITEM *aItem) const override
Definition: sch_junction.h:88
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...
wxPoint m_pos
Definition: sch_junction.h:38
bool IsConnectable() const override
Function IsConnectable returns true if the schematic item can connect to another schematic item...
Definition: sch_junction.h:84
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...
Base plotter engine class.
Definition: plotter.h:97
SCH_JUNCTION(const wxPoint &pos=wxPoint(0, 0))
static int GetSymbolSize()
Definition: sch_junction.h:53
BITMAP_DEF GetMenuImage() const override
Function GetMenuImage returns a pointer to an image to be used in menus.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
static int GetEffectiveSymbolSize()
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Definition: common.h:160
void Plot(PLOTTER *aPlotter) override
Function Plot plots the schematic item to aPlotter.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39