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...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. 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...
 
SCH_LINEBreakAt (const VECTOR2I &aPoint)
 Break this segment into two at the specified point. 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 GetItemDescription (UNITS_PROVIDER *aUnitsProvider) const override
 Return a user-visible description string of this item. 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...
 
const wxString & GetOperatingPoint () const
 
void SetOperatingPoint (const wxString &aText)
 
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 IsSelected () const
 
bool IsEntered () const
 
bool IsBrightened () const
 
bool IsRollover () const
 
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 XorFlags (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...
 
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
 
wxString m_operatingPoint
 
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:342
COLOR4D m_lastResolvedColor
Definition: sch_line.h:354
VECTOR2I m_start
Line start point.
Definition: sch_line.h:344
int m_lastResolvedWidth
Definition: sch_line.h:353
VECTOR2I m_end
Line end point.
Definition: sch_line.h:345
PLOT_DASH_TYPE m_lastResolvedLineStyle
Definition: sch_line.h:352
STROKE_PARAMS m_stroke
Line stroke properties.
Definition: sch_line.h:347
bool m_endIsDangling
True if end point is not connected.
Definition: sch_line.h:343
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:590

◆ 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 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

◆ BreakAt()

SCH_LINE * SCH_LINE::BreakAt ( const VECTOR2I aPoint)

Break this segment into two at the specified point.

Note
No checks are made to verify if aPoint is contained within the segment. That is the responsibility of the caller.
It is the responsibility of the caller to add the newly created segment to the screen.
Parameters
aPointPoint at which to break the segment
Returns
The newly created segment.

Definition at line 592 of file sch_line.cpp.

593{
594 SCH_LINE* newSegment = static_cast<SCH_LINE*>( Duplicate() );
595
596 newSegment->SetStartPoint( aPoint );
597 newSegment->SetConnectivityDirty( true );
598 SetEndPoint( aPoint );
599
600 return newSegment;
601}
void SetConnectivityDirty(bool aDirty=true)
Definition: sch_item.h:415
SCH_ITEM * Duplicate(bool doClone=false) const
Routine to create a new copy of given item.
Definition: sch_item.cpp:93
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:40
void SetStartPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:139
void SetEndPoint(const VECTOR2I &aPosition)
Definition: sch_line.h:144

References SCH_ITEM::Duplicate(), SCH_ITEM::SetConnectivityDirty(), SetEndPoint(), and SetStartPoint().

Referenced by SCH_EDIT_FRAME::BreakSegment(), and SCHEMATIC::FixupJunctions().

◆ CanConnect()

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

Reimplemented from SCH_ITEM.

Definition at line 664 of file sch_line.cpp.

665{
666 if( m_layer == LAYER_WIRE )
667 {
668 switch( aItem->Type() )
669 {
670 case SCH_JUNCTION_T:
671 case SCH_NO_CONNECT_T:
672 case SCH_LABEL_T:
674 case SCH_HIER_LABEL_T:
677 case SCH_SYMBOL_T:
678 case SCH_SHEET_T:
679 case SCH_SHEET_PIN_T:
680 return true;
681 default:
682 break;
683 }
684 }
685 else if( m_layer == LAYER_BUS )
686 {
687 switch( aItem->Type() )
688 {
689 case SCH_JUNCTION_T:
690 case SCH_LABEL_T:
692 case SCH_HIER_LABEL_T:
695 case SCH_SHEET_T:
696 case SCH_SHEET_PIN_T:
697 return true;
698 default:
699 break;
700 }
701 }
702
703 return aItem->GetLayer() == m_layer;
704}
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 119 of file eda_item.h.

void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
#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 141 of file eda_item.h.

141{ m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:498

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), SCH_EDIT_TOOL::BreakWire(), 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(), BOARD_COMMIT::dirtyIntersectingZones(), 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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetIsShownAsBitmap(), BOARD_COMMIT::Stage(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), SCH_DRAWING_TOOLS::TwoClickPlace(), and EE_SELECTION_TOOL::unhighlight().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 153 of file eda_item.h.

154 {
156 }
#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 SKIP_STRUCT
flag indicating that the structure should be ignored
#define CANDIDATE
flag indicating that the structure is connected

References CANDIDATE, EDA_ITEM::ClearFlags(), 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 133 of file sch_line.cpp.

134{
135 return new SCH_LINE( *this );
136}

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:122
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 713 of file sch_line.cpp.

714{
715 switch( aItem->Type() )
716 {
717 case SCH_LINE_T:
718 return IsBus() == static_cast<const SCH_LINE*>( aItem )->IsBus();
719
720 default:
721 return true;
722 }
723}
bool IsBus() const
Return true if the line is a bus.
Definition: sch_line.cpp:974

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 853 of file sch_line.cpp.

854{
855 if( m_layer != LAYER_WIRE && m_layer != LAYER_BUS )
856 return false;
857
858 return IsEndPoint( aPosition );
859}
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:492
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 BreakAt(), 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 101 of file sch_line.cpp.

104{
105 for ( auto connected : line->ConnectedItems( aSheet ) )
106 {
107 if( connected->Type() == SCH_LINE_T )
108 {
109 if( std::find(checkedLines.begin(), checkedLines.end(), connected ) == checkedLines.end() )
110 {
111 SCH_LINE* connectedLine = static_cast<SCH_LINE*>( connected );
112 checkedLines.push_back( connectedLine );
113
114 wxString netName = FindWireSegmentNetNameRecursive( connectedLine, checkedLines,
115 aSheet );
116
117 if( !netName.IsEmpty() )
118 return netName;
119 }
120 }
121 else if( connected->Type() == SCH_LABEL_T
122 || connected->Type() == SCH_GLOBAL_LABEL_T
123 || connected->Type() == SCH_DIRECTIVE_LABEL_T)
124 {
125 return static_cast<SCH_TEXT*>( connected )->GetText();
126 }
127
128 }
129 return "";
130}
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:101
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:101

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:352
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:74
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:76
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:63
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:46

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(), PROPERTIES_PANEL::getItemValue(), 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 432 of file sch_line.cpp.

433{
434 VECTOR2I vec;
435
436 if( aPoint == m_start )
437 vec = m_end - aPoint;
438 else
439 vec = m_start - aPoint;
440
441 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
442}
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 222 of file sch_line.cpp.

223{
224 int width = GetPenWidth() / 2;
225
226 int xmin = std::min( m_start.x, m_end.x ) - width;
227 int ymin = std::min( m_start.y, m_end.y ) - width;
228
229 int xmax = std::max( m_start.x, m_end.x ) + width + 1;
230 int ymax = std::max( m_start.y, m_end.y ) + width + 1;
231
232 BOX2I ret( VECTOR2I( xmin, ymin ), VECTOR2I( xmax - xmin, ymax - ymin ) );
233
234 return ret;
235}
int GetPenWidth() const override
Definition: sch_line.cpp:323

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 707 of file sch_line.cpp.

708{
709 return { m_start, m_end };
710}

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 145 of file eda_item.h.

146 {
147 constexpr int mask =
149
150 return m_flags & mask;
151 }
#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_BROKEN
Is a segment just broken by BreakSegment.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_MOVING
Item being moved.

References IS_BROKEN, IS_CHANGED, IS_MOVING, IS_NEW, IS_PASTED, 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 303 of file sch_line.cpp.

304{
307 else if( !IsConnectable() )
309 else if( !IsConnectivityDirty() )
311
313}
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:655
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 604 of file sch_line.cpp.

605{
606 if( IsConnectable() )
607 {
608 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_start );
609 aItemList.emplace_back( IsBus() ? BUS_END : WIRE_END, this, m_end );
610 }
611}
@ 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(), and SCH_SEXPR_PLUGIN::saveText().

