KiCad PCB EDA Suite
SCH_LINE Class Reference

Segment description base class to describe items which have 2 end points (track, wire, draw line ...) More...

#include <sch_line.h>

Inheritance diagram for SCH_LINE:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 SCH_LINE (const VECTOR2I &pos=VECTOR2I(0, 0), int layer=LAYER_NOTES)
 
 SCH_LINE (const VECTOR2D &pos, int layer=LAYER_NOTES)
 
 SCH_LINE (const SCH_LINE &aLine)
 
 ~SCH_LINE ()
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetNetname (const SCH_SHEET_PATH &aSheet)
 This function travel though all the connected wire segments to look for connected labels. More...
 
bool IsType (const std::vector< KICAD_T > &aScanTypes) const override
 Check whether the item is one of the listed types. More...
 
bool IsEndPoint (const VECTOR2I &aPoint) const
 
int GetAngleFrom (const VECTOR2I &aPoint) const
 
int GetReverseAngleFrom (const VECTOR2I &aPoint) const
 
EDA_ANGLE Angle () const
 Gets the angle between the start and end lines. More...
 
void StoreAngle ()
 Saves the current line angle. More...
 
void StoreAngle (const EDA_ANGLE &aAngle)
 
EDA_ANGLE GetStoredAngle () const
 Returns the angle stored by StoreAngle() More...
 
bool IsOrthogonal () const
 Checks if line is orthogonal (to the grid). More...
 
bool IsNull () const
 
VECTOR2I GetStartPoint () const
 
void SetStartPoint (const VECTOR2I &aPosition)
 
VECTOR2I GetMidPoint () const
 
VECTOR2I GetEndPoint () const
 
void SetEndPoint (const VECTOR2I &aPosition)
 
void SetLastResolvedState (const SCH_ITEM *aItem) override
 
void SetLineStyle (const PLOT_DASH_TYPE aStyle)
 
void SetLineStyle (const int aStyleId)
 
PLOT_DASH_TYPE GetLineStyle () const
 
PLOT_DASH_TYPE GetEffectiveLineStyle () const
 
void SetLineColor (const COLOR4D &aColor)
 
void SetLineColor (const double r, const double g, const double b, const double a)
 
COLOR4D GetLineColor () const
 Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line. More...
 
void SetLineWidth (const int aSize)
 
virtual bool HasLineStroke () const override
 Check if this schematic item has line stoke properties. More...
 
virtual STROKE_PARAMS GetStroke () const override
 
virtual void SetStroke (const STROKE_PARAMS &aStroke) override
 
bool IsStrokeEquivalent (const SCH_LINE *aLine)
 
int GetLineSize () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the layers the item is drawn on (which may be more than its "home" layer) More...
 
const BOX2I GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
double GetLength () const
 
void Print (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset) override
 Print a schematic item. More...
 
int GetPenWidth () const override
 
void Move (const VECTOR2I &aMoveVector) override
 Move the item by aMoveVector to a new position. More...
 
void MoveStart (const VECTOR2I &aMoveVector)
 
void MoveEnd (const VECTOR2I &aMoveVector)
 
void MirrorVertically (int aCenter) override
 Mirror item vertically about aCenter. More...
 
void MirrorHorizontally (int aCenter) override
 Mirror item horizontally about aCenter. More...
 
void Rotate (const VECTOR2I &aCenter) override
 Rotate the item around aCenter 90 degrees in the clockwise direction. More...
 
void RotateStart (const VECTOR2I &aCenter)
 
void RotateEnd (const VECTOR2I &aCenter)
 
SCH_LINEMergeOverlap (SCH_SCREEN *aScreen, SCH_LINE *aLine, bool aCheckJunctions)
 Check line against aLine to see if it overlaps and merge if it does. More...
 
bool IsParallel (const SCH_LINE *aLine) const
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Add the schematic item end points to aItemList if the item has end points. More...
 
bool UpdateDanglingState (std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr) override
 Test the schematic item to aItemList to check if it's dangling state has changed. More...
 
bool IsStartDangling () const
 
bool IsEndDangling () const
 
bool IsDangling () const override
 
bool IsConnectable () const override
 
std::vector< VECTOR2IGetConnectionPoints () const override
 Add all the connection points for this item to aPoints. More...
 
bool ConnectionPropagatesTo (const EDA_ITEM *aItem) const override
 Return true if this item should propagate connection info to aItem. More...
 
void GetSelectedPoints (std::vector< VECTOR2I > &aPoints) const
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
wxString GetSelectMenuText (UNITS_PROVIDER *aUnitsProvider) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
bool operator< (const SCH_ITEM &aItem) const override
 
VECTOR2I GetPosition () const override
 
void SetPosition (const VECTOR2I &aPosition) override
 
VECTOR2I GetSortPosition () const override
 Return the coordinates that should be used for sorting this element visually compared to other elements. More...
 
bool IsPointClickableAnchor (const VECTOR2I &aPos) const override
 
bool HitTest (const VECTOR2I &aPosition, int aAccuracy=0) const override
 Test if aPosition is inside or on the boundary of this item. More...
 
