25#include <unordered_map>
26#include <unordered_set>
69#define MINIMUM_SELECTION_DISTANCE 2
150 static std::vector<DANGLING_END_ITEM>::iterator
153 static std::vector<DANGLING_END_ITEM>::iterator
158 std::vector<DANGLING_END_ITEM>& aItemListByPos );
182 return wxT(
"SCH_ITEM" );
185 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
190 for(
KICAD_T scanType : aScanTypes )
265 const wxString& aVariantName = wxEmptyString ) { }
267 const wxString& aVariantName = wxEmptyString )
const {
return false; }
269 const wxString& aVariantName = wxEmptyString )
const;
272 const wxString& aVariantName = wxEmptyString ) { }
274 const wxString& aVariantName = wxEmptyString )
const {
return false; }
276 const wxString& aVariantName = wxEmptyString )
const;
279 const wxString& aVariantName = wxEmptyString ) { }
281 const wxString& aVariantName = wxEmptyString )
const {
return false; }
283 const wxString& aVariantName = wxEmptyString )
const;
286 const wxString& aVariantName = wxEmptyString ) { }
288 const wxString& aVariantName = wxEmptyString )
const {
return false; }
290 const wxString& aVariantName = wxEmptyString )
const;
293 const wxString& aVariantName = wxEmptyString ) { }
295 const wxString& aVariantName = wxEmptyString )
const {
return false; }
297 const wxString& aVariantName = wxEmptyString )
const;
301 const wxString& aVariantName )
const;
390 wxCHECK_MSG(
false, 0.0, wxT(
"Similarity not implemented in " ) +
GetClass() );
400 double similarity = 1.0;
419 wxCHECK_MSG(
false, , wxT(
"Move not implemented in " ) +
GetClass() );
427 wxCHECK_MSG(
false, , wxT(
"MirrorHorizontally not implemented in " ) +
GetClass() );
435 wxCHECK_MSG(
false, , wxT(
"MirrorVertically not implemented in " ) +
GetClass() );
443 wxCHECK_MSG(
false, , wxT(
"Rotate not implemented in " ) +
GetClass() );
474 virtual void EndEdit(
bool aClosed =
false ) {}
497 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
518 std::vector<DANGLING_END_ITEM>& aItemListByPos,
580 bool aLocal =
false,
bool aIgnoreSheet =
false )
const;
710 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed)
712 wxCHECK_MSG(
false, , wxT(
"Plot not implemented in " ) +
GetClass() );
Calculate the connectivity of a schematic and generate netlists.
static std::vector< DANGLING_END_ITEM >::iterator get_lower_type(std::vector< DANGLING_END_ITEM > &aItemListByType, const DANGLING_END_T &aType)
static std::vector< DANGLING_END_ITEM >::iterator get_lower_pos(std::vector< DANGLING_END_ITEM > &aItemListByPos, const VECTOR2I &aPos)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
const EDA_ITEM * m_parent
A pointer to the parent object (in the case of pins).
bool operator==(const DANGLING_END_ITEM &aB) const
DANGLING_END_T m_type
The type of connection of m_item.
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition)
DANGLING_END_T GetType() const
bool operator<(const DANGLING_END_ITEM &rhs) const
DANGLING_END_ITEM(DANGLING_END_T aType, EDA_ITEM *aItem, const VECTOR2I &aPosition, const EDA_ITEM *aParent)
VECTOR2I m_pos
The position of the connection point.
const EDA_ITEM * GetParent() const
EDA_ITEM * GetItem() const
EDA_ITEM * m_item
A pointer to the connectable object.
VECTOR2I GetPosition() const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
A collection of nets and the parameters used to route or test these nets.
Base plotter engine class.
Holds all the data relating to one schematic.
Commit for the schematic and symbol editors.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Schematic editor (Eeschema) main window.
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool aDoClone=false) const
Routine to create a new copy of given item.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
void SetStoredPos(const VECTOR2I &aPos)
friend class CONNECTION_GRAPH
virtual void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
virtual void SetBodyStyle(int aBodyStyle)
virtual bool CanConnect(const SCH_ITEM *aItem) const
virtual bool IsEndPoint(const VECTOR2I &aPt) const
Test if aPt is an end point of this schematic object.
virtual bool IsConnectable() const
void SetLocked(bool aLocked) override
bool MatchesNetName(const EDA_SEARCH_DATA &aSearchData, const SCH_SHEET_PATH *aSheet) const
Match aSearchData against the connection of this item on aSheet.
void RemoveRuleAreaFromCache(SCH_RULE_AREA *aRuleArea)
Remove a specific rule area from the item's cache.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
virtual bool HasHoveredHypertext() const
Indicates that a hypertext link is currently active.
bool ResolveExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual int GetPenWidth() const
SCH_ITEM & operator=(const SCH_ITEM &aPin)
std::map< SCH_SHEET_PATH, std::vector< SCH_ITEM * >, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
const wxString & GetDefaultFont(const KIGFX::RENDER_SETTINGS *aSettings) const
void ClearConnectedItems(const SCH_SHEET_PATH &aPath)
Clear all connections to this item.
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
SCH_SCREEN * GetParentScreen() const
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
std::vector< std::weak_ptr< CONNECTION_GRAPH_LIFETIME > > m_connectivityOwners
An item may be indexed by multiple graphs, each with an independent lifetime.
void invalidateConnectivity(KICAD_T aChangedType=TYPE_NOT_INIT)
Bump the parent screen's connectivity revision when this item, or the item owning it as a child,...
const std::vector< wxString > * GetEmbeddedFonts() override
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aSheet=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
const SYMBOL * GetParentSymbol() const
virtual wxString GetBodyStyleDescription(int aBodyStyle, bool aLabel) const
void SetPrivate(bool aPrivate)
virtual void swapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
virtual const wxString & GetCachedDriverName() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
virtual void SetLastResolvedState(const SCH_ITEM *aItem)
virtual double Similarity(const SCH_ITEM &aItem) const
Return a measure of how likely the other object is to represent the same object.
virtual bool IsDangling() const
virtual bool IsPointClickableAnchor(const VECTOR2I &aPos) const
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame, const VECTOR2I &aMousePos) const
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Get the cache of rule areas enclosing this item.
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
const std::vector< SCH_ITEM * > & ConnectedItems(const SCH_SHEET_PATH &aPath) const
Retrieve the set of items connected to this item on the given sheet.
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
bool IsLocked() const override
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
COMPARE_FLAGS
The list of flags used by various compare functions.
virtual bool HasHypertext() const
Indicates that the item has at least one hypertext action.
virtual bool GetExcludedFromPosFiles(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
std::vector< wxString > GetBusMemberNames(const SCH_SHEET_PATH *aSheet=nullptr) const
Names of the bus members of this item's connection, empty when it does not have a bus.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
virtual bool operator==(const SCH_ITEM &aOther) const
bool m_connectivity_dirty
virtual void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
virtual void ClearCaches()
void SetLayer(SCH_LAYER_ID aLayer)
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
virtual void SetStroke(const STROKE_PARAMS &aStroke)
virtual bool GetExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
void SetConnectivityDirty(bool aDirty=true)
Set the dirty flag.
virtual wxString GetBodyStyleProp() const
void SetFieldsAutoplaced(AUTOPLACE_ALGO aAlgo)
bool RenderAsBitmap(double aWorldScale) const override
virtual void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot the item to aPlotter.
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
bool IsConnectivityDirty() const
std::optional< wxString > GetConnectionName(const SCH_SHEET_PATH *aSheet=nullptr, bool aLocal=false, bool aIgnoreSheet=false) const
Return the active connection name; absent for missing or stale published rows.
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Update the connection graph for all connections in this item.
virtual void SetUnit(int aUnit)
AUTOPLACE_ALGO m_fieldsAutoplaced
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
void SwapFlags(SCH_ITEM *aItem)
Swap the non-temp and non-edit flags.
bool IsConnected(const VECTOR2I &aPoint) const
Test the item to see if it is connected to aPoint.
virtual void SetUnitString(const wxString &aUnit)
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
virtual bool HasCachedDriverName() const
virtual bool operator<(const SCH_ITEM &aItem) const
bool ResolveExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
void registerConnectivityOwner(const std::shared_ptr< CONNECTION_GRAPH_LIFETIME > &aOwner)
Graph membership belongs to this item identity and must not propagate to clones.
SCH_CONNECTION * GetOrInitConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
virtual bool IsMovableFromAnchorPoint() const
Check if object is movable from the anchor point.
virtual bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const
Check if aItem has connectivity changes against this object.
AUTOPLACE_ALGO GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=~COMPARE_FLAGS::UNIT) const
Provide the draw object specific comparison called by the == and < operators.
virtual void SetExcludedFromPosFiles(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
wxString GetClass() const override
Return the class name.
VECTOR2I & GetStoredPos()
bool ResolveExcludedFromBoard(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual void EndEdit(bool aClosed=false)
End an object editing action.
const KIFONT::METRICS & GetFontMetrics() const
bool ResolveDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual wxString GetUnitString() const
bool HasBusConnection(const SCH_SHEET_PATH *aSheet=nullptr) const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
virtual STROKE_PARAMS GetStroke() const
virtual void BeginEdit(const VECTOR2I &aPosition)
Begin drawing a symbol library draw item at aPosition.
bool IsGroupableType() const
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
bool ResolveExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool HasLineStroke() const
Check if this schematic item has line stoke properties.
virtual bool ConnectionPropagatesTo(const EDA_ITEM *aItem) const
Return true if this item should propagate connection info to aItem.
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
virtual void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
virtual bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
virtual void SetExcludedFromSim(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString)
const BOX2I ViewBBox() const override
The view bounds of text that shows a net name must match the drawing, so this reads connectivity insi...
virtual bool GetExcludedFromBOM(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Simple container to manage line stroke parameters.
A base class for LIB_SYMBOL and SCH_SYMBOL.
SCH_LAYER_ID
Eeschema drawing layers.
The Cairo implementation of the graphics abstraction layer.
#define DECLARE_ENUM_TO_WXANY(type)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Lets indexed items detect graph destruction without traversing their schematic parents.
bool operator()(const SCH_ITEM *aFirst, const SCH_ITEM *aSecond) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
VECTOR2< int32_t > VECTOR2I