28#include <unordered_map>
29#include <unordered_set>
64#define MINIMUM_SELECTION_DISTANCE 2
144 static std::vector<DANGLING_END_ITEM>::iterator
147 static std::vector<DANGLING_END_ITEM>::iterator
152 std::vector<DANGLING_END_ITEM>& aItemListByPos );
178 return wxT(
"SCH_ITEM" );
181 bool IsType(
const std::vector<KICAD_T>& aScanTypes )
const override
186 for(
KICAD_T scanType : aScanTypes )
287 void ViewGetLayers(
int aLayers[],
int& aCount )
const override;
308 wxCHECK_MSG(
false, 0.0, wxT(
"Similarity not implemented in " ) +
GetClass() );
318 double similarity = 1.0;
337 wxCHECK_MSG(
false, , wxT(
"Move not implemented in " ) +
GetClass() );
345 wxCHECK_MSG(
false, , wxT(
"MirrorHorizontally not implemented in " ) +
GetClass() );
353 wxCHECK_MSG(
false, , wxT(
"MirrorVertically not implemented in " ) +
GetClass() );
361 wxCHECK_MSG(
false, , wxT(
"Rotate not implemented in " ) +
GetClass() );
392 virtual void EndEdit(
bool aClosed =
false ) {}
415 virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
436 std::vector<DANGLING_END_ITEM>& aItemListByPos,
595 const VECTOR2I& aOffset,
bool aForceNoFill,
bool aDimmed )
597 wxCHECK_MSG(
false, , wxT(
"Print not implemented in " ) +
GetClass() );
604 const VECTOR2I& aOffset,
bool aDimmed )
606 wxCHECK_MSG(
false, , wxT(
"PrintBackground not implemented in " ) +
GetClass() );
620 int aUnit,
int aBodyStyle,
const VECTOR2I& aOffset,
bool aDimmed)
622 wxCHECK_MSG(
false, , wxT(
"Plot not implemented in " ) +
GetClass() );
702 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
The type of connection of m_item.
bool operator==(const DANGLING_END_ITEM &aB) const
DANGLING_END_T m_type
The position of the connection point.
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
A pointer to the connectable object.
const EDA_ITEM * GetParent() const
EDA_ITEM * GetItem() const
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.
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
virtual void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed)
Print an item.
void SetStoredPos(const VECTOR2I &aPos)
virtual void PrintBackground(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Print just the background fills.
virtual void SetBodyStyle(int aBodyStyle)
virtual bool CanConnect(const SCH_ITEM *aItem) const
virtual bool IsConnectable() const
virtual bool IsLocked() const
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 GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
const wxString & GetDefaultFont() const
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
void SetPrivate(bool aPrivate)
virtual const wxString & GetCachedDriverName() const
SCHEMATIC * Schematic() const
Searches 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
virtual bool ContinueEdit(const VECTOR2I &aPosition)
Continue an edit in progress at aPosition.
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
static wxString GetUnitDescription(int aUnit)
const std::unordered_set< SCH_RULE_AREA * > & GetRuleAreaCache() const
Gets 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.
void AddConnectionTo(const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
Add a connection link between this item and another.
virtual void SetLocked(bool aLocked)
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
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
void ClearFieldsAutoplaced()
virtual void ClearCaches()
void SetLayer(SCH_LAYER_ID aLayer)
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Adds 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 recomputation)
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
virtual void SetStroke(const STROKE_PARAMS &aStroke)
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
virtual void SwapData(SCH_ITEM *aItem)
Swap the internal data structures aItem with the schematic item.
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.
void SetFieldsAutoplaced()
FIELDS_AUTOPLACED m_fieldsAutoplaced
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
virtual void SetExcludedFromSim(bool aExclude)
static wxString GetBodyStyleDescription(int aBodyStyle)
void SetConnectionGraph(CONNECTION_GRAPH *aGraph)
Updates the connection graph for all connections in this item.
virtual void SetUnit(int aUnit)
std::unordered_set< SCH_RULE_AREA * > m_rule_areas_cache
Store pointers to rule areas which this item is contained within.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
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.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
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
virtual bool HasConnectivityChanges(const SCH_ITEM *aItem, const SCH_SHEET_PATH *aInstance=nullptr) const
Check if aItem has connectivity changes against this object.
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()
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.
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
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...
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
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.
void getSymbolEditorMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
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
@ FIELDS_AUTOPLACED_MANUAL
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