bool HitTest (const BOX2I &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects this item. More...
 
void Plot (PLOTTER *aPlotter, bool aBackground) const override
 Plot the schematic item to aPlotter. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
void SwapData (SCH_ITEM *aItem) override
 Swap the internal data structures aItem with the schematic item. More...
 
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. More...
 
bool IsGraphicLine () const
 Return if the line is a graphic (non electrical line) More...
 
bool IsWire () const
 Return true if the line is a wire. More...
 
bool IsBus () const
 Return true if the line is a bus. More...
 
SCH_ITEMDuplicate (bool doClone=false) const
 Routine to create a new copy of given item. More...
 
virtual bool IsMovableFromAnchorPoint () const
 
VECTOR2IGetStoredPos ()
 
void SetStoredPos (const VECTOR2I &aPos)
 
SCHEMATICSchematic () const
 Searches the item hierarchy to find a SCHEMATIC. More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Set the 'lock' status to aLocked for of this item. More...
 
virtual bool IsHypertext () const
 Allow items to support hypertext actions when hovered/clicked. More...
 
virtual void DoHypertextAction (EDA_DRAW_FRAME *aFrame) const
 
SCH_LAYER_ID GetLayer () const
 Return the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
const wxString & GetDefaultFont () const
 
bool RenderAsBitmap (double aWorldScale) const override
 
virtual void PrintBackground (const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset)
 Print the (optional) backaground elements if they exist. More...
 
void ClearConnections ()
 Clears all of the connection items from the list. More...
 
bool IsConnected (const VECTOR2I &aPoint) const
 Test the item to see if it is connected to aPoint. More...
 
SCH_CONNECTIONConnection (const SCH_SHEET_PATH *aSheet=nullptr) const
 Retrieve the connection associated with this object in the given sheet. More...
 
SCH_ITEM_SETConnectedItems (const SCH_SHEET_PATH &aPath)
 Retrieve the set of items connected to this item on the given sheet. More...
 
void AddConnectionTo (const SCH_SHEET_PATH &aPath, SCH_ITEM *aItem)
 Add a connection link between this item and another. More...
 
SCH_CONNECTIONInitializeConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 Create a new connection object associated with this object. More...
 
SCH_CONNECTIONGetOrInitConnection (const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
 
bool IsConnectivityDirty () const
 
void SetConnectivityDirty (bool aDirty=true)
 
std::shared_ptr< NETCLASSGetEffectiveNetClass (const SCH_SHEET_PATH *aSheet=nullptr) const
 
FIELDS_AUTOPLACED GetFieldsAutoplaced () const
 Return whether the fields have been automatically placed. More...
 
void SetFieldsAutoplaced ()
 
void ClearFieldsAutoplaced ()
 
void AutoAutoplaceFields (SCH_SCREEN *aScreen)
 Autoplace fields only if correct to do so automatically. More...
 
virtual void AutoplaceFields (SCH_SCREEN *aScreen, bool aManual)
 
virtual void RunOnChildren (const std::function< void(SCH_ITEM *)> &aFunction)
 
virtual void ClearCaches ()
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
EDA_ITEMGetParent () const
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetIsShownAsBitmap (bool aBitmap)
 
bool IsShownAsBitmap () const
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual wxString GetFriendlyName () const
 
virtual const VECTOR2I GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual INSPECT_RESULT Visit (INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetTypeDesc () const
 Return a translated description of the type for this EDA_ITEM for display in user facing messages. More...
 
virtual bool Matches (const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const EDA_SEARCH_DATA &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
Get (PROPERTY_BASE *aProperty) const
 
template<typename T >
std::optional< T > Get (const wxString &aProperty) const
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
template<class T >
static INSPECT_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static INSPECT_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &scanTypes)
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const EDA_SEARCH_DATA &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

const KIID m_Uuid
 

Static Public Attributes

static enum wxPenStyle PenStyle []
 

Protected Member Functions

bool Matches (const wxString &aText, const EDA_SEARCH_DATA &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

SCH_LAYER_ID m_layer
 
EDA_ITEMS m_connections
 
FIELDS_AUTOPLACED m_fieldsAutoplaced
 
VECTOR2I m_storedPos
 
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMPm_connected_items
 Store pointers to other items that are connected to this one, per sheet. More...
 
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
 Store connectivity information, per sheet. More...
 
bool m_connectivity_dirty
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Member Functions

wxString FindWireSegmentNetNameRecursive (SCH_LINE *line, std::list< const SCH_LINE * > &checkedLines, const SCH_SHEET_PATH &aSheet) const
 Recursively called function to travel through the connected wires and find a connected net name label. More...
 
bool doIsConnected (const VECTOR2I &aPosition) const override
 Provide the object specific test to see if it is connected to aPosition. More...
 

Private Attributes

bool m_startIsDangling
 True if start point is not connected. More...
 
bool m_endIsDangling
 True if end point is not connected. More...
 
VECTOR2I m_start
 Line start point. More...
 
VECTOR2I m_end
 Line end point. More...
 
EDA_ANGLE m_storedAngle
 Stored angle. More...
 
STROKE_PARAMS m_stroke
 Line stroke properties. More...
 
PLOT_DASH_TYPE m_lastResolvedLineStyle
 
int m_lastResolvedWidth
 
COLOR4D m_lastResolvedColor
 
KICAD_T m_structType
 Run time identification, keep private so it can never be changed after a ctor sets it. More...
 
VIEW_ITEM_DATA * m_viewPrivData
 

Detailed Description

Segment description base class to describe items which have 2 end points (track, wire, draw line ...)

Definition at line 39 of file sch_line.h.

Constructor & Destructor Documentation

◆ SCH_LINE() [1/3]

SCH_LINE::SCH_LINE ( const VECTOR2I pos = VECTOR2I( 0, 0 ),
int  layer = LAYER_NOTES 
)

Definition at line 43 of file sch_line.cpp.

43 :
44 SCH_ITEM( nullptr, SCH_LINE_T )
45{
46 m_start = pos;
47 m_end = pos;
48 m_stroke.SetWidth( 0 );
50 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
51
52 switch( layer )
53 {
54 default: m_layer = LAYER_NOTES; break;
55 case LAYER_WIRE: m_layer = LAYER_WIRE; break;
56 case LAYER_BUS: m_layer = LAYER_BUS; break;
57 }
58
59 if( layer == LAYER_NOTES )
61 else
63
64 if( layer == LAYER_WIRE )
66 else if( layer == LAYER_BUS )
68 else
70
72 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
73}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
Definition: sch_item.cpp:52
SCH_LAYER_ID m_layer
Definition: sch_item.h:491
bool m_startIsDangling
True if start point is not connected.
Definition: sch_line.h:322
COLOR4D m_lastResolvedColor
Definition: sch_line.h:334
VECTOR2I m_start
Line start point.
Definition: sch_line.h:324
int m_lastResolvedWidth
Definition: sch_line.h:333
VECTOR2I m_end
Line end point.
Definition: sch_line.h:325
PLOT_DASH_TYPE m_lastResolvedLineStyle
Definition: sch_line.h:332
STROKE_PARAMS m_stroke
Line stroke properties.
Definition: sch_line.h:327
bool m_endIsDangling
True if end point is not connected.
Definition: sch_line.h:323
void SetWidth(int aWidth)
Definition: stroke_params.h:99
void SetColor(const KIGFX::COLOR4D &aColor)
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
#define DEFAULT_BUS_WIDTH_MILS
The default noconnect size in mils.
#define DEFAULT_WIRE_WIDTH_MILS
The default bus width in mils. (can be changed in preference menu)
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
@ LAYER_WIRE
Definition: layer_ids.h:344
@ LAYER_NOTES
Definition: layer_ids.h:358
@ LAYER_BUS
Definition: layer_ids.h:345
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94
@ SCH_LINE_T
Definition: typeinfo.h:146

References DEFAULT, DEFAULT_BUS_WIDTH_MILS, DEFAULT_LINE_WIDTH_MILS, DEFAULT_WIRE_WIDTH_MILS, LAYER_BUS, LAYER_NOTES, LAYER_WIRE, m_end, m_endIsDangling, m_lastResolvedColor, m_lastResolvedLineStyle, m_lastResolvedWidth, SCH_ITEM::m_layer, m_start, m_startIsDangling, m_stroke, EDA_IU_SCALE::MilsToIU(), schIUScale, STROKE_PARAMS::SetColor(), STROKE_PARAMS::SetPlotStyle(), STROKE_PARAMS::SetWidth(), and SOLID.

Referenced by Clone(), and MergeOverlap().

◆ SCH_LINE() [2/3]

SCH_LINE::SCH_LINE ( const VECTOR2D pos,
int  layer = LAYER_NOTES 
)
inline

Definition at line 46 of file sch_line.h.

46 :
47 SCH_LINE( VECTOR2I( pos.x, pos.y ), layer )
48 {}
SCH_LINE(const VECTOR2I &pos=VECTOR2I(0, 0), int layer=LAYER_NOTES)
Definition: sch_line.cpp:43
VECTOR2< int > VECTOR2I
Definition: vector2d.h:618

◆ SCH_LINE() [3/3]

◆ ~SCH_LINE()

SCH_LINE::~SCH_LINE ( )
inline

Definition at line 52 of file sch_line.h.

52{ }

Member Function Documentation

◆ AddConnectionTo()

void SCH_ITEM::AddConnectionTo ( const SCH_SHEET_PATH aPath,
SCH_ITEM aItem 
)
inherited

Add a connection link between this item and another.

Definition at line 193 of file sch_item.cpp.

194{
195 SCH_ITEM_SET& set = m_connected_items[ aSheet ];
196
197 // The vector elements are small, so reserve 1k at a time to prevent re-allocations
198 if( set.size() == set.capacity() )
199 set.reserve( set.size() + 4096 );
200
201 set.emplace_back( aItem );
202}
std::map< SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP > m_connected_items
Store pointers to other items that are connected to this one, per sheet.
Definition: sch_item.h:498
std::vector< SCH_ITEM * > SCH_ITEM_SET
Definition: sch_item.h:136

References SCH_ITEM::m_connected_items.

Referenced by SCH_LABEL_BASE::UpdateDanglingState(), and CONNECTION_GRAPH::updateItemConnectivity().

◆ Angle()

EDA_ANGLE SCH_LINE::Angle ( ) const
inline

Gets the angle between the start and end lines.

Returns
Line angle in radians.

Definition at line 105 of file sch_line.h.

106 {
107 return ( EDA_ANGLE( (VECTOR2I) m_end - (VECTOR2I) m_start ) );
108 }

References m_end, and m_start.

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), IsOrthogonal(), SCH_MOVE_TOOL::orthoLineDrag(), and StoreAngle().

◆ AutoAutoplaceFields()

void SCH_ITEM::AutoAutoplaceFields ( SCH_SCREEN aScreen)
inlineinherited

Autoplace fields only if correct to do so automatically.

Fields that have been moved by hand are not automatically placed.

Parameters
aScreenis the SCH_SCREEN associated with the current instance of the symbol.

Definition at line 436 of file sch_item.h.

437 {
438 if( GetFieldsAutoplaced() )
440 }
FIELDS_AUTOPLACED GetFieldsAutoplaced() const
Return whether the fields have been automatically placed.
Definition: sch_item.h:424
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Definition: sch_item.h:442
@ FIELDS_AUTOPLACED_MANUAL
Definition: sch_item.h:58

References SCH_ITEM::AutoplaceFields(), FIELDS_AUTOPLACED_MANUAL, and SCH_ITEM::GetFieldsAutoplaced().

Referenced by DIALOG_CHANGE_SYMBOLS::processSymbol(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Rotate(), SCH_SHEET::SCH_SHEET(), SCH_EDIT_FRAME::SelectUnit(), and DIALOG_LABEL_PROPERTIES::TransferDataFromWindow().

◆ AutoplaceFields()

virtual void SCH_ITEM::AutoplaceFields ( SCH_SCREEN aScreen,
bool  aManual 
)
inlinevirtualinherited

◆ CanConnect()

bool SCH_LINE::CanConnect ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 621 of file sch_line.cpp.

622{
623 if( m_layer == LAYER_WIRE )
624 {
625 switch( aItem->Type() )
626 {
627 case SCH_JUNCTION_T:
628 case SCH_NO_CONNECT_T:
629 case SCH_LABEL_T:
631 case SCH_HIER_LABEL_T:
634 case SCH_SYMBOL_T:
635 case SCH_SHEET_T:
636 case SCH_SHEET_PIN_T:
637 return true;
638 default:
639 break;
640 }
641 }
642 else if( m_layer == LAYER_BUS )
643 {
644 switch( aItem->Type() )
645 {
646 case SCH_JUNCTION_T:
647 case SCH_LABEL_T:
649 case SCH_HIER_LABEL_T:
652 case SCH_SHEET_T:
653 case SCH_SHEET_PIN_T:
654 return true;
655 default:
656 break;
657 }
658 }
659
660 return aItem->GetLayer() == m_layer;
661}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
Definition: sch_item.h:246
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:143
@ SCH_SYMBOL_T
Definition: typeinfo.h:156
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:154
@ SCH_LABEL_T
Definition: typeinfo.h:151
@ SCH_SHEET_T
Definition: typeinfo.h:158
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:153
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:157
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:144
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:152
@ SCH_JUNCTION_T
Definition: typeinfo.h:142

References SCH_ITEM::GetLayer(), LAYER_BUS, LAYER_WIRE, SCH_ITEM::m_layer, SCH_BUS_WIRE_ENTRY_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_JUNCTION_T, SCH_LABEL_T, SCH_NO_CONNECT_T, SCH_SHEET_PIN_T, SCH_SHEET_T, SCH_SYMBOL_T, and EDA_ITEM::Type().

◆ ClassOf()

static bool SCH_LINE::ClassOf ( const EDA_ITEM aItem)
inlinestatic

Definition at line 54 of file sch_line.h.

55 {
56 return aItem && SCH_LINE_T == aItem->Type();
57 }

References SCH_LINE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 122 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:143
#define BRIGHTENED
item is drawn with a bright contour

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SCH_EDIT_FRAME::FocusOnItem(), PCB_BASE_FRAME::FocusOnItems(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearCaches()

void SCH_ITEM::ClearCaches ( )
virtualinherited

Reimplemented in SCH_FIELD.

Definition at line 251 of file sch_item.cpp.

252{
253 auto clearTextCaches =
254 []( SCH_ITEM* aItem )
255 {
256 EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
257
258 if( text )
259 {
260 text->ClearBoundingBoxCache();
261 text->ClearRenderCache();
262 }
263 };
264
265 clearTextCaches( this );
266
267 RunOnChildren( clearTextCaches );
268}
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:72
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:147
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction)
Definition: sch_item.h:444

References SCH_ITEM::RunOnChildren(), and text.

◆ ClearConnections()

void SCH_ITEM::ClearConnections ( )
inlineinherited

Clears all of the connection items from the list.

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.

Definition at line 372 of file sch_item.h.

372{ m_connections.clear(); }
EDA_ITEMS m_connections
Definition: sch_item.h:492

References SCH_ITEM::m_connections.

◆ ClearEditFlags()

◆ ClearFieldsAutoplaced()

◆ ClearFlags()

void EDA_ITEM::ClearFlags ( EDA_ITEM_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 143 of file eda_item.h.

143{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:500

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildCourtyardCaches(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SYMBOL_EDITOR_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), PCB_TOOL_BASE::doInteractiveItemPlacement(), KIGFX::SCH_PAINTER::draw(), SCH_ITEM::Duplicate(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::Init(), EE_COLLECTOR::Inspect(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), DRC_TEST_PROVIDER_DISALLOW::Run(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 155 of file eda_item.h.

156 {
158 }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define SELECTED_BY_DRAG
Item was algorithmically selected as a dragged item.
#define DO_NOT_DRAW
Used to disable draw function.
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, IS_LINKED, SELECTED_BY_DRAG, and SKIP_STRUCT.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles(), and SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 143 of file view_item.h.

144 {
145 m_viewPrivData = nullptr;
146 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:151

References KIGFX::VIEW_ITEM::m_viewPrivData.

Referenced by KIGFX::VIEW::OnDestroy().

◆ Clone()

EDA_ITEM * SCH_LINE::Clone ( ) const
overridevirtual

Create a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented from EDA_ITEM.

Definition at line 128 of file sch_line.cpp.

129{
130 return new SCH_LINE( *this );
131}

References SCH_LINE().

◆ ConnectedItems()

SCH_ITEM_SET & SCH_ITEM::ConnectedItems ( const SCH_SHEET_PATH aPath)
inherited

Retrieve the set of items connected to this item on the given sheet.

Definition at line 187 of file sch_item.cpp.

188{
189 return m_connected_items[ aSheet ];
190}

References SCH_ITEM::m_connected_items.

Referenced by addConnections(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), FindWireSegmentNetNameRecursive(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ Connection()

SCH_CONNECTION * SCH_ITEM::Connection ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Retrieve the connection associated with this object in the given sheet.

Note
The returned value can be nullptr.

Definition at line 146 of file sch_item.cpp.

147{
148 if( !IsConnectable() )
149 return nullptr;
150
151 wxCHECK_MSG( !IsConnectivityDirty(), nullptr,
152 wxT( "Shouldn't be asking for connection if connectivity is dirty!" ) );
153
154 if( !aSheet )
155 aSheet = &Schematic()->CurrentSheet();
156
157 auto it = m_connection_map.find( *aSheet );
158
159 if( it == m_connection_map.end() )
160 return nullptr;
161 else
162 return it->second;
163}
SCH_SHEET_PATH & CurrentSheet() const override
Definition: schematic.h:120
virtual bool IsConnectable() const
Definition: sch_item.h:349
SCHEMATIC * Schematic() const
Searches the item hierarchy to find a SCHEMATIC.
Definition: sch_item.cpp:112
bool IsConnectivityDirty() const
Definition: sch_item.h:413
std::unordered_map< SCH_SHEET_PATH, SCH_CONNECTION * > m_connection_map
Store connectivity information, per sheet.
Definition: sch_item.h:501

References SCHEMATIC::CurrentSheet(), SCH_ITEM::IsConnectable(), SCH_ITEM::IsConnectivityDirty(), SCH_ITEM::m_connection_map, and SCH_ITEM::Schematic().

Referenced by CONNECTION_SUBGRAPH::Absorb(), CONNECTION_SUBGRAPH::AddItem(), CONNECTION_GRAPH::buildConnectionGraph(), KIGFX::SCH_PAINTER::draw(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::GetBusesNeedingMigration(), SCH_ITEM::GetEffectiveNetClass(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNetName(), SCH_ITEM::GetOrInitConnection(), highlightNet(), SCH_ITEM::InitializeConnection(), SCH_LABEL_BASE::Plot(), Plot(), SCH_TEXT::Plot(), SCH_LABEL_BASE::Print(), NETLIST_EXPORTER_SPICE_MODEL::readPorts(), SCH_EDIT_FRAME::RecalculateConnections(), SCH_LABEL_BASE::ResolveTextVar(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), BUS_UNFOLD_MENU::update(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ ConnectionPropagatesTo()

bool SCH_LINE::ConnectionPropagatesTo ( const EDA_ITEM aItem) const
overridevirtual

Return true if this item should propagate connection info to aItem.

Reimplemented from SCH_ITEM.

Definition at line 670 of file sch_line.cpp.

671{
672 switch( aItem->Type() )
673 {
674 case SCH_LINE_T:
675 return IsBus() == static_cast<const SCH_LINE*>( aItem )->IsBus();
676
677 default:
678 return true;
679 }
680}
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
bool IsBus() const
Return true if the line is a bus.
Definition: sch_line.cpp:931

References IsBus(), SCH_LINE_T, and EDA_ITEM::Type().

◆ DoHypertextAction()

virtual void SCH_ITEM::DoHypertextAction ( EDA_DRAW_FRAME aFrame) const
inlinevirtualinherited

Reimplemented in SCH_FIELD, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 241 of file sch_item.h.

241{ }

◆ doIsConnected()

bool SCH_LINE::doIsConnected ( const VECTOR2I aPosition) const
overrideprivatevirtual

Provide the object specific test to see if it is connected to 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.
Parameters
aPositionis a reference to a VECTOR2I object containing the test position.
Returns
True if connection to aPosition exists.

Reimplemented from SCH_ITEM.

Definition at line 810 of file sch_line.cpp.

811{
812 if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS )
813 return false;
814
815 return IsEndPoint( aPosition );
816}
bool IsEndPoint(const VECTOR2I &aPoint) const
Definition: sch_line.h:92

References IsEndPoint(), LAYER_BUS, LAYER_WIRE, and SCH_ITEM::m_layer.

◆ Duplicate()

SCH_ITEM * SCH_ITEM::Duplicate ( bool  doClone = false) const
inherited

Routine to create a new copy of given item.

The new object is not put in draw list (not linked).

Parameters
doClone(default = false) indicates unique values (such as timestamp and sheet name) should be duplicated. Use only for undo/redo operations.

Definition at line 93 of file sch_item.cpp.

94{
95 SCH_ITEM* newItem = (SCH_ITEM*) Clone();
96
97 if( !doClone )
98 const_cast<KIID&>( newItem->m_Uuid ) = KIID();
99
100 newItem->ClearFlags( SELECTED | BRIGHTENED );
101
102 newItem->RunOnChildren(
103 []( SCH_ITEM* aChild )
104 {
105 aChild->ClearFlags( SELECTED | BRIGHTENED );
106 } );
107
108 return newItem;
109}
const KIID m_Uuid
Definition: eda_item.h:494
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:82
Definition: kiid.h:48

References BRIGHTENED, EDA_ITEM::ClearFlags(), EDA_ITEM::Clone(), EDA_ITEM::m_Uuid, SCH_ITEM::RunOnChildren(), and SELECTED.

Referenced by SCH_EDIT_FRAME::BreakSegment(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), CADSTAR_SCH_ARCHIVE_LOADER::loadItemOntoKiCadSheet(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyInUndoList(), and SCH_LINE_WIRE_BUS_TOOL::startSegments().

◆ FindWireSegmentNetNameRecursive()

wxString SCH_LINE::FindWireSegmentNetNameRecursive ( SCH_LINE line,
std::list< const SCH_LINE * > &  checkedLines,
const SCH_SHEET_PATH aSheet 
) const
private

Recursively called function to travel through the connected wires and find a connected net name label.

Parameters
line- the wire segment to start the recursive lookup
checkedLines- a lsit containing the already checked wire segments, to prevent the infinite recursion in the case if someone draws a rectangle for e.g.
aSheet- the sheet where the lookup is performed
Returns
With the net name if a connected label found, otherwise with an empty string

Definition at line 97 of file sch_line.cpp.

100{
101 for ( auto connected : line->ConnectedItems( aSheet ) )
102 {
103 if( connected->Type() == SCH_LINE_T )
104 {
105 if( std::find(checkedLines.begin(), checkedLines.end(), connected ) == checkedLines.end() )
106 {
107 SCH_LINE* connectedLine = static_cast<SCH_LINE*>( connected );
108 checkedLines.push_back( connectedLine );
109
110 wxString netName = FindWireSegmentNetNameRecursive( connectedLine, checkedLines,
111 aSheet );
112
113 if( !netName.IsEmpty() )
114 return netName;
115 }
116 }
117 else if( connected->Type() == SCH_LABEL_T
118 || connected->Type() == SCH_GLOBAL_LABEL_T
119 || connected->Type() == SCH_DIRECTIVE_LABEL_T)
120 {
121 return static_cast<SCH_TEXT*>( connected )->GetText();
122 }
123
124 }
125 return "";
126}
SCH_ITEM_SET & ConnectedItems(const SCH_SHEET_PATH &aPath)
Retrieve the set of items connected to this item on the given sheet.
Definition: sch_item.cpp:187
wxString FindWireSegmentNetNameRecursive(SCH_LINE *line, std::list< const SCH_LINE * > &checkedLines, const SCH_SHEET_PATH &aSheet) const
Recursively called function to travel through the connected wires and find a connected net name label...
Definition: sch_line.cpp:97
wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:98

References SCH_ITEM::ConnectedItems(), FindWireSegmentNetNameRecursive(), EDA_UNIT_UTILS::GetText(), SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_LABEL_T, and SCH_LINE_T.

Referenced by FindWireSegmentNetNameRecursive(), and GetNetname().

◆ Get() [1/3]

template<typename T >
std::optional< T > INSPECTABLE::Get ( const wxString &  aProperty) const
inlineinherited

Definition at line 104 of file inspectable.h.

105 {
107 TYPE_ID thisType = TYPE_HASH( *this );
108 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
109 std::optional<T> ret;
110
111 if( prop )
112 {
113 const void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114
115 if( object )
116 ret = prop->get<T>( object );
117 }
118
119 return ret;
120 }
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:294
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:67
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:69
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
#define TYPE_HASH(x)
Definition: property.h:61
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:44

References PROPERTY_BASE::get(), PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Get() [2/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 84 of file inspectable.h.

85 {
87 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
88 return object ? aProperty->getter( object ) : wxAny();
89 }
virtual wxAny getter(const void *aObject) const =0

References PROPERTY_BASE::getter(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by BOOST_AUTO_TEST_CASE(), CLASS_D_DESC::CLASS_D_DESC(), EDA_SHAPE_DESC::EDA_SHAPE_DESC(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [3/3]

template<typename T >
T INSPECTABLE::Get ( PROPERTY_BASE aProperty) const
inlineinherited

Definition at line 92 of file inspectable.h.

93 {
95 const void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
96
97 if( !object )
98 throw std::runtime_error( "Could not cast INSPECTABLE to the requested type" );
99
100 return aProperty->get<T>( object );
101 }

References PROPERTY_BASE::get(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ GetAngleFrom()

int SCH_LINE::GetAngleFrom ( const VECTOR2I aPoint) const

Definition at line 401 of file sch_line.cpp.

402{
403 VECTOR2I vec;
404
405 if( aPoint == m_start )
406 vec = m_end - aPoint;
407 else
408 vec = m_start - aPoint;
409
410 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
411}
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

References KiROUND(), m_end, and m_start.

Referenced by SCH_SCREEN::doIsJunction().

◆ GetBoundingBox()

const BOX2I SCH_LINE::GetBoundingBox ( ) const
overridevirtual

Return the orthogonal bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented from EDA_ITEM.

Definition at line 191 of file sch_line.cpp.

192{
193 int width = GetPenWidth() / 2;
194
195 int xmin = std::min( m_start.x, m_end.x ) - width;
196 int ymin = std::min( m_start.y, m_end.y ) - width;
197
198 int xmax = std::max( m_start.x, m_end.x ) + width + 1;
199 int ymax = std::max( m_start.y, m_end.y ) + width + 1;
200
201 BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
202
203 return ret;
204}
int GetPenWidth() const override
Definition: sch_line.cpp:292

References GetPenWidth(), m_end, m_start, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), SCH_EAGLE_PLUGIN::moveLabels(), and Plot().

◆ GetClass()

wxString SCH_LINE::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Reimplemented from SCH_ITEM.

Definition at line 59 of file sch_line.h.

60 {
61 return wxT( "SCH_LINE" );
62 }

◆ GetConnectionPoints()

std::vector< VECTOR2I > SCH_LINE::GetConnectionPoints ( ) const
overridevirtual

Add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsis the list of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 664 of file sch_line.cpp.

665{
666 return { m_start, m_end };
667}

References m_end, and m_start.

Referenced by SCH_MOVE_TOOL::Main().

◆ GetDefaultFont()

const wxString & SCH_ITEM::GetDefaultFont ( ) const
inherited

Definition at line 286 of file sch_item.cpp.

287{
288 EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
289
290 return cfg->m_Appearance.default_font;
291}
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References EESCHEMA_SETTINGS::APPEARANCE::default_font, EESCHEMA_SETTINGS::m_Appearance, and Pgm().

Referenced by SCH_FIELD::getDrawFont(), SCH_TEXT::getDrawFont(), SCH_TEXTBOX::getDrawFont(), SCH_FIELD::GetRenderCache(), and SCH_TEXTBOX::GetShownText().

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 147 of file eda_item.h.

148 {
149 constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
151
152 return m_flags & mask;
153 }
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_CHANGED
Item was edited, and modified.
#define IS_NEW
New item, just created.
#define IS_DRAGGING
Item being dragged.
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.
#define IS_RESIZING
Item being resized.

References IS_CHANGED, IS_DRAGGING, IS_MOVING, IS_NEW, IS_PASTED, IS_RESIZING, IS_WIRE_IMAGE, EDA_ITEM::m_flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_SYMBOL::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveLineStyle()

PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle ( ) const
Returns
the style that the line should be drawn in this might be set on the line or inherited from the line's netclass

Definition at line 272 of file sch_line.cpp.

273{
276 else if( !IsConnectable() )
278 else if( !IsConnectivityDirty() )
280
282}
std::shared_ptr< NETCLASS > GetEffectiveNetClass(const SCH_SHEET_PATH *aSheet=nullptr) const
Definition: sch_item.cpp:166
bool IsConnectable() const override
Definition: sch_line.cpp:612
PLOT_DASH_TYPE GetPlotStyle() const
PLOT_DASH_TYPE
Dashed line types.
Definition: stroke_params.h:48

References DEFAULT, SCH_ITEM::GetEffectiveNetClass(), STROKE_PARAMS::GetPlotStyle(), IsConnectable(), SCH_ITEM::IsConnectivityDirty(), m_lastResolvedLineStyle, m_stroke, and SOLID.

Referenced by KIGFX::SCH_PAINTER::draw(), GetMsgPanelInfo(), Plot(), and Print().

◆ GetEffectiveNetClass()

std::shared_ptr< NETCLASS > SCH_ITEM::GetEffectiveNetClass ( const SCH_SHEET_PATH aSheet = nullptr) const
inherited

Definition at line 166 of file sch_item.cpp.

167{
168 static std::shared_ptr<NETCLASS> nullNetclass = std::make_shared<NETCLASS>( wxEmptyString );
169
170 SCHEMATIC* schematic = Schematic();
171
172 if( schematic )
173 {
174 std::shared_ptr<NET_SETTINGS>& netSettings = schematic->Prj().GetProjectFile().m_NetSettings;
175 SCH_CONNECTION* connection = Connection( aSheet );
176
177 if( connection )
178 return netSettings->GetEffectiveNetClass( connection->Name() );
179 else
180 return netSettings->m_DefaultNetClass;
181 }
182
183 return nullNetclass;
184}
std::shared_ptr< NET_SETTINGS > m_NetSettings
Net settings for this project (owned here)
Definition: project_file.h:168
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:149
Holds all the data relating to one schematic.
Definition: schematic.h:61
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:76
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
wxString Name(bool aIgnoreSheet=false) const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:146

References SCH_ITEM::Connection(), PROJECT::GetProjectFile(), PROJECT_FILE::m_NetSettings, SCH_CONNECTION::Name(), SCHEMATIC::Prj(), and SCH_ITEM::Schematic().

Referenced by SCH_BUS_ENTRY_BASE::GetBusEntryColor(), GetEffectiveLineStyle(), SCH_JUNCTION::getEffectiveShape(), SCH_FIELD::GetFieldColor(), SCH_JUNCTION::GetJunctionColor(), SCH_LABEL_BASE::GetLabelColor(), GetLineColor(), SCH_BUS_ENTRY_BASE::GetLineStyle(), SCH_BUS_ENTRY_BASE::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), GetMsgPanelInfo(), SCH_BUS_WIRE_ENTRY::GetPenWidth(), SCH_BUS_BUS_ENTRY::GetPenWidth(), GetPenWidth(), SCH_LABEL_BASE::Plot(), Plot(), and SCH_LABEL_BASE::ResolveTextVar().

◆ GetEndPoint()

◆ GetEndPoints()

void SCH_LINE::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Add the schematic item end points to aItemList if the item has end points.

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.

Parameters
aItemListis the list of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 561 of file sch_line.cpp.

562{
563 if( IsConnectable() )
564 {
565 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_start );
566 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_end );
567 }
568}
@ BUS_END
Definition: sch_item.h:66
@ WIRE_END
Definition: sch_item.h:65

References BUS_END, IsBus(), IsConnectable(), m_end, m_start, and WIRE_END.

◆ GetFieldsAutoplaced()

FIELDS_AUTOPLACED SCH_ITEM::GetFieldsAutoplaced ( ) const
inlineinherited

Return whether the fields have been automatically placed.

Definition at line 424 of file sch_item.h.

424{ return m_fieldsAutoplaced; }

References SCH_ITEM::m_fieldsAutoplaced.

Referenced by SCH_ITEM::AutoAutoplaceFields(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), and EE_POINT_EDITOR::updateParentItem().

◆ GetFlags()

◆ GetFocusPosition()

virtual const VECTOR2I EDA_ITEM::GetFocusPosition ( ) const
inlinevirtualinherited

Similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented in BOARD, PCB_SHAPE, and PCB_TRACK.

Definition at line 258 of file eda_item.h.

258{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:251

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, and ZONE.

Definition at line 310 of file eda_item.cpp.

311{
312 return GetTypeDesc();
313}
wxString GetTypeDesc() const
Return a translated description of the type for this EDA_ITEM for display in user facing messages.
Definition: eda_item.cpp:301

References EDA_ITEM::GetTypeDesc().

Referenced by PROPERTIES_PANEL::update().

◆ GetLayer()

◆ GetLength()

double SCH_LINE::GetLength ( ) const
Returns
The length of the line segment.

Definition at line 207 of file sch_line.cpp.

208{
209 return GetLineLength( m_start, m_end );
210}
double GetLineLength(const VECTOR2I &aPointA, const VECTOR2I &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:188

References GetLineLength(), m_end, and m_start.

Referenced by SCH_MOVE_TOOL::orthoLineDrag().

◆ GetLineColor()

COLOR4D SCH_LINE::GetLineColor ( ) const

Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.

Definition at line 237 of file sch_line.cpp.

238{
239 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
241 else if( !IsConnectable() )
242 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
243 else if( !IsConnectivityDirty() )
244 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
245
246 return m_lastResolvedColor;
247}
KIGFX::COLOR4D GetColor() const

References STROKE_PARAMS::GetColor(), SCH_ITEM::GetEffectiveNetClass(), IsConnectable(), SCH_ITEM::IsConnectivityDirty(), m_lastResolvedColor, and m_stroke.

Referenced by Plot(), Print(), SCH_LEGACY_PLUGIN::saveLine(), and SetLineColor().

◆ GetLineSize()

int SCH_LINE::GetLineSize ( ) const
inline

Definition at line 195 of file sch_line.h.

195{ return m_stroke.GetWidth(); }
int GetWidth() const
Definition: stroke_params.h:98

References STROKE_PARAMS::GetWidth(), and m_stroke.

Referenced by SCH_LEGACY_PLUGIN::saveLine().

◆ GetLineStyle()

PLOT_DASH_TYPE SCH_LINE::GetLineStyle ( ) const

Definition at line 263 of file sch_line.cpp.

264{
266 return m_stroke.GetPlotStyle();
267
269}

References DEFAULT, STROKE_PARAMS::GetPlotStyle(), m_stroke, and SOLID.

Referenced by GetMsgPanelInfo(), SCH_LEGACY_PLUGIN::saveLine(), and SetLineStyle().

◆ GetMenuImage()

BITMAPS SCH_LINE::GetMenuImage ( ) const
overridevirtual

Return a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented from EDA_ITEM.

Definition at line 730 of file sch_line.cpp.

731{
732 if( m_layer == LAYER_NOTES )
734 else if( m_layer == LAYER_WIRE )
735 return BITMAPS::add_line;
736
737 return BITMAPS::add_bus;
738}
@ add_dashed_line

References add_bus, add_dashed_line, add_line, LAYER_NOTES, LAYER_WIRE, and SCH_ITEM::m_layer.

◆ GetMidPoint()

VECTOR2I SCH_LINE::GetMidPoint ( ) const
inline

Definition at line 141 of file sch_line.h.

141{ return ( m_start + m_end ) / 2; }

References m_end, and m_start.

Referenced by GetSortPosition().

◆ GetMsgPanelInfo()

void SCH_LINE::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 881 of file sch_line.cpp.

882{
883 wxString msg;
884
885 switch( GetLayer() )
886 {
887 case LAYER_WIRE: msg = _( "Wire" ); break;
888 case LAYER_BUS: msg = _( "Bus" ); break;
889 default: msg = _( "Graphical" ); break;
890 }
891
892 aList.emplace_back( _( "Line Type" ), msg );
893
894 PLOT_DASH_TYPE lineStyle = GetLineStyle();
895
896 if( GetEffectiveLineStyle() != lineStyle )
897 aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
898 else
899 m_stroke.GetMsgPanelInfo( aFrame, aList, true, false );
900
901 SCH_CONNECTION* conn = nullptr;
902
903 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
904 conn = Connection();
905
906 if( conn )
907 {
908 conn->AppendInfoToMsgPanel( aList );
909
910 if( !conn->IsBus() )
911 {
912 aList.emplace_back( _( "Resolved Netclass" ),
913 UnescapeString( GetEffectiveNetClass()->GetName() ) );
914 }
915 }
916}
bool IsBus() const
void AppendInfoToMsgPanel(std::vector< MSG_PANEL_ITEM > &aList) const
Adds information about the connection object to aList.
Schematic editor (Eeschema) main window.
PLOT_DASH_TYPE GetLineStyle() const
Definition: sch_line.cpp:263
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: sch_line.cpp:272
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
#define _(s)
wxString UnescapeString(const wxString &aSource)

References _, SCH_CONNECTION::AppendInfoToMsgPanel(), SCH_ITEM::Connection(), GetEffectiveLineStyle(), SCH_ITEM::GetEffectiveNetClass(), SCH_ITEM::GetLayer(), GetLineStyle(), STROKE_PARAMS::GetMsgPanelInfo(), SCH_CONNECTION::IsBus(), SCH_ITEM::IsConnectivityDirty(), LAYER_BUS, LAYER_WIRE, m_stroke, and UnescapeString().

◆ GetNetname()

wxString SCH_LINE::GetNetname ( const SCH_SHEET_PATH aSheet)

This function travel though all the connected wire segments to look for connected labels.

Parameters
aSheet- the sheet where the current wire segment is located
Returns
returns the name of the wire if connected labels found, otherwise empty string

Definition at line 90 of file sch_line.cpp.

91{
92 std::list<const SCH_LINE *> checkedLines;
93 checkedLines.push_back(this);
94 return FindWireSegmentNetNameRecursive( this, checkedLines, aSheet );
95}

References FindWireSegmentNetNameRecursive().

Referenced by SCH_DRAWING_TOOLS::TwoClickPlace().

◆ GetOrInitConnection()

SCH_CONNECTION * SCH_ITEM::GetOrInitConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Definition at line 228 of file sch_item.cpp.

230{
231 if( !IsConnectable() )
232 return nullptr;
233
234 SetConnectivityDirty( false );
235
236 SCH_CONNECTION* connection = Connection( &aSheet );
237
238 if( connection )
239 return connection;
240 else
241 return InitializeConnection( aSheet, aGraph );
242}
SCH_CONNECTION * InitializeConnection(const SCH_SHEET_PATH &aPath, CONNECTION_GRAPH *aGraph)
Create a new connection object associated with this object.
Definition: sch_item.cpp:205
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:415

References SCH_ITEM::Connection(), SCH_ITEM::InitializeConnection(), SCH_ITEM::IsConnectable(), and SCH_ITEM::SetConnectivityDirty().

◆ GetParent()

◆ GetPenWidth()

int SCH_LINE::GetPenWidth ( ) const
overridevirtual
Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented from SCH_ITEM.

Definition at line 292 of file sch_line.cpp.

293{
294 SCHEMATIC* schematic = Schematic();
295
296 switch ( m_layer )
297 {
298 default:
299 if( m_stroke.GetWidth() > 0 )
300 return m_stroke.GetWidth();
301
302 if( schematic )
303 return schematic->Settings().m_DefaultLineWidth;
304
306
307 case LAYER_WIRE:
308 if( m_stroke.GetWidth() > 0 )
310 else if( !IsConnectivityDirty() )
311 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
312
313 return m_lastResolvedWidth;
314
315 case LAYER_BUS:
316 if( m_stroke.GetWidth() > 0 )
318 else if( !IsConnectivityDirty() )
319 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
320
321 return m_lastResolvedWidth;
322 }
323}
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:172

References DEFAULT_LINE_WIDTH_MILS, SCH_ITEM::GetEffectiveNetClass(), STROKE_PARAMS::GetWidth(), SCH_ITEM::IsConnectivityDirty(), LAYER_BUS, LAYER_WIRE, SCHEMATIC_SETTINGS::m_DefaultLineWidth, m_lastResolvedWidth, SCH_ITEM::m_layer, m_stroke, EDA_IU_SCALE::MilsToIU(), SCH_ITEM::Schematic(), schIUScale, and SCHEMATIC::Settings().

Referenced by GetBoundingBox(), HitTest(), Plot(), Print(), and SetLineWidth().

◆ GetPosition()

VECTOR2I SCH_LINE::GetPosition ( ) const
inlineoverridevirtual

Reimplemented from EDA_ITEM.

Definition at line 262 of file sch_line.h.

262{ return m_start; }

References m_start.

◆ GetReverseAngleFrom()

int SCH_LINE::GetReverseAngleFrom ( const VECTOR2I aPoint) const

Definition at line 414 of file sch_line.cpp.

415{
416 VECTOR2I vec;
417
418 if( aPoint == m_end )
419 vec = m_start - aPoint;
420 else
421 vec = m_end - aPoint;
422
423 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
424}

References KiROUND(), m_end, and m_start.

◆ GetSelectedPoints()

void SCH_LINE::GetSelectedPoints ( std::vector< VECTOR2I > &  aPoints) const

Definition at line 683 of file sch_line.cpp.

684{
685 if( m_flags & STARTPOINT )
686 aPoints.push_back( m_start );
687
688 if( m_flags & ENDPOINT )
689 aPoints.push_back( m_end );
690}
#define ENDPOINT
ends. (Used to support dragging.)
#define STARTPOINT
When a line is selected, these flags indicate which.

References ENDPOINT, m_end, EDA_ITEM::m_flags, m_start, and STARTPOINT.

Referenced by SCH_MOVE_TOOL::Main().

◆ GetSelectMenuText()

wxString SCH_LINE::GetSelectMenuText ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 693 of file sch_line.cpp.

694{
695 wxString txtfmt;
696
697 if( m_start.x == m_end.x )
698 {
699 switch( m_layer )
700 {
701 case LAYER_WIRE: txtfmt = _( "Vertical Wire, length %s" ); break;
702 case LAYER_BUS: txtfmt = _( "Vertical Bus, length %s" ); break;
703 default: txtfmt = _( "Vertical Graphic Line, length %s" ); break;
704 }
705 }
706 else if( m_start.y == m_end.y )
707 {
708 switch( m_layer )
709 {
710 case LAYER_WIRE: txtfmt = _( "Horizontal Wire, length %s" ); break;
711 case LAYER_BUS: txtfmt = _( "Horizontal Bus, length %s" ); break;
712 default: txtfmt = _( "Horizontal Graphic Line, length %s" ); break;
713 }
714 }
715 else
716 {
717 switch( m_layer )
718 {
719 case LAYER_WIRE: txtfmt = _( "Wire, length %s" ); break;
720 case LAYER_BUS: txtfmt = _( "Bus, length %s" ); break;
721 default: txtfmt = _( "Graphic Line, length %s" ); break;
722 }
723 }
724
725 return wxString::Format( txtfmt,
726 aUnitsProvider->MessageTextFromValue( EuclideanNorm( m_start - m_end ) ) );
727}
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129

References _, EuclideanNorm(), Format(), LAYER_BUS, LAYER_WIRE, m_end, SCH_ITEM::m_layer, m_start, UNITS_PROVIDER::MessageTextFromValue(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ GetSortPosition()

VECTOR2I SCH_LINE::GetSortPosition ( ) const
inlineoverridevirtual

Return the coordinates that should be used for sorting this element visually compared to other elements.

For instance, for lines the midpoint might be a better sorting point than either end.

Returns
X,Y coordinate of the sort point

Reimplemented from EDA_ITEM.

Definition at line 264 of file sch_line.h.

264{ return GetMidPoint(); }
VECTOR2I GetMidPoint() const
Definition: sch_line.h:141

References GetMidPoint().

◆ GetStartPoint()

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 126 of file eda_item.h.

127 {
128 return m_status & type;
129 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:497

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 139 of file eda_item.h.

139{ return m_status; }

References EDA_ITEM::m_status.

◆ GetStoredAngle()

EDA_ANGLE SCH_LINE::GetStoredAngle ( ) const
inline

Returns the angle stored by StoreAngle()

Returns
Stored angle in radians.

Definition at line 127 of file sch_line.h.

127{ return m_storedAngle; }
EDA_ANGLE m_storedAngle
Stored angle.
Definition: sch_line.h:326

References m_storedAngle.

◆ GetStoredPos()

VECTOR2I & SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 209 of file sch_item.h.

209{ return m_storedPos; }
VECTOR2I m_storedPos
Definition: sch_item.h:494

References SCH_ITEM::m_storedPos.

◆ GetStroke()

virtual STROKE_PARAMS SCH_LINE::GetStroke ( ) const
inlineoverridevirtual

◆ GetTypeDesc()

wxString EDA_ITEM::GetTypeDesc ( ) const
inherited

Return a translated description of the type for this EDA_ITEM for display in user facing messages.

Definition at line 301 of file eda_item.cpp.

302{
303 //@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
304 wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
305
306 return wxGetTranslation( typeDescr );
307}
static ENUM_MAP< T > & Instance()
Definition: property.h:546

References ENUM_MAP< T >::Instance(), and EDA_ITEM::Type().

Referenced by PCB_GROUP::AddItem(), EDIT_TOOL::doMoveSelection(), and EDA_ITEM::GetFriendlyName().

◆ HasFlag()

◆ HasLineStroke()

virtual bool SCH_LINE::HasLineStroke ( ) const
inlineoverridevirtual

Check if this schematic item has line stoke properties.

See also
STROKE_PARAMS
Returns
true if this schematic item support line stroke properties. Otherwise, false.

Reimplemented from SCH_ITEM.

Definition at line 175 of file sch_line.h.

175{ return true; }

◆ HitTest() [1/2]

bool SCH_LINE::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects this item.

Parameters
aRectA reference to a BOX2I object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 779 of file sch_line.cpp.

780{
782 return false;
783
784 BOX2I rect = aRect;
785
786 if ( aAccuracy )
787 rect.Inflate( aAccuracy );
788
789 if( aContained )
790 return rect.Contains( m_start ) && rect.Contains( m_end );
791
792 return rect.Intersects( m_start, m_end );
793}
bool Intersects(const BOX2< Vec > &aRect) const
Definition: box2.h:269
bool Contains(const Vec &aPoint) const
Definition: box2.h:141
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:506

References BOX2< Vec >::Contains(), BOX2< Vec >::Inflate(), BOX2< Vec >::Intersects(), m_end, EDA_ITEM::m_flags, m_start, SKIP_STRUCT, and STRUCT_DELETED.

◆ HitTest() [2/2]

bool SCH_LINE::HitTest ( const VECTOR2I aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Test if aPosition is inside or on the boundary of this item.

Parameters
aPositionA reference to a VECTOR2I object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from EDA_ITEM.

Definition at line 764 of file sch_line.cpp.

765{
766 // Performance enhancement for connection-building
767 if( aPosition == m_start || aPosition == m_end )
768 return true;
769
770 if( aAccuracy >= 0 )
771 aAccuracy += GetPenWidth() / 2;
772 else
773 aAccuracy = abs( aAccuracy );
774
775 return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
776}
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:401
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129

References std::abs(), GetPenWidth(), m_end, m_start, and TestSegmentHit().

Referenced by SCH_SCREEN::doIsJunction(), SCH_MOVE_TOOL::getConnectedDragItems(), and SCH_MOVE_TOOL::getConnectedItems().

◆ InitializeConnection()

SCH_CONNECTION * SCH_ITEM::InitializeConnection ( const SCH_SHEET_PATH aPath,
CONNECTION_GRAPH aGraph 
)
inherited

Create a new connection object associated with this object.

Parameters
aPathis the sheet path to initialize.

Definition at line 205 of file sch_item.cpp.

207{
208 SetConnectivityDirty( false );
209
210 SCH_CONNECTION* connection = Connection( &aSheet );
211
212 if( connection )
213 {
214 connection->Reset();
215 }
216 else
217 {
218 connection = new SCH_CONNECTION( this );
219 m_connection_map.insert( std::make_pair( aSheet, connection ) );
220 }
221
222 connection->SetGraph( aGraph );
223 connection->SetSheet( aSheet );
224 return connection;
225}
void Reset()
Clears connectivity information.
void SetGraph(CONNECTION_GRAPH *aGraph)
void SetSheet(SCH_SHEET_PATH aSheet)

References SCH_ITEM::Connection(), SCH_ITEM::m_connection_map, SCH_CONNECTION::Reset(), SCH_ITEM::SetConnectivityDirty(), SCH_CONNECTION::SetGraph(), and SCH_CONNECTION::SetSheet().

Referenced by SCH_ITEM::GetOrInitConnection().

◆ IsBrightened()

◆ IsBus()

bool SCH_LINE::IsBus ( ) const

Return true if the line is a bus.

Returns
true if this line is on the bus layer.

Definition at line 931 of file sch_line.cpp.

932{
933 return ( GetLayer() == LAYER_BUS );
934}

References SCH_ITEM::GetLayer(), and LAYER_BUS.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), EE_SELECTION_TOOL::autostartEvent(), ConnectionPropagatesTo(), GetEndPoints(), and UpdateDanglingState().

◆ IsConnectable()

bool SCH_LINE::IsConnectable ( ) const
overridevirtual
Returns
true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Definition at line 612 of file sch_line.cpp.

613{
614 if( m_layer == LAYER_WIRE || m_layer == LAYER_BUS )
615 return true;
616
617 return false;
618}

References LAYER_BUS, LAYER_WIRE, and SCH_ITEM::m_layer.

Referenced by GetEffectiveLineStyle(), GetEndPoints(), GetLineColor(), and UpdateDanglingState().

◆ IsConnected()

bool SCH_ITEM::IsConnected ( const VECTOR2I aPoint) const
inherited

Test the item to see if it is connected to aPoint.

Parameters
aPointis a reference to a VECTOR2I object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 137 of file sch_item.cpp.

138{
139 if(( m_flags & STRUCT_DELETED ) || ( m_flags & SKIP_STRUCT ) )
140 return false;
141
142 return doIsConnected( aPosition );
143}
virtual bool doIsConnected(const VECTOR2I &aPosition) const
Provide the object specific test to see if it is connected to aPosition.
Definition: sch_item.h:488

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::doIsJunction(), SCH_MOVE_TOOL::getConnectedItems(), SCH_SCREEN::IsTerminalPoint(), and SCH_SCREEN::MarkConnections().

◆ IsConnectivityDirty()

◆ IsDangling()

bool SCH_LINE::IsDangling ( ) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 244 of file sch_line.h.

References m_endIsDangling, and m_startIsDangling.

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 105 of file eda_item.h.

105{ return m_flags & IS_DRAGGING; }

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEndDangling()

bool SCH_LINE::IsEndDangling ( ) const
inline

Definition at line 243 of file sch_line.h.

243{ return m_endIsDangling; }

References m_endIsDangling.

Referenced by KIGFX::SCH_PAINTER::draw(), and IsPointClickableAnchor().

◆ IsEndPoint()

bool SCH_LINE::IsEndPoint ( const VECTOR2I aPoint) const
inline

Definition at line 92 of file sch_line.h.

93 {
94 return aPoint == m_start || aPoint == m_end;
95 }

References m_end, and m_start.

Referenced by SCH_EDIT_FRAME::BreakSegments(), SCH_EDIT_FRAME::DeleteJunction(), and doIsConnected().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 108 of file eda_item.h.

108{ return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

Referenced by KIGFX::PCB_PAINTER::draw().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 203 of file eda_item.h.

203{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:499

References EDA_ITEM::m_forceVisible.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_FIELD::Print().

◆ IsGraphicLine()

bool SCH_LINE::IsGraphicLine ( ) const

Return if the line is a graphic (non electrical line)

Currently, anything on the internal NOTES layer is a graphic line

Definition at line 919 of file sch_line.cpp.

920{
921 return ( GetLayer() == LAYER_NOTES );
922}

References SCH_ITEM::GetLayer(), and LAYER_NOTES.

Referenced by EE_SELECTION_TOOL::autostartEvent(), and SCH_LEGACY_PLUGIN::saveLine().

◆ IsHypertext()

virtual bool SCH_ITEM::IsHypertext ( ) const
inlinevirtualinherited

Allow items to support hypertext actions when hovered/clicked.

Reimplemented in SCH_FIELD, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 239 of file sch_item.h.

239{ return false; }

Referenced by SCH_ITEM::RenderAsBitmap().

◆ IsLocked()

virtual bool SCH_ITEM::IsLocked ( ) const
inlinevirtualinherited
Returns
true if the object is locked, else false.

Definition at line 229 of file sch_item.h.

229{ return false; }

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 102 of file eda_item.h.

102{ return m_flags & IS_CHANGED; }

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMovableFromAnchorPoint()

virtual bool SCH_ITEM::IsMovableFromAnchorPoint ( ) const
inlinevirtualinherited
Returns
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, symbols)

Reimplemented in SCH_BITMAP, SCH_BUS_ENTRY_BASE, SCH_SHEET, SCH_SHEET_PIN, and SCH_SYMBOL.

Definition at line 207 of file sch_item.h.

207{ return true; }

Referenced by SCH_MOVE_TOOL::Main().

◆ IsMoving()

◆ IsNew()

◆ IsNull()

bool SCH_LINE::IsNull ( ) const
inline

Definition at line 136 of file sch_line.h.

136{ return m_start == m_end; }

References m_end, and m_start.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::simplifyWireList(), and StoreAngle().

◆ IsOrthogonal()

bool SCH_LINE::IsOrthogonal ( ) const
inline

Checks if line is orthogonal (to the grid).

Returns
True if orthogonal, false if not or the line is zero length.

Definition at line 134 of file sch_line.h.

134{ return Angle().IsCardinal(); }
bool IsCardinal() const
Definition: eda_angle.cpp:49
EDA_ANGLE Angle() const
Gets the angle between the start and end lines.
Definition: sch_line.h:105

References Angle(), and EDA_ANGLE::IsCardinal().

◆ IsParallel()

bool SCH_LINE::IsParallel ( const SCH_LINE aLine) const

Definition at line 427 of file sch_line.cpp.

428{
429 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
430 wxT( "Cannot test line segment for overlap." ) );
431
432 VECTOR2I firstSeg = m_end - m_start;
433 VECTOR2I secondSeg = aLine->m_end - aLine->m_start;
434
435 // Use long long here to avoid overflow in calculations
436 return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x );
437}

References m_end, m_start, SCH_LINE_T, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ IsPointClickableAnchor()

bool SCH_LINE::IsPointClickableAnchor ( const VECTOR2I aPos) const
inlineoverridevirtual
Returns
true if the given point can start drawing (usually means the anchor is unused/free/dangling).

Reimplemented from SCH_ITEM.

Definition at line 266 of file sch_line.h.

267 {
268 return ( GetStartPoint() == aPos && IsStartDangling() )
269 || ( GetEndPoint() == aPos && IsEndDangling() );
270 }
bool IsStartDangling() const
Definition: sch_line.h:242
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
bool IsEndDangling() const
Definition: sch_line.h:243

References GetEndPoint(), GetStartPoint(), IsEndDangling(), and IsStartDangling().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in LIB_TEXTBOX, SCH_FIELD, SCH_LABEL, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, and SCH_TEXTBOX.

Definition at line 422 of file eda_item.h.

422{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 109 of file eda_item.h.

109{ return m_flags & IS_RESIZING; }

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 112 of file eda_item.h.

113 {
114 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
115 }
#define IS_ROLLOVER
Rollover active. Used for hyperlink highlighting.

References IS_MOVING, IS_ROLLOVER, and EDA_ITEM::m_flags.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ return m_flags & SELECTED; }

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_TOOL::ChangeTextType(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), EDIT_TOOL::doMoveSelection(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_SCREEN::MarkConnections(), MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), KIGFX::SCH_PAINTER::nonCached(), SCH_MOVE_TOOL::orthoLineDrag(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), EE_SELECTION_TOOL::RebuildSelection(), PCB_SELECTION_TOOL::RebuildSelection(), RENDER_3D_OPENGL::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), GERBVIEW_SELECTION_TOOL::unselect(), HIERARCHY_NAVIG_PANEL::UpdateHierarchySelection(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem().

◆ IsShownAsBitmap()

bool EDA_ITEM::IsShownAsBitmap ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175{ return m_flags & IS_SHOWN_AS_BITMAP; }
#define IS_SHOWN_AS_BITMAP

References IS_SHOWN_AS_BITMAP, and EDA_ITEM::m_flags.

◆ IsStartDangling()

bool SCH_LINE::IsStartDangling ( ) const
inline

Definition at line 242 of file sch_line.h.

242{ return m_startIsDangling; }

References m_startIsDangling.

Referenced by KIGFX::SCH_PAINTER::draw(), and IsPointClickableAnchor().

◆ IsStrokeEquivalent()

bool SCH_LINE::IsStrokeEquivalent ( const SCH_LINE aLine)
inline

Definition at line 179 of file sch_line.h.

180 {
181 if( m_stroke.GetWidth() != aLine->GetStroke().GetWidth() )
182 return false;
183
184 if( m_stroke.GetColor() != aLine->GetStroke().GetColor() )
185 return false;
186
188 PLOT_DASH_TYPE style_b = aLine->GetStroke().GetPlotStyle();
189
190 return style_a == style_b
191 || ( style_a == PLOT_DASH_TYPE::DEFAULT && style_b == PLOT_DASH_TYPE::SOLID )
192 || ( style_a == PLOT_DASH_TYPE::SOLID && style_b == PLOT_DASH_TYPE::DEFAULT );
193 }
virtual STROKE_PARAMS GetStroke() const override
Definition: sch_line.h:176

References DEFAULT, STROKE_PARAMS::GetColor(), STROKE_PARAMS::GetPlotStyle(), GetStroke(), STROKE_PARAMS::GetWidth(), m_stroke, and SOLID.

◆ IsType()

bool SCH_LINE::IsType ( const std::vector< KICAD_T > &  aScanTypes) const
inlineoverridevirtual

Check whether the item is one of the listed types.

Parameters
aScanTypesList of item types
Returns
true if the item type is contained in the list aScanTypes

Reimplemented from SCH_ITEM.

Definition at line 72 of file sch_line.h.

73 {
74 if( SCH_ITEM::IsType( aScanTypes ) )
75 return true;
76
77 for( KICAD_T scanType : aScanTypes )
78 {
79 if( scanType == SCH_ITEM_LOCATE_WIRE_T && m_layer == LAYER_WIRE )
80 return true;
81
82 if ( scanType == SCH_ITEM_LOCATE_BUS_T && m_layer == LAYER_BUS )
83 return true;
84
86 return true;
87 }
88
89 return false;
90 }
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: sch_item.h:162
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ SCH_ITEM_LOCATE_WIRE_T
Definition: typeinfo.h:170
@ SCH_ITEM_LOCATE_BUS_T
Definition: typeinfo.h:171
@ SCH_ITEM_LOCATE_GRAPHIC_LINE_T
Definition: typeinfo.h:172

References SCH_ITEM::IsType(), LAYER_BUS, LAYER_NOTES, LAYER_WIRE, SCH_ITEM::m_layer, SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, and SCH_ITEM_LOCATE_WIRE_T.

Referenced by SCH_EDIT_FRAME::DeleteJunction().

◆ IsWire()

bool SCH_LINE::IsWire ( ) const

Return true if the line is a wire.

Returns
true if this line is on the wire layer.

Definition at line 925 of file sch_line.cpp.

926{
927 return ( GetLayer() == LAYER_WIRE );
928}

References SCH_ITEM::GetLayer(), and LAYER_WIRE.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), KIGFX::SCH_PAINTER::draw(), SCH_DRAWING_TOOLS::TwoClickPlace(), and UpdateDanglingState().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 106 of file eda_item.h.

106{ return m_flags & IS_WIRE_IMAGE; }

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::deque< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

This changes first parameter to avoid the DList and use the main queue instead.

Definition at line 304 of file eda_item.h.

306 {
307 for( const auto& it : aList )
308 {
309 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
310 testData,
311 scanTypes ) == INSPECT_RESULT::QUIT )
312 {
314 }
315 }
316
318 }
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes)
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

References CONTINUE, QUIT, and EDA_ITEM::Visit().

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

template<class T >
static INSPECT_RESULT EDA_ITEM::IterateForward ( std::vector< T > &  aList,
INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  scanTypes 
)
inlinestaticinherited

Change first parameter to avoid the DList and use std::vector instead.

Definition at line 324 of file eda_item.h.

326 {
327 for( const auto& it : aList )
328 {
329 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
330 testData,
331 scanTypes ) == INSPECT_RESULT::QUIT )
332 {
334 }
335 }
336
338 }

References CONTINUE, QUIT, and EDA_ITEM::Visit().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData 
) const
inlinevirtualinherited

Compare the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_MARKER, LIB_TEXTBOX, SCH_FIELD, SCH_LABEL_BASE, SCH_PIN, SCH_SHEET, SCH_SHEET_PIN, SCH_SYMBOL, SCH_TEXT, SCH_TEXTBOX, FP_TEXT, FP_TEXTBOX, NETINFO_ITEM, PCB_MARKER, PCB_TEXT, PCB_TEXTBOX, and ZONE.

Definition at line 384 of file eda_item.h.

385 {
386 return false;
387 }

Referenced by SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_EDITOR_CONTROL::HasMatch(), SCH_MARKER::Matches(), LIB_TEXTBOX::Matches(), SCH_FIELD::Matches(), SCH_LABEL_BASE::Matches(), SCH_PIN::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), SCH_TEXTBOX::Matches(), FP_TEXT::Matches(), FP_TEXTBOX::Matches(), NETINFO_ITEM::Matches(), PCB_MARKER::Matches(), PCB_TEXT::Matches(), PCB_TEXTBOX::Matches(), ZONE::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const EDA_SEARCH_DATA aSearchData 
) const
protectedinherited

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 117 of file eda_item.cpp.

118{
119 wxString text = aText;
120 wxString searchText = aSearchData.findString;
121
122 // Don't match if searching for replaceable item and the item doesn't support text replace.
123 if( aSearchData.searchAndReplace && !IsReplaceable() )
124 return false;
125
126 if( !aSearchData.matchCase )
127 {
128 text.MakeUpper();
129 searchText.MakeUpper();
130 }
131
133 {
134 int ii = 0;
135
136 while( ii < (int) text.length() )
137 {
138 int next = text.find( searchText, ii );
139
140 if( next == wxNOT_FOUND )
141 return false;
142
143 ii = next;
144 next += searchText.length();
145
146 bool startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
147 bool endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
148
149 if( startOK && endOK )
150 return true;
151 else
152 ii++;
153 }
154
155 return false;
156 }
157 else if( aSearchData.matchMode == EDA_SEARCH_MATCH_MODE::WILDCARD )
158 {
159 return text.Matches( searchText );
160 }
161 else
162 {
163 return text.Find( searchText ) != wxNOT_FOUND;
164 }
165}
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:422
CITER next(CITER it)
Definition: ptree.cpp:126
EDA_SEARCH_MATCH_MODE matchMode

References EDA_SEARCH_DATA::findString, EDA_ITEM::IsReplaceable(), EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::searchAndReplace, text, WHOLEWORD, and WILDCARD.

◆ MergeOverlap()

SCH_LINE * SCH_LINE::MergeOverlap ( SCH_SCREEN aScreen,
SCH_LINE aLine,
bool  aCheckJunctions 
)

Check line against aLine to see if it overlaps and merge if it does.

This method will return an equivalent of the union of line and aLine if the two lines overlap. This method is used to merge multiple line segments into a single line.

Parameters
aScreenis the current screen.
aLineis the line to compare.
aCheckJunctionsis used to indicate if we need to check for a junction if the two segments are colinear and touch.
Returns
New line that combines the two or NULL on non-overlapping segments.

Definition at line 440 of file sch_line.cpp.

441{
442 auto less =
443 []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool
444 {
445 if( lhs.x == rhs.x )
446 return lhs.y < rhs.y;
447
448 return lhs.x < rhs.x;
449 };
450
451 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, nullptr,
452 wxT( "Cannot test line segment for overlap." ) );
453
454 if( this == aLine || GetLayer() != aLine->GetLayer() )
455 return nullptr;
456
457 VECTOR2I leftmost_start = aLine->m_start;
458 VECTOR2I leftmost_end = aLine->m_end;
459
460 VECTOR2I rightmost_start = m_start;
461 VECTOR2I rightmost_end = m_end;
462
463 // We place the start to the left and below the end of both lines
464 if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
465 std::swap( leftmost_start, leftmost_end );
466 if( rightmost_start != std::min( { rightmost_start, rightmost_end }, less ) )
467 std::swap( rightmost_start, rightmost_end );
468
469 // - leftmost is the line that starts farthest to the left
470 // - other is the line that is _not_ leftmost
471 // - rightmost is the line that ends farthest to the right. This may or may not be 'other'
472 // as the second line may be completely covered by the first.
473 if( less( rightmost_start, leftmost_start ) )
474 {
475 std::swap( leftmost_start, rightmost_start );
476 std::swap( leftmost_end, rightmost_end );
477 }
478
479 VECTOR2I other_start = rightmost_start;
480 VECTOR2I other_end = rightmost_end;
481
482 if( less( rightmost_end, leftmost_end ) )
483 {
484 rightmost_start = leftmost_start;
485 rightmost_end = leftmost_end;
486 }
487
488 // If we end one before the beginning of the other, no overlap is possible
489 if( less( leftmost_end, other_start ) )
490 {
491 return nullptr;
492 }
493
494 // Search for a common end:
495 if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) ) // Trivial case
496 {
497 SCH_LINE* ret = new SCH_LINE( *aLine );
498 ret->SetStartPoint( leftmost_start );
499 ret->SetEndPoint( leftmost_end );
500 ret->SetConnectivityDirty( true );
501
502 if( IsSelected() || aLine->IsSelected() )
503 ret->SetSelected();
504
505 return ret;
506 }
507
508 bool colinear = false;
509
510 /* Test alignment: */
511 if( ( leftmost_start.y == leftmost_end.y ) &&
512 ( other_start.y == other_end.y ) ) // Horizontal segment
513 {
514 colinear = ( leftmost_start.y == other_start.y );
515 }
516 else if( ( leftmost_start.x == leftmost_end.x ) &&
517 ( other_start.x == other_end.x ) ) // Vertical segment
518 {
519 colinear = ( leftmost_start.x == other_start.x );
520 }
521 else
522 {
523 // We use long long here to avoid overflow -- it enforces promotion
524 // The slope of the left-most line is dy/dx. Then we check that the slope from the
525 // left most start to the right most start is the same as well as the slope from the
526 // left most start to right most end.
527 long long dx = leftmost_end.x - leftmost_start.x;
528 long long dy = leftmost_end.y - leftmost_start.y;
529 colinear = ( ( ( other_start.y - leftmost_start.y ) * dx ==
530 ( other_start.x - leftmost_start.x ) * dy ) &&
531 ( ( other_end.y - leftmost_start.y ) * dx ==
532 ( other_end.x - leftmost_start.x ) * dy ) );
533 }
534
535 if( !colinear )
536 return nullptr;
537
538 // We either have a true overlap or colinear touching segments. We always want to merge
539 // the former, but the later only get merged if there no junction at the touch point.
540
541 bool touching = leftmost_end == rightmost_start;
542
543 if( touching && aCheckJunctions && aScreen->IsJunction( leftmost_end ) )
544 return nullptr;
545
546 // Make a new segment that merges the 2 segments
547 leftmost_end = rightmost_end;
548
549 SCH_LINE* ret = new SCH_LINE( *aLine );
550 ret->SetStartPoint( leftmost_start );
551 ret->SetEndPoint( leftmost_end );
552 ret->SetConnectivityDirty( true );
553
554 if( IsSelected() || aLine->IsSelected() )
555 ret->SetSelected();
556
557 return ret;
558}
bool IsSelected() const
Definition: eda_item.h:107
void SetSelected()
Definition: eda_item.h:118
void SetStartPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:139
void SetEndPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:144
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:423

References SCH_ITEM::GetLayer(), SCH_SCREEN::IsJunction(), EDA_ITEM::IsSelected(), m_end, m_start, SCH_LINE(), SCH_LINE_T, SCH_ITEM::SetConnectivityDirty(), SetEndPoint(), EDA_ITEM::SetSelected(), SetStartPoint(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by SCH_EDIT_FRAME::DeleteJunction(), and SCH_LINE_WIRE_BUS_TOOL::simplifyWireList().

◆ MirrorHorizontally()

void SCH_LINE::MirrorHorizontally ( int  aCenter)
overridevirtual

Mirror item horizontally about aCenter.

Implements SCH_ITEM.

Definition at line 366 of file sch_line.cpp.

367{
368 if( m_flags & STARTPOINT )
369 MIRROR( m_start.x, aCenter );
370
371 if( m_flags & ENDPOINT )
372 MIRROR( m_end.x, aCenter );
373}
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40

References ENDPOINT, m_end, EDA_ITEM::m_flags, m_start, MIRROR(), STARTPOINT, and VECTOR2< T >::x.

◆ MirrorVertically()

void SCH_LINE::MirrorVertically ( int  aCenter)
overridevirtual

Mirror item vertically about aCenter.

Implements SCH_ITEM.

Definition at line 356 of file sch_line.cpp.

357{
358 if( m_flags & STARTPOINT )
359 MIRROR( m_start.y, aCenter );
360
361 if( m_flags & ENDPOINT )
362 MIRROR( m_end.y, aCenter );
363}

References ENDPOINT, m_end, EDA_ITEM::m_flags, m_start, MIRROR(), STARTPOINT, and VECTOR2< T >::y.

◆ Move()

void SCH_LINE::Move ( const VECTOR2I aMoveVector)
overridevirtual

Move the item by aMoveVector to a new position.

Implements SCH_ITEM.

Definition at line 134 of file sch_line.cpp.

135{
136 if( aOffset != VECTOR2I( 0, 0 ) )
137 {
138 m_start += aOffset;
139 m_end += aOffset;
140 SetModified();
141 }
142}
void SetModified()
Definition: eda_item.cpp:64

References m_end, m_start, and EDA_ITEM::SetModified().

◆ MoveEnd()

void SCH_LINE::MoveEnd ( const VECTOR2I aMoveVector)

Definition at line 155 of file sch_line.cpp.

156{
157 if( aOffset != VECTOR2I( 0, 0 ) )
158 {
159 m_end += aOffset;
160 SetModified();
161 }
162}

References m_end, and EDA_ITEM::SetModified().

Referenced by SCH_MOVE_TOOL::moveItem(), and SCH_MOVE_TOOL::orthoLineDrag().

◆ MoveStart()

void SCH_LINE::MoveStart ( const VECTOR2I aMoveVector)

Definition at line 145 of file sch_line.cpp.

146{
147 if( aOffset != VECTOR2I( 0, 0 ) )
148 {
149 m_start += aOffset;
150 SetModified();
151 }
152}

References m_start, and EDA_ITEM::SetModified().

Referenced by SCH_MOVE_TOOL::moveItem(), and SCH_MOVE_TOOL::orthoLineDrag().

◆ operator<() [1/2]

bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 231 of file eda_item.cpp.

232{
233 wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
234 GetClass() ) );
235
236 return false;
237}
virtual wxString GetClass() const =0
Return the class name.

References Format(), and EDA_ITEM::GetClass().

◆ operator<() [2/2]

bool SCH_LINE::operator< ( const SCH_ITEM aItem) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 741 of file sch_line.cpp.

742{
743 if( Type() != aItem.Type() )
744 return Type() < aItem.Type();
745
746 const SCH_LINE* line = static_cast<const SCH_LINE*>( &aItem );
747
748 if( GetLayer() != line->GetLayer() )
749 return GetLayer() < line->GetLayer();
750
751 if( GetStartPoint().x != line->GetStartPoint().x )
752 return GetStartPoint().x < line->GetStartPoint().x;
753
754 if( GetStartPoint().y != line->GetStartPoint().y )
755 return GetStartPoint().y < line->GetStartPoint().y;
756
757 if( GetEndPoint().x != line->GetEndPoint().x )
758 return GetEndPoint().x < line->GetEndPoint().x;
759
760 return GetEndPoint().y < line->GetEndPoint().y;
761}

References GetEndPoint(), SCH_ITEM::GetLayer(), GetStartPoint(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Plot()

void SCH_LINE::Plot ( PLOTTER aPlotter,
bool  aBackground 
) const
overridevirtual

Plot the schematic item to aPlotter.

Parameters
aPlotteris the PLOTTER object to plot to.
aBackgrounda poor-man's Z-order. The routine will get called twice, first with aBackground true and then with aBackground false.

Reimplemented from SCH_ITEM.

Definition at line 819 of file sch_line.cpp.

820{
821 if( aBackground )
822 return;
823
824 auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
825 int penWidth = std::max( GetPenWidth(), settings->GetMinPenWidth() );
827
828 if( color == COLOR4D::UNSPECIFIED )
829 color = settings->GetLayerColor( GetLayer() );
830
831 aPlotter->SetColor( color );
832
833 aPlotter->SetCurrentLineWidth( penWidth );
834 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
835
836 aPlotter->MoveTo( m_start );
837 aPlotter->FinishTo( m_end );
838
839 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
840
841 // Plot attributes to a hypertext menu
842 std::vector<wxString> properties;
843 BOX2I bbox = GetBoundingBox();
844 bbox.Inflate( GetPenWidth() * 3 );
845
846 if( GetLayer() == LAYER_WIRE )
847 {
848 if( SCH_CONNECTION* connection = Connection() )
849 {
850 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
851 _( "Net" ),
852 connection->Name() ) );
853
854 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
855 _( "Resolved netclass" ),
856 GetEffectiveNetClass()->GetName() ) );
857 }
858 }
859 else if( GetLayer() == LAYER_BUS )
860 {
861 if( SCH_CONNECTION* connection = Connection() )
862 {
863 for( std::shared_ptr<SCH_CONNECTION>& member : connection->Members() )
864 properties.emplace_back( wxT( "!" ) + member->Name() );
865 }
866
867 }
868
869 if( !properties.empty() )
870 aPlotter->HyperlinkMenu( bbox, properties );
871}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Store schematic specific render settings.
Definition: sch_painter.h:71
virtual void SetDash(int aLineWidth, PLOT_DASH_TYPE aLineStyle)=0
void MoveTo(const VECTOR2I &pos)
Definition: plotter.h:247
void FinishTo(const VECTOR2I &pos)
Definition: plotter.h:257
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:141
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void HyperlinkMenu(const BOX2I &aBox, const std::vector< wxString > &aDestURLs)
Create a clickable hyperlink menu with a rectangular click area.
Definition: plotter.h:446
virtual void SetColor(const COLOR4D &color)=0
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_line.cpp:191
COLOR4D GetLineColor() const
Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
Definition: sch_line.cpp:237

