KiCad PCB EDA Suite
LIB_ARC Class Reference

#include <lib_arc.h>

Inheritance diagram for LIB_ARC:
LIB_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Types

enum  LIB_CONVERT : int { BASE = 1, DEMORGAN = 2 }
 
enum  COMPARE_FLAGS : int { NORMAL = 0x00, UNIT = 0x01 }
 The list of flags used by the compare function. More...
 

Public Member Functions

 LIB_ARC (LIB_SYMBOL *aParent)
 
 ~LIB_ARC ()
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetTypeName () const override
 Provide a user-consumable name of the object type. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. 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...
 
int GetPenWidth () const override
 
void BeginEdit (const wxPoint &aStartPoint) override
 Begin drawing a symbol library draw item at aPosition. More...
 
void CalcEdit (const wxPoint &aPosition) override
 Calculate the attributes of an item at aPosition when it is being edited. More...
 
void SetEditState (int aState)
 
void Offset (const wxPoint &aOffset) override
 Set the drawing object by aOffset from the current position. More...
 
void MoveTo (const wxPoint &aPosition) override
 Move a draw object to aPosition. More...
 
wxPoint GetPosition () const override
 
void MirrorHorizontal (const wxPoint &aCenter) override
 Mirror the draw object along the horizontal (X) axis about aCenter point. More...
 
void MirrorVertical (const wxPoint &aCenter) override
 Mirror the draw object along the MirrorVertical (Y) axis about aCenter point. More...
 
void Rotate (const wxPoint &aCenter, bool aRotateCCW=true) override
 Rotate the object about aCenter point. More...
 
void Plot (PLOTTER *aPlotter, const wxPoint &aOffset, bool aFill, const TRANSFORM &aTransform) const override
 Plot the draw item using the plot object. More...
 
int GetWidth () const override
 
void SetWidth (int aWidth) override
 
void SetRadius (int aRadius)
 
int GetRadius () const
 
void SetFirstRadiusAngle (int aAngle)
 
int GetFirstRadiusAngle () const
 
void SetSecondRadiusAngle (int aAngle)
 
int GetSecondRadiusAngle () const
 
wxPoint GetStart () const
 
void SetStart (const wxPoint &aPoint)
 
wxPoint GetEnd () const
 
void SetEnd (const wxPoint &aPoint)
 
VECTOR2I CalcMidPoint () const
 Calculate the arc mid point using the arc start and end angles and radius length. More...
 
void CalcEndPoints ()
 Calculate the start and end points using the center point and the two angles. More...
 
void CalcRadiusAngles ()
 Calculate the radius and angle of an arc using the start, end, and center points. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
virtual bool ContinueEdit (const wxPoint &aPosition)
 Continue an edit in progress at aPosition. More...
 
virtual void EndEdit ()
 End an object editing action. More...
 
virtual void Print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform)
 Draw an item. More...
 
virtual int GetEffectivePenWidth (const RENDER_SETTINGS *aSettings) const
 
LIB_SYMBOLGetParent () const
 
void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
bool operator== (const LIB_ITEM &aOther) const
 Test LIB_ITEM objects for equivalence. More...
 
bool operator== (const LIB_ITEM *aOther) const
 
bool operator< (const LIB_ITEM &aOther) const
 Test if another draw item is less than this draw object. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
void SetPosition (const wxPoint &aPosition) override
 
bool IsFillable () const
 Check if draw object can be filled. More...
 
void SetUnit (int aUnit)
 
int GetUnit () const
 
void SetConvert (int aConvert)
 
int GetConvert () const
 
void SetFillMode (FILL_TYPE aFillMode)
 
FILL_TYPE GetFillMode () const
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (EDA_ITEM_FLAGS type) const
 
void SetState (EDA_ITEM_FLAGS type, bool state)
 
EDA_ITEM_FLAGS GetStatus () const
 
void SetStatus (EDA_ITEM_FLAGS aStatus)
 
void SetFlags (EDA_ITEM_FLAGS aMask)
 
void ClearFlags (EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
EDA_ITEM_FLAGS GetFlags () const
 
bool HasFlag (EDA_ITEM_FLAGS aFlag) const
 
EDA_ITEM_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Check whether the item is one of the listed types. More...
 
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 const wxPoint GetFocusPosition () const
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
virtual const BOX2I ViewBBox () const override
 Return the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Draw the parts of the object belonging to layer aLayer. More...
 
virtual double ViewGetLOD (int aLayer, VIEW *aView) const
 Return the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &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
 

Protected Member Functions

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

Protected Attributes

int m_unit
 Unit identification for multiple parts per package. More...
 
int m_convert
 Shape identification for alternate body styles. More...
 
FILL_TYPE m_fill
 The body fill type. More...
 
bool m_isFillable
 
EDA_ITEM_FLAGS m_status
 
EDA_ITEMm_parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
EDA_ITEM_FLAGS m_flags
 

Private Types

enum  SELECT_T { ARC_STATUS_START, ARC_STATUS_END, ARC_STATUS_OUTLINE }
 

Private Member Functions

void print (const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform) override
 Print the item to aDC. More...
 
int compare (const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const override
 Provide the draw object specific comparison called by the == and < operators. More...
 

Private Attributes

int m_Radius
 
int m_t1
 
int m_t2
 
wxPoint m_ArcStart
 
wxPoint m_ArcEnd
 
wxPoint m_Pos
 
int m_Width
 
int m_editState
 

Detailed Description

Definition at line 35 of file lib_arc.h.

Member Enumeration Documentation

◆ COMPARE_FLAGS

enum LIB_ITEM::COMPARE_FLAGS : int
inherited

The list of flags used by the compare function.

  • NORMAL This compares everything between two LIB_ITEM objects.
  • UNIT This compare flag ignores unit and convert and pin number information when comparing LIB_ITEM objects for unit comparison.
Enumerator
NORMAL 
UNIT 

Definition at line 81 of file lib_item.h.

81 : int { NORMAL = 0x00, UNIT = 0x01 };

◆ LIB_CONVERT

enum LIB_ITEM::LIB_CONVERT : int
inherited
Enumerator
BASE 
DEMORGAN 

Definition at line 72 of file lib_item.h.

72 : int { BASE = 1, DEMORGAN = 2 };

◆ SELECT_T

enum LIB_ARC::SELECT_T
private
Enumerator
ARC_STATUS_START 
ARC_STATUS_END 
ARC_STATUS_OUTLINE 

Definition at line 141 of file lib_arc.h.

Constructor & Destructor Documentation

◆ LIB_ARC()

LIB_ARC::LIB_ARC ( LIB_SYMBOL aParent)

Definition at line 47 of file lib_arc.cpp.

47  : LIB_ITEM( LIB_ARC_T, aParent )
48 {
49  m_Radius = 0;
50  m_t1 = 0;
51  m_t2 = 0;
52  m_Width = 0;
54  m_isFillable = true;
55  m_editState = 0;
56 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
FILL_TYPE m_fill
The body fill type.
Definition: lib_item.h:339
bool m_isFillable
Definition: lib_item.h:340
int m_editState
Definition: lib_arc.h:155
LIB_ITEM(KICAD_T aType, LIB_SYMBOL *aSymbol=nullptr, int aUnit=0, int aConvert=0, FILL_TYPE aFillType=FILL_TYPE::NO_FILL)
Definition: lib_item.cpp:35
int m_Width
Definition: lib_arc.h:154

References m_editState, LIB_ITEM::m_fill, LIB_ITEM::m_isFillable, m_Radius, m_t1, m_t2, m_Width, and NO_FILL.

Referenced by Clone().

◆ ~LIB_ARC()

LIB_ARC::~LIB_ARC ( )
inline

Definition at line 42 of file lib_arc.h.

42 { }

Member Function Documentation

◆ BeginEdit()

void LIB_ARC::BeginEdit ( const wxPoint &  aPosition)
overridevirtual

Begin drawing a symbol library draw item at aPosition.

It typically would be called on a left click when a draw tool is selected in the symbol library editor and one of the graphics tools is selected.

Parameters
aPositionThe position in drawing coordinates where the drawing was started. May or may not be required depending on the item being drawn.

Reimplemented from LIB_ITEM.

Definition at line 420 of file lib_arc.cpp.

421 {
422  m_ArcStart = m_ArcEnd = aPosition;
423  m_editState = 1;
424 }
wxPoint m_ArcEnd
Definition: lib_arc.h:152
int m_editState
Definition: lib_arc.h:155
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, and m_editState.

◆ CalcEdit()

void LIB_ARC::CalcEdit ( const wxPoint &  aPosition)
overridevirtual

Calculate the attributes of an item at aPosition when it is being edited.

This method gets called by the Draw() method when the item is being edited. This probably should be a pure virtual method but bezier curves are not yet editable in the symbol library editor. Therefore, the default method does nothing.

Parameters
aPositionThe current mouse position in drawing coordinates.

Reimplemented from LIB_ITEM.

Definition at line 427 of file lib_arc.cpp.

428 {
429 #define sq( x ) pow( x, 2 )
430 
431  // Edit state 0: drawing: place ArcStart
432  // Edit state 1: drawing: place ArcEnd (center calculated for 90-degree subtended angle)
433  // Edit state 2: point editing: move ArcStart (center calculated for invariant subtended angle)
434  // Edit state 3: point editing: move ArcEnd (center calculated for invariant subtended angle)
435  // Edit state 4: point editing: move center
436 
437  switch( m_editState )
438  {
439  case 0:
440  m_ArcStart = aPosition;
441  m_ArcEnd = aPosition;
442  m_Pos = aPosition;
443  m_Radius = 0;
444  m_t1 = 0;
445  m_t2 = 0;
446  return;
447 
448  case 1:
449  m_ArcEnd = aPosition;
450  m_Radius = KiROUND( sqrt( pow( GetLineLength( m_ArcStart, m_ArcEnd ), 2 ) / 2.0 ) );
451  break;
452 
453  case 2:
454  case 3:
455  {
456  wxPoint v = m_ArcStart - m_ArcEnd;
457  double chordBefore = sq( v.x ) + sq( v.y );
458 
459  if( m_editState == 2 )
460  m_ArcStart = aPosition;
461  else
462  m_ArcEnd = aPosition;
463 
464  v = m_ArcStart - m_ArcEnd;
465  double chordAfter = sq( v.x ) + sq( v.y );
466  double ratio = chordAfter / chordBefore;
467 
468  if( ratio > 0 )
469  {
470  m_Radius = int( sqrt( m_Radius * m_Radius * ratio ) ) + 1;
471  m_Radius = std::max( m_Radius, int( sqrt( chordAfter ) / 2 ) + 1 );
472  }
473 
474  break;
475  }
476 
477  case 4:
478  {
479  double chordA = GetLineLength( m_ArcStart, aPosition );
480  double chordB = GetLineLength( m_ArcEnd, aPosition );
481  m_Radius = int( ( chordA + chordB ) / 2.0 ) + 1;
482  break;
483  }
484  }
485 
486  // Calculate center based on start, end, and radius
487  //
488  // Let 'l' be the length of the chord and 'm' the middle point of the chord
489  double l = GetLineLength( m_ArcStart, m_ArcEnd );
490  wxPoint m = ( m_ArcStart + m_ArcEnd ) / 2;
491 
492  // Calculate 'd', the vector from the chord midpoint to the center
493  wxPoint d;
494  d.x = KiROUND( sqrt( sq( m_Radius ) - sq( l/2 ) ) * ( m_ArcStart.y - m_ArcEnd.y ) / l );
495  d.y = KiROUND( sqrt( sq( m_Radius ) - sq( l/2 ) ) * ( m_ArcEnd.x - m_ArcStart.x ) / l );
496 
497  wxPoint c1 = m + d;
498  wxPoint c2 = m - d;
499 
500  // Solution gives us 2 centers; we need to pick one:
501  switch( m_editState )
502  {
503  case 1:
504  {
505  // Keep center clockwise from chord while drawing
506  wxPoint chordVector = twoPointVector( m_ArcStart, m_ArcEnd );
507  double chordAngle = ArcTangente( chordVector.y, chordVector.x );
508  NORMALIZE_ANGLE_POS( chordAngle );
509 
510  wxPoint c1Test = c1;
511  RotatePoint( &c1Test, m_ArcStart, -chordAngle );
512 
513  m_Pos = c1Test.x > 0 ? c2 : c1;
514  }
515  break;
516 
517  case 2:
518  case 3:
519  // Pick the one closer to the old center
520  m_Pos = ( GetLineLength( c1, m_Pos ) < GetLineLength( c2, m_Pos ) ) ? c1 : c2;
521  break;
522 
523  case 4:
524  // Pick the one closer to the mouse position
525  m_Pos = ( GetLineLength( c1, aPosition ) < GetLineLength( c2, aPosition ) ) ? c1 : c2;
526  break;
527  }
528 
530 }
int m_Radius
Definition: lib_arc.h:148
static wxPoint twoPointVector(const wxPoint &startPoint, const wxPoint &endPoint)
Definition: lib_arc.cpp:41
int m_t1
Definition: lib_arc.h:149
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:222
int m_t2
Definition: lib_arc.h:150
void CalcRadiusAngles()
Calculate the radius and angle of an arc using the start, end, and center points.
Definition: lib_arc.cpp:533
wxPoint m_ArcEnd
Definition: lib_arc.h:152
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
wxPoint m_Pos
Definition: lib_arc.h:153
int m_editState
Definition: lib_arc.h:155
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:73
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:183
#define sq(x)
wxPoint m_ArcStart
Definition: lib_arc.h:151

References ArcTangente(), CalcRadiusAngles(), GetLineLength(), KiROUND(), m_ArcEnd, m_ArcStart, m_editState, m_Pos, m_Radius, m_t1, m_t2, NORMALIZE_ANGLE_POS(), RotatePoint(), sq, and twoPointVector().

Referenced by EE_POINT_EDITOR::updateParentItem().

◆ CalcEndPoints()

void LIB_ARC::CalcEndPoints ( )

Calculate the start and end points using the center point and the two angles.

Definition at line 593 of file lib_arc.cpp.

594 {
595  double startAngle = DEG2RAD( static_cast<double>( m_t1 ) / 10.0 );
596  double endAngle = DEG2RAD( static_cast<double>( m_t2 ) / 10.0 );
597 
598  m_ArcStart.x = KiROUND( cos( startAngle ) * m_Radius ) + m_Pos.x;
599  m_ArcStart.y = KiROUND( sin( startAngle ) * m_Radius ) + m_Pos.y;
600 
601  m_ArcEnd.x = KiROUND( cos( endAngle ) * m_Radius ) + m_Pos.x;
602  m_ArcEnd.y = KiROUND( sin( endAngle ) * m_Radius ) + m_Pos.y;
603 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
double DEG2RAD(double deg)
Definition: trigo.h:229
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:73
wxPoint m_ArcStart
Definition: lib_arc.h:151

References DEG2RAD(), KiROUND(), m_ArcEnd, m_ArcStart, m_Pos, m_Radius, m_t1, and m_t2.

Referenced by SCH_ALTIUM_PLUGIN::ParseArc().

◆ CalcMidPoint()

VECTOR2I LIB_ARC::CalcMidPoint ( ) const

Calculate the arc mid point using the arc start and end angles and radius length.

Note
This is not a general purpose trigonometric arc midpoint calculation. It is limited to the less than 180.0 degree arcs used in symbols.
Returns
A VECTOR2I object containing the midpoint of the arc.

Definition at line 573 of file lib_arc.cpp.

574 {
575  VECTOR2D midPoint;
576  double startAngle = static_cast<double>( m_t1 ) / 10.0;
577  double endAngle = static_cast<double>( m_t2 ) / 10.0;
578 
579  if( endAngle < startAngle )
580  endAngle -= 360.0;
581 
582  double midPointAngle = ( ( endAngle - startAngle ) / 2.0 ) + startAngle;
583  double x = cos( DEG2RAD( midPointAngle ) ) * m_Radius;
584  double y = sin( DEG2RAD( midPointAngle ) ) * m_Radius;
585 
586  midPoint.x = KiROUND( x ) + m_Pos.x;
587  midPoint.y = KiROUND( y ) + m_Pos.y;
588 
589  return midPoint;
590 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_Pos
Definition: lib_arc.h:153
double DEG2RAD(double deg)
Definition: trigo.h:229
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:73

References DEG2RAD(), KiROUND(), m_Pos, m_Radius, m_t1, m_t2, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ CalcRadiusAngles()

void LIB_ARC::CalcRadiusAngles ( )

Calculate the radius and angle of an arc using the start, end, and center points.

Definition at line 533 of file lib_arc.cpp.

534 {
535  wxPoint centerStartVector = twoPointVector( m_Pos, m_ArcStart );
536  wxPoint centerEndVector = twoPointVector( m_Pos, m_ArcEnd );
537 
538  m_Radius = KiROUND( EuclideanNorm( centerStartVector ) );
539 
540  // Angles in Eeschema are still integers
541  m_t1 = KiROUND( ArcTangente( centerStartVector.y, centerStartVector.x ) );
542  m_t2 = KiROUND( ArcTangente( centerEndVector.y, centerEndVector.x ) );
543 
545  NORMALIZE_ANGLE_POS( m_t2 ); // angles = 0 .. 3600
546 
547  // Restrict angle to less than 180 to avoid PBS display mirror Trace because it is
548  // assumed that the arc is less than 180 deg to find orientation after rotate or mirror.
549  if( ( m_t2 - m_t1 ) > 1800 )
550  m_t2 -= 3600;
551  else if( ( m_t2 - m_t1 ) <= -1800 )
552  m_t2 += 3600;
553 
554  while( ( m_t2 - m_t1 ) >= 1800 )
555  {
556  m_t2--;
557  m_t1++;
558  }
559 
560  while( ( m_t1 - m_t2 ) >= 1800 )
561  {
562  m_t2++;
563  m_t1--;
564  }
565 
567 
568  if( !IsMoving() )
570 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:146
int m_Radius
Definition: lib_arc.h:148
static wxPoint twoPointVector(const wxPoint &startPoint, const wxPoint &endPoint)
Definition: lib_arc.cpp:41
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
bool IsMoving() const
Definition: eda_item.h:120
wxPoint m_ArcEnd
Definition: lib_arc.h:152
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:290
wxPoint m_Pos
Definition: lib_arc.h:153
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:73
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:183
wxPoint m_ArcStart
Definition: lib_arc.h:151

References ArcTangente(), EuclideanNorm(), EDA_ITEM::IsMoving(), KiROUND(), m_ArcEnd, m_ArcStart, m_Pos, m_Radius, m_t1, m_t2, NORMALIZE_ANGLE_POS(), and twoPointVector().

Referenced by CalcEdit(), KIGFX::SCH_PAINTER::draw(), and CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 154 of file eda_item.h.

154 { m_flags &= ~aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_MOVE_TOOL::AlignElements(), FOOTPRINT::BuildPolyCourtyards(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), ConvertOutlineToPolygon(), 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(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::ExchangeFootprint(), PCB_SELECTION_TOOL::ExitGroup(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary(), EE_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::narrowSelection(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceFootprint(), SYMBOL_EDITOR_PIN_TOOL::PlacePin(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 166 of file eda_item.h.

167  {
169  DO_NOT_DRAW );
170  }
#define DO_NOT_DRAW
Used to disable draw function.
#define STARTPOINT
When a line is selected, these flags indicate which.
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
#define CANDIDATE
flag indicating that the structure is connected
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
#define SKIP_STRUCT
flag indicating that the structure should be ignored
#define TEMP_SELECTED
flag indicating that the structure has already selected

References CANDIDATE, EDA_ITEM::ClearFlags(), DO_NOT_DRAW, ENDPOINT, IS_LINKED, SKIP_STRUCT, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

149  {
150  m_viewPrivData = nullptr;
151  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:156

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * LIB_ARC::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 127 of file lib_arc.cpp.

128 {
129  return new LIB_ARC( *this );
130 }
LIB_ARC(LIB_SYMBOL *aParent)
Definition: lib_arc.cpp:47

References LIB_ARC().

◆ compare()

int LIB_ARC::compare ( const LIB_ITEM aOther,
LIB_ITEM::COMPARE_FLAGS  aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL 
) const
overrideprivatevirtual

Provide the draw object specific comparison called by the == and < operators.

The base object sort order which always proceeds the derived object sort order is as follows:

  • Symbol alternate part (DeMorgan) number.
  • Symbol part number.
  • KICAD_T enum value.
  • Result of derived classes comparison.
Note
Make sure you call down to LIB_ITEM::compare before doing any derived object comparisons or you will break the sorting using the symbol library file format.
Parameters
aOtherA reference to the other LIB_ITEM to compare the arc against.
aCompareFlagsThe flags used to perform the comparison.
Returns
An integer value less than 0 if the object is less than aOther object, zero if the object is equal to aOther object, or greater than 0 if the object is greater than aOther object.

The arc specific sort order is as follows:

  • Arc horizontal (X) position.
  • Arc vertical (Y) position.
  • Arc start angle.
  • Arc end angle.

Reimplemented from LIB_ITEM.

Definition at line 133 of file lib_arc.cpp.

134 {
135  wxASSERT( aOther.Type() == LIB_ARC_T );
136 
137  int retv = LIB_ITEM::compare( aOther );
138 
139  if( retv )
140  return retv;
141 
142  const LIB_ARC* tmp = ( LIB_ARC* ) &aOther;
143 
144  if( m_Pos.x != tmp->m_Pos.x )
145  return m_Pos.x - tmp->m_Pos.x;
146 
147  if( m_Pos.y != tmp->m_Pos.y )
148  return m_Pos.y - tmp->m_Pos.y;
149 
150  if( m_t1 != tmp->m_t1 )
151  return m_t1 - tmp->m_t1;
152 
153  if( m_t2 != tmp->m_t2 )
154  return m_t2 - tmp->m_t2;
155 
156  return 0;
157 }
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_Pos
Definition: lib_arc.h:153
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References LIB_ITEM::compare(), LIB_ARC_T, m_Pos, m_t1, m_t2, and EDA_ITEM::Type().

◆ ContinueEdit()

virtual bool LIB_ITEM::ContinueEdit ( const wxPoint &  aPosition)
inlinevirtualinherited

Continue an edit in progress at aPosition.

This is used to perform the next action while drawing an item. This would be called for each additional left click when the mouse is captured while the item is being drawn.

Parameters
aPositionThe position of the mouse left click in drawing coordinates.
Returns
True if additional mouse clicks are required to complete the edit in progress.

Reimplemented in LIB_POLYLINE.

Definition at line 110 of file lib_item.h.

110 { return false; }

Referenced by SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape().

◆ EndEdit()

virtual void LIB_ITEM::EndEdit ( )
inlinevirtualinherited

End an object editing action.

This is used to end or abort an edit action in progress initiated by BeginEdit().

Reimplemented in LIB_POLYLINE.

Definition at line 117 of file lib_item.h.

117 {}

Referenced by SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape().

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

87  {
89  TYPE_ID thisType = TYPE_HASH( *this );
90  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
91  return object ? aProperty->getter( object ) : wxAny();
92  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual wxAny getter(void *aObject) const =0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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(), PCB_EXPR_VAR_REF::GetValue(), and PAD_DESC::PAD_DESC().

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

96  {
98  TYPE_ID thisType = TYPE_HASH( *this );
99  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
100  return object ? aProperty->get<T>( object ) : T();
101  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Get() [3/3]

template<typename T >
boost::optional<T> INSPECTABLE::Get ( const wxString &  aProperty)
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  boost::optional<T> ret = T();
110 
111  if( prop )
112  {
113  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
114 
115  if( object )
116  ret = prop->get<T>( object );
117  }
118 
119  return ret;
120  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
T get(void *aObject)
Definition: property.h:268
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ GetBoundingBox()

const EDA_RECT LIB_ARC::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 332 of file lib_arc.cpp.

333 {
334  int minX, minY, maxX, maxY, angleStart, angleEnd;
335  EDA_RECT rect;
336  wxPoint nullPoint, startPos, endPos, centerPos;
337  wxPoint normStart = m_ArcStart - m_Pos;
338  wxPoint normEnd = m_ArcEnd - m_Pos;
339 
340  if( ( normStart == nullPoint ) || ( normEnd == nullPoint ) || ( m_Radius == 0 ) )
341  return rect;
342 
346  angleStart = m_t1;
347  angleEnd = m_t2;
348 
349  if( DefaultTransform.MapAngles( &angleStart, &angleEnd ) )
350  {
351  std::swap( endPos.x, startPos.x );
352  std::swap( endPos.y, startPos.y );
353  }
354 
355  /* Start with the start and end point of the arc. */
356  minX = std::min( startPos.x, endPos.x );
357  minY = std::min( startPos.y, endPos.y );
358  maxX = std::max( startPos.x, endPos.x );
359  maxY = std::max( startPos.y, endPos.y );
360 
361  /* Zero degrees is a special case. */
362  if( angleStart == 0 )
363  maxX = centerPos.x + m_Radius;
364 
365  /* Arc end angle wrapped passed 360. */
366  if( angleStart > angleEnd )
367  angleEnd += 3600;
368 
369  if( angleStart <= 900 && angleEnd >= 900 ) /* 90 deg */
370  maxY = centerPos.y + m_Radius;
371 
372  if( angleStart <= 1800 && angleEnd >= 1800 ) /* 180 deg */
373  minX = centerPos.x - m_Radius;
374 
375  if( angleStart <= 2700 && angleEnd >= 2700 ) /* 270 deg */
376  minY = centerPos.y - m_Radius;
377 
378  if( angleStart <= 3600 && angleEnd >= 3600 ) /* 0 deg */
379  maxX = centerPos.x + m_Radius;
380 
381  rect.SetOrigin( minX, minY );
382  rect.SetEnd( maxX, maxY );
383  rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
384 
385  return rect;
386 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:121
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
wxPoint m_Pos
Definition: lib_arc.h:153
void SetEnd(int x, int y)
Definition: eda_rect.h:182
TRANSFORM DefaultTransform
Definition: eeschema.cpp:56
int GetPenWidth() const override
Definition: lib_arc.cpp:286
Handle the component boundary box.
Definition: eda_rect.h:42
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:79
wxPoint m_ArcStart
Definition: lib_arc.h:151
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364

References DefaultTransform, GetPenWidth(), EDA_RECT::Inflate(), m_ArcEnd, m_ArcStart, m_Pos, m_Radius, m_t1, m_t2, TRANSFORM::MapAngles(), EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), and TRANSFORM::TransformCoordinate().

Referenced by GetMsgPanelInfo(), and HitTest().

◆ GetClass()

wxString LIB_ARC::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 44 of file lib_arc.h.

45  {
46  return wxT( "LIB_ARC" );
47  }

◆ GetConvert()

◆ GetEditFlags()

EDA_ITEM_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 158 of file eda_item.h.

159  {
160  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
162 
163  return m_flags & mask;
164  }
#define IS_NEW
New item, just created.
#define IS_RESIZING
Item being resized.
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_MOVING
Item being moved.
#define STRUCT_DELETED
flag indication structures to be erased
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

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

Referenced by 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_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), and DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow().

◆ GetEffectivePenWidth()

virtual int LIB_ITEM::GetEffectivePenWidth ( const RENDER_SETTINGS aSettings) const
inlinevirtualinherited

Definition at line 146 of file lib_item.h.

147  {
148  // For historical reasons, a stored value of 0 means "default width" and negative
149  // numbers meant "don't stroke".
150 
151  if( GetPenWidth() < 0 && GetFillMode() != FILL_TYPE::NO_FILL )
152  return 0;
153  else if( GetPenWidth() == 0 )
154  return aSettings->GetDefaultPenWidth();
155  else
156  return std::max( GetPenWidth(), aSettings->GetMinPenWidth() );
157  }
virtual int GetPenWidth() const =0
FILL_TYPE GetFillMode() const
Definition: lib_item.h:278
int GetDefaultPenWidth() const

References KIGFX::RENDER_SETTINGS::GetDefaultPenWidth(), LIB_ITEM::GetFillMode(), KIGFX::RENDER_SETTINGS::GetMinPenWidth(), LIB_ITEM::GetPenWidth(), and NO_FILL.

Referenced by KIGFX::SCH_PAINTER::getLineWidth(), LIB_CIRCLE::Plot(), LIB_RECTANGLE::Plot(), Plot(), LIB_BEZIER::Plot(), LIB_POLYLINE::Plot(), LIB_FIELD::Plot(), LIB_PIN::PlotSymbol(), LIB_BEZIER::print(), LIB_CIRCLE::print(), LIB_RECTANGLE::print(), LIB_POLYLINE::print(), print(), LIB_FIELD::print(), and LIB_PIN::printPinSymbol().

◆ GetEnd()

◆ GetFillMode()

◆ GetFirstRadiusAngle()

int LIB_ARC::GetFirstRadiusAngle ( ) const
inline

Definition at line 87 of file lib_arc.h.

87 { return m_t1; }
int m_t1
Definition: lib_arc.h:149

References m_t1.

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), and SCH_LEGACY_PLUGIN_CACHE::saveArc().

◆ GetFlags()

◆ GetFocusPosition()

virtual const wxPoint 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 259 of file eda_item.h.

259 { return GetPosition(); }
virtual wxPoint GetPosition() const
Definition: eda_item.h:252

References EDA_ITEM::GetPosition().

Referenced by PCB_BASE_FRAME::FocusOnItem(), and SCH_EDIT_FRAME::FocusOnItem().

◆ GetMenuImage()

BITMAPS LIB_ARC::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 414 of file lib_arc.cpp.

415 {
416  return BITMAPS::add_arc;
417 }

References add_arc.

◆ GetMsgPanelInfo()

void LIB_ARC::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 389 of file lib_arc.cpp.

390 {
391  wxString msg;
392  EDA_RECT bBox = GetBoundingBox();
393 
394  LIB_ITEM::GetMsgPanelInfo( aFrame, aList );
395 
396  msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width );
397 
398  aList.emplace_back( _( "Line Width" ), msg );
399 
400  msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
401  bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
402 
403  aList.emplace_back( _( "Bounding Box" ), msg );
404 }
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_arc.cpp:332
const wxPoint GetEnd() const
Definition: eda_rect.h:103
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
#define _(s)
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Display basic info (type, part and convert) about the current item in message panel.
Definition: lib_item.cpp:50
Handle the component boundary box.
Definition: eda_rect.h:42
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
int m_Width
Definition: lib_arc.h:154

References _, GetBoundingBox(), EDA_RECT::GetEnd(), LIB_ITEM::GetMsgPanelInfo(), EDA_RECT::GetOrigin(), EDA_BASE_FRAME::GetUserUnits(), m_Width, and MessageTextFromValue().

◆ GetParent()

◆ GetPenWidth()

int LIB_ARC::GetPenWidth ( ) const
overridevirtual

Implements LIB_ITEM.

Definition at line 286 of file lib_arc.cpp.

287 {
288  return m_Width;
289 }
int m_Width
Definition: lib_arc.h:154

References m_Width.

Referenced by GetBoundingBox(), and HitTest().

◆ GetPosition()

wxPoint LIB_ARC::GetPosition ( ) const
inlineoverridevirtual

◆ GetRadius()

int LIB_ARC::GetRadius ( ) const
inline

◆ GetSecondRadiusAngle()

int LIB_ARC::GetSecondRadiusAngle ( ) const
inline

Definition at line 90 of file lib_arc.h.

90 { return m_t2; }
int m_t2
Definition: lib_arc.h:150

References m_t2.

Referenced by KIGFX::SCH_PAINTER::draw(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), and SCH_LEGACY_PLUGIN_CACHE::saveArc().

◆ GetSelectMenuText()

wxString LIB_ARC::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 407 of file lib_arc.cpp.

408 {
409  return wxString::Format( _( "Arc, radius %s" ),
410  MessageTextFromValue( aUnits, m_Radius ) );
411 }
int m_Radius
Definition: lib_arc.h:148
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:104
#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

References _, Format(), m_Radius, and MessageTextFromValue().

◆ GetStart()

◆ GetState()

int EDA_ITEM::GetState ( EDA_ITEM_FLAGS  type) const
inlineinherited

Definition at line 137 of file eda_item.h.

138  {
139  return m_status & type;
140  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

EDA_ITEM_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 150 of file eda_item.h.

150 { return m_status; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

◆ GetTypeName()

wxString LIB_ARC::GetTypeName ( ) const
inlineoverridevirtual

Provide a user-consumable name of the object type.

Perform localization when called so that run-time language selection works.

Implements LIB_ITEM.

Definition at line 49 of file lib_arc.h.

50  {
51  return _( "Arc" );
52  }
#define _(s)

References _.

◆ GetUnit()

◆ GetWidth()

int LIB_ARC::GetWidth ( ) const
inlineoverridevirtual

Implements LIB_ITEM.

Definition at line 80 of file lib_arc.h.

80 { return m_Width; }
int m_Width
Definition: lib_arc.h:154

References m_Width.

Referenced by HitTest(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), and SCH_LEGACY_PLUGIN_CACHE::saveArc().

◆ HasFlag()

◆ HitTest() [1/2]

bool LIB_ARC::HitTest ( const wxPoint &  aPosition,
int  aAccuracy = 0 
) const
overridevirtual

Test if aPosition is contained within or on the bounding box of an item.

Parameters
aPositionA reference to a wxPoint 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 59 of file lib_arc.cpp.

60 {
61  int mindist = std::max( aAccuracy + GetPenWidth() / 2,
62  Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
63  wxPoint relativePosition = aRefPoint;
64 
65  relativePosition.y = -relativePosition.y; // reverse Y axis
66 
67  int distance = KiROUND( GetLineLength( m_Pos, relativePosition ) );
68 
69  if( abs( distance - m_Radius ) > mindist )
70  return false;
71 
72  // We are on the circle, ensure we are only on the arc, i.e. between
73  // m_ArcStart and m_ArcEnd
74 
75  wxPoint startEndVector = twoPointVector( m_ArcStart, m_ArcEnd );
76  wxPoint startRelativePositionVector = twoPointVector( m_ArcStart, relativePosition );
77 
78  wxPoint centerStartVector = twoPointVector( m_Pos, m_ArcStart );
79  wxPoint centerEndVector = twoPointVector( m_Pos, m_ArcEnd );
80  wxPoint centerRelativePositionVector = twoPointVector( m_Pos, relativePosition );
81 
82  // Compute the cross product to check if the point is in the sector
83  double crossProductStart = CrossProduct( centerStartVector, centerRelativePositionVector );
84  double crossProductEnd = CrossProduct( centerEndVector, centerRelativePositionVector );
85 
86  // The cross products need to be exchanged, depending on which side the center point
87  // relative to the start point to end point vector lies
88  if( CrossProduct( startEndVector, startRelativePositionVector ) < 0 )
89  {
90  std::swap( crossProductStart, crossProductEnd );
91  }
92 
93  // When the cross products have a different sign, the point lies in sector
94  // also check, if the reference is near start or end point
95  return HitTestPoints( m_ArcStart, relativePosition, MINIMUM_SELECTION_DISTANCE ) ||
96  HitTestPoints( m_ArcEnd, relativePosition, MINIMUM_SELECTION_DISTANCE ) ||
97  ( crossProductStart <= 0 && crossProductEnd >= 0 );
98 }
int m_Radius
Definition: lib_arc.h:148
static wxPoint twoPointVector(const wxPoint &startPoint, const wxPoint &endPoint)
Definition: lib_arc.cpp:41
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:222
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
#define MINIMUM_SELECTION_DISTANCE
Definition: lib_item.h:47
double CrossProduct(const wxPoint &vectorA, const wxPoint &vectorB)
Determine the cross product.
Definition: trigo.h:198
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
int GetPenWidth() const override
Definition: lib_arc.cpp:286
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:184
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:73
wxPoint m_ArcStart
Definition: lib_arc.h:151

References CrossProduct(), distance(), GetLineLength(), GetPenWidth(), HitTestPoints(), KiROUND(), m_ArcEnd, m_ArcStart, m_Pos, m_Radius, MINIMUM_SELECTION_DISTANCE, and twoPointVector().

◆ HitTest() [2/2]

bool LIB_ARC::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Test if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT 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 101 of file lib_arc.cpp.

102 {
103  if( m_flags & (STRUCT_DELETED | SKIP_STRUCT ) )
104  return false;
105 
106  wxPoint center = DefaultTransform.TransformCoordinate( GetPosition() );
107  int radius = GetRadius();
108  int lineWidth = GetWidth();
109  EDA_RECT sel = aRect ;
110 
111  if ( aAccuracy )
112  sel.Inflate( aAccuracy );
113 
114  if( aContained )
115  return sel.Contains( GetBoundingBox() );
116 
117  EDA_RECT arcRect = GetBoundingBox().Common( sel );
118 
119  /* All following tests must pass:
120  * 1. Rectangle must intersect arc BoundingBox
121  * 2. Rectangle must cross the outside of the arc
122  */
123  return arcRect.Intersects( sel ) && arcRect.IntersectsCircleEdge( center, radius, lineWidth );
124 }
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: lib_arc.cpp:332
bool IntersectsCircleEdge(const wxPoint &aCenter, const int aRadius, const int aWidth) const
Test for intersection between this rect and the edge (radius) of a circle.
Definition: eda_rect.cpp:331
EDA_RECT Common(const EDA_RECT &aRect) const
Return the area that is common with another rectangle.
Definition: eda_rect.cpp:489
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
#define STRUCT_DELETED
flag indication structures to be erased
int GetRadius() const
Definition: lib_arc.h:84
int GetWidth() const override
Definition: lib_arc.h:80
TRANSFORM DefaultTransform
Definition: eeschema.cpp:56
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Handle the component boundary box.
Definition: eda_rect.h:42
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:364
wxPoint GetPosition() const override
Definition: lib_arc.h:71

References EDA_RECT::Common(), EDA_RECT::Contains(), DefaultTransform, GetBoundingBox(), GetPosition(), GetRadius(), GetWidth(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_RECT::IntersectsCircleEdge(), EDA_ITEM::m_flags, SKIP_STRUCT, STRUCT_DELETED, and TRANSFORM::TransformCoordinate().

◆ IsBrightened()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 121 of file eda_item.h.

121 { return m_flags & IS_DRAGGING; }
#define IS_DRAGGING
Item being dragged.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_DRAGGING, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 124 of file eda_item.h.

124 { return m_flags & ENTERED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define ENTERED
indicates a group has been entered

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFillable()

bool LIB_ITEM::IsFillable ( ) const
inlineinherited

Check if draw object can be filled.

The default setting is false. If the derived object support filling, set the m_isFillable member to true.

Definition at line 269 of file lib_item.h.

269 { return m_isFillable; }
bool m_isFillable
Definition: lib_item.h:340

References LIB_ITEM::m_isFillable.

Referenced by formatFill(), DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow(), and DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 206 of file eda_item.h.

206 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

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

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 118 of file eda_item.h.

118 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_CHANGED, and EDA_ITEM::m_flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ 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 SCH_SYMBOL, SCH_SHEET, SCH_LABEL, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 403 of file eda_item.h.

403 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 125 of file eda_item.h.

125 { return m_flags & IS_RESIZING; }
#define IS_RESIZING
Item being resized.
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References IS_RESIZING, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 123 of file eda_item.h.

123 { return m_flags & SELECTED; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define 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_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(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), DIALOG_EXCHANGE_FOOTPRINTS::isMatch(), DIALOG_CHANGE_SYMBOLS::isMatch(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), GERBVIEW_SELECTION_TOOL::unselect(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsType()

virtual bool EDA_ITEM::IsType ( const KICAD_T  aScanTypes[]) const
inlinevirtualinherited

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 in PCB_VIA, SCH_LABEL, PCB_DIMENSION_BASE, PAD, SCH_FIELD, FP_TEXT, SCH_LINE, PCB_SHAPE, FP_SHAPE, and PCB_TEXT.

Definition at line 183 of file eda_item.h.

184  {
185  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
186  return true;
187 
188  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
189  {
190  if( m_structType == *p )
191  return true;
192  }
193 
194  return false;
195  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
KICAD_T m_structType
Run time identification, keep private so it can never be changed after a ctor sets it.
Definition: eda_item.h:488

References EOT, EDA_ITEM::m_structType, and SCH_LOCATE_ANY_T.

Referenced by ROUTER_TOOL::CanInlineDrag(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), PCB_TEXT::IsType(), FP_SHAPE::IsType(), PCB_SHAPE::IsType(), SCH_LINE::IsType(), FP_TEXT::IsType(), SCH_FIELD::IsType(), PAD::IsType(), PCB_DIMENSION_BASE::IsType(), SCH_LABEL::IsType(), PCB_VIA::IsType(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), SCH_BASE_FRAME::UpdateItem(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 122 of file eda_item.h.

122 { return m_flags & IS_WIRE_IMAGE; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 295 of file eda_item.h.

299  {
300  for( auto it : aList )
301  {
302  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
304  return SEARCH_RESULT::QUIT;
305  }
306 
308  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 314 of file eda_item.h.

316  {
317  for( auto it : aList )
318  {
319  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
321  return SEARCH_RESULT::QUIT;
322  }
323 
325  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:93

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

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( const wxFindReplaceData &  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_SYMBOL, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 365 of file eda_item.h.

366  {
367  return false;
368  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), inDiffPair(), PCB_TEXT::Matches(), FP_TEXT::Matches(), PCB_MARKER::Matches(), SCH_MARKER::Matches(), SCH_PIN::Matches(), ZONE::Matches(), SCH_SHEET_PIN::Matches(), SCH_FIELD::Matches(), SCH_TEXT::Matches(), SCH_EDITOR_CONTROL::ReplaceAndFindNext(), and SCH_EDITOR_CONTROL::UpdateFind().

◆ Matches() [2/2]

bool EDA_ITEM::Matches ( const wxString &  aText,
const wxFindReplaceData &  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 118 of file eda_item.cpp.

119 {
120  wxString text = aText;
121  wxString searchText = aSearchData.GetFindString();
122 
123  // Don't match if searching for replaceable item and the item doesn't support text replace.
124  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
125  return false;
126 
127  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
128  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
129 
130  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
131  {
132  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
133  return text.Matches( searchText );
134 
135  return text.MakeUpper().Matches( searchText.MakeUpper() );
136  }
137 
138  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
139  return aText.Find( searchText ) != wxNOT_FOUND;
140 
141  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
142 }
virtual bool IsReplaceable() const
Override this method in any derived object that supports test find and replace.
Definition: eda_item.h:403

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, EDA_ITEM::IsReplaceable(), and text.

◆ MirrorHorizontal()

void LIB_ARC::MirrorHorizontal ( const wxPoint &  aCenter)
overridevirtual

Mirror the draw object along the horizontal (X) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 177 of file lib_arc.cpp.

178 {
179  m_Pos.x -= aCenter.x;
180  m_Pos.x *= -1;
181  m_Pos.x += aCenter.x;
182  m_ArcStart.x -= aCenter.x;
183  m_ArcStart.x *= -1;
184  m_ArcStart.x += aCenter.x;
185  m_ArcEnd.x -= aCenter.x;
186  m_ArcEnd.x *= -1;
187  m_ArcEnd.x += aCenter.x;
188  std::swap( m_ArcStart, m_ArcEnd );
189  std::swap( m_t1, m_t2 );
190  m_t1 = 1800 - m_t1;
191  m_t2 = 1800 - m_t2;
192 
193  if( m_t1 > 3600 || m_t2 > 3600 )
194  {
195  m_t1 -= 3600;
196  m_t2 -= 3600;
197  }
198  else if( m_t1 < -3600 || m_t2 < -3600 )
199  {
200  m_t1 += 3600;
201  m_t2 += 3600;
202  }
203 }
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, m_Pos, m_t1, and m_t2.

◆ MirrorVertical()

void LIB_ARC::MirrorVertical ( const wxPoint &  aCenter)
overridevirtual

Mirror the draw object along the MirrorVertical (Y) axis about aCenter point.

Parameters
aCenterPoint to mirror around.

Implements LIB_ITEM.

Definition at line 206 of file lib_arc.cpp.

207 {
208  m_Pos.y -= aCenter.y;
209  m_Pos.y *= -1;
210  m_Pos.y += aCenter.y;
211  m_ArcStart.y -= aCenter.y;
212  m_ArcStart.y *= -1;
213  m_ArcStart.y += aCenter.y;
214  m_ArcEnd.y -= aCenter.y;
215  m_ArcEnd.y *= -1;
216  m_ArcEnd.y += aCenter.y;
217  std::swap( m_ArcStart, m_ArcEnd );
218  std::swap( m_t1, m_t2 );
219  m_t1 = - m_t1;
220  m_t2 = - m_t2;
221 
222  if( m_t1 > 3600 || m_t2 > 3600 )
223  {
224  m_t1 -= 3600;
225  m_t2 -= 3600;
226  }
227  else if( m_t1 < -3600 || m_t2 < -3600 )
228  {
229  m_t1 += 3600;
230  m_t2 += 3600;
231  }
232 }
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, m_Pos, m_t1, and m_t2.

◆ MoveTo()

void LIB_ARC::MoveTo ( const wxPoint &  aPosition)
overridevirtual

Move a draw object to aPosition.

Parameters
aPositionPosition to move draw item to.

Implements LIB_ITEM.

Definition at line 168 of file lib_arc.cpp.

169 {
170  wxPoint offset = aPosition - m_Pos;
171  m_Pos = aPosition;
172  m_ArcStart += offset;
173  m_ArcEnd += offset;
174 }
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, and m_Pos.

◆ Offset()

void LIB_ARC::Offset ( const wxPoint &  aOffset)
overridevirtual

Set the drawing object by aOffset from the current position.

Parameters
aOffsetCoordinates to offset the item position.

Implements LIB_ITEM.

Definition at line 160 of file lib_arc.cpp.

161 {
162  m_Pos += aOffset;
163  m_ArcStart += aOffset;
164  m_ArcEnd += aOffset;
165 }
wxPoint m_ArcEnd
Definition: lib_arc.h:152
wxPoint m_Pos
Definition: lib_arc.h:153
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, and m_Pos.

◆ operator<() [1/2]

bool LIB_ITEM::operator< ( const LIB_ITEM aOther) const
inherited

Test if another draw item is less than this draw object.

Parameters
aOther- Draw item to compare against.
Returns
- True if object is less than this object.

Definition at line 99 of file lib_item.cpp.

100 {
101  return ( compare( aOther ) < 0 );
102 }
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74

References LIB_ITEM::compare().

◆ operator<() [2/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 171 of file eda_item.cpp.

172 {
173  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
174  GetClass() ) );
175 
176  return false;
177 }
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
virtual wxString GetClass() const =0
Return the class name.

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

◆ operator==() [1/2]

bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inherited

Test LIB_ITEM objects for equivalence.

Parameters
aOtherObject to test against.
Returns
True if object is identical to this object.

Definition at line 93 of file lib_item.cpp.

94 {
95  return compare( aOther ) == 0;
96 }
virtual int compare(const LIB_ITEM &aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags=LIB_ITEM::COMPARE_FLAGS::NORMAL) const
Provide the draw object specific comparison called by the == and < operators.
Definition: lib_item.cpp:74

References LIB_ITEM::compare().

◆ operator==() [2/2]

bool LIB_ITEM::operator== ( const LIB_ITEM aOther) const
inlineinherited

Definition at line 198 of file lib_item.h.

199  {
200  return *this == *aOther;
201  }

◆ Plot()

void LIB_ARC::Plot ( PLOTTER aPlotter,
const wxPoint &  aOffset,
bool  aFill,
const TRANSFORM aTransform 
) const
overridevirtual

Plot the draw item using the plot object.

Parameters
aPlotterThe plot object to plot to.
aOffsetPlot offset position.
aFillFlag to indicate whether or not the object is filled.
aTransformThe plot transform.

Implements LIB_ITEM.

Definition at line 257 of file lib_arc.cpp.

259 {
260  wxASSERT( aPlotter != nullptr );
261 
262  int t1 = m_t1;
263  int t2 = m_t2;
264  wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + aOffset;
265 
266  aTransform.MapAngles( &t1, &t2 );
267 
269  {
270  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
271  aPlotter->Arc( pos, -t2, -t1, m_Radius, FILL_TYPE::FILLED_WITH_BG_BODYCOLOR, 0 );
272  }
273 
274  bool already_filled = m_fill == FILL_TYPE::FILLED_WITH_BG_BODYCOLOR;
275  int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() );
276 
277  if( !already_filled || pen_size > 0 )
278  {
279  aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
280  aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? FILL_TYPE::NO_FILL : m_fill,
281  pen_size );
282  }
283 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:146
virtual void Arc(const wxPoint &centre, double StAngle, double EndAngle, int rayon, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)
Generic fallback: arc rendered as a polyline.
Definition: plotter.cpp:164
FILL_TYPE m_fill
The body fill type.
Definition: lib_item.h:339
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
wxPoint m_Pos
Definition: lib_arc.h:153
virtual void SetColor(const COLOR4D &color)=0
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:156
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:79

References PLOTTER::Arc(), FILLED_WITH_BG_BODYCOLOR, LIB_ITEM::GetEffectivePenWidth(), KIGFX::RENDER_SETTINGS::GetLayerColor(), LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LIB_ITEM::m_fill, m_Pos, m_Radius, m_t1, m_t2, TRANSFORM::MapAngles(), NO_FILL, PLOTTER::RenderSettings(), PLOTTER::SetColor(), and TRANSFORM::TransformCoordinate().

◆ print()

void LIB_ARC::print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
void *  aData,
const TRANSFORM aTransform 
)
overrideprivatevirtual

Print the item to aDC.

Parameters
aOffsetA reference to a wxPoint object containing the offset where to draw from the object's current position.
aDataA pointer to any object specific data required to perform the draw.
aTransformA reference to a TRANSFORM object containing drawing transform.

Implements LIB_ITEM.

Definition at line 292 of file lib_arc.cpp.

294 {
295  bool forceNoFill = static_cast<bool>( aData );
296  int penWidth = GetEffectivePenWidth( aSettings );
297 
298  if( forceNoFill && m_fill != FILL_TYPE::NO_FILL && penWidth == 0 )
299  return;
300 
301  wxDC* DC = aSettings->GetPrintDC();
302  wxPoint pos1, pos2, posc;
303  COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
304 
305  pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset;
306  pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset;
307  posc = aTransform.TransformCoordinate( m_Pos ) + aOffset;
308  int pt1 = m_t1;
309  int pt2 = m_t2;
310  bool swap = aTransform.MapAngles( &pt1, &pt2 );
311 
312  if( swap )
313  {
314  std::swap( pos1.x, pos2.x );
315  std::swap( pos1.y, pos2.y );
316  }
317 
318  if( forceNoFill || m_fill == FILL_TYPE::NO_FILL )
319  {
320  GRArc1( nullptr, DC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penWidth, color );
321  }
322  else
323  {
326 
327  GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penWidth, color, color );
328  }
329 }
int m_Radius
Definition: lib_arc.h:148
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
int color
Definition: DXF_plotter.cpp:57
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
virtual int GetEffectivePenWidth(const RENDER_SETTINGS *aSettings) const
Definition: lib_item.h:146
wxPoint m_ArcEnd
Definition: lib_arc.h:152
FILL_TYPE m_fill
The body fill type.
Definition: lib_item.h:339
wxPoint TransformCoordinate(const wxPoint &aPoint) const
Calculate a new coordinate according to the mirror/rotation transform.
Definition: transform.cpp:42
wxPoint m_Pos
Definition: lib_arc.h:153
wxDC * GetPrintDC() const
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, const COLOR4D &Color)
Definition: gr_basic.cpp:594
bool MapAngles(int *aAngle1, int *aAngle2) const
Calculate new angles according to the transform.
Definition: transform.cpp:79
wxPoint m_ArcStart
Definition: lib_arc.h:151
void GRFilledArc(EDA_RECT *ClipBox, wxDC *DC, int x, int y, double StAngle, double EndAngle, int r, int width, const COLOR4D &Color, const COLOR4D &BgColor)
Definition: gr_basic.cpp:641
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, FILLED_WITH_BG_BODYCOLOR, LIB_ITEM::GetEffectivePenWidth(), KIGFX::RENDER_SETTINGS::GetLayerColor(), KIGFX::RENDER_SETTINGS::GetPrintDC(), GRArc1(), GRFilledArc(), LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, m_ArcEnd, m_ArcStart, LIB_ITEM::m_fill, m_Pos, m_Radius, m_t1, m_t2, TRANSFORM::MapAngles(), NO_FILL, and TRANSFORM::TransformCoordinate().

◆ Print()

void LIB_ITEM::Print ( const RENDER_SETTINGS aSettings,
const wxPoint &  aOffset,
void *  aData,
const TRANSFORM aTransform 
)
virtualinherited

Draw an item.

Parameters
aDCDevice Context (can be null)
aOffsetOffset to draw
aDataValue or pointer used to pass others parameters, depending on body items. Used for some items to force to force no fill mode ( has meaning only for items what can be filled ). used in printing or moving objects mode or to pass reference to the lib symbol for pins.
aTransformTransform Matrix (rotation, mirror ..)

Definition at line 122 of file lib_item.cpp.

124 {
125  print( aSettings, aOffset, aData, aTransform );
126 }
virtual void print(const RENDER_SETTINGS *aSettings, const wxPoint &aOffset, void *aData, const TRANSFORM &aTransform)=0
Print the item to aDC.

References LIB_ITEM::print().

Referenced by DIALOG_PIN_PROPERTIES::OnPaintShowPanel().

◆ Replace() [1/2]

bool EDA_ITEM::Replace ( const wxFindReplaceData &  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 145 of file eda_item.cpp.

146 {
147  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
148 
149  int result = searchString.Find( ( aSearchData.GetFlags() & wxFR_MATCHCASE ) ?
150  aSearchData.GetFindString() :
151  aSearchData.GetFindString().Upper() );
152 
153  if( result == wxNOT_FOUND )
154  return false;
155 
156  wxString prefix = aText.Left( result );
157  wxString suffix;
158 
159  if( aSearchData.GetFindString().length() + result < aText.length() )
160  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
161 
162  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
163  aText, prefix, aSearchData.GetReplaceString(), suffix );
164 
165  aText = prefix + aSearchData.GetReplaceString() + suffix;
166 
167  return true;
168 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.

References traceFindReplace.

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

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( const wxFindReplaceData &  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 SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 392 of file eda_item.h.

393  {
394  return false;
395  }

◆ Rotate()

void LIB_ARC::Rotate ( const wxPoint &  aCenter,
bool  aRotateCCW = true 
)
overridevirtual

Rotate the object about aCenter point.

Parameters
aCenterPoint to rotate around.
aRotateCCWTrue to rotate counter clockwise. False to rotate clockwise.

Implements LIB_ITEM.

Definition at line 235 of file lib_arc.cpp.

236 {
237  int rot_angle = aRotateCCW ? -900 : 900;
238  RotatePoint( &m_Pos, aCenter, rot_angle );
239  RotatePoint( &m_ArcStart, aCenter, rot_angle );
240  RotatePoint( &m_ArcEnd, aCenter, rot_angle );
241  m_t1 -= rot_angle;
242  m_t2 -= rot_angle;
243 
244  if( m_t1 > 3600 || m_t2 > 3600 )
245  {
246  m_t1 -= 3600;
247  m_t2 -= 3600;
248  }
249  else if( m_t1 < -3600 || m_t2 < -3600 )
250  {
251  m_t1 += 3600;
252  m_t2 += 3600;
253  }
254 }
int m_t1
Definition: lib_arc.h:149
int m_t2
Definition: lib_arc.h:150
wxPoint m_ArcEnd
Definition: lib_arc.h:152
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:229
wxPoint m_Pos
Definition: lib_arc.h:153
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcEnd, m_ArcStart, m_Pos, m_t1, m_t2, and RotatePoint().

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

43  {
45  TYPE_ID thisType = TYPE_HASH( *this );
46  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
47 
48  if( object )
49  aProperty->setter( object, aValue );
50 
51  return object != nullptr;
52  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

56  {
58  TYPE_ID thisType = TYPE_HASH( *this );
59  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
60 
61  if( object )
62  aProperty->set<T>( object, aValue );
63 
64  return object != nullptr;
65  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

69  {
71  TYPE_ID thisType = TYPE_HASH( *this );
72  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
73  void* object = nullptr;
74 
75  if( prop )
76  {
77  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
78 
79  if( object )
80  prop->set<T>( object, aValue );
81  }
82 
83  return object != nullptr;
84  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:65
#define TYPE_HASH(x)
Definition: property.h:59
size_t TYPE_ID
Unique type identifier.
Definition: property_mgr.h:42
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
Provide class metadata.Helper macro to map type hashes to names.
Definition: property_mgr.h:62
void set(void *aObject, T aValue)
Definition: property.h:261
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.

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

◆ SetBrightened()

◆ SetConvert()

◆ SetEditState()

void LIB_ARC::SetEditState ( int  aState)
inline

Definition at line 65 of file lib_arc.h.

65 { m_editState = aState; }
int m_editState
Definition: lib_arc.h:155

References m_editState.

Referenced by EE_POINT_EDITOR::updateParentItem().

◆ SetEnd()

void LIB_ARC::SetEnd ( const wxPoint &  aPoint)
inline

Definition at line 96 of file lib_arc.h.

96 { m_ArcEnd = aPoint; }
wxPoint m_ArcEnd
Definition: lib_arc.h:152

References m_ArcEnd.

Referenced by KIGFX::SCH_PAINTER::draw(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), and SCH_LEGACY_PLUGIN_CACHE::loadArc().

◆ SetFillMode()

◆ SetFirstRadiusAngle()

void LIB_ARC::SetFirstRadiusAngle ( int  aAngle)
inline

Definition at line 86 of file lib_arc.h.

86 { m_t1 = aAngle; }
int m_t1
Definition: lib_arc.h:149

References m_t1.

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadArc(), and SCH_ALTIUM_PLUGIN::ParseArc().

◆ SetFlags()

void EDA_ITEM::SetFlags ( EDA_ITEM_FLAGS  aMask)
inlineinherited

Definition at line 153 of file eda_item.h.

153 { m_flags |= aMask; }
EDA_ITEM_FLAGS m_flags
Definition: eda_item.h:481

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), 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::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_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 204 of file eda_item.h.

204 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:480

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in PCB_DIMENSION_BASE.

Definition at line 116 of file eda_item.h.

116 { m_parent = aParent; }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:479

References EDA_ITEM::m_parent.

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

◆ SetPosition()

◆ SetRadius()

void LIB_ARC::SetRadius ( int  aRadius)
inline

Definition at line 83 of file lib_arc.h.

83 { m_Radius = aRadius; }
int m_Radius
Definition: lib_arc.h:148

References m_Radius.

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadArc(), and SCH_ALTIUM_PLUGIN::ParseArc().

◆ SetSecondRadiusAngle()

void LIB_ARC::SetSecondRadiusAngle ( int  aAngle)
inline

Definition at line 89 of file lib_arc.h.

89 { m_t2 = aAngle; }
int m_t2
Definition: lib_arc.h:150

References m_t2.

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadArc(), and SCH_ALTIUM_PLUGIN::ParseArc().

◆ SetSelected()

◆ SetStart()

void LIB_ARC::SetStart ( const wxPoint &  aPoint)
inline

Definition at line 93 of file lib_arc.h.

93 { m_ArcStart = aPoint; }
wxPoint m_ArcStart
Definition: lib_arc.h:151

References m_ArcStart.

Referenced by KIGFX::SCH_PAINTER::draw(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), and SCH_LEGACY_PLUGIN_CACHE::loadArc().

◆ SetState()

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

Definition at line 142 of file eda_item.h.

143  {
144  if( state )
145  m_status |= type; // state = ON or OFF
146  else
147  m_status &= ~type;
148  }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( EDA_ITEM_FLAGS  aStatus)
inlineinherited

Definition at line 151 of file eda_item.h.

151 { m_status = aStatus; }
EDA_ITEM_FLAGS m_status
Definition: eda_item.h:478

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetUnit()

◆ SetWidth()

void LIB_ARC::SetWidth ( int  aWidth)
inlineoverridevirtual

Implements LIB_ITEM.

Definition at line 81 of file lib_arc.h.

81 { m_Width = aWidth; }
int m_Width
Definition: lib_arc.h:154

References m_Width.

Referenced by SCH_LEGACY_PLUGIN_CACHE::loadArc().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 128 of file eda_item.h.

128 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:153
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Sort()

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

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

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

Definition at line 421 of file eda_item.h.

421 { return *aLeft < *aRight; }

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

113 { 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:488

References EDA_ITEM::m_structType.

Referenced by KIGFX::PCB_VIEW::Add(), FOOTPRINT::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), PCB_POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), SCH_SCREEN::Append(), CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings(), PNS::TOPOLOGY::AssembleTuningPath(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_NET_INSPECTOR::buildNewItem(), SCH_SCREENS::buildScreenList(), calcIsInsideArea(), calcIsInsideCourtyard(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), PCB_POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_LABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SYMBOL::CanConnect(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_PIN::ClassOf(), PCB_TEXT::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_NO_CONNECT::ClassOf(), PCB_MARKER::ClassOf(), FP_SHAPE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), PCB_SHAPE::ClassOf(), PCB_GROUP::ClassOf(), SCH_FIELD::ClassOf(), FP_TEXT::ClassOf(), SCH_SHEET::ClassOf(), NETINFO_ITEM::ClassOf(), ZONE::ClassOf(), SCH_SHEET_PIN::ClassOf(), SCH_BITMAP::ClassOf(), PCB_TRACK::ClassOf(), PAD::ClassOf(), SCH_SYMBOL::ClassOf(), FOOTPRINT::ClassOf(), SCH_SCREEN::ClassOf(), SCH_TEXT::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), PCB_ARC::ClassOf(), SCH_LABEL::ClassOf(), PCB_VIA::ClassOf(), SCH_GLOBALLABEL::ClassOf(), PCB_DIM_ALIGNED::ClassOf(), PCB_DIM_ORTHOGONAL::ClassOf(), SCH_HIERLABEL::ClassOf(), PCB_DIM_LEADER::ClassOf(), PCB_DIM_CENTER::ClassOf(), TRACKS_CLEANER::cleanup(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), LIB_SYMBOL::Compare(), EE_GRID_HELPER::computeAnchors(), PCB_GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), BOARD::ConvertKIIDsToCrossReferences(), SCHEMATIC::ConvertKIIDsToRefs(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createLayers(), CONVERT_TOOL::CreateLines(), PCB_BASE_FRAME::CreateNewFootprint(), SCH_DRAWING_TOOLS::createNewText(), ZONE_CREATE_HELPER::createNewZone(), CONVERT_TOOL::CreatePolys(), BOARD_ADAPTER::createTrack(), SCH_SCREEN::DeleteItem(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES(), DIALOG_TEXT_AND_LABEL_PROPERTIES::DIALOG_TEXT_AND_LABEL_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally(), ALIGN_DISTRIBUTE_TOOL::DistributeVertically(), 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(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawVia(), CONNECTION_SUBGRAPH::driverName(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), FOOTPRINT::DuplicateItem(), EDA_ITEM_DESC::EDA_ITEM_DESC(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckBusToNetConflicts(), CONNECTION_GRAPH::ercCheckFloatingWires(), CONNECTION_GRAPH::ercCheckMultipleDrivers(), CONNECTION_GRAPH::ercCheckNoConnects(), DRC_ENGINE::EvalRules(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), NETLIST_EXPORTER_BASE::findNextSymbol(), CADSTAR_ARCHIVE_PARSER::FixTextPositionNoAlignment(), PCB_BASE_FRAME::FocusOnItem(), EDIT_TOOL::FootprintFilter(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), FP_TEXT::FP_TEXT(), PCB_POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), SCH_FIELD::GetBoundingBox(), PCB_TRACK::GetBoundingBox(), SCH_FIELD::GetCanonicalName(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetContextualTextVars(), FOOTPRINT::GetCoverageArea(), CONNECTION_GRAPH::getDefaultConnection(), getDrilledHoleShape(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), SCH_FIELD::GetMenuImage(), getMinDist(), PCB_TRACK::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_FIELD::GetName(), CONNECTIVITY_DATA::GetNetItems(), LIB_SYMBOL::GetNextDrawItem(), PCB_SHAPE::GetParentFootprint(), LIB_SYMBOL::GetPin(), SCH_SYMBOL::GetPinPhysicalPosition(), SCH_FIELD::GetPosition(), KIGFX::SCH_PAINTER::getRenderColor(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), PCB_TRACK::GetSelectMenuText(), DRC_ENGINE::GetShape(), PCB_TEXT::GetShownText(), SCH_FIELD::GetShownText(), SCH_TEXT::GetShownText(), CONVERT_TOOL::getStartEndPoints(), getTopLevelGroup(), PCB_EXPR_TYPE_REF::GetValue(), GROUP_TOOL::Group(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), hash_fp_item(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlightInternal(), BOARD_INSPECTION_TOOL::HighlightItem(), BOARD_INSPECTION_TOOL::highlightNet(), highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), DRC_RTREE::Insert(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), BOARD_INSPECTION_TOOL::InspectDRCError(), ARRAY_CREATOR::Invoke(), isCopper(), CN_ANCHOR::IsDangling(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), PNS_KICAD_IFACE::IsFlashedOnLayer(), CADSTAR_PCB_ARCHIVE_LOADER::isFootprint(), SCH_FIELD::IsHypertext(), isKeepoutZone(), DRC_ENGINE::IsNetTie(), PCB_TRACK::IsNull(), SCH_LINE::IsParallel(), isPlated(), SCH_FIELD::IsReplaceable(), PNS::ROUTER::isStartingPointRoutable(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), PCB_SELECTION_TOOL::itemPassesFilter(), CLIPBOARD_IO::Load(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), CADSTAR_SCH_ARCHIVE_LOADER::loadNets(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), NETLIST_EXPORTER_XML::makeListOfNets(), PCB_POINT_EDITOR::makePoints(), CONVERT_TOOL::makePolysFromSegs(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_FIELD::Matches(), memberOf(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), SCH_EDITOR_CONTROL::nextMatch(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), EDA_3D_CANVAS::OnMouseMove(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_TRACK::cmp_tracks::operator()(), CN_VISITOR::operator()(), PCB_SHAPE::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), SCH_BUS_ENTRY_BASE::operator<(), SCH_JUNCTION::operator<(), SCH_TEXT::operator<(), SCH_FIELD::operator<(), SCH_LINE::operator<(), SCH_SHEET::operator<(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_SYMBOL::operator=(), PAD::PAD(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCB_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), POSITION_RELATIVE_TOOL::PositionRelative(), SCH_FIELD::Print(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), BACK_ANNOTATE::processNetNameChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_GRID_HELPER::queryVisible(), SCH_CONNECTION::recacheName(), SCH_BASE_FRAME::RefreshSelection(), KIGFX::PCB_VIEW::Remove(), EE_RTREE::remove(), FOOTPRINT::Remove(), CN_CONNECTIVITY_ALGO::Remove(), SCH_SCREEN::Remove(), BOARD::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), LIB_SYMBOL::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_FIELD::Replace(), PCB_SELECTION_TOOL::RequestSelection(), SCHEMATIC::ResolveCrossReference(), PCB_PARSER::resolveGroups(), DS_PROXY_UNDO_ITEM::Restore(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_TOOL::Rotate(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), SCH_SEXPR_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_SEXPR_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_SEXPR_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_SEXPR_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SCREEN::Schematic(), SCH_ITEM::Schematic(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_POINT_EDITOR::setAltConstraint(), SCH_FIELD::SetId(), ITEM_PICKER::SetItem(), SCH_FIELD::SetPosition(), DIALOG_TEXT_AND_LABEL_PROPERTIES::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), SCH_FIELD::SwapData(), PCB_GROUP::SwapData(), PCB_TEXT::SwapData(), PCB_TRACK::SwapData(), SCH_SHEET::SwapData(), PCB_ARC::SwapData(), PCB_DIM_ALIGNED::SwapData(), PCB_DIM_ORTHOGONAL::SwapData(), SCH_SYMBOL::SwapData(), PCB_VIA::SwapData(), PCB_DIM_LEADER::SwapData(), PCB_DIM_CENTER::SwapData(), PAD::SwapData(), FOOTPRINT::SwapData(), ZONE::SwapData(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testItemAgainstZones(), ERC_TESTER::TestMultUnitPinConflicts(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), ERC_TESTER::TestPinToPin(), ERC_TESTER::TestSimilarLabels(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), CONNECTIVITY_DATA::TestTrackEndpointDangling(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataToWindow(), PCB_TRACK::TransformShapeWithClearanceToPolygon(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlightInternal(), KIGFX::PCB_VIEW::Update(), SCH_TEXT::UpdateDanglingState(), DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog(), DIALOG_SCH_FIELD_PROPERTIES::UpdateField(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_BASE_FRAME::UpdateItem(), CONNECTION_GRAPH::updateItemConnectivity(), 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(), PCB_TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), SCH_GLOBALLABEL::Visit(), SCH_SHEET::Visit(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem(), and NETLIST_EXPORTER_CADSTAR::writeListOfNets().

◆ ViewBBox()

const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Return the bounding box of the item covering all its layers.

Returns
the current bounding box.

Implements KIGFX::VIEW_ITEM.

Reimplemented in PAD, FOOTPRINT, PCB_DIM_CENTER, EDIT_POINTS, PCB_SHAPE, PCB_DIMENSION_BASE, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, PCB_MARKER, MY_DRAWING, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::POLYGON_ITEM, RATSNEST_VIEW_ITEM, KIGFX::PREVIEW::RULER_ITEM, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 194 of file eda_item.cpp.

195 {
196  // Basic fallback
197  EDA_RECT bbox = GetBoundingBox();
198 
199  return BOX2I( bbox.GetOrigin(), bbox.GetSize() );
200 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
Handle the component boundary box.
Definition: eda_rect.h:42
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
const wxSize GetSize() const
Definition: eda_rect.h:91

References EDA_ITEM::GetBoundingBox(), EDA_RECT::GetOrigin(), and EDA_RECT::GetSize().

Referenced by GERBVIEW_FRAME::GetDocumentExtents(), PCB_DIMENSION_BASE::ViewBBox(), and PCB_SHAPE::ViewBBox().

◆ 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 EDIT_POINTS, DS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, KIGFX::VIEW_OVERLAY, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::PREVIEW::TWO_POINT_ASSISTANT, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, KIGFX::PREVIEW::RULER_ITEM, and RATSNEST_VIEW_ITEM.

Definition at line 111 of file view_item.h.

112  {}

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

◆ ViewGetLayers()

void LIB_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Return the all the layers within the VIEW the object is painted on.

For instance, a PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]is the output layer index array.
aCountis the number of layer indices in aLayers[].

Reimplemented from EDA_ITEM.

Reimplemented in LIB_TEXT.

Definition at line 129 of file lib_item.cpp.

130 {
131  // Basic fallback
132  aCount = 3;
133  aLayers[0] = LAYER_DEVICE;
134  aLayers[1] = LAYER_DEVICE_BACKGROUND;
135  aLayers[2] = LAYER_SELECTION_SHADOWS;
136 }

References LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, and LAYER_SELECTION_SHADOWS.

◆ ViewGetLOD()

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

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

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

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

Reimplemented in FP_ZONE, PAD, FOOTPRINT, PCB_VIA, GERBER_DRAW_ITEM, FP_TEXT, PCB_TRACK, ZONE, PCB_GROUP, and FP_SHAPE.

Definition at line 137 of file view_item.h.

138  {
139  // By default always show the item
140  return 0.0;
141  }

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

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT EDA_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
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 scanTypes[], 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.
scanTypesWhich# KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else #SCAN_CONTINUE, and determined by the inspector.

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

Definition at line 93 of file eda_item.cpp.

94 {
95 #if 0 && defined(DEBUG)
96  std::cout << GetClass().mb_str() << ' ';
97 #endif
98 
99  if( IsType( scanTypes ) )
100  {
101  if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
102  return SEARCH_RESULT::QUIT;
103  }
104 
106 }
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:183
virtual wxString GetClass() const =0
Return the class name.

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

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

Member Data Documentation

◆ m_ArcEnd

◆ m_ArcStart

◆ m_convert

int LIB_ITEM::m_convert
protectedinherited

Shape identification for alternate body styles.

Set 0 if the item is common to all body styles. This is typially used for representing DeMorgan variants in KiCad.

Definition at line 333 of file lib_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::compare(), LIB_ITEM::GetConvert(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::LIB_ITEM(), LIB_SYMBOL::SetConversion(), and LIB_ITEM::SetConvert().

◆ m_editState

int LIB_ARC::m_editState
private

Definition at line 155 of file lib_arc.h.

Referenced by BeginEdit(), CalcEdit(), LIB_ARC(), and SetEditState().

◆ m_fill

◆ m_flags

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

◆ m_isFillable

◆ m_parent

◆ m_Pos

◆ m_Radius

◆ m_status

◆ m_t1

◆ m_t2

◆ m_unit

int LIB_ITEM::m_unit
protectedinherited

Unit identification for multiple parts per package.

Set to 0 if the item is common to all units.

Definition at line 327 of file lib_item.h.

Referenced by LIB_TEXT::Clone(), LIB_ITEM::compare(), LIB_ITEM::GetMsgPanelInfo(), LIB_ITEM::GetUnit(), LIB_ITEM::LIB_ITEM(), LIB_ITEM::SetUnit(), and LIB_SYMBOL::SetUnitCount().

◆ m_Uuid

const KIID EDA_ITEM::m_Uuid
inherited

Definition at line 475 of file eda_item.h.

Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), SCH_SYMBOL::AddHierarchicalReference(), RC_ITEM::AddItem(), SCH_EDIT_FRAME::AnnotateSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), BOOST_FIXTURE_TEST_CASE(), SCH_SHEET_PATH::Cmp(), SCHEMATIC::ConvertRefsToKIIDs(), MICROWAVE_TOOL::createMicrowaveInductor(), DRAWING_TOOL::DrawVia(), LIB_SYMBOL::Duplicate(), BOARD_ITEM::Duplicate(), SCH_ITEM::Duplicate(), FOOTPRINT::Duplicate(), FOOTPRINT::DuplicateItem(), PCB_EDIT_FRAME::ExchangeFootprint(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), BOARD::FillItemMap(), SCH_SHEET_LIST::FillItemMap(), PCB_BASE_FRAME::FocusOnItem(), SCH_EDIT_FRAME::FocusOnItem(), PCB_IO::format(), FormatProbeItem(), SCH_PIN::GetDefaultNetName(), BOARD::GetItem(), SCH_SHEET_LIST::GetItem(), PAD::GetMsgPanelInfo(), DIALOG_BOARD_REANNOTATE::GetNewRefDes(), FP_TEXT::GetParentAsString(), PAD::GetParentAsString(), FP_SHAPE::GetParentAsString(), SCH_REFERENCE::GetPath(), SCH_SCREEN::GetSheets(), SCH_MARKER::GetUUID(), PCB_MARKER::GetUUID(), FIELDS_EDITOR_GRID_DATA_MODEL::groupMatch(), SCH_SHEET_PATH::IsContainedWithin(), LEGACY_PLUGIN::loadFOOTPRINT(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PCB_EDIT_FRAME::LoadFootprints(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), SCH_LEGACY_PLUGIN::loadSymbol(), LEGACY_PLUGIN::loadTrackList(), PNS::LOGGER::Log(), NETLIST_EXPORTER_XML::makeSymbols(), SCH_EDIT_FRAME::mapExistingAnnotation(), SCH_EDITOR_CONTROL::nextMatch(), PCB_TRACK::cmp_tracks::operator()(), PCB_SHAPE::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_pads::operator()(), SCH_ITEM::operator<(), SCH_SYMBOL::operator<(), PAD::PAD(), SCH_SEXPR_PARSER::parseSchSheetInstances(), SCH_EDITOR_CONTROL::Paste(), SCH_SHEET_PATH::PathAsString(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SYMBOL::ReplaceInstanceSheetPath(), PCB_PARSER::resolveGroups(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusEntry(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_EDIT_FRAME::SaveProject(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_REFERENCE::SCH_REFERENCE(), SCH_SHEET::SCH_SHEET(), SCH_SYMBOL::SCH_SYMBOL(), RC_ITEM::SetItems(), SwapItemData(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), testGroupEqual(), SCH_EDITOR_CONTROL::updatePastedSheet(), SCH_EDITOR_CONTROL::updatePastedSymbol(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ m_Width

int LIB_ARC::m_Width
private

Definition at line 154 of file lib_arc.h.

Referenced by GetMsgPanelInfo(), GetPenWidth(), GetWidth(), LIB_ARC(), and SetWidth().


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