28#include <unordered_map>
29#include <unordered_set>
65#define MINIMUM_SELECTION_DISTANCE 2
146 static std::vector<DANGLING_END_ITEM>::iterator
149 static std::vector<DANGLING_END_ITEM>::iterator
154 std::vector<DANGLING_END_ITEM>& aItemListByPos );
180 return wxT(
"SCH_ITEM" );
183 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
188 for(
KICAD_T scanType : aScanTypes )
269 virtual bool GetDNP()
const {
return false; }
342 wxCHECK_MSG(
false, 0.0, wxT(
"Similarity not implemented in " ) +
GetClass() );
352 double similarity = 1.0;
371 wxCHECK_MSG(
false, , wxT(
"Move not implemented in " ) +
GetClass() );
379 wxCHECK_MSG(
false, ,
380 wxT(
"MirrorHorizontally not implemented in " ) +
GetClass() );
388 wxCHECK_MSG(
false, , wxT(
"MirrorVertically not implemented in " ) +
GetClass() );
396 wxCHECK_MSG(
false, , wxT(
"Rotate not implemented in " ) +
GetClass() );
427 virtual void EndEdit(
bool aClosed =
false ) {}
450 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
471 std::vector<DANGLING_END_ITEM>& aItemListByPos,
632 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed)
634 wxCHECK_MSG(
false, , wxT(
"Plot not implemented in " ) +
GetClass() );
723 virtual int compare(
const SCH_ITEM& aOther,
int aCompareFlags = 0 )
const;
Calculate the connectivity of a schematic and generates 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)
Both contain the same information.
Helper class used to store the state of schematic items that can be connected to other schematic item...
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.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Define a library symbol object.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Base plotter engine class.
RENDER_SETTINGS * RenderSettings()
Holds all the data relating to one schematic.
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,...
virtual bool GetExcludedFromSim() const
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)
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
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
virtual void AutoplaceFields(SCH_SCREEN *aScreen, AUTOPLACE_ALGO aAlgo)
virtual int GetPenWidth() const
const SCH_ITEM_VEC & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
SCH_ITEM & operator=(const SCH_ITEM &aPin)
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)
virtual wxString GetUnitProp() const
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
virtual void SetExcludedFromBoard(bool aExcludeFromBoard)
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.
bool ResolveExcludedFromBOM() 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.
virtual wxString GetUnitDisplayName(int aUnit, bool aLabel) const
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
virtual void SetUnitProp(const wxString &aUnit)
virtual void Move(const VECTOR2I &aMoveVector)
Move the item by aMoveVector to a new position.
COMPARE_FLAGS
The list of flags used by the compare function.
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
bool ResolveExcludedFromBoard() const
virtual void CalcEdit(const VECTOR2I &aPosition)
Calculate the attributes of an item at aPosition when it is being edited.
virtual bool GetDNP() const
virtual bool operator==(const SCH_ITEM &aOther) const
bool m_connectivity_dirty
virtual bool GetExcludedFromBOM() const
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 bool GetExcludedFromBoard() const
virtual void SetStroke(const STROKE_PARAMS &aStroke)
virtual void SetBodyStyleProp(const wxString &aBodyStyle)
void SetConnectivityDirty(bool aDirty=true)
virtual int compare(const SCH_ITEM &aOther, int aCompareFlags=0) const
Provide the draw object specific comparison called by the == and < operators.
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.
const wxString & GetDefaultFont(const RENDER_SETTINGS *aSettings) const
bool IsConnectivityDirty() const
virtual void SetExcludedFromSim(bool aExclude)
virtual void SetExcludedFromBOM(bool aExcludeFromBOM)
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.
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
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
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.
virtual void DoHypertextAction(EDA_DRAW_FRAME *aFrame) const
wxString GetClass() const override
Return the class name.
VECTOR2I & GetStoredPos()
bool ResolveExcludedFromSim() const
virtual void EndEdit(bool aClosed=false)
End an object editing action.
const KIFONT::METRICS & GetFontMetrics() const
std::map< SCH_SHEET_PATH, SCH_ITEM_VEC, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
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.
virtual void SetDNP(bool aDNP)
bool IsGroupableType() const
void SwapItemData(SCH_ITEM *aImage)
Swap data between aItem and aImage.
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.
double SimilarityBase(const SCH_ITEM &aItem) const
Calculate the boilerplate similarity for all LIB_ITEMs without preventing the use above of a pure vir...
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.
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.
#define DECLARE_ENUM_TO_WXANY(type)
std::vector< SCH_ITEM * > SCH_ITEM_VEC
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
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