References _, color, SCH_ITEM::Connection(), PLOTTER::FinishTo(), Format(), GetBoundingBox(), GetEffectiveLineStyle(), SCH_ITEM::GetEffectiveNetClass(), SCH_ITEM::GetLayer(), GetLineColor(), GetPenWidth(), PLOTTER::HyperlinkMenu(), BOX2< Vec >::Inflate(), LAYER_BUS, LAYER_WIRE, m_end, m_start, PLOTTER::MoveTo(), PLOTTER::RenderSettings(), PLOTTER::SetColor(), PLOTTER::SetCurrentLineWidth(), PLOTTER::SetDash(), and SOLID.

◆ Print()

void SCH_LINE::Print ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
overridevirtual

Print a schematic item.

Each schematic item should have its own method

Parameters
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Implements SCH_ITEM.

Definition at line 326 of file sch_line.cpp.

327{
328 wxDC* DC = aSettings->GetPrintDC();
330
331 if( color == COLOR4D::UNSPECIFIED )
332 color = aSettings->GetLayerColor( GetLayer() );
333
334 VECTOR2I start = m_start;
335 VECTOR2I end = m_end;
337 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
338
339 if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
340 {
341 GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
342 }
343 else
344 {
345 SHAPE_SEGMENT segment( start, end );
346
347 STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
348 [&]( const VECTOR2I& a, const VECTOR2I& b )
349 {
350 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
351 } );
352 }
353}
int GetDefaultPenWidth() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
wxDC * GetPrintDC() const
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
void GRLine(wxDC *DC, int x1, int y1, int x2, int y2, int width, const COLOR4D &Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:162

References color, FIRST_TYPE, KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), GetEffectiveLineStyle(), SCH_ITEM::GetLayer(), KIGFX::RENDER_SETTINGS::GetLayerColor(), GetLineColor(), GetPenWidth(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GRLine(), m_end, m_start, STROKE_PARAMS::Stroke(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ PrintBackground()

virtual void SCH_ITEM::PrintBackground ( const RENDER_SETTINGS aSettings,
const VECTOR2I aOffset 
)
inlinevirtualinherited

Print the (optional) backaground elements if they exist.

Parameters
aSettingsPrint settings
aOffsetis the drawing offset (usually {0,0} but can be different when moving an object).

Reimplemented in SCH_SHAPE, and SCH_SYMBOL.

Definition at line 286 of file sch_item.h.

286{};

◆ RenderAsBitmap()

bool SCH_ITEM::RenderAsBitmap ( double  aWorldScale) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 294 of file sch_item.cpp.

295{
296 if( IsHypertext() )
297 return false;
298
299 if( const EDA_TEXT* text = dynamic_cast<const EDA_TEXT*>( this ) )
300 return text->GetTextHeight() * aWorldScale < BITMAP_FONT_SIZE_THRESHOLD;
301
302 return false;
303}
virtual bool IsHypertext() const
Allow items to support hypertext actions when hovered/clicked.
Definition: sch_item.h:239
#define BITMAP_FONT_SIZE_THRESHOLD
Definition: sch_item.cpp:46

References BITMAP_FONT_SIZE_THRESHOLD, SCH_ITEM::IsHypertext(), and text.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ Replace() [1/2]

virtual bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
void *  aAuxData = nullptr 
)
inlinevirtualinherited

Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in LIB_TEXTBOX, SCH_LABEL_BASE, SCH_PIN, SCH_TEXT, SCH_TEXTBOX, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 411 of file eda_item.h.

412 {
413 return false;
414 }

◆ Replace() [2/2]

bool EDA_ITEM::Replace ( const EDA_SEARCH_DATA aSearchData,
wxString &  aText 
)
staticinherited

Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 168 of file eda_item.cpp.

169{
170 wxString text = aText;
171 wxString searchText = aSearchData.findString;
172 wxString result;
173 bool replaced = false;
174
175 if( !aSearchData.matchCase )
176 {
177 text = text.Upper();
178 searchText = searchText.Upper();
179 }
180
181 int ii = 0;
182
183 while( ii < (int) text.length() )
184 {
185 int next = text.find( searchText, ii );
186
187 if( next == wxNOT_FOUND )
188 {
189 result += aText.Mid( ii, wxString::npos );
190 break;
191 }
192
193 if( next > ii )
194 result += aText.Mid( ii, next - ii );
195
196 ii = next;
197 next += searchText.length();
198
199 bool startOK;
200 bool endOK;
201
203 {
204 startOK = ( ii == 0 || !wxIsalnum( text.GetChar( ii - 1 ) ) );
205 endOK = ( next == (int) text.length() || !wxIsalnum( text.GetChar( next ) ) );
206 }
207 else
208 {
209 startOK = true;
210 endOK = true;
211 }
212
213 if( startOK && endOK )
214 {
215 result += aSearchData.replaceString;
216 replaced = true;
217 ii = next;
218 }
219 else
220 {
221 result += aText.GetChar( ii );
222 ii++;
223 }
224 }
225
226 aText = result;
227 return replaced;
228}
wxString replaceString

References EDA_SEARCH_DATA::findString, EDA_SEARCH_DATA::matchCase, EDA_SEARCH_DATA::matchMode, next(), EDA_SEARCH_DATA::replaceString, text, and WHOLEWORD.

Referenced by EDA_TEXT::Replace(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Rotate()

void SCH_LINE::Rotate ( const VECTOR2I aCenter)
overridevirtual

Rotate the item around aCenter 90 degrees in the clockwise direction.

Implements SCH_ITEM.

Definition at line 376 of file sch_line.cpp.

377{
378 // When we allow off grid items, the
379 // else if should become a plain if to allow
380 // rotation around the center of the line
381 if( m_flags & STARTPOINT )
382 RotatePoint( m_start, aCenter, ANGLE_90 );
383
384 else if( m_flags & ENDPOINT )
385 RotatePoint( m_end, aCenter, ANGLE_90 );
386}
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:414
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References ANGLE_90, ENDPOINT, m_end, EDA_ITEM::m_flags, m_start, RotatePoint(), and STARTPOINT.

◆ RotateEnd()

void SCH_LINE::RotateEnd ( const VECTOR2I aCenter)

Definition at line 395 of file sch_line.cpp.

396{
397 RotatePoint( m_end, aCenter, ANGLE_90 );
398}

References ANGLE_90, m_end, and RotatePoint().

Referenced by SCH_EDIT_TOOL::Rotate().

◆ RotateStart()

void SCH_LINE::RotateStart ( const VECTOR2I aCenter)

Definition at line 389 of file sch_line.cpp.

390{
391 RotatePoint( m_start, aCenter, ANGLE_90 );
392}

References ANGLE_90, m_start, and RotatePoint().

Referenced by SCH_EDIT_TOOL::Rotate().

◆ RunOnChildren()

virtual void SCH_ITEM::RunOnChildren ( const std::function< void(SCH_ITEM *)> &  aFunction)
inlinevirtualinherited

◆ Schematic()

SCHEMATIC * SCH_ITEM::Schematic ( ) const
inherited

Searches the item hierarchy to find a SCHEMATIC.

Every SCH_ITEM that lives on a SCH_SCREEN should be parented to either that screen or another SCH_ITEM on the same screen (for example, pins to their symbols).

Every SCH_SCREEN should be parented to the SCHEMATIC.

Note
This hierarchy is not the same as the sheet hierarchy!
Returns
the parent schematic this item lives on, or nullptr.

Definition at line 112 of file sch_item.cpp.

113{
114 EDA_ITEM* parent = GetParent();
115
116 while( parent )
117 {
118 if( parent->Type() == SCHEMATIC_T )
119 return static_cast<SCHEMATIC*>( parent );
120 else
121 parent = parent->GetParent();
122 }
123
124 return nullptr;
125}
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
@ SCHEMATIC_T
Definition: typeinfo.h:188

References EDA_ITEM::GetParent(), SCHEMATIC_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_TOOL::ChangeTextType(), SCH_ITEM::Connection(), SCH_DRAWING_TOOLS::createSheetPin(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), SCH_SHEET::findSelf(), SCH_MARKER::GetColorLayer(), SCH_ITEM::GetEffectiveNetClass(), SCH_JUNCTION::getEffectiveShape(), SCH_LABEL_BASE::GetIntersheetRefs(), SCH_LABEL_BASE::GetLabelBoxExpansion(), SCH_DIRECTIVE_LABEL::GetPenWidth(), GetPenWidth(), SCH_NO_CONNECT::GetPenWidth(), SCH_SHAPE::GetPenWidth(), SCH_SHEET::GetPenWidth(), SCH_SHEET_PIN::GetPenWidth(), SCH_SYMBOL::GetPins(), SCH_MARKER::GetSeverity(), SCH_FIELD::GetShownText(), SCH_LABEL_BASE::GetShownText(), SCH_TEXT::GetShownText(), SCH_TEXTBOX::GetShownText(), SCH_TEXT::GetTextOffset(), SCH_PIN::HitTest(), SCH_SHEET::IsRootSheet(), SCH_LABEL_BASE::IsType(), DIALOG_SYMBOL_PROPERTIES::OnAddField(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_TEXT_PROPERTIES::onScintillaCharAdded(), SCH_LABEL_BASE::ResolveTextVar(), SCH_GLOBALLABEL::ResolveTextVar(), SCH_SHEET::ResolveTextVar(), SCH_SYMBOL::ResolveTextVar(), SCH_SYMBOL::SetRef(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), and SCH_MARKER::ViewGetLayers().

◆ Set() [1/3]

template<typename T >
bool INSPECTABLE::Set ( const wxString &  aProperty,
aValue 
)
inlineinherited

Definition at line 66 of file inspectable.h.

67 {
69 TYPE_ID thisType = TYPE_HASH( *this );
70 PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71 void* object = nullptr;
72
73 if( prop )
74 {
75 object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76
77 if( object )
78 prop->set<T>( object, aValue );
79 }
80
81 return object != nullptr;
82 }
void set(void *aObject, T aValue)
Definition: property.h:275

References PROPERTY_MANAGER::GetProperty(), PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [2/3]

template<typename T >
bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
aValue 
)
inlineinherited

Definition at line 54 of file inspectable.h.

55 {
57 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
58
59 if( object )
60 aProperty->set<T>( object, aValue );
61
62 return object != nullptr;
63 }

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::set(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

◆ Set() [3/3]

bool INSPECTABLE::Set ( PROPERTY_BASE aProperty,
wxAny &  aValue 
)
inlineinherited

Definition at line 42 of file inspectable.h.

43 {
45 void* object = propMgr.TypeCast( this, TYPE_HASH( *this ), aProperty->OwnerHash() );
46
47 if( object )
48 aProperty->setter( object, aValue );
49
50 return object != nullptr;
51 }
virtual void setter(void *aObject, wxAny &aValue)=0

References PROPERTY_MANAGER::Instance(), PROPERTY_BASE::OwnerHash(), PROPERTY_BASE::setter(), TYPE_HASH, and PROPERTY_MANAGER::TypeCast().

Referenced by PCB_PROPERTIES_PANEL::valueChanged().

◆ SetBrightened()

◆ SetConnectivityDirty()

◆ SetEndPoint()

◆ SetFieldsAutoplaced()

void SCH_ITEM::SetFieldsAutoplaced ( )
inlineinherited

Definition at line 426 of file sch_item.h.

@ FIELDS_AUTOPLACED_AUTO
Definition: sch_item.h:57

References FIELDS_AUTOPLACED_AUTO, and SCH_ITEM::m_fieldsAutoplaced.

Referenced by SCH_SEXPR_PARSER::parseSchText().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 142 of file eda_item.h.

142{ m_flags |= aMask; }

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_ALTIUM_PLUGIN::AddTextBox(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildCourtyardCaches(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupShapes(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PAD_TOOL::explodePad(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_COLLECTOR::Inspect(), CONVERT_TOOL::makePolysFromChainedSegs(), CONVERT_TOOL::makePolysFromClosedGraphics(), CONVERT_TOOL::makePolysFromOpenGraphics(), SCH_SCREEN::MarkConnections(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), DIALOG_SYMBOL_PROPERTIES::OnUnitChoice(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_MOVE_TOOL::orthoLineDrag(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseHarnessPort(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLabel(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseSignalHarness(), SCH_ALTIUM_PLUGIN::ParseWire(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), SCH_SYMBOL::Plot(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), BOARD::Remove(), FOOTPRINT::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::SelectAll(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 201 of file eda_item.h.

201{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 167 of file eda_item.h.

168 {
169 if( aBitmap )
171 else
173 }

References EDA_ITEM::ClearFlags(), IS_SHOWN_AS_BITMAP, and EDA_ITEM::SetFlags().

◆ SetLastResolvedState()

void SCH_LINE::SetLastResolvedState ( const SCH_ITEM aItem)
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 146 of file sch_line.h.

147 {
148 const SCH_LINE* aLine = dynamic_cast<const SCH_LINE*>( aItem );
149
150 if( aLine )
151 {
155 }
156 }

References m_lastResolvedColor, m_lastResolvedLineStyle, and m_lastResolvedWidth.

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), and SCH_MOVE_TOOL::orthoLineDrag().

◆ SetLayer()

void SCH_ITEM::SetLayer ( SCH_LAYER_ID  aLayer)
inlineinherited

◆ SetLineColor() [1/2]

void SCH_LINE::SetLineColor ( const COLOR4D aColor)

◆ SetLineColor() [2/2]

void SCH_LINE::SetLineColor ( const double  r,
const double  g,
const double  b,
const double  a 
)

Definition at line 220 of file sch_line.cpp.

221{
222 COLOR4D newColor(r, g, b, a);
223
224 if( newColor == COLOR4D::UNSPECIFIED )
225 {
226 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
227 }
228 else
229 {
230 // Eeschema does not allow alpha channel in colors
231 newColor.a = 1.0;
232 m_stroke.SetColor( newColor );
233 }
234}
E_SERIE r
Definition: eserie.cpp:41

References KIGFX::COLOR4D::a, m_stroke, r, and STROKE_PARAMS::SetColor().

◆ SetLineStyle() [1/2]

void SCH_LINE::SetLineStyle ( const int  aStyleId)

Definition at line 250 of file sch_line.cpp.

251{
252 SetLineStyle( static_cast<PLOT_DASH_TYPE>( aStyleId ) );
253}
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
Definition: sch_line.cpp:256

References SetLineStyle().

◆ SetLineStyle() [2/2]

◆ SetLineWidth()

◆ SetLocked()

virtual void SCH_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Set the 'lock' status to aLocked for of this item.

Definition at line 234 of file sch_item.h.

234{}

◆ SetModified()

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL, and PCB_DIMENSION_BASE.

Definition at line 100 of file eda_item.h.

100{ m_parent = aParent; }

References EDA_ITEM::m_parent.

Referenced by BOARD::Add(), FOOTPRINT::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewFootprint(), SCH_SHEET::AddPin(), PAD::AddPrimitive(), PAD::AddPrimitiveAnnotationBox(), PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), SCH_DRAWING_TOOLS::createNewText(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), LIB_SYMBOL::Flatten(), FOOTPRINT::FOOTPRINT(), PCB_PLUGIN::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), CADSTAR_SCH_ARCHIVE_LOADER::getKiCadSchText(), LIB_SYMBOL::LIB_SYMBOL(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_SYMBOL::operator=(), FOOTPRINT::operator=(), PCB_PARSER::parseFOOTPRINT_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BACK_ANNOTATE::processNetNameChange(), BOARD_COMMIT::Push(), SCH_LIB_PLUGIN_CACHE::removeSymbol(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SaveCopyOfZones(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), PCB_DIMENSION_BASE::SetParent(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), SCH_LABEL_BASE::SwapData(), SCH_SHEET::SwapData(), SCH_SYMBOL::SwapData(), BOARD_ITEM::SwapItemData(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetPosition()

void SCH_LINE::SetPosition ( const VECTOR2I aPosition)
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 874 of file sch_line.cpp.

875{
876 m_end = m_end - ( m_start - aPosition );
877 m_start = aPosition;
878}

References m_end, and m_start.

◆ SetSelected()

◆ SetStartPoint()

◆ SetState()

void EDA_ITEM::SetState ( EDA_ITEM_FLAGS  type,
bool  state 
)
inlineinherited

Definition at line 131 of file eda_item.h.

132 {
133 if( state )
134 m_status |= type; // state = ON or OFF
135 else
136 m_status &= ~type;
137 }

References EDA_ITEM::m_status.

Referenced by LEGACY_PLUGIN::loadTrackList(), and TRACKS_CLEANER::mergeCollinearSegments().

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_status = aStatus; }

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetStoredPos()

void SCH_ITEM::SetStoredPos ( const VECTOR2I aPos)
inlineinherited

Definition at line 210 of file sch_item.h.

210{ m_storedPos = aPos; }

References SCH_ITEM::m_storedPos.

Referenced by SCH_MOVE_TOOL::Main().

◆ SetStroke()

virtual void SCH_LINE::SetStroke ( const STROKE_PARAMS aStroke)
inlineoverridevirtual

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 117 of file eda_item.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 440 of file eda_item.h.

440{ return *aLeft < *aRight; }

◆ StoreAngle() [1/2]

void SCH_LINE::StoreAngle ( )
inline

Saves the current line angle.

Useful when dragging a line and its important to be able to restart the line from length 0 in the correct direction.

Definition at line 114 of file sch_line.h.

115 {
116 if( !IsNull() )
118 }
bool IsNull() const
Definition: sch_line.h:136

References Angle(), IsNull(), and m_storedAngle.

Referenced by SCH_MOVE_TOOL::getConnectedDragItems(), and SCH_MOVE_TOOL::Main().

◆ StoreAngle() [2/2]

void SCH_LINE::StoreAngle ( const EDA_ANGLE aAngle)
inline

Definition at line 120 of file sch_line.h.

120{ m_storedAngle = aAngle; }

References m_storedAngle.

◆ SwapData()

void SCH_LINE::SwapData ( SCH_ITEM aItem)
overridevirtual

Swap the internal data structures aItem with the schematic item.

Obviously, aItem must have the same type than me.

Parameters
aItemThe item to swap the data structures with.

Reimplemented from SCH_ITEM.

Definition at line 796 of file sch_line.cpp.

797{
798 SCH_LINE* item = (SCH_LINE*) aItem;
799
800 std::swap( m_layer, item->m_layer );
801
802 std::swap( m_start, item->m_start );
803 std::swap( m_end, item->m_end );
804 std::swap( m_startIsDangling, item->m_startIsDangling );
805 std::swap( m_endIsDangling, item->m_endIsDangling );
806 std::swap( m_stroke, item->m_stroke );
807}

References m_end, m_endIsDangling, SCH_ITEM::m_layer, m_start, m_startIsDangling, and m_stroke.

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Returns the type of object.

This attribute should never be changed after a ctor sets it, so there is no public "setter" method.

Returns
the type of object.

Definition at line 97 of file eda_item.h.

97{ return m_structType; }
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:507

References EDA_ITEM::m_structType.

Referenced by CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), FOOTPRINT::Add(), CN_CLUSTER::Add(), KIGFX::PCB_VIEW::Add(), PCB_POINT_EDITOR::addCorner(), PCB_GROUP::AddItem(), CONNECTION_SUBGRAPH::AddItem(), DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), SCH_MOVE_TOOL::AlignElements(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), SCH_LABEL_BASE::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_LABEL_BASE::CanConnect(), CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_SHEET::CanConnect(), SCH_SYMBOL::CanConnect(), SCH_EDIT_TOOL::ChangeTextType(), KI_TEST::CheckFootprint(), KI_TEST::CheckFpPad(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpText(), KI_TEST::CheckFpZone(), CN_VISITOR::checkZoneItemConnection(), LIB_TEXTBOX::ClassOf(), SCH_BITMAP::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_FIELD::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_LABEL::ClassOf(), SCH_DIRECTIVE_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), ClassOf(), SCH_MARKER::ClassOf(), SCH_NO_CONNECT::ClassOf(), SCH_PIN::ClassOf(), SCH_SCREEN::ClassOf(), SCH_SHEET::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_SYMBOL::ClassOf(), SCH_TEXT::ClassOf(), SCH_TEXTBOX::ClassOf(), PCB_GROUP::ClassOf(), BOARD::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), FOOTPRINT::ClassOf(), FP_SHAPE::ClassOf(), FP_TEXT::ClassOf(), FP_TEXTBOX::ClassOf(), NETINFO_ITEM::ClassOf(), PAD::ClassOf(), PCB_BITMAP::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), PCB_DIM_RADIAL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), PCB_MARKER::ClassOf(), PCB_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), PCB_TEXT::ClassOf(), PCB_TEXTBOX::ClassOf(), PCB_TRACK::ClassOf(), PCB_ARC::ClassOf(), PCB_VIA::ClassOf(), ZONE::ClassOf(), CONNECTION_GRAPH::collectAllDriverValues(), collidesWithArea(), LIB_ITEM::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_TEXT::compare(), LIB_TEXTBOX::compare(), LIB_SYMBOL::Compare(), PCB_GRID_HELPER::computeAnchors(), EE_GRID_HELPER::computeAnchors(), TEARDROP_MANAGER::ComputePointsOnPadVia(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), BOARD_ADAPTER::createTrack(), DRC_TOOL::CrossProbe(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES(), BOARD_COMMIT::dirtyIntersectingZones(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), APPEARANCE_CONTROLS::doesBoardItemNeedRebuild(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextBoxProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusConflicts(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), DRC_ENGINE::EvalZoneConnection(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForFreePads(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_SELECTION_TOOL::FilterCollectorForMarkers(), PCB_SELECTION_TOOL::FindItem(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItems(), EDIT_TOOL::FootprintFilter(), PCB_PLUGIN::Format(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), SCH_LABEL_BASE::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), getClosestGroup(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_MOVE_TOOL::getConnectedItems(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), SCH_FIELD::GetDrawRotation(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), getFieldFunc(), getInferredSymbols(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), SCH_LABEL_BASE::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTION_SUBGRAPH::GetNetclassForDriver(), CONNECTIVITY_DATA::GetNetItems(), LIB_SYMBOL::GetNextDrawItem(), BOARD_ITEM::GetParentFootprint(), LIB_SYMBOL::GetPin(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), PCB_TRACK::GetSelectMenuText(), SCH_FIELD::GetShownText(), PCB_TEXT::GetShownText(), PCB_TEXTBOX::GetShownText(), CONVERT_TOOL::getStartEndPoints(), KIGFX::SCH_PAINTER::getTextThickness(), EDA_ITEM::GetTypeDesc(), PCB_EXPR_TYPE_REF::GetValue(), PCB_SELECTION_TOOL::grabUnconnected(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hasDrilledHole(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), SCH_FIELD::HitTest(), SCH_LABEL_BASE::HitTest(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRC_RTREE::Insert(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), CONNECTIVITY_DATA::IsConnectedOnLayer(), isCopper(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE_BASE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), isMaskAperture(), isNPTHPad(), PCB_TRACK::IsNull(), isNullAperture(), IsParallel(), isPlatedFunc(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), SCH_ITEM::IsType(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromChainedSegs(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), SCH_FIELD::Matches(), memberOfFunc(), MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), DIALOG_DRC::OnDRCItemSelected(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), CN_VISITOR::operator()(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), KI_TEST::kitest_cmp_drawings::operator()(), PCB_TRACK::cmp_tracks::operator()(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_BUS_ENTRY_BASE::operator<(), SCH_FIELD::operator<(), SCH_JUNCTION::operator<(), operator<(), SCH_SHEET::operator<(), SCH_SYMBOL::operator<(), SCH_TEXT::operator<(), SCH_TEXTBOX::operator<(), PCB_BITMAP::operator=(), SCH_BITMAP::operator=(), SCH_SYMBOL::operator=(), SCH_SHEET::operator=(), LIB_ITEM::operator==(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), SCH_SEXPR_PARSER::parseSchField(), SCH_EDITOR_CONTROL::Paste(), PCB_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_LABEL_BASE::Plot(), BRDITEMS_PLOTTER::PlotPcbGraphicItem(), SCH_FIELD::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), CONNECTION_GRAPH::processSubGraphs(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), BOARD_REANNOTATE_TOOL::ReannotateDuplicates(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshZoomDependentItems(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), FOOTPRINT::Remove(), EE_RTREE::remove(), SCH_SCREEN::Remove(), KIGFX::PCB_VIEW::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), SCH_EDITOR_CONTROL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), CONNECTION_GRAPH::resolveAllDrivers(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), SCH_LABEL_BASE::ResolveTextVar(), DS_PROXY_UNDO_ITEM::Restore(), BOARD_COMMIT::Revert(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), EE_TOOL_BASE< T >::saveCopyInUndoList(), PCB_BASE_EDIT_FRAME::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePin(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_ITEM::Schematic(), SCH_SCREEN::Schematic(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectUnconnected(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), BOARD_COMMIT::Stage(), PNS::LINE_PLACER::Start(), SCH_EDIT_TOOL::Swap(), PCB_GROUP::swapData(), FOOTPRINT::swapData(), PAD::swapData(), PCB_DIM_ALIGNED::swapData(), PCB_DIM_ORTHOGONAL::swapData(), PCB_DIM_RADIAL::swapData(), PCB_DIM_LEADER::swapData(), PCB_DIM_CENTER::swapData(), PCB_TARGET::swapData(), PCB_TEXT::swapData(), PCB_TEXTBOX::swapData(), PCB_TRACK::swapData(), PCB_ARC::swapData(), PCB_VIA::swapData(), ZONE::swapData(), PCB_BITMAP::swapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_SHEET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_SYMBOL::SwapData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZone(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_SOLDER_MASK::testMaskItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_TRACK::TransformShapeToPolygon(), SCH_LINE_WIRE_BUS_TOOL::TrimOverLappingWires(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_BASE_FRAME::UpdateItem(), PCB_CONTROL::UpdateMessagePanel(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), SCH_EDITOR_CONTROL::updatePastedSheet(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), PCB_GROUP::Visit(), SCH_SHEET::Visit(), GERBER_DRAW_ITEM::Visit(), PCB_TRACK::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ UpdateDanglingState()

bool SCH_LINE::UpdateDanglingState ( std::vector< DANGLING_END_ITEM > &  aItemList,
const SCH_SHEET_PATH aPath = nullptr 
)
overridevirtual

Test the schematic item to aItemList to check if it's dangling state has changed.

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.

If aSheet is passed a non-null pointer to a SCH_SHEET_PATH, the overridden method can optionally use it to update sheet-local connectivity information

Parameters
aItemListis the list of items to test item against.
aSheetis the sheet path to update connections for.
Returns
True if the dangling state has changed from it's current setting.

Reimplemented from SCH_ITEM.

Definition at line 571 of file sch_line.cpp.

573{
574 if( IsConnectable() )
575 {
576 bool previousStartState = m_startIsDangling;
577 bool previousEndState = m_endIsDangling;
578
580
581 for( DANGLING_END_ITEM item : aItemList )
582 {
583 if( item.GetItem() == this )
584 continue;
585
586 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
587 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
588 {
589 if( m_start == item.GetPosition() )
590 m_startIsDangling = false;
591
592 if( m_end == item.GetPosition() )
593 m_endIsDangling = false;
594
596 break;
597 }
598 }
599
600 // We only use the bus dangling state for automatic line starting, so we don't care if it
601 // has changed or not (and returning true will result in extra work)
602 if( IsBus() )
603 return false;
604
605 return previousStartState != m_startIsDangling || previousEndState != m_endIsDangling;
606 }
607
608 return false;
609}
Helper class used to store the state of schematic items that can be connected to other schematic item...
Definition: sch_item.h:82
bool IsWire() const
Return true if the line is a wire.
Definition: sch_line.cpp:925
@ PIN_END
Definition: sch_item.h:68
@ BUS_ENTRY_END
Definition: sch_item.h:70

References BUS_END, BUS_ENTRY_END, IsBus(), IsConnectable(), IsWire(), m_end, m_endIsDangling, m_start, m_startIsDangling, PIN_END, and WIRE_END.

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

◆ ViewDraw()

virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Draw the parts of the object belonging to layer aLayer.

An alternative way for drawing objects if there is no #PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.

Reimplemented in DS_PROXY_VIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, EDIT_POINTS, RATSNEST_VIEW_ITEM, ROUTER_PREVIEW_ITEM, MY_DRAWING, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::VIEW_GROUP, and KIGFX::VIEW_OVERLAY.

Definition at line 106 of file view_item.h.

107 {}

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

◆ ViewGetLayers()

void SCH_LINE::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtual

Return the layers the item is drawn on (which may be more than its "home" layer)

Reimplemented from SCH_ITEM.

Definition at line 182 of file sch_line.cpp.

183{
184 aCount = 3;
185 aLayers[0] = LAYER_DANGLING;
186 aLayers[1] = m_layer;
187 aLayers[2] = LAYER_SELECTION_SHADOWS;
188}
@ LAYER_DANGLING
Definition: layer_ids.h:368
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381

References LAYER_DANGLING, LAYER_SELECTION_SHADOWS, and SCH_ITEM::m_layer.

◆ ViewGetLOD()

virtual double KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Return the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayeris the current drawing layer.
aViewis a pointer to the VIEW device we are drawing on.
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in GERBER_DRAW_ITEM, PCB_GROUP, FOOTPRINT, FP_SHAPE, FP_TEXT, FP_TEXTBOX, PAD, PCB_BITMAP, PCB_SHAPE, PCB_TEXT, PCB_TEXTBOX, PCB_TRACK, PCB_VIA, ZONE, and FP_ZONE.

Definition at line 132 of file view_item.h.

133 {
134 // By default always show the item
135 return 0.0;
136 }

Referenced by PNS_KICAD_IFACE::IsItemVisible(), KIGFX::VIEW::DRAW_ITEM_VISITOR::operator()(), EE_GRID_HELPER::queryVisible(), and PCB_GRID_HELPER::queryVisible().

◆ viewPrivData()

◆ Visit()

INSPECT_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const std::vector< KICAD_T > &  aScanTypes 
)
virtualinherited

May be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in aScanTypes, and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
aScanTypesWhich KICAD_T types are of interest and the order in which they should be processed.
Returns
#SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

Reimplemented in PCB_GROUP, LIB_SYMBOL, SCH_SHEET, SCH_SYMBOL, GBR_LAYOUT, GERBER_DRAW_ITEM, GERBER_FILE_IMAGE, FOOTPRINT, PCB_TRACK, SCH_LABEL_BASE, and BOARD.

Definition at line 91 of file eda_item.cpp.

93{
94#if 0 && defined(DEBUG)
95 std::cout << GetClass().mb_str() << ' ';
96#endif
97
98 if( IsType( aScanTypes ) )
99 {
100 if( INSPECT_RESULT::QUIT == inspector( this, testData ) )
102 }
103
105}
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183

References CONTINUE, EDA_ITEM::GetClass(), EDA_ITEM::IsType(), and QUIT.

Referenced by PCB_TYPE_COLLECTOR::Collect(), PCB_LAYER_COLLECTOR::Collect(), GENERAL_COLLECTOR::Collect(), GERBER_COLLECTOR::Collect(), and EDA_ITEM::IterateForward().

Member Data Documentation

◆ m_connected_items

std::map<SCH_SHEET_PATH, SCH_ITEM_SET, SHEET_PATH_CMP> SCH_ITEM::m_connected_items
protectedinherited

Store pointers to other items that are connected to this one, per sheet.

Definition at line 498 of file sch_item.h.

Referenced by SCH_ITEM::AddConnectionTo(), SCH_ITEM::ConnectedItems(), and SCH_LABEL_BASE::IsType().

◆ m_connection_map

std::unordered_map<SCH_SHEET_PATH, SCH_CONNECTION*> SCH_ITEM::m_connection_map
protectedinherited

Store connectivity information, per sheet.

Definition at line 501 of file sch_item.h.

Referenced by SCH_ITEM::Connection(), SCH_ITEM::InitializeConnection(), and SCH_ITEM::~SCH_ITEM().

◆ m_connections

EDA_ITEMS SCH_ITEM::m_connections
protectedinherited

Definition at line 492 of file sch_item.h.

Referenced by SCH_ITEM::ClearConnections(), and SCH_ITEM::~SCH_ITEM().

◆ m_connectivity_dirty

bool SCH_ITEM::m_connectivity_dirty
protectedinherited

◆ m_end

◆ m_endIsDangling

bool SCH_LINE::m_endIsDangling
private

True if end point is not connected.

Definition at line 323 of file sch_line.h.

Referenced by IsDangling(), IsEndDangling(), SCH_LINE(), SwapData(), and UpdateDanglingState().

◆ m_fieldsAutoplaced

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_lastResolvedColor

COLOR4D SCH_LINE::m_lastResolvedColor
mutableprivate

Definition at line 334 of file sch_line.h.

Referenced by GetLineColor(), SCH_LINE(), SetLastResolvedState(), and SetLineColor().

◆ m_lastResolvedLineStyle

PLOT_DASH_TYPE SCH_LINE::m_lastResolvedLineStyle
mutableprivate

Definition at line 332 of file sch_line.h.

Referenced by GetEffectiveLineStyle(), SCH_LINE(), SetLastResolvedState(), and SetLineStyle().

◆ m_lastResolvedWidth

int SCH_LINE::m_lastResolvedWidth
mutableprivate

Definition at line 333 of file sch_line.h.

Referenced by GetPenWidth(), SCH_LINE(), SetLastResolvedState(), and SetLineWidth().

◆ m_layer

◆ m_parent

◆ m_start

◆ m_startIsDangling

bool SCH_LINE::m_startIsDangling
private

True if start point is not connected.

Definition at line 322 of file sch_line.h.

Referenced by IsDangling(), IsStartDangling(), SCH_LINE(), SwapData(), and UpdateDanglingState().

◆ m_status

◆ m_storedAngle

EDA_ANGLE SCH_LINE::m_storedAngle
private

Stored angle.

Definition at line 326 of file sch_line.h.

Referenced by GetStoredAngle(), and StoreAngle().

◆ m_storedPos

VECTOR2I SCH_ITEM::m_storedPos
protectedinherited

Definition at line 494 of file sch_item.h.

Referenced by SCH_ITEM::GetStoredPos(), and SCH_ITEM::SetStoredPos().

◆ m_stroke

◆ m_structType

KICAD_T EDA_ITEM::m_structType
privateinherited

Run time identification, keep private so it can never be changed after a ctor sets it.

See comment near SetType() regarding virtual functions.

Definition at line 507 of file eda_item.h.

Referenced by EDA_ITEM::IsType(), EDA_ITEM::operator=(), and EDA_ITEM::Type().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 494 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), SCH_SHEET::AddInstance(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), KI_TEST::CheckFpPad(), KI_TEST::CheckFpShape(), KI_TEST::CheckFpText(), KI_TEST::CheckFpZone(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::CreateScreens(), ZONE_FILLER_TOOL::DirtyZone(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), FOOTPRINT::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), SCH_SHEET_LIST::FillItemMap(), BOARD::FillItemMap(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_PLUGIN::format(), SCH_SEXPR_PLUGIN::Format(), SCH_PIN::GetDefaultNetName(), BOARD::GetItem(), SCH_SHEET_LIST::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), SCH_SHEET::getPageNumber(), FP_SHAPE::GetParentAsString(), FP_TEXT::GetParentAsString(), FP_TEXTBOX::GetParentAsString(), PAD::GetParentAsString(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::GetValue(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), ZONE::HigherPriority(), SCH_SHEET_PATH::IsContainedWithin(), SCH_ALTIUM_PLUGIN::Load(), SCH_EAGLE_PLUGIN::Load(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), SCH_LEGACY_PLUGIN::loadHierarchy(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), BOARD_ITEM::ptr_cmp::operator()(), BOARD::cmp_items::operator()(), BOARD::cmp_drawings::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), FOOTPRINT::cmp_pads::operator()(), PCB_TRACK::cmp_tracks::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), FIELDS_EDITOR_GRID_DATA_MODEL::RemoveColumn(), SCH_SYMBOL::RemoveInstance(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveShape(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveTextBox(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), SCH_SHEET::setPageNumber(), FIELDS_EDITOR_GRID_DATA_MODEL::SetValue(), SCH_DRAWING_TOOLS::SingleClickPlace(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_EDITOR_CONTROL::updatePastedSymbol(), SCH_SHEET_LIST::UpdateSymbolInstanceData(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ m_viewPrivData

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
privateinherited

◆ PenStyle

enum wxPenStyle SCH_LINE::PenStyle[]
static

Definition at line 42 of file sch_line.h.


The documentation for this class was generated from the following files: