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
|
2024-03-09 13:50:26 +00:00
|
|
|
* Copyright (C) 2004-2024 KiCad Developers, see AUTHORS.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
|
|
|
|
*/
|
|
|
|
|
2019-05-10 19:57:24 +00:00
|
|
|
#ifndef SCH_ITEM_H
|
|
|
|
#define SCH_ITEM_H
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <unordered_map>
|
2024-04-25 14:24:46 +00:00
|
|
|
#include <unordered_set>
|
2022-03-11 21:37:03 +00:00
|
|
|
#include <map>
|
2022-02-28 23:56:30 +00:00
|
|
|
#include <set>
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2020-10-14 01:06:53 +00:00
|
|
|
#include <eda_item.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <sch_sheet_path.h>
|
2020-07-08 18:29:16 +00:00
|
|
|
#include <netclass.h>
|
2022-09-20 18:41:16 +00:00
|
|
|
#include <stroke_params.h>
|
|
|
|
#include <layer_ids.h>
|
2024-04-02 17:28:17 +00:00
|
|
|
#include <sch_render_settings.h>
|
2024-04-05 21:35:32 +00:00
|
|
|
#include <plotters/plotter.h>
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2020-06-30 00:27:08 +00:00
|
|
|
class CONNECTION_GRAPH;
|
2019-04-20 01:45:33 +00:00
|
|
|
class SCH_CONNECTION;
|
2019-06-25 23:39:58 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2020-05-13 02:00:37 +00:00
|
|
|
class SCHEMATIC;
|
2024-04-05 21:35:32 +00:00
|
|
|
class SYMBOL;
|
2010-11-10 15:30:12 +00:00
|
|
|
class LINE_READER;
|
2010-12-08 20:12:46 +00:00
|
|
|
class SCH_EDIT_FRAME;
|
2024-04-25 14:24:46 +00:00
|
|
|
class SCH_RULE_AREA;
|
2024-04-05 21:35:32 +00:00
|
|
|
struct SCH_PLOT_OPTS;
|
2019-05-31 12:15:25 +00:00
|
|
|
|
2023-08-06 19:20:53 +00:00
|
|
|
namespace KIFONT
|
|
|
|
{
|
|
|
|
class METRICS;
|
|
|
|
}
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
enum BODY_STYLE : int
|
|
|
|
{
|
|
|
|
BASE = 1,
|
|
|
|
DEMORGAN = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define MINIMUM_SELECTION_DISTANCE 2 // Minimum selection distance in mils
|
|
|
|
|
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
enum FIELDS_AUTOPLACED
|
|
|
|
{
|
|
|
|
FIELDS_AUTOPLACED_NO = 0,
|
|
|
|
FIELDS_AUTOPLACED_AUTO,
|
|
|
|
FIELDS_AUTOPLACED_MANUAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum DANGLING_END_T
|
|
|
|
{
|
2024-01-16 16:14:57 +00:00
|
|
|
DANGLING_END_UNKNOWN = 0,
|
2021-09-24 11:18:54 +00:00
|
|
|
WIRE_END,
|
|
|
|
BUS_END,
|
2010-11-03 14:13:15 +00:00
|
|
|
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
|
|
|
|
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Helper class used to store the state of schematic items that can be connected to
|
2011-12-06 21:02:21 +00:00
|
|
|
* other schematic items.
|
|
|
|
*/
|
2010-11-03 14:13:15 +00:00
|
|
|
class DANGLING_END_ITEM
|
|
|
|
{
|
2011-12-06 21:02:21 +00:00
|
|
|
public:
|
2022-01-01 06:04:08 +00:00
|
|
|
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& 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;
|
|
|
|
}
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
DANGLING_END_ITEM( DANGLING_END_T aType, EDA_ITEM* aItem, const VECTOR2I& aPosition,
|
2021-09-24 11:18:54 +00:00
|
|
|
const EDA_ITEM* aParent )
|
2017-12-07 20:23:02 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
bool operator==( const DANGLING_END_ITEM& aB ) const
|
2020-01-03 13:36:13 +00:00
|
|
|
{
|
|
|
|
return GetItem() == aB.GetItem()
|
|
|
|
&& GetPosition() == aB.GetPosition()
|
|
|
|
&& GetType() == aB.GetType()
|
|
|
|
&& GetParent() == aB.GetParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<( const DANGLING_END_ITEM& rhs ) const
|
|
|
|
{
|
|
|
|
return( m_pos.x < rhs.m_pos.x || ( m_pos.x == rhs.m_pos.x && m_pos.y < rhs.m_pos.y )
|
|
|
|
|| ( m_pos == rhs.m_pos && m_item < rhs.m_item ) );
|
|
|
|
}
|
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I 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; }
|
2021-03-25 14:07:16 +00:00
|
|
|
|
|
|
|
private:
|
2021-09-24 11:18:54 +00:00
|
|
|
EDA_ITEM* m_item; /// A pointer to the connectable object.
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I m_pos; /// The position of the connection point.
|
2021-09-24 11:18:54 +00:00
|
|
|
DANGLING_END_T m_type; /// The type of connection of #m_item.
|
|
|
|
const EDA_ITEM* m_parent; /// A pointer to the parent object (in the case of pins)
|
2010-11-03 14:13:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-02-12 08:01:45 +00:00
|
|
|
class DANGLING_END_ITEM_HELPER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static std::vector<DANGLING_END_ITEM>::iterator
|
|
|
|
get_lower_pos( std::vector<DANGLING_END_ITEM>& aItemListByPos, const VECTOR2I& aPos );
|
|
|
|
|
|
|
|
static std::vector<DANGLING_END_ITEM>::iterator
|
|
|
|
get_lower_type( std::vector<DANGLING_END_ITEM>& aItemListByType, const DANGLING_END_T& aType );
|
|
|
|
|
|
|
|
/** Both contain the same information */
|
|
|
|
static void sort_dangling_end_items( std::vector<DANGLING_END_ITEM>& aItemListByType,
|
|
|
|
std::vector<DANGLING_END_ITEM>& aItemListByPos );
|
|
|
|
};
|
|
|
|
|
2024-04-10 23:40:43 +00:00
|
|
|
typedef std::vector<SCH_ITEM*> SCH_ITEM_VEC;
|
2020-01-17 02:33:16 +00:00
|
|
|
|
2020-06-17 19:59:27 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
{
|
|
|
|
public:
|
2024-04-06 13:14:44 +00:00
|
|
|
SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType, int aUnit = 0, int aBodyStyle = 0 );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
SCH_ITEM( const SCH_ITEM& aItem );
|
|
|
|
|
2021-11-21 16:54:00 +00:00
|
|
|
SCH_ITEM& operator=( const SCH_ITEM& aPin );
|
|
|
|
|
2021-01-19 03:40:58 +00:00
|
|
|
virtual ~SCH_ITEM();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2024-04-10 09:26:35 +00:00
|
|
|
wxString GetClass() const override
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
return wxT( "SCH_ITEM" );
|
|
|
|
}
|
|
|
|
|
2022-08-21 19:54:07 +00:00
|
|
|
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
|
2021-07-17 19:56:18 +00:00
|
|
|
{
|
|
|
|
if( EDA_ITEM::IsType( aScanTypes ) )
|
|
|
|
return true;
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
for( KICAD_T scanType : aScanTypes )
|
2021-07-17 19:56:18 +00:00
|
|
|
{
|
2022-08-20 09:27:35 +00:00
|
|
|
if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
|
2021-07-17 19:56:18 +00:00
|
|
|
return true;
|
2021-10-12 20:05:37 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
|
2021-07-17 19:56:18 +00:00
|
|
|
return true;
|
2021-10-12 20:05:37 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
if ( scanType == SCH_ITEM_LOCATE_GRAPHIC_LINE_T
|
2021-10-12 20:05:37 +00:00
|
|
|
&& Type() == SCH_LINE_T && m_layer == LAYER_NOTES )
|
|
|
|
{
|
2021-07-17 19:56:18 +00:00
|
|
|
return true;
|
2021-10-12 20:05:37 +00:00
|
|
|
}
|
2021-07-17 19:56:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Swap the internal data structures \a aItem with the schematic item.
|
2021-03-25 14:07:16 +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 );
|
|
|
|
|
2023-07-08 17:37:47 +00:00
|
|
|
/**
|
|
|
|
* Swap the non-temp and non-edit flags.
|
|
|
|
*/
|
|
|
|
void SwapFlags( SCH_ITEM* aItem );
|
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
/**
|
|
|
|
* Routine to create a new copy of given item.
|
|
|
|
* The new object is not put in draw list (not linked).
|
|
|
|
*
|
|
|
|
* @param doClone (default = false) indicates unique values (such as timestamp and
|
2021-03-25 14:07:16 +00:00
|
|
|
* sheet name) should be duplicated. Use only for undo/redo operations.
|
2019-05-04 13:02:05 +00:00
|
|
|
*/
|
2020-02-20 12:11:04 +00:00
|
|
|
SCH_ITEM* Duplicate( bool doClone = false ) const;
|
2019-05-04 13:02:05 +00:00
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
static wxString GetUnitDescription( int aUnit );
|
|
|
|
static wxString GetBodyStyleDescription( int aBodyStyle );
|
|
|
|
|
2024-04-08 20:24:32 +00:00
|
|
|
virtual void SetUnit( int aUnit ) { m_unit = aUnit; }
|
2024-04-06 13:14:44 +00:00
|
|
|
int GetUnit() const { return m_unit; }
|
|
|
|
|
2024-04-08 20:24:32 +00:00
|
|
|
virtual void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
|
2024-04-06 13:14:44 +00:00
|
|
|
int GetBodyStyle() const { return m_bodyStyle; }
|
|
|
|
|
|
|
|
void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
|
|
|
|
bool IsPrivate() const { return m_private; }
|
|
|
|
|
2023-08-08 16:32:08 +00:00
|
|
|
virtual void SetExcludedFromSim( bool aExclude ) { }
|
|
|
|
virtual bool GetExcludedFromSim() const { return false; }
|
2023-04-09 11:14:21 +00:00
|
|
|
|
2015-02-28 16:56:09 +00:00
|
|
|
/**
|
|
|
|
* @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
|
2020-11-15 17:03:27 +00:00
|
|
|
* items which can be large (hierarchical sheets, symbols)
|
2015-02-28 16:56:09 +00:00
|
|
|
*/
|
2020-12-20 18:44:13 +00:00
|
|
|
virtual bool IsMovableFromAnchorPoint() const { return true; }
|
2015-02-28 16:56:09 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I& GetStoredPos() { return m_storedPos; }
|
|
|
|
void SetStoredPos( const VECTOR2I& aPos ) { m_storedPos = aPos; }
|
2015-02-28 16:56:09 +00:00
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Searches the item hierarchy to find a SCHEMATIC.
|
2020-05-13 02:00:37 +00:00
|
|
|
*
|
|
|
|
* Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen
|
2020-11-15 17:03:27 +00:00
|
|
|
* or another SCH_ITEM on the same screen (for example, pins to their symbols).
|
2020-05-13 02:00:37 +00:00
|
|
|
*
|
|
|
|
* Every SCH_SCREEN should be parented to the SCHEMATIC.
|
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* @note This hierarchy is not the same as the sheet hierarchy!
|
|
|
|
*
|
|
|
|
* @return the parent schematic this item lives on, or nullptr.
|
2020-05-13 02:00:37 +00:00
|
|
|
*/
|
|
|
|
SCHEMATIC* Schematic() const;
|
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
const SYMBOL* GetParentSymbol() const;
|
|
|
|
SYMBOL* GetParentSymbol();
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
virtual bool IsLocked() const { return false; }
|
|
|
|
virtual void SetLocked( bool aLocked ) {}
|
2015-02-28 16:56:09 +00:00
|
|
|
|
2020-11-17 16:02:47 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Allow items to support hypertext actions when hovered/clicked.
|
2020-11-17 16:02:47 +00:00
|
|
|
*/
|
|
|
|
virtual bool IsHypertext() const { return false; }
|
|
|
|
|
2022-08-27 18:14:57 +00:00
|
|
|
virtual void DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const { }
|
2020-11-17 16:02:47 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Return the layer this item is on.
|
2008-04-14 19:22:48 +00:00
|
|
|
*/
|
2020-11-14 14:29:11 +00:00
|
|
|
SCH_LAYER_ID GetLayer() const { return m_layer; }
|
2020-12-20 18:50:45 +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
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Return the layers the item is drawn on (which may be more than its "home" layer)
|
2018-10-21 12:50:31 +00:00
|
|
|
*/
|
|
|
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2009-06-30 19:21:41 +00:00
|
|
|
* @return the size of the "pen" that be used to draw or plot this item
|
|
|
|
*/
|
2020-04-14 12:25:00 +00:00
|
|
|
virtual int GetPenWidth() const { return 0; }
|
2009-06-30 19:21:41 +00:00
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
int GetEffectivePenWidth( const SCH_RENDER_SETTINGS* aSettings ) const;
|
|
|
|
|
2022-01-07 00:47:23 +00:00
|
|
|
const wxString& GetDefaultFont() const;
|
|
|
|
|
2023-08-06 19:20:53 +00:00
|
|
|
const KIFONT::METRICS& GetFontMetrics() const;
|
|
|
|
|
2022-05-13 21:36:20 +00:00
|
|
|
bool RenderAsBitmap( double aWorldScale ) const override;
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
/**
|
|
|
|
* Return a measure of how likely the other object is to represent the same
|
|
|
|
* object. The scale runs from 0.0 (definitely different objects) to 1.0 (same)
|
2024-04-02 17:28:17 +00:00
|
|
|
*/
|
|
|
|
virtual double Similarity( const SCH_ITEM& aItem ) const
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, 0.0, wxT( "Similarity not implemented in " ) + GetClass() );
|
|
|
|
}
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
/**
|
|
|
|
* Calculate the boilerplate similarity for all LIB_ITEMs without
|
|
|
|
* preventing the use above of a pure virtual function that catches at compile
|
|
|
|
* time when a new object has not been fully implemented
|
|
|
|
*/
|
|
|
|
double SimilarityBase( const SCH_ITEM& aItem ) const
|
2024-04-02 17:28:17 +00:00
|
|
|
{
|
2024-04-06 13:14:44 +00:00
|
|
|
double similarity = 1.0;
|
|
|
|
|
|
|
|
if( m_unit != aItem.m_unit )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
if( m_bodyStyle != aItem.m_bodyStyle )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
if( m_private != aItem.m_private )
|
|
|
|
similarity *= 0.9;
|
|
|
|
|
|
|
|
return similarity;
|
2024-04-02 17:28:17 +00:00
|
|
|
}
|
2023-09-14 21:39:42 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Move the item by \a aMoveVector to a new position.
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2024-04-02 17:28:17 +00:00
|
|
|
virtual void Move( const VECTOR2I& aMoveVector )
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "Move not implemented in " ) + GetClass() );
|
|
|
|
}
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
/**
|
2021-02-16 20:45:25 +00:00
|
|
|
* Mirror item horizontally about \a aCenter.
|
2009-07-27 14:32:40 +00:00
|
|
|
*/
|
2024-04-02 17:28:17 +00:00
|
|
|
virtual void MirrorHorizontally( int aCenter )
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "MirrorHorizontally not implemented in " ) + GetClass() );
|
|
|
|
}
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
2021-02-16 20:45:25 +00:00
|
|
|
* Mirror item vertically about \a aCenter.
|
2012-03-15 14:31:16 +00:00
|
|
|
*/
|
2024-04-02 17:28:17 +00:00
|
|
|
virtual void MirrorVertically( int aCenter )
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "MirrorVertically not implemented in " ) + GetClass() );
|
|
|
|
}
|
2010-09-05 17:01:48 +00:00
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
2021-03-19 19:33:06 +00:00
|
|
|
* Rotate the item around \a aCenter 90 degrees in the clockwise direction.
|
2012-03-15 14:31:16 +00:00
|
|
|
*/
|
2024-04-04 22:51:22 +00:00
|
|
|
virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
2024-04-02 17:28:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
|
|
|
|
}
|
2009-07-27 14:32:40 +00:00
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
/**
|
|
|
|
* Begin drawing a symbol library draw item at \a aPosition.
|
|
|
|
*
|
|
|
|
* It typically would be called on a left click when a draw tool is selected in
|
|
|
|
* the symbol library editor and one of the graphics tools is selected.
|
|
|
|
*
|
|
|
|
* @param aPosition The position in drawing coordinates where the drawing was started.
|
|
|
|
* May or may not be required depending on the item being drawn.
|
|
|
|
*/
|
|
|
|
virtual void BeginEdit( const VECTOR2I& aPosition ) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Continue an edit in progress at \a aPosition.
|
|
|
|
*
|
|
|
|
* This is used to perform the next action while drawing an item. This would be
|
|
|
|
* called for each additional left click when the mouse is captured while the item
|
|
|
|
* is being drawn.
|
|
|
|
*
|
|
|
|
* @param aPosition The position of the mouse left click in drawing coordinates.
|
|
|
|
* @return True if additional mouse clicks are required to complete the edit in progress.
|
|
|
|
*/
|
|
|
|
virtual bool ContinueEdit( const VECTOR2I& aPosition ) { return false; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* End an object editing action.
|
|
|
|
*
|
|
|
|
* This is used to end or abort an edit action in progress initiated by BeginEdit().
|
|
|
|
*/
|
|
|
|
virtual void EndEdit( bool aClosed = false ) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the attributes of an item at \a aPosition when it is being edited.
|
|
|
|
*
|
|
|
|
* This method gets called by the Draw() method when the item is being edited. This
|
|
|
|
* probably should be a pure virtual method but bezier curves are not yet editable in
|
|
|
|
* the symbol library editor. Therefore, the default method does nothing.
|
|
|
|
*
|
|
|
|
* @param aPosition The current mouse position in drawing coordinates.
|
|
|
|
*/
|
|
|
|
virtual void CalcEdit( const VECTOR2I& aPosition ) {}
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Add 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.
|
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* @param aItemList is the list of DANGLING_END_ITEMS to add to.
|
2010-11-03 14:13:15 +00:00
|
|
|
*/
|
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
|
|
|
|
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Test 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.
|
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* If aSheet is passed a non-null pointer to a SCH_SHEET_PATH, the overridden method can
|
2020-01-17 02:33:16 +00:00
|
|
|
* optionally use it to update sheet-local connectivity information
|
|
|
|
*
|
2024-02-12 08:01:45 +00:00
|
|
|
* @param aItemListByType is the list of items to test item against. It's sorted
|
|
|
|
* by item type, keeping WIRE_END pairs together.
|
|
|
|
* @param aItemListByPos is the same list but sorted first by Y then by X.
|
2021-03-25 14:07:16 +00:00
|
|
|
* @param aSheet is the sheet path to update connections for.
|
2010-11-03 14:13:15 +00:00
|
|
|
* @return True if the dangling state has changed from it's current setting.
|
|
|
|
*/
|
2024-02-12 08:01:45 +00:00
|
|
|
virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListByType,
|
|
|
|
std::vector<DANGLING_END_ITEM>& aItemListByPos,
|
2024-04-10 09:26:35 +00:00
|
|
|
const SCH_SHEET_PATH* aSheet = nullptr )
|
2020-01-17 02:33:16 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2010-11-03 14:13:15 +00:00
|
|
|
|
|
|
|
virtual bool IsDangling() const { return false; }
|
|
|
|
|
2020-11-14 14:29:11 +00:00
|
|
|
virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_layer == aItem->GetLayer(); }
|
2017-12-01 01:21:23 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* @return true if the schematic item can connect to another schematic item.
|
2011-01-07 19:24:24 +00:00
|
|
|
*/
|
|
|
|
virtual bool IsConnectable() const { return false; }
|
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* @return true if the given point can start drawing (usually means the anchor is
|
|
|
|
* unused/free/dangling).
|
2020-10-01 23:53:47 +00:00
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
virtual bool IsPointClickableAnchor( const VECTOR2I& aPos ) const { return false; }
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2010-11-03 14:13:15 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* @param aPoints is the list of connection points to add to.
|
2010-11-03 14:13:15 +00:00
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
virtual std::vector<VECTOR2I> GetConnectionPoints() const { return {}; }
|
2010-11-03 14:13:15 +00:00
|
|
|
|
2010-12-13 15:59:00 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Test the item to see if it is connected to \a aPoint.
|
2010-12-13 15:59:00 +00:00
|
|
|
*
|
2022-01-01 06:04:08 +00:00
|
|
|
* @param aPoint is a reference to a VECTOR2I 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
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
bool IsConnected( const VECTOR2I& aPoint ) const;
|
2010-12-13 15:59:00 +00:00
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Retrieve the connection associated with this object in the given sheet.
|
2020-06-17 19:59:27 +00:00
|
|
|
*
|
|
|
|
* @note The returned value can be nullptr.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
2020-10-07 14:40:12 +00:00
|
|
|
SCH_CONNECTION* Connection( const SCH_SHEET_PATH* aSheet = nullptr ) const;
|
2019-03-11 21:32:05 +00:00
|
|
|
|
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Retrieve the set of items connected to this item on the given sheet.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
2024-04-10 23:40:43 +00:00
|
|
|
const SCH_ITEM_VEC& ConnectedItems( const SCH_SHEET_PATH& aPath );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Add a connection link between this item and another.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
2020-01-17 02:33:16 +00:00
|
|
|
void AddConnectionTo( const SCH_SHEET_PATH& aPath, SCH_ITEM* aItem );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2024-04-10 23:40:43 +00:00
|
|
|
/**
|
|
|
|
* Clear all connections to this item.
|
|
|
|
*/
|
|
|
|
void ClearConnectedItems( const SCH_SHEET_PATH& aPath );
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Create a new connection object associated with this object.
|
2019-03-11 21:32:05 +00:00
|
|
|
*
|
2021-03-25 14:07:16 +00:00
|
|
|
* @param aPath is the sheet path to initialize.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
2020-06-30 00:27:08 +00:00
|
|
|
SCH_CONNECTION* InitializeConnection( const SCH_SHEET_PATH& aPath, CONNECTION_GRAPH* aGraph );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2021-11-24 13:19:50 +00:00
|
|
|
SCH_CONNECTION* GetOrInitConnection( const SCH_SHEET_PATH& aPath, CONNECTION_GRAPH* aGraph );
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
/**
|
2021-03-25 14:07:16 +00:00
|
|
|
* Return true if this item should propagate connection info to \a aItem.
|
2019-03-11 21:32:05 +00:00
|
|
|
*/
|
|
|
|
virtual bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const { return true; }
|
|
|
|
|
2021-11-24 13:19:50 +00:00
|
|
|
bool IsConnectivityDirty() const { return m_connectivity_dirty; }
|
2019-03-30 15:57:30 +00:00
|
|
|
|
|
|
|
void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
|
|
|
|
|
2024-03-09 13:50:26 +00:00
|
|
|
/**
|
|
|
|
* Check if \a aItem has connectivity changes against this object.
|
|
|
|
*
|
2024-03-16 12:00:03 +00:00
|
|
|
* This provides granular per object connectivity change testing to prevent the need
|
2024-03-09 13:50:26 +00:00
|
|
|
* to rebuild the #CONNECTION_GRAPH when object properties that have nothing to do with
|
|
|
|
* the schematic connectivity changes i.e. color, thickness, fill type. etc.
|
|
|
|
*
|
|
|
|
* @note Developers should override this method for all objects that are connectable.
|
|
|
|
*
|
|
|
|
* @param aItem is the item to test for connectivity changes.
|
|
|
|
* @param aInstance is the instance to test for connectivity changes. This parameter is
|
|
|
|
* only meaningful for #SCH_SYMBOL objects.
|
|
|
|
*
|
|
|
|
* @return true if there are connectivity changes otherwise false.
|
|
|
|
*/
|
|
|
|
virtual bool HasConnectivityChanges( const SCH_ITEM* aItem,
|
|
|
|
const SCH_SHEET_PATH* aInstance = nullptr ) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-04-08 15:22:34 +00:00
|
|
|
/// Updates the connection graph for all connections in this item
|
|
|
|
void SetConnectionGraph( CONNECTION_GRAPH* aGraph );
|
|
|
|
|
2023-08-07 20:43:36 +00:00
|
|
|
virtual bool HasCachedDriverName() const { return false; }
|
|
|
|
virtual const wxString& GetCachedDriverName() const;
|
|
|
|
|
2021-11-28 17:08:30 +00:00
|
|
|
virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
|
|
|
|
|
2022-08-14 11:03:18 +00:00
|
|
|
std::shared_ptr<NETCLASS> GetEffectiveNetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
|
2020-07-08 18:29:16 +00:00
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
/**
|
|
|
|
* Return whether the fields have been automatically placed.
|
|
|
|
*/
|
|
|
|
FIELDS_AUTOPLACED GetFieldsAutoplaced() const { return m_fieldsAutoplaced; }
|
|
|
|
|
2021-04-02 16:08:13 +00:00
|
|
|
void SetFieldsAutoplaced() { m_fieldsAutoplaced = FIELDS_AUTOPLACED_AUTO; }
|
2020-03-06 20:02:58 +00:00
|
|
|
void ClearFieldsAutoplaced() { m_fieldsAutoplaced = FIELDS_AUTOPLACED_NO; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Autoplace fields only if correct to do so automatically.
|
|
|
|
*
|
|
|
|
* Fields that have been moved by hand are not automatically placed.
|
|
|
|
*
|
2020-11-15 17:03:27 +00:00
|
|
|
* @param aScreen is the SCH_SCREEN associated with the current instance of the symbol.
|
2020-03-06 20:02:58 +00:00
|
|
|
*/
|
|
|
|
void AutoAutoplaceFields( SCH_SCREEN* aScreen )
|
|
|
|
{
|
|
|
|
if( GetFieldsAutoplaced() )
|
|
|
|
AutoplaceFields( aScreen, GetFieldsAutoplaced() == FIELDS_AUTOPLACED_MANUAL );
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) { }
|
|
|
|
|
2020-11-17 16:02:47 +00:00
|
|
|
virtual void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) { }
|
|
|
|
|
2022-01-07 17:42:43 +00:00
|
|
|
virtual void ClearCaches();
|
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Check if this schematic item has line stoke properties.
|
|
|
|
*
|
|
|
|
* @see #STROKE_PARAMS
|
|
|
|
*
|
|
|
|
* @return true if this schematic item support line stroke properties. Otherwise, false.
|
|
|
|
*/
|
|
|
|
virtual bool HasLineStroke() const { return false; }
|
|
|
|
|
2020-06-19 11:48:00 +00:00
|
|
|
virtual STROKE_PARAMS GetStroke() const { wxCHECK( false, STROKE_PARAMS() ); }
|
|
|
|
|
|
|
|
virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
|
|
|
|
|
2020-06-17 19:59:27 +00:00
|
|
|
/**
|
2024-04-05 21:35:32 +00:00
|
|
|
* Print an item.
|
2012-03-15 14:31:16 +00:00
|
|
|
*
|
2024-04-05 21:35:32 +00:00
|
|
|
* @param aUnit - Which unit to print.
|
|
|
|
* @param aBodyStyle - Which body style to print.
|
|
|
|
* @param aOffset - Relative offset.
|
|
|
|
* @param aForceNoFill - Disable printing of fills.
|
|
|
|
* @param aDimmed - Reduce brightness of item.
|
|
|
|
*/
|
|
|
|
virtual void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
|
|
|
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "Print not implemented in " ) + GetClass() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print just the background fills.
|
2012-03-15 14:31:16 +00:00
|
|
|
*/
|
2024-04-05 21:35:32 +00:00
|
|
|
virtual void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
|
|
|
const VECTOR2I& aOffset, bool aDimmed )
|
2024-04-02 17:28:17 +00:00
|
|
|
{
|
2024-04-05 21:35:32 +00:00
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "PrintBackground not implemented in " ) + GetClass() );
|
2024-04-02 17:28:17 +00:00
|
|
|
}
|
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
/**
|
|
|
|
* Plot the item to \a aPlotter.
|
|
|
|
*
|
|
|
|
* @param aBackground a poor-man's Z-order. The routine will get called twice, first with
|
|
|
|
* aBackground true and then with aBackground false.
|
|
|
|
* @param aUnit - which unit to print.
|
|
|
|
* @param aBodyStyle - which body style to print.
|
|
|
|
* @param aOffset relative offset.
|
|
|
|
* @param aDimmed reduce brightness of item.
|
|
|
|
*/
|
|
|
|
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
|
|
|
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed)
|
2024-04-02 17:28:17 +00:00
|
|
|
{
|
|
|
|
wxCHECK_MSG( false, /*void*/, wxT( "Plot not implemented in " ) + GetClass() );
|
|
|
|
}
|
2011-06-17 13:24:22 +00:00
|
|
|
|
2024-04-25 14:24:46 +00:00
|
|
|
/**
|
|
|
|
* Reset the cache of rule areas (called prior to schematic connectivity recomputation)
|
|
|
|
*/
|
|
|
|
void ClearRuleAreasCache() { m_rule_areas_cache.clear(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a rule area to the item's cache
|
|
|
|
*/
|
|
|
|
void AddRuleAreaToCache( SCH_RULE_AREA* aRuleArea ) { m_rule_areas_cache.insert( aRuleArea ); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the cache of rule areas enclosing this item
|
|
|
|
*/
|
|
|
|
const std::unordered_set<SCH_RULE_AREA*>& GetRuleAreaCache() const
|
|
|
|
{
|
|
|
|
return m_rule_areas_cache;
|
|
|
|
}
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
/**
|
|
|
|
* The list of flags used by the #compare function.
|
|
|
|
*
|
|
|
|
* UNIT This flag relaxes unit, body-style and pin-number constraints. It is used for
|
|
|
|
* #SCH_ITEM object unit comparisons.
|
|
|
|
*
|
2024-04-25 17:44:46 +00:00
|
|
|
* EQUALITY This flag relaxes ordering constraints so that fields, etc. don't have to
|
2024-04-06 13:14:44 +00:00
|
|
|
* appear in the same order to be considered equal.
|
|
|
|
*
|
|
|
|
* ERC This flag relaxes constraints on data that is settable in the schematic editor.
|
|
|
|
* It compares only symbol-editor-only data.
|
2024-04-25 17:44:46 +00:00
|
|
|
*
|
|
|
|
* SKIP_TST_POS This flag relaxes comparisons on position (mainly for fields) for ERC.
|
2024-04-06 13:14:44 +00:00
|
|
|
*/
|
|
|
|
enum COMPARE_FLAGS : int
|
|
|
|
{
|
2024-04-25 17:44:46 +00:00
|
|
|
UNIT = 0x01,
|
|
|
|
EQUALITY = 0x02,
|
|
|
|
ERC = 0x04,
|
|
|
|
SKIP_TST_POS = 0x08
|
2024-04-06 13:14:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool operator==( const SCH_ITEM& aOther ) const;
|
|
|
|
|
|
|
|
virtual bool operator<( const SCH_ITEM& aItem ) const;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2024-04-05 21:35:32 +00:00
|
|
|
protected:
|
|
|
|
SCH_RENDER_SETTINGS* getRenderSettings( PLOTTER* aPlotter ) const
|
|
|
|
{
|
|
|
|
return static_cast<SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
|
|
|
}
|
|
|
|
|
2024-04-12 21:14:06 +00:00
|
|
|
struct cmp_items
|
|
|
|
{
|
|
|
|
bool operator()( const SCH_ITEM* aFirst, const SCH_ITEM* aSecond ) const;
|
|
|
|
};
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
void getSymbolEditorMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Provide the draw object specific comparison called by the == and < operators.
|
|
|
|
*
|
|
|
|
* The base object sort order which always proceeds the derived object sort order
|
|
|
|
* is as follows:
|
|
|
|
* - Symbol alternate part (DeMorgan) number.
|
|
|
|
* - Symbol part number.
|
|
|
|
* - KICAD_T enum value.
|
|
|
|
* - Result of derived classes comparison.
|
|
|
|
*
|
|
|
|
* @note Make sure you call down to #SCH_ITEM::compare before doing any derived object
|
|
|
|
* comparisons or you will break the sorting using the symbol library file format.
|
|
|
|
*
|
|
|
|
* @param aOther A reference to the other #SCH_ITEM to compare the arc against.
|
|
|
|
* @param aCompareFlags The flags used to perform the comparison.
|
|
|
|
*
|
|
|
|
* @return An integer value less than 0 if the object is less than \a aOther object,
|
|
|
|
* zero if the object is equal to \a aOther object, or greater than 0 if the
|
|
|
|
* object is greater than \a aOther object.
|
|
|
|
*/
|
|
|
|
virtual int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const;
|
|
|
|
|
2012-03-15 14:31:16 +00:00
|
|
|
private:
|
2021-03-25 14:07:16 +00:00
|
|
|
friend class CONNECTION_GRAPH;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
/**
|
2020-06-17 19:59:27 +00:00
|
|
|
* Provide the object specific test to see if it is connected to \a aPosition.
|
2012-03-15 14:31:16 +00:00
|
|
|
*
|
|
|
|
* @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.
|
|
|
|
*
|
2022-01-01 06:04:08 +00:00
|
|
|
* @param aPosition is a reference to a VECTOR2I object containing the test position.
|
2012-03-15 14:31:16 +00:00
|
|
|
* @return True if connection to \a aPosition exists.
|
2010-12-10 19:47:44 +00:00
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
virtual bool doIsConnected( const VECTOR2I& aPosition ) const { return false; }
|
2021-03-25 14:07:16 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
SCH_LAYER_ID m_layer;
|
2024-04-06 13:14:44 +00:00
|
|
|
int m_unit; // set to 0 if common to all units
|
|
|
|
int m_bodyStyle; // set to 0 if common to all body styles
|
|
|
|
bool m_private; // only shown in Symbol Editor
|
2024-04-06 09:00:26 +00:00
|
|
|
FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement
|
|
|
|
VECTOR2I m_storedPos; // temp variable used in some move commands to store
|
|
|
|
// an initial position of the item or mouse cursor
|
2021-03-25 14:07:16 +00:00
|
|
|
|
|
|
|
/// Store pointers to other items that are connected to this one, per sheet.
|
2024-04-10 23:40:43 +00:00
|
|
|
std::map<SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP> m_connected_items;
|
2021-03-25 14:07:16 +00:00
|
|
|
|
|
|
|
/// Store connectivity information, per sheet.
|
2024-04-06 09:00:26 +00:00
|
|
|
std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> m_connection_map;
|
2021-03-25 14:07:16 +00:00
|
|
|
|
2024-04-06 09:00:26 +00:00
|
|
|
bool m_connectivity_dirty;
|
2024-04-06 13:14:44 +00:00
|
|
|
|
2024-04-25 14:24:46 +00:00
|
|
|
/// Store pointers to rule areas which this item is contained within
|
|
|
|
std::unordered_set<SCH_RULE_AREA*> m_rule_areas_cache;
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
private:
|
|
|
|
friend class LIB_SYMBOL;
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
2023-06-21 01:57:20 +00:00
|
|
|
#ifndef SWIG
|
|
|
|
DECLARE_ENUM_TO_WXANY( SCH_LAYER_ID );
|
|
|
|
#endif
|
|
|
|
|
2019-05-10 19:57:24 +00:00
|
|
|
#endif /* SCH_ITEM_H */
|