◆ 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 256 of file eda_item.h.

256{ return GetPosition(); }
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:249

References EDA_ITEM::GetPosition().

Referenced by SCH_EDIT_FRAME::FocusOnItem().

◆ GetFriendlyName()

wxString EDA_ITEM::GetFriendlyName ( ) const
virtualinherited

Reimplemented in PCB_SHAPE, PCB_TRACK, 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::rebuildProperties().

◆ GetItemDescription()

wxString SCH_LINE::GetItemDescription ( UNITS_PROVIDER aUnitsProvider) const
overridevirtual

Return a user-visible description string of this item.

This description is used in disambiguation menus, the message panel, ERC/DRC reports, etc.

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 736 of file sch_line.cpp.

737{
738 wxString txtfmt;
739
740 if( m_start.x == m_end.x )
741 {
742 switch( m_layer )
743 {
744 case LAYER_WIRE: txtfmt = _( "Vertical Wire, length %s" ); break;
745 case LAYER_BUS: txtfmt = _( "Vertical Bus, length %s" ); break;
746 default: txtfmt = _( "Vertical Graphic Line, length %s" ); break;
747 }
748 }
749 else if( m_start.y == m_end.y )
750 {
751 switch( m_layer )
752 {
753 case LAYER_WIRE: txtfmt = _( "Horizontal Wire, length %s" ); break;
754 case LAYER_BUS: txtfmt = _( "Horizontal Bus, length %s" ); break;
755 default: txtfmt = _( "Horizontal Graphic Line, length %s" ); break;
756 }
757 }
758 else
759 {
760 switch( m_layer )
761 {
762 case LAYER_WIRE: txtfmt = _( "Wire, length %s" ); break;
763 case LAYER_BUS: txtfmt = _( "Bus, length %s" ); break;
764 default: txtfmt = _( "Graphic Line, length %s" ); break;
765 }
766 }
767
768 return wxString::Format( txtfmt,
769 aUnitsProvider->MessageTextFromValue( EuclideanNorm( m_start - m_end ) ) );
770}
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define _(s)
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.

◆ GetLayer()

◆ GetLength()

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

Definition at line 238 of file sch_line.cpp.

239{
240 return GetLineLength( m_start, m_end );
241}
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(), and SCH_EDIT_FRAME::RefreshOperatingPointDisplay().

◆ GetLineColor()

COLOR4D SCH_LINE::GetLineColor ( ) const

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

Definition at line 268 of file sch_line.cpp.

269{
270 if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
272 else if( !IsConnectable() )
273 m_lastResolvedColor = COLOR4D::UNSPECIFIED;
274 else if( !IsConnectivityDirty() )
275 m_lastResolvedColor = GetEffectiveNetClass()->GetSchematicColor();
276
277 return m_lastResolvedColor;
278}
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 196 of file sch_line.h.

196{ 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 294 of file sch_line.cpp.

295{
297 return m_stroke.GetPlotStyle();
298
300}

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 773 of file sch_line.cpp.

774{
775 if( m_layer == LAYER_NOTES )
777 else if( m_layer == LAYER_WIRE )
778 return BITMAPS::add_line;
779
780 return BITMAPS::add_bus;
781}
@ 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 KIGFX::SCH_PAINTER::draw(), and 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 924 of file sch_line.cpp.

925{
926 wxString msg;
927
928 switch( GetLayer() )
929 {
930 case LAYER_WIRE: msg = _( "Wire" ); break;
931 case LAYER_BUS: msg = _( "Bus" ); break;
932 default: msg = _( "Graphical" ); break;
933 }
934
935 aList.emplace_back( _( "Line Type" ), msg );
936
937 PLOT_DASH_TYPE lineStyle = GetLineStyle();
938
939 if( GetEffectiveLineStyle() != lineStyle )
940 aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
941 else
942 m_stroke.GetMsgPanelInfo( aFrame, aList, true, false );
943
944 SCH_CONNECTION* conn = nullptr;
945
946 if( !IsConnectivityDirty() && dynamic_cast<SCH_EDIT_FRAME*>( aFrame ) )
947 conn = Connection();
948
949 if( conn )
950 {
951 conn->AppendInfoToMsgPanel( aList );
952
953 if( !conn->IsBus() )
954 {
955 aList.emplace_back( _( "Resolved Netclass" ),
956 UnescapeString( GetEffectiveNetClass()->GetName() ) );
957 }
958 }
959}
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:294
PLOT_DASH_TYPE GetEffectiveLineStyle() const
Definition: sch_line.cpp:303
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
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 93 of file sch_line.cpp.

94{
95 std::list<const SCH_LINE *> checkedLines;
96 checkedLines.push_back(this);
97 return FindWireSegmentNetNameRecursive( this, checkedLines, aSheet );
98}

References FindWireSegmentNetNameRecursive().

Referenced by SCH_DRAWING_TOOLS::TwoClickPlace().

◆ GetOperatingPoint()

const wxString & SCH_LINE::GetOperatingPoint ( ) const
inline

Definition at line 300 of file sch_line.h.

300{ return m_operatingPoint; }

References m_operatingPoint.

Referenced by KIGFX::SCH_PAINTER::draw(), and SCH_EDIT_FRAME::RefreshOperatingPointDisplay().

◆ 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

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 323 of file sch_line.cpp.

324{
325 SCHEMATIC* schematic = Schematic();
326
327 switch ( m_layer )
328 {
329 default:
330 if( m_stroke.GetWidth() > 0 )
331 return m_stroke.GetWidth();
332
333 if( schematic )
334 return schematic->Settings().m_DefaultLineWidth;
335
337
338 case LAYER_WIRE:
339 if( m_stroke.GetWidth() > 0 )
341 else if( !IsConnectivityDirty() )
342 m_lastResolvedWidth = GetEffectiveNetClass()->GetWireWidth();
343
344 return m_lastResolvedWidth;
345
346 case LAYER_BUS:
347 if( m_stroke.GetWidth() > 0 )
349 else if( !IsConnectivityDirty() )
350 m_lastResolvedWidth = GetEffectiveNetClass()->GetBusWidth();
351
352 return m_lastResolvedWidth;
353 }
354}
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:205

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 279 of file sch_line.h.

279{ return m_start; }

References m_start.

◆ GetReverseAngleFrom()

int SCH_LINE::GetReverseAngleFrom ( const VECTOR2I aPoint) const

Definition at line 445 of file sch_line.cpp.

446{
447 VECTOR2I vec;
448
449 if( aPoint == m_end )
450 vec = m_start - aPoint;
451 else
452 vec = m_end - aPoint;
453
454 return KiROUND( EDA_ANGLE( vec ).AsDegrees() );
455}

References KiROUND(), m_end, and m_start.

◆ GetSelectedPoints()

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

Definition at line 726 of file sch_line.cpp.

727{
728 if( m_flags & STARTPOINT )
729 aPoints.push_back( m_start );
730
731 if( m_flags & ENDPOINT )
732 aPoints.push_back( m_end );
733}
#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.

◆ 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 281 of file sch_line.h.

281{ 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 123 of file eda_item.h.

124 {
125 return m_status & type;
126 }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:495

References EDA_ITEM::m_status.

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 136 of file eda_item.h.

136{ 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:346

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:623

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 176 of file sch_line.h.

176{ 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 822 of file sch_line.cpp.

823{
825 return false;
826
827 BOX2I rect = aRect;
828
829 if ( aAccuracy )
830 rect.Inflate( aAccuracy );
831
832 if( aContained )
833 return rect.Contains( m_start ) && rect.Contains( m_end );
834
835 return rect.Intersects( m_start, m_end );
836}
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 807 of file sch_line.cpp.

808{
809 // Performance enhancement for connection-building
810 if( aPosition == m_start || aPosition == m_end )
811 return true;
812
813 if( aAccuracy >= 0 )
814 aAccuracy += GetPenWidth() / 2;
815 else
816 aAccuracy = abs( aAccuracy );
817
818 return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
819}
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418
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(), SCH_MOVE_TOOL::getConnectedItems(), and EE_SELECTION_TOOL::selectMultiple().

◆ 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 974 of file sch_line.cpp.

975{
976 return ( GetLayer() == LAYER_BUS );
977}

References SCH_ITEM::GetLayer(), and LAYER_BUS.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), EE_SELECTION_TOOL::autostartEvent(), ConnectionPropagatesTo(), SCH_MOVE_TOOL::getConnectedDragItems(), 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 655 of file sch_line.cpp.

656{
657 if( m_layer == LAYER_WIRE || m_layer == LAYER_BUS )
658 return true;
659
660 return false;
661}

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 261 of file sch_line.h.

References m_endIsDangling, and m_startIsDangling.

◆ IsEndDangling()

bool SCH_LINE::IsEndDangling ( ) const
inline

◆ 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::DeleteJunction(), doIsConnected(), and SCH_SCREEN::GetBusesAndWires().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 107 of file eda_item.h.

107{ 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 201 of file eda_item.h.

201{ return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:497

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 962 of file sch_line.cpp.

963{
964 return ( GetLayer() == LAYER_NOTES );
965}

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 458 of file sch_line.cpp.

459{
460 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, false,
461 wxT( "Cannot test line segment for overlap." ) );
462
463 VECTOR2I firstSeg = m_end - m_start;
464 VECTOR2I secondSeg = aLine->m_end - aLine->m_start;
465
466 // Use long long here to avoid overflow in calculations
467 return !( (long long) firstSeg.x * secondSeg.y - (long long) firstSeg.y * secondSeg.x );
468}

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 283 of file sch_line.h.

284 {
285 return ( GetStartPoint() == aPos && IsStartDangling() )
286 || ( GetEndPoint() == aPos && IsEndDangling() );
287 }
bool IsStartDangling() const
Definition: sch_line.h:259
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
bool IsEndDangling() const
Definition: sch_line.h:260

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 420 of file eda_item.h.

420{ return false; }

Referenced by EDA_ITEM::Matches().

◆ IsRollover()

bool EDA_ITEM::IsRollover ( ) const
inlineinherited

Definition at line 110 of file eda_item.h.

111 {
112 return ( m_flags & ( IS_ROLLOVER | IS_MOVING ) ) == IS_ROLLOVER;
113 }
#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 106 of file eda_item.h.

106{ 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(), RENDER_3D_OPENGL::get3dModelsFromFootprint(), 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(), SCH_FIND_REPLACE_TOOL::ReplaceAll(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< T >::saveCopyInUndoList(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), SCH_FIND_REPLACE_TOOL::UpdateFind(), HIERARCHY_PANE::UpdateHierarchySelection(), PCB_BASE_FRAME::UpdateUserUnits(), 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 173 of file eda_item.h.

173{ 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

◆ IsStrokeEquivalent()

bool SCH_LINE::IsStrokeEquivalent ( const SCH_LINE aLine)
inline

Definition at line 180 of file sch_line.h.

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

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 968 of file sch_line.cpp.

969{
970 return ( GetLayer() == LAYER_WIRE );
971}

References SCH_ITEM::GetLayer(), and LAYER_WIRE.

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

◆ 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 302 of file eda_item.h.

304 {
305 for( const auto& it : aList )
306 {
307 if( static_cast<EDA_ITEM*>( it )->Visit( inspector,
308 testData,
309 scanTypes ) == INSPECT_RESULT::QUIT )
310 {
312 }
313 }
314
316 }
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 322 of file eda_item.h.

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

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 382 of file eda_item.h.

383 {
384 return false;
385 }

Referenced by SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_FIND_REPLACE_TOOL::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_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_FIND_REPLACE_TOOL::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:420
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 471 of file sch_line.cpp.

472{
473 auto less =
474 []( const VECTOR2I& lhs, const VECTOR2I& rhs ) -> bool
475 {
476 if( lhs.x == rhs.x )
477 return lhs.y < rhs.y;
478
479 return lhs.x < rhs.x;
480 };
481
482 wxCHECK_MSG( aLine != nullptr && aLine->Type() == SCH_LINE_T, nullptr,
483 wxT( "Cannot test line segment for overlap." ) );
484
485 if( this == aLine || GetLayer() != aLine->GetLayer() )
486 return nullptr;
487
488 VECTOR2I leftmost_start = aLine->m_start;
489 VECTOR2I leftmost_end = aLine->m_end;
490
491 VECTOR2I rightmost_start = m_start;
492 VECTOR2I rightmost_end = m_end;
493
494 // We place the start to the left and below the end of both lines
495 if( leftmost_start != std::min( { leftmost_start, leftmost_end }, less ) )
496 std::swap( leftmost_start, leftmost_end );
497 if( rightmost_start != std::min( { rightmost_start, rightmost_end }, less ) )
498 std::swap( rightmost_start, rightmost_end );
499
500 // - leftmost is the line that starts farthest to the left
501 // - other is the line that is _not_ leftmost
502 // - rightmost is the line that ends farthest to the right. This may or may not be 'other'
503 // as the second line may be completely covered by the first.
504 if( less( rightmost_start, leftmost_start ) )
505 {
506 std::swap( leftmost_start, rightmost_start );
507 std::swap( leftmost_end, rightmost_end );
508 }
509
510 VECTOR2I other_start = rightmost_start;
511 VECTOR2I other_end = rightmost_end;
512
513 if( less( rightmost_end, leftmost_end ) )
514 {
515 rightmost_start = leftmost_start;
516 rightmost_end = leftmost_end;
517 }
518
519 // If we end one before the beginning of the other, no overlap is possible
520 if( less( leftmost_end, other_start ) )
521 {
522 return nullptr;
523 }
524
525 // Search for a common end:
526 if( ( leftmost_start == other_start ) && ( leftmost_end == other_end ) ) // Trivial case
527 {
528 SCH_LINE* ret = new SCH_LINE( *aLine );
529 ret->SetStartPoint( leftmost_start );
530 ret->SetEndPoint( leftmost_end );
531 ret->SetConnectivityDirty( true );
532
533 if( IsSelected() || aLine->IsSelected() )
534 ret->SetSelected();
535
536 return ret;
537 }
538
539 bool colinear = false;
540
541 /* Test alignment: */
542 if( ( leftmost_start.y == leftmost_end.y ) &&
543 ( other_start.y == other_end.y ) ) // Horizontal segment
544 {
545 colinear = ( leftmost_start.y == other_start.y );
546 }
547 else if( ( leftmost_start.x == leftmost_end.x ) &&
548 ( other_start.x == other_end.x ) ) // Vertical segment
549 {
550 colinear = ( leftmost_start.x == other_start.x );
551 }
552 else
553 {
554 // We use long long here to avoid overflow -- it enforces promotion
555 // The slope of the left-most line is dy/dx. Then we check that the slope from the
556 // left most start to the right most start is the same as well as the slope from the
557 // left most start to right most end.
558 long long dx = leftmost_end.x - leftmost_start.x;
559 long long dy = leftmost_end.y - leftmost_start.y;
560 colinear = ( ( ( other_start.y - leftmost_start.y ) * dx ==
561 ( other_start.x - leftmost_start.x ) * dy ) &&
562 ( ( other_end.y - leftmost_start.y ) * dx ==
563 ( other_end.x - leftmost_start.x ) * dy ) );
564 }
565
566 if( !colinear )
567 return nullptr;
568
569 // We either have a true overlap or colinear touching segments. We always want to merge
570 // the former, but the later only get merged if there no junction at the touch point.
571
572 bool touching = leftmost_end == rightmost_start;
573
574 if( touching && aCheckJunctions && aScreen->IsJunction( leftmost_end ) )
575 return nullptr;
576
577 // Make a new segment that merges the 2 segments
578 leftmost_end = rightmost_end;
579
580 SCH_LINE* ret = new SCH_LINE( *aLine );
581 ret->SetStartPoint( leftmost_start );
582 ret->SetEndPoint( leftmost_end );
583 ret->SetConnectivityDirty( true );
584
585 if( IsSelected() || aLine->IsSelected() )
586 ret->SetSelected();
587
588 return ret;
589}
bool IsSelected() const
Definition: eda_item.h:106
void SetSelected()
Definition: eda_item.h:115
bool IsJunction(const VECTOR2I &aPosition) const
Test if a junction is required for the items at aPosition on the screen.
Definition: sch_screen.cpp:458

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 397 of file sch_line.cpp.

398{
399 if( m_flags & STARTPOINT )
400 MIRROR( m_start.x, aCenter );
401
402 if( m_flags & ENDPOINT )
403 MIRROR( m_end.x, aCenter );
404}
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 387 of file sch_line.cpp.

388{
389 if( m_flags & STARTPOINT )
390 MIRROR( m_start.y, aCenter );
391
392 if( m_flags & ENDPOINT )
393 MIRROR( m_end.y, aCenter );
394}

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 139 of file sch_line.cpp.

140{
141 if( aOffset != VECTOR2I( 0, 0 ) )
142 {
143 m_start += aOffset;
144 m_end += aOffset;
145 SetModified();
146 }
147}
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 160 of file sch_line.cpp.

161{
162 if( aOffset != VECTOR2I( 0, 0 ) )
163 {
164 m_end += aOffset;
165 SetModified();
166 }
167}

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 150 of file sch_line.cpp.

151{
152 if( aOffset != VECTOR2I( 0, 0 ) )
153 {
154 m_start += aOffset;
155 SetModified();
156 }
157}

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 784 of file sch_line.cpp.

785{
786 if( Type() != aItem.Type() )
787 return Type() < aItem.Type();
788
789 const SCH_LINE* line = static_cast<const SCH_LINE*>( &aItem );
790
791 if( GetLayer() != line->GetLayer() )
792 return GetLayer() < line->GetLayer();
793
794 if( GetStartPoint().x != line->GetStartPoint().x )
795 return GetStartPoint().x < line->GetStartPoint().x;
796
797 if( GetStartPoint().y != line->GetStartPoint().y )
798 return GetStartPoint().y < line->GetStartPoint().y;
799
800 if( GetEndPoint().x != line->GetEndPoint().x )
801 return GetEndPoint().x < line->GetEndPoint().x;
802
803 return GetEndPoint().y < line->GetEndPoint().y;
804}

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 862 of file sch_line.cpp.

863{
864 if( aBackground )
865 return;
866
867 auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
868 int penWidth = std::max( GetPenWidth(), settings->GetMinPenWidth() );
870
871 if( color == COLOR4D::UNSPECIFIED )
872 color = settings->GetLayerColor( GetLayer() );
873
874 aPlotter->SetColor( color );
875
876 aPlotter->SetCurrentLineWidth( penWidth );
877 aPlotter->SetDash( penWidth, GetEffectiveLineStyle() );
878
879 aPlotter->MoveTo( m_start );
880 aPlotter->FinishTo( m_end );
881
882 aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
883
884 // Plot attributes to a hypertext menu
885 std::vector<wxString> properties;
886 BOX2I bbox = GetBoundingBox();
887 bbox.Inflate( GetPenWidth() * 3 );
888
889 if( GetLayer() == LAYER_WIRE )
890 {
891 if( SCH_CONNECTION* connection = Connection() )
892 {
893 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
894 _( "Net" ),
895 connection->Name() ) );
896
897 properties.emplace_back( wxString::Format( wxT( "!%s = %s" ),
898 _( "Resolved netclass" ),
899 GetEffectiveNetClass()->GetName() ) );
900 }
901 }
902 else if( GetLayer() == LAYER_BUS )
903 {
904 if( SCH_CONNECTION* connection = Connection() )
905 {
906 for( std::shared_ptr<SCH_CONNECTION>& member : connection->Members() )
907 properties.emplace_back( wxT( "!" ) + member->Name() );
908 }
909
910 }
911
912 if( !properties.empty() )
913 aPlotter->HyperlinkMenu( bbox, properties );
914}
int color
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
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:466
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:222
COLOR4D GetLineColor() const
Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line.
Definition: sch_line.cpp:268

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 357 of file sch_line.cpp.

358{
359 wxDC* DC = aSettings->GetPrintDC();
361
362 if( color == COLOR4D::UNSPECIFIED )
363 color = aSettings->GetLayerColor( GetLayer() );
364
365 VECTOR2I start = m_start;
366 VECTOR2I end = m_end;
368 int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
369
370 if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
371 {
372 GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
373 }
374 else
375 {
376 SHAPE_SEGMENT segment( start, end );
377
378 STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
379 [&]( const VECTOR2I& a, const VECTOR2I& b )
380 {
381 GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
382 } );
383 }
384}
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:171

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 409 of file eda_item.h.

410 {
411 return false;
412 }

◆ 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_FIND_REPLACE_TOOL::ReplaceAll(), and SCH_FIND_REPLACE_TOOL::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 407 of file sch_line.cpp.

408{
409 // When we allow off grid items, the
410 // else if should become a plain if to allow
411 // rotation around the center of the line
412 if( m_flags & STARTPOINT )
413 RotatePoint( m_start, aCenter, ANGLE_90 );
414
415 else if( m_flags & ENDPOINT )
416 RotatePoint( m_end, aCenter, ANGLE_90 );
417}
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431
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 426 of file sch_line.cpp.

427{
428 RotatePoint( m_end, aCenter, ANGLE_90 );
429}

References ANGLE_90, m_end, and RotatePoint().

Referenced by SCH_EDIT_TOOL::Rotate().

◆ RotateStart()

void SCH_LINE::RotateStart ( const VECTOR2I aCenter)

Definition at line 420 of file sch_line.cpp.

421{
422 RotatePoint( m_start, aCenter, ANGLE_90 );
423}

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 EE_SELECTION_TOOL::autostartEvent(), 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_SHEET::GetContextualTextVars(), 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_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:325

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 139 of file eda_item.h.

139{ 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(), SCH_EDIT_FRAME::BreakSegment(), SCH_EDIT_TOOL::BreakWire(), 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(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), 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(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetIsShownAsBitmap(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), SCH_DRAWING_TOOLS::SingleClickPlace(), BOARD_COMMIT::Stage(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_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 199 of file eda_item.h.

199{ m_forceVisible = aEnable; }

References EDA_ITEM::m_forceVisible.

Referenced by SCH_FIND_REPLACE_TOOL::FindNext(), and SCH_FIND_REPLACE_TOOL::UpdateFind().

◆ SetIsShownAsBitmap()

void EDA_ITEM::SetIsShownAsBitmap ( bool  aBitmap)
inlineinherited

Definition at line 165 of file eda_item.h.

166 {
167 if( aBitmap )
169 else
171 }

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 {
152 m_stroke = aLine->GetStroke();
156 }
157 }

References GetStroke(), m_lastResolvedColor, m_lastResolvedLineStyle, m_lastResolvedWidth, and m_stroke.

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

◆ SetLayer()

◆ 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 251 of file sch_line.cpp.

252{
253 COLOR4D newColor(r, g, b, a);
254
255 if( newColor == COLOR4D::UNSPECIFIED )
256 {
257 m_stroke.SetColor( COLOR4D::UNSPECIFIED );
258 }
259 else
260 {
261 // Eeschema does not allow alpha channel in colors
262 newColor.a = 1.0;
263 m_stroke.SetColor( newColor );
264 }
265}

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

◆ SetLineStyle() [1/2]

void SCH_LINE::SetLineStyle ( const int  aStyleId)

Definition at line 281 of file sch_line.cpp.

282{
283 SetLineStyle( static_cast<PLOT_DASH_TYPE>( aStyleId ) );
284}
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
Definition: sch_line.cpp:287

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()

◆ SetOperatingPoint()

void SCH_LINE::SetOperatingPoint ( const wxString &  aText)
inline

Definition at line 301 of file sch_line.h.

301{ m_operatingPoint = aText; }

References m_operatingPoint.

Referenced by SCH_EDIT_FRAME::RefreshOperatingPointDisplay().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in LIB_SYMBOL.

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_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), PCBNEW_JOBS_HANDLER::doFpExportSvg(), 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(), KI_TEST::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(), CLIPBOARD_IO::SaveSelection(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_SYMBOL::SetFields(), 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 917 of file sch_line.cpp.

918{
919 m_end = m_end - ( m_start - aPosition );
920 m_start = aPosition;
921}

References m_end, and m_start.

◆ SetSelected()

◆ SetStartPoint()

◆ SetState()

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

Definition at line 128 of file eda_item.h.

129 {
130 if( state )
131 m_status |= type; // state = ON or OFF
132 else
133 m_status &= ~type;
134 }

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 137 of file eda_item.h.

137{ 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

◆ 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 438 of file eda_item.h.

438{ 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 839 of file sch_line.cpp.

840{
841 SCH_LINE* item = (SCH_LINE*) aItem;
842
843 std::swap( m_layer, item->m_layer );
844
845 std::swap( m_start, item->m_start );
846 std::swap( m_end, item->m_end );
847 std::swap( m_startIsDangling, item->m_startIsDangling );
848 std::swap( m_endIsDangling, item->m_endIsDangling );
849 std::swap( m_stroke, item->m_stroke );
850}

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:505

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(), 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::CheckFpShape(), 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(), EXPORTER_STEP::composePCB(), 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(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), 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(), PCB_TRACK::GetFriendlyName(), getInferredSymbols(), PCB_TRACK::GetItemDescription(), 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(), SCH_SCREEN::GetNeededJunctions(), CONNECTION_SUBGRAPH::GetNetclassForDriver(), CONNECTIVITY_DATA::GetNetItems(), BOARD_ITEM::GetParentFootprint(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), SCH_FIELD::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(), 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(), 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_FIND_REPLACE_TOOL::ReplaceAll(), PCB_SELECTION_TOOL::RequestSelection(), CONNECTION_GRAPH::resolveAllDrivers(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), SCH_LABEL_BASE::ResolveTextVar(), BOARD::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::selectMultiple(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectUnconnected(), PCB_EDIT_FRAME::SetActiveLayer(), 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(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), 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(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ 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 614 of file sch_line.cpp.

616{
617 if( IsConnectable() )
618 {
619 bool previousStartState = m_startIsDangling;
620 bool previousEndState = m_endIsDangling;
621
623
624 for( DANGLING_END_ITEM item : aItemList )
625 {
626 if( item.GetItem() == this )
627 continue;
628
629 if( ( IsWire() && item.GetType() != BUS_END && item.GetType() != BUS_ENTRY_END )
630 || ( IsBus() && item.GetType() != WIRE_END && item.GetType() != PIN_END ) )
631 {
632 if( m_start == item.GetPosition() )
633 m_startIsDangling = false;
634
635 if( m_end == item.GetPosition() )
636 m_endIsDangling = false;
637
639 break;
640 }
641 }
642
643 // We only use the bus dangling state for automatic line starting, so we don't care if it
644 // has changed or not (and returning true will result in extra work)
645 if( IsBus() )
646 return false;
647
648 return previousStartState != m_startIsDangling || previousEndState != m_endIsDangling;
649 }
650
651 return false;
652}
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:968
@ 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 187 of file sch_line.cpp.

188{
189 aCount = 4;
190 aLayers[0] = LAYER_DANGLING;
191 aLayers[1] = m_layer;
192 aLayers[2] = LAYER_SELECTION_SHADOWS;
193 aLayers[3] = LAYER_OP_VOLTAGES;
194}
@ LAYER_DANGLING
Definition: layer_ids.h:368
@ LAYER_SELECTION_SHADOWS
Definition: layer_ids.h:381
@ LAYER_OP_VOLTAGES
Definition: layer_ids.h:387

References LAYER_DANGLING, LAYER_OP_VOLTAGES, LAYER_SELECTION_SHADOWS, and SCH_ITEM::m_layer.

◆ ViewGetLOD()

double SCH_LINE::ViewGetLOD ( int  aLayer,
KIGFX::VIEW aView 
) const
overridevirtual

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 from KIGFX::VIEW_ITEM.

Definition at line 197 of file sch_line.cpp.

198{
199 constexpr double HIDE = std::numeric_limits<double>::max();
200 constexpr double SHOW = 0.0;
201
202 if( aLayer == LAYER_OP_VOLTAGES )
203 {
204 if( m_start == m_end )
205 return HIDE;
206
207 int height = std::abs( m_end.y - m_start.y );
208 int width = std::abs( m_end.x - m_start.x );
209
210 // Operating points will be shown only if zoom is appropriate
211 if( height == 0 )
212 return (double) schIUScale.mmToIU( 15 ) / width;
213 else
214 return (double) schIUScale.mmToIU( 5 ) / height;
215 }
216
217 // Other layers are always drawn.
218 return SHOW;
219}
constexpr int mmToIU(double mm) const
Definition: base_units.h:89

References std::abs(), LAYER_OP_VOLTAGES, m_end, m_start, EDA_IU_SCALE::mmToIU(), schIUScale, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ 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:181

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(), EDA_ITEM::IterateForward(), and PCB_BASE_FRAME::UpdateUserUnits().

◆ XorFlags()

void EDA_ITEM::XorFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 140 of file eda_item.h.

140{ m_flags ^= aMask; }

References EDA_ITEM::m_flags.

Referenced by EE_SELECTION_TOOL::selectMultiple().

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 343 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 354 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 352 of file sch_line.h.

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

◆ m_lastResolvedWidth

int SCH_LINE::m_lastResolvedWidth
mutableprivate

Definition at line 353 of file sch_line.h.

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

◆ m_layer

◆ m_operatingPoint

wxString SCH_LINE::m_operatingPoint
private

Definition at line 356 of file sch_line.h.

Referenced by GetOperatingPoint(), SCH_LINE(), and SetOperatingPoint().

◆ m_parent

◆ m_start

◆ m_startIsDangling

bool SCH_LINE::m_startIsDangling
private

True if start point is not connected.

Definition at line 342 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 346 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 505 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 492 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(), 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(), SCH_SHEET_PATH::GetItem(), BOARD::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(), SCH_EDIT_FRAME::LoadSheetFromFile(), 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(), PCB_VIA::PCB_VIA(), SCH_EDIT_FRAME::RecalculateConnections(), 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_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: