2011-10-19 20:32:21 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
2019-04-21 23:45:34 +00:00
|
|
|
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors.
|
2011-10-19 20:32:21 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-10-11 13:38:13 +00:00
|
|
|
/**
|
|
|
|
* @file sch_item_struct.h
|
|
|
|
* @brief Base schematic object class definition.
|
|
|
|
*/
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
#ifndef SCH_ITEM_STRUCT_H
|
|
|
|
#define SCH_ITEM_STRUCT_H
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <unordered_map>
|
2019-04-20 01:45:33 +00:00
|
|
|
#include <unordered_set>
|
2010-11-03 14:13:15 +00:00
|
|
|
#include <vector>
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <base_screen.h>
|
2013-04-06 12:01:53 +00:00
|
|
|
#include <general.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
class SCH_ITEM;
|
2019-03-11 21:32:05 +00:00
|
|
|
//class SCH_SHEET_PATH;
|
2019-04-20 01:45:33 +00:00
|
|
|
class SCH_CONNECTION;
|
2010-11-10 15:30:12 +00:00
|
|
|
class LINE_READER;
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2010-03-16 18:22:59 +00:00
|
|
|
class wxFindReplaceData;
|
2011-06-17 13:24:22 +00:00
|
|
|
class PLOTTER;
|
2011-10-11 13:38:13 +00:00
|
|
|
class NETLIST_OBJECT;
|
2013-09-25 19:09:57 +00:00
|
|
|
class NETLIST_OBJECT_LIST;
|
2018-08-03 12:18:26 +00:00
|
|
|
class EDA_DRAW_PANEL;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
enum DANGLING_END_T {
|
|
|
|
UNKNOWN = 0,
|
|
|
|
WIRE_START_END,
|
|
|
|
WIRE_END_END,
|
|
|
|
BUS_START_END,
|
|
|
|
BUS_END_END,
|
|
|
|
JUNCTION_END,
|
|
|
|
PIN_END,
|
|
|
|
LABEL_END,
|
2017-12-01 01:21:23 +00:00
|
|
|
BUS_ENTRY_END,
|
|
|
|
WIRE_ENTRY_END,
|
2015-06-08 00:07:42 +00:00
|
|
|
SHEET_LABEL_END,
|
|
|
|
NO_CONNECT_END,
|
2010-11-03 14:13:15 +00:00
|
|
|
};
|
|
|
|
|
2011-12-06 21:02:21 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-15 14:31:16 +00:00
|
|
|
* Class DANGLING_END_ITEM
|
2011-12-06 21:02:21 +00:00
|
|
|
* is a helper class used to store the state of schematic items that can be connected to
|
|
|
|
* other schematic items.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
class DANGLING_END_ITEM
|
|
|
|
{
|
2013-03-31 13:27:46 +00:00
|
|
|
private:
|
2012-03-15 14:31:16 +00:00
|
|
|
/// A pointer to the connectable object.
|
2019-03-11 21:32:05 +00:00
|
|
|
EDA_ITEM* m_item;
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2011-12-06 21:02:21 +00:00
|
|
|
/// The position of the connection point.
|
|
|
|
wxPoint m_pos;
|
|
|
|
|
|
|
|
/// The type of connection of #m_item.
|
|
|
|
DANGLING_END_T m_type;
|
|
|
|
|
2017-12-07 20:23:02 +00:00
|
|
|
/// A pointer to the parent object (in the case of pins)
|
|
|
|
const EDA_ITEM* m_parent;
|
|
|
|
|
2011-12-06 21:02:21 +00:00
|
|
|
public:
|
2019-03-11 21:32:05 +00:00
|
|
|
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const wxPoint& aPosition )
|
2010-11-03 14:13:15 +00:00
|
|
|
{
|
2011-12-06 21:02:21 +00:00
|
|
|
m_item = aItem;
|
|
|
|
m_type = aType;
|
|
|
|
m_pos = aPosition;
|
2017-12-07 20:23:02 +00:00
|
|
|
m_parent = aItem;
|
|
|
|
}
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem,
|
2017-12-07 20:23:02 +00:00
|
|
|
const wxPoint& aPosition, const EDA_ITEM* aParent )
|
|
|
|
{
|
|
|
|
m_item = aItem;
|
|
|
|
m_type = aType;
|
|
|
|
m_pos = aPosition;
|
|
|
|
m_parent = aParent;
|
2010-11-03 14:13:15 +00:00
|
|
|
}
|
2011-12-06 21:02:21 +00:00
|
|
|
|
|
|
|
wxPoint GetPosition() const { return m_pos; }
|
2019-03-11 21:32:05 +00:00
|
|
|
EDA_ITEM* GetItem() const { return m_item; }
|
2017-12-07 20:23:02 +00:00
|
|
|
const EDA_ITEM* GetParent() const { return m_parent; }
|
2011-12-06 21:02:21 +00:00
|
|
|
DANGLING_END_T GetType() const { return m_type; }
|
2010-11-03 14:13:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Class SCH_ITEM
|
|
|
|
* is a base class for any item which can be embedded within the SCHEMATIC
|
|
|
|
* container class, and therefore instances of derived classes should only be
|
|
|
|
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
|
2011-09-30 18:15:37 +00:00
|
|
|
* The corresponding class in Pcbnew is BOARD_ITEM.
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_ITEM : public EDA_ITEM
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
2019-03-11 21:32:05 +00:00
|
|
|
friend class CONNECTION_GRAPH;
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
protected:
|
2017-03-13 03:19:33 +00:00
|
|
|
SCH_LAYER_ID m_Layer;
|
2010-11-03 14:13:15 +00:00
|
|
|
EDA_ITEMS m_connections; ///< List of items connected to this item.
|
2015-02-28 16:56:09 +00:00
|
|
|
wxPoint m_storedPos; ///< a temporary variable used in some move commands
|
|
|
|
///> to store a initial pos (of the item or mouse cursor)
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/// Stores pointers to other items that are connected to this one (schematic only)
|
|
|
|
std::unordered_set<SCH_ITEM*> m_connected_items;
|
|
|
|
|
|
|
|
/// Stores connectivity information, per sheet
|
|
|
|
std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
|
|
|
|
|
2019-03-30 15:57:30 +00:00
|
|
|
/// True if connectivity info might be out of date
|
|
|
|
bool m_connectivity_dirty;
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_ITEM( const SCH_ITEM& aItem );
|
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
~SCH_ITEM();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
virtual wxString GetClass() const override
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
return wxT( "SCH_ITEM" );
|
|
|
|
}
|
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
/**
|
2012-01-09 20:26:55 +00:00
|
|
|
* Function SwapData
|
2011-04-05 14:46:51 +00:00
|
|
|
* swap the internal data structures \a aItem with the schematic item.
|
2011-06-09 13:30:46 +00:00
|
|
|
* Obviously, aItem must have the same type than me
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aItem The item to swap the data structures with.
|
|
|
|
*/
|
|
|
|
virtual void SwapData( SCH_ITEM* aItem );
|
|
|
|
|
2014-04-30 19:16:22 +00:00
|
|
|
SCH_ITEM* Next() const { return static_cast<SCH_ITEM*>( Pnext ); }
|
|
|
|
SCH_ITEM* Back() const { return static_cast<SCH_ITEM*>( Pback ); }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* Virtual function IsMovableFromAnchorPoint
|
|
|
|
* @return true for items which are moved with the anchor point at mouse cursor
|
|
|
|
* and false for items moved with no reference to anchor
|
|
|
|
* Usually return true for small items (labels, junctions) and false for
|
|
|
|
* items which can be large (hierarchical sheets, compoments)
|
|
|
|
*/
|
|
|
|
virtual bool IsMovableFromAnchorPoint() { return true; }
|
|
|
|
|
|
|
|
wxPoint& GetStoredPos() { return m_storedPos; }
|
|
|
|
void SetStoredPos( wxPoint aPos ) { m_storedPos = aPos; }
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
/**
|
|
|
|
* Function IsLocked
|
|
|
|
* @return bool - true if the object is locked, else false
|
|
|
|
*/
|
|
|
|
virtual bool IsLocked() const { return false; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLocked
|
|
|
|
* modifies 'lock' status for of the item.
|
|
|
|
*/
|
|
|
|
virtual void SetLocked( bool aLocked ) {}
|
2015-02-28 16:56:09 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Function GetLayer
|
|
|
|
* returns the layer this item is on.
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
SCH_LAYER_ID GetLayer() const { return m_Layer; }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLayer
|
|
|
|
* sets the layer this item is on.
|
|
|
|
* @param aLayer The layer number.
|
|
|
|
*/
|
2017-03-13 03:19:33 +00:00
|
|
|
void SetLayer( SCH_LAYER_ID aLayer ) { m_Layer = aLayer; }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2018-10-21 12:50:31 +00:00
|
|
|
/**
|
|
|
|
* Function ViewGetLayers
|
|
|
|
* returns the layers the item is drawn on (which may be more than its "home" layer)
|
|
|
|
*/
|
|
|
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPenSize virtual pure
|
2009-06-30 19:21:41 +00:00
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2010-12-10 19:47:44 +00:00
|
|
|
virtual int GetPenSize() const { return 0; }
|
2009-06-30 19:21:41 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
|
|
|
* Function Draw
|
2015-02-28 16:56:09 +00:00
|
|
|
* Draw a schematic item. Each schematic item should have its own method
|
|
|
|
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
|
|
|
|
* @param aDC Device Context (can be null)
|
|
|
|
* @param aOffset drawing Offset (usually wxPoint(0,0),
|
|
|
|
* but can be different when moving an object)
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2019-04-04 22:49:49 +00:00
|
|
|
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) = 0;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
|
|
|
* Function Move
|
|
|
|
* moves the item by \a aMoveVector to a new position.
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aMoveVector = the displacement vector
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
virtual void Move( const wxPoint& aMoveVector ) = 0;
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
2012-03-15 14:31:16 +00:00
|
|
|
* Function MirrorY
|
|
|
|
* mirrors item relative to the Y axis about \a aYaxis_position.
|
2010-12-21 15:13:09 +00:00
|
|
|
* @param aYaxis_position The Y axis position to mirror around.
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2012-03-15 14:31:16 +00:00
|
|
|
virtual void MirrorY( int aYaxis_position ) = 0;
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
|
|
|
* Function MirrorX
|
|
|
|
* mirrors item relative to the X axis about \a aXaxis_position.
|
|
|
|
* @param aXaxis_position The X axis position to mirror around.
|
|
|
|
*/
|
|
|
|
virtual void MirrorX( int aXaxis_position ) = 0;
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
|
|
|
* Function Rotate
|
|
|
|
* rotates the item around \a aPosition 90 degrees in the clockwise direction.
|
|
|
|
* @param aPosition A reference to a wxPoint object containing the coordinates to
|
|
|
|
* rotate around.
|
|
|
|
*/
|
|
|
|
virtual void Rotate( wxPoint aPosition ) = 0;
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function Load
|
|
|
|
* reads a schematic item from \a aLine in a .sch file.
|
2010-11-10 15:30:12 +00:00
|
|
|
*
|
|
|
|
* @param aLine - Essentially this is file to read the object from.
|
|
|
|
* @param aErrorMsg - Description of the error if an error occurs while loading the object.
|
|
|
|
* @return True if the object loaded successfully.
|
|
|
|
*/
|
|
|
|
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ) { return false; }
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function GetEndPoints
|
|
|
|
* adds the schematic item end points to \a aItemList if the item has end points.
|
2010-11-03 14:13:15 +00:00
|
|
|
*
|
|
|
|
* The default version doesn't do anything since many of the schematic object cannot
|
|
|
|
* be tested for dangling ends. If you add a new schematic item that can have a
|
|
|
|
* dangling end ( no connect ), override this method to provide the correct end
|
|
|
|
* points.
|
|
|
|
*
|
|
|
|
* @param aItemList - List of DANGLING_END_ITEMS to add to.
|
|
|
|
*/
|
2013-12-13 16:27:30 +00:00
|
|
|
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function IsDanglingStateChanged
|
|
|
|
* tests the schematic item to \a aItemList to check if it's dangling state has changed.
|
2010-11-03 14:13:15 +00:00
|
|
|
*
|
|
|
|
* Note that the return value only true when the state of the test has changed. Use
|
|
|
|
* the IsDangling() method to get the current dangling state of the item. Some of
|
|
|
|
* the schematic objects cannot be tested for a dangling state, the default method
|
|
|
|
* always returns false. Only override the method if the item can be tested for a
|
|
|
|
* dangling state.
|
|
|
|
*
|
|
|
|
* @param aItemList - List of items to test item against.
|
|
|
|
* @return True if the dangling state has changed from it's current setting.
|
|
|
|
*/
|
2018-10-29 18:11:04 +00:00
|
|
|
virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) { return false; }
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
virtual bool IsDangling() const { return false; }
|
|
|
|
|
2017-12-19 17:45:56 +00:00
|
|
|
virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_Layer == aItem->GetLayer(); }
|
2017-12-01 01:21:23 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function IsSelectStateChanged
|
|
|
|
* checks if the selection state of an item inside \a aRect has changed.
|
2010-11-03 14:13:15 +00:00
|
|
|
*
|
2010-12-21 15:13:09 +00:00
|
|
|
* This is used by the block selection code to verify if an item is selected or not.
|
2010-11-03 14:13:15 +00:00
|
|
|
* True is be return anytime the select state changes. If you need to know the
|
|
|
|
* the current selection state, use the IsSelected() method.
|
|
|
|
*
|
2011-03-25 19:16:05 +00:00
|
|
|
* @param aRect - Rectangle to test against.
|
2010-11-03 14:13:15 +00:00
|
|
|
*/
|
|
|
|
virtual bool IsSelectStateChanged( const wxRect& aRect ) { return false; }
|
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
|
|
|
* Function IsConnectable
|
|
|
|
* returns true if the schematic item can connect to another schematic item.
|
|
|
|
*/
|
|
|
|
virtual bool IsConnectable() const { return false; }
|
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function GetConnectionPoints
|
|
|
|
* add all the connection points for this item to \a aPoints.
|
2010-11-03 14:13:15 +00:00
|
|
|
*
|
|
|
|
* Not all schematic items have connection points so the default method does nothing.
|
|
|
|
*
|
2010-12-21 15:13:09 +00:00
|
|
|
* @param aPoints List of connection points to add to.
|
2010-11-03 14:13:15 +00:00
|
|
|
*/
|
2013-12-13 16:27:30 +00:00
|
|
|
virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { }
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function ClearConnections
|
|
|
|
* clears all of the connection items from the list.
|
2010-11-03 14:13:15 +00:00
|
|
|
*
|
|
|
|
* The vector release method is used to prevent the item pointers from being deleted.
|
|
|
|
* Do not use the vector erase method on the connection list.
|
|
|
|
*/
|
2011-03-25 19:16:05 +00:00
|
|
|
void ClearConnections() { m_connections.clear(); }
|
2010-12-10 19:47:44 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function IsConnected
|
|
|
|
* tests the item to see if it is connected to \a aPoint.
|
2010-12-13 15:59:00 +00:00
|
|
|
*
|
2012-03-15 14:31:16 +00:00
|
|
|
* @param aPoint A reference to a wxPoint object containing the coordinates to test.
|
2010-12-14 15:56:30 +00:00
|
|
|
* @return True if connection to \a aPoint exists.
|
2010-12-13 15:59:00 +00:00
|
|
|
*/
|
|
|
|
bool IsConnected( const wxPoint& aPoint ) const;
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
|
|
|
* Retrieves the connection associated with this object in the given sheet
|
|
|
|
*/
|
|
|
|
SCH_CONNECTION* Connection( const SCH_SHEET_PATH& aPath ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the set of items connected to this item (schematic only)
|
|
|
|
*/
|
|
|
|
std::unordered_set<SCH_ITEM*>& ConnectedItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a connection link between this item and another
|
|
|
|
*/
|
|
|
|
void AddConnectionTo( SCH_ITEM* aItem );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new connection object associated with this object
|
|
|
|
*
|
|
|
|
* @param aPath is the sheet path to initialize
|
|
|
|
*/
|
2019-04-05 22:27:09 +00:00
|
|
|
SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this item should propagate connection info to aItem
|
|
|
|
*/
|
|
|
|
virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
|
|
|
|
|
2019-03-30 15:57:30 +00:00
|
|
|
bool IsConnectivityDirty() { return m_connectivity_dirty; }
|
|
|
|
|
|
|
|
void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
|
|
|
|
|
2016-09-25 17:06:49 +00:00
|
|
|
virtual bool HitTest( const wxPoint& aPosition ) const override
|
2014-05-04 17:08:36 +00:00
|
|
|
{
|
|
|
|
return HitTest( aPosition, 0 );
|
|
|
|
}
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function HitTest
|
2012-03-15 14:31:16 +00:00
|
|
|
* tests if \a aPosition is contained within or on the bounding box of an item.
|
2010-12-10 19:47:44 +00:00
|
|
|
*
|
2012-03-15 14:31:16 +00:00
|
|
|
* @param aPosition A reference to a wxPoint object containing the coordinates to test.
|
|
|
|
* @param aAccuracy Increase the item bounding box by this amount.
|
|
|
|
* @return True if \a aPosition is within the item bounding box.
|
2010-12-10 19:47:44 +00:00
|
|
|
*/
|
2012-03-15 14:31:16 +00:00
|
|
|
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const { return false; }
|
2010-12-10 19:47:44 +00:00
|
|
|
|
|
|
|
/**
|
2010-12-21 15:13:09 +00:00
|
|
|
* Function HitTest
|
|
|
|
* tests if \a aRect intersects or is contained within the bounding box of an item.
|
2010-12-10 19:47:44 +00:00
|
|
|
*
|
2012-03-15 14:31:16 +00:00
|
|
|
* @param aRect A reference to a EDA_RECT object containing the rectangle to test.
|
|
|
|
* @param aContained Set to true to test for containment instead of an intersection.
|
|
|
|
* @param aAccuracy Increase \a aRect by this amount.
|
2010-12-14 15:56:30 +00:00
|
|
|
* @return True if \a aRect contains or intersects the item bounding box.
|
2010-12-10 19:47:44 +00:00
|
|
|
*/
|
2012-03-15 14:31:16 +00:00
|
|
|
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const
|
2010-12-10 19:47:44 +00:00
|
|
|
{
|
2012-03-15 14:31:16 +00:00
|
|
|
return false;
|
2010-12-10 19:47:44 +00:00
|
|
|
}
|
|
|
|
|
2011-02-05 02:21:11 +00:00
|
|
|
virtual bool CanIncrementLabel() const { return false; }
|
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
|
|
|
* Function Plot
|
|
|
|
* plots the schematic item to \a aPlotter.
|
|
|
|
*
|
|
|
|
* @param aPlotter A pointer to a #PLOTTER object.
|
|
|
|
*/
|
|
|
|
virtual void Plot( PLOTTER* aPlotter );
|
2011-06-17 13:24:22 +00:00
|
|
|
|
2011-10-11 13:38:13 +00:00
|
|
|
/**
|
|
|
|
* Function GetNetListItem
|
|
|
|
* creates a new #NETLIST_OBJECT for the schematic object and adds it to
|
|
|
|
* \a aNetListItems.
|
|
|
|
* <p>
|
|
|
|
* Not all schematic objects have net list items associated with them. This
|
|
|
|
* method only needs to be overridden for those schematic objects that have
|
|
|
|
* net list objects associated with them.
|
2012-03-15 14:31:16 +00:00
|
|
|
* </p>
|
2011-10-11 13:38:13 +00:00
|
|
|
*/
|
2013-09-25 19:09:57 +00:00
|
|
|
virtual void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
|
|
|
SCH_SHEET_PATH* aSheetPath ) { }
|
2011-10-11 13:38:13 +00:00
|
|
|
|
2011-10-19 20:32:21 +00:00
|
|
|
/**
|
|
|
|
* Function GetPosition
|
2012-03-15 14:31:16 +00:00
|
|
|
* @return A wxPoint object containing the schematic item position.
|
2011-10-19 20:32:21 +00:00
|
|
|
*/
|
2012-03-15 14:31:16 +00:00
|
|
|
virtual wxPoint GetPosition() const = 0;
|
2011-10-19 20:32:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetPosition
|
|
|
|
* set the schematic item position to \a aPosition.
|
|
|
|
*
|
|
|
|
* @param aPosition A reference to a wxPoint object containing the new position.
|
|
|
|
*/
|
2012-03-15 14:31:16 +00:00
|
|
|
virtual void SetPosition( const wxPoint& aPosition ) = 0;
|
2011-10-19 20:32:21 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
virtual bool operator <( const SCH_ITEM& aItem ) const;
|
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
private:
|
2010-12-10 19:47:44 +00:00
|
|
|
/**
|
2012-03-15 14:31:16 +00:00
|
|
|
* Function doIsConnected
|
|
|
|
* provides the object specific test to see if it is connected to \a aPosition.
|
|
|
|
*
|
|
|
|
* @note Override this function if the derived object can be connect to another
|
|
|
|
* object such as a wire, bus, or junction. Do not override this function
|
|
|
|
* for objects that cannot have connections. The default will always return
|
|
|
|
* false. This functions is call through the public function IsConnected()
|
|
|
|
* which performs tests common to all schematic items before calling the
|
|
|
|
* item specific connection testing.
|
|
|
|
*
|
|
|
|
* @param aPosition A reference to a wxPoint object containing the test position.
|
|
|
|
* @return True if connection to \a aPosition exists.
|
2010-12-10 19:47:44 +00:00
|
|
|
*/
|
2010-12-21 15:13:09 +00:00
|
|
|
virtual bool doIsConnected( const wxPoint& aPosition ) const { return false; }
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCH_ITEM_STRUCT_H */
|