KiCad PCB EDA Suite
EDGE_MODULE Class Reference

#include <class_edge_mod.h>

Inheritance diagram for EDGE_MODULE:
DRAWSEGMENT BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 EDGE_MODULE (MODULE *parent, STROKE_T aShape=S_SEGMENT)
 
 ~EDGE_MODULE ()
 
bool IsType (const KICAD_T aScanTypes[]) const override
 Function IsType Checks whether the item is one of the listed types. More...
 
void Move (const wxPoint &aMoveVector) override
 Move an edge of the footprint. More...
 
void Mirror (const wxPoint &aCentre, bool aMirrorAroundXAxis)
 Mirror an edge of the footprint. More...
 
void Rotate (const wxPoint &aRotCentre, double aAngle) override
 Rotate an edge of the footprint. More...
 
void Flip (const wxPoint &aCentre, bool aFlipLeftRight) override
 Flip entity relative to aCentre. More...
 
bool IsParentFlipped () const
 
void SetStart0 (const wxPoint &aPoint)
 
const wxPointGetStart0 () const
 
void SetEnd0 (const wxPoint &aPoint)
 
const wxPointGetEnd0 () const
 
void SetBezier0_C1 (const wxPoint &aPoint)
 
const wxPointGetBezier0_C1 () const
 
void SetBezier0_C2 (const wxPoint &aPoint)
 
const wxPointGetBezier0_C2 () const
 
void SetLocalCoord ()
 Set relative coordinates from draw coordinates. More...
 
void SetDrawCoord ()
 Set draw coordinates (absolute values ) from relative coordinates. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual unsigned int ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
bool IsPolygonFilled () const
 Polygonal shape is not always filled. More...
 
void SetWidth (int aWidth)
 
int GetWidth () const
 
void SetAngle (double aAngle)
 Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees. More...
 
double GetAngle () const
 
void SetType (int aType)
 
int GetType () const
 
void SetShape (STROKE_T aShape)
 
STROKE_T GetShape () const
 
void SetBezControl1 (const wxPoint &aPoint)
 
const wxPointGetBezControl1 () const
 
void SetBezControl2 (const wxPoint &aPoint)
 
const wxPointGetBezControl2 () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
const wxPointGetStart () const
 Function GetStart returns the starting point of the graphic. More...
 
int GetStartY ()
 
int GetStartX ()
 
void SetStart (const wxPoint &aStart)
 
void SetStartY (int y)
 
void SetStartX (int x)
 
const wxPointGetEnd () const
 Function GetEnd returns the ending point of the graphic. More...
 
int GetEndY ()
 
int GetEndX ()
 
void SetEnd (const wxPoint &aEnd)
 
void SetEndY (int y)
 
void SetEndX (int x)
 
wxPoint GetCenter () const override
 Function GetCenter() More...
 
wxPoint GetArcStart () const
 
wxPoint GetArcEnd () const
 
wxPoint GetArcMid () const
 
void GetRectCorners (std::vector< wxPoint > *pts) const
 
double GetArcAngleStart () const
 function GetArcAngleStart() More...
 
int GetRadius () const
 Function GetRadius returns the radius of this item Has meaning only for arc and circle. More...
 
void SetArcStart (const wxPoint &aArcStartPoint)
 Initialize the start arc point. More...
 
void SetCenter (const wxPoint &aCenterPoint)
 For arcs and circles: More...
 
const wxPoint GetFocusPosition () const override
 Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
MODULEGetParentModule () const
 Function GetParentModule returns a pointer to the parent module, or NULL if DRAWSEGMENT does not belong to a module. More...
 
const std::vector< wxPoint > & GetBezierPoints () const
 
const std::vector< wxPointBuildPolyPointsList () const
 Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SHAPE_POLY_SET internal corner buffer to a list of wxPoints, and nothing else, because it duplicates the buffer, that is inefficient to know for instance the corner count. More...
 
int GetPointCount () const
 
SHAPE_POLY_SETGetPolyShape ()
 
const SHAPE_POLY_SETGetPolyShape () const
 
bool IsPolyShapeValid () const
 
void SetPolyShape (const SHAPE_POLY_SET &aShape)
 
void SetBezierPoints (const std::vector< wxPoint > &aPoints)
 
void RebuildBezierToSegmentsPointsList (int aMinSegLen)
 Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has meaning only for S_CURVE DRAW_SEGMENT shape. More...
 
void SetPolyPoints (const std::vector< wxPoint > &aPoints)
 
std::vector< SHAPE * > MakeEffectiveShapes () const
 Makes a set of SHAPE objects representing the DRAWSEGMENT. More...
 
virtual std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Function HitTest tests 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
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
double GetLength () const
 Function GetLength returns the length of the track using the hypotenuse calculation. More...
 
void Move (const VECTOR2I &aMoveVector)
 
void Rotate (const VECTOR2I &aRotCentre, double aAngle)
 
void Flip (const VECTOR2I &aCentre, bool aFlipLeftRight)
 
void Scale (double aScale)
 
void TransformShapeWithClearanceToPolygon (SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aError=ARC_HIGH_DEF, bool ignoreLineWidth=false) const override
 Function TransformShapeWithClearanceToPolygon Convert the draw segment to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void SwapData (BOARD_ITEM *aImage) override
 Swap data between aItem and aImage. More...
 
int GetX () const
 
int GetY () const
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM. More...
 
virtual bool IsOnCopperLayer () const
 
BOARD_ITEM_CONTAINERGetParent () const
 
virtual PCB_LAYER_ID GetLayer () const
 Function GetLayer returns the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides. More...
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
BOARD_ITEMDuplicate () const
 Function Duplicate creates a copy of a BOARD_ITEM. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Function IsOnLayer tests to see if this object is on the given layer. More...
 
bool IsTrack () const
 Function IsTrack tests to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 Function IsLocked. More...
 
virtual void SetLocked (bool aLocked)
 Function SetLocked modifies 'lock' status for of the item. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after removing from its parent if it has one. More...
 
virtual BOARDGetBoard () const
 Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Function GetLayerName returns the name of the PCB layer on which the item resides. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
KICAD_T Type () const
 Function Type() 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 IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag 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 SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
template<typename T >
Get (PROPERTY_BASE *aProperty)
 
template<typename T >
boost::optional< T > Get (const wxString &aProperty)
 

Static Public Member Functions

static bool ClassOf (const EDA_ITEM *aItem)
 
static wxString ShowShape (STROKE_T aShape)
 Function ShowShape converts the enum STROKE_T integer value to a wxString. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs 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)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

wxPoint m_Start0
 Start point or center, relative to module origin, orient 0. More...
 
wxPoint m_End0
 End point, relative to module origin, orient 0. More...
 
wxPoint m_Bezier0_C1
 Bezier Control Point 1, relative to module origin, orient 0. More...
 
wxPoint m_Bezier0_C2
 Bezier Control Point 2, relative to module origin, orient 0. More...
 
const KIID m_Uuid
 

Static Public Attributes

static wxPoint ZeroOffset
 A value of wxPoint(0,0) which can be passed to the Draw() functions. More...
 

Protected Member Functions

void computeArcBBox (EDA_RECT &aBBox) const
 
const std::vector< wxPointbuildBezierToSegmentsPointsList (int aMinSegLen) const
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Static Protected Member Functions

static wxString LayerMaskDescribe (const BOARD *aBoard, LSET aMask)
 Helper function Return a string (to be shown to the user) describing a layer mask. More...
 

Protected Attributes

int m_Width
 thickness of lines ... More...
 
wxPoint m_Start
 Line start point or Circle and Arc center. More...
 
wxPoint m_End
 Line end point or circle and arc start point. More...
 
STROKE_T m_Shape
 Shape: line, Circle, Arc. More...
 
int m_Type
 Used in complex associations ( Dimensions.. ) More...
 
double m_Angle
 Used only for Arcs: Arc angle in 1/10 deg. More...
 
wxPoint m_BezierC1
 Bezier Control Point 1. More...
 
wxPoint m_BezierC2
 Bezier Control Point 2. More...
 
std::vector< wxPointm_BezierPoints
 
SHAPE_POLY_SET m_Poly
 Stores the S_POLYGON shape. More...
 
PCB_LAYER_ID m_Layer
 
STATUS_FLAGS m_Status
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
bool m_forceVisible
 
STATUS_FLAGS m_Flags
 

Detailed Description

Definition at line 44 of file class_edge_mod.h.

Constructor & Destructor Documentation

◆ EDGE_MODULE()

EDGE_MODULE::EDGE_MODULE ( MODULE parent,
STROKE_T  aShape = S_SEGMENT 
)

Definition at line 39 of file class_edge_mod.cpp.

39  :
41 {
42  m_Shape = aShape;
43  m_Angle = 0;
44  m_Layer = F_SilkS;
45 }
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
PCB_LAYER_ID m_Layer
STROKE_T m_Shape
Shape: line, Circle, Arc.
DRAWSEGMENT(BOARD_ITEM *aParent=NULL, KICAD_T idtype=PCB_LINE_T)

References F_SilkS, DRAWSEGMENT::m_Angle, BOARD_ITEM::m_Layer, and DRAWSEGMENT::m_Shape.

Referenced by Clone().

◆ ~EDGE_MODULE()

EDGE_MODULE::~EDGE_MODULE ( )

Definition at line 48 of file class_edge_mod.cpp.

49 {
50 }

Member Function Documentation

◆ buildBezierToSegmentsPointsList()

const std::vector< wxPoint > DRAWSEGMENT::buildBezierToSegmentsPointsList ( int  aMinSegLen) const
protectedinherited

Definition at line 304 of file class_drawsegment.cpp.

305 {
306  std::vector<wxPoint> bezierPoints;
307 
308  // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
309  std::vector<wxPoint> ctrlPoints = { m_Start, m_BezierC1, m_BezierC2, m_End };
310  BEZIER_POLY converter( ctrlPoints );
311  converter.GetPoly( bezierPoints, aMinSegLen );
312 
313  return bezierPoints;
314 }
wxPoint m_BezierC1
Bezier Control Point 1.
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
wxPoint m_BezierC2
Bezier Control Point 2.

References BEZIER_POLY::GetPoly(), DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, and DRAWSEGMENT::m_Start.

Referenced by DRAWSEGMENT::MakeEffectiveShapes(), and DRAWSEGMENT::RebuildBezierToSegmentsPointsList().

◆ BuildPolyPointsList()

const std::vector< wxPoint > DRAWSEGMENT::BuildPolyPointsList ( ) const
inherited

Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SHAPE_POLY_SET internal corner buffer to a list of wxPoints, and nothing else, because it duplicates the buffer, that is inefficient to know for instance the corner count.

Definition at line 1141 of file class_drawsegment.cpp.

1142 {
1143  std::vector<wxPoint> rv;
1144 
1145  if( m_Poly.OutlineCount() )
1146  {
1147  if( m_Poly.COutline( 0 ).PointCount() )
1148  {
1149  for ( auto iter = m_Poly.CIterate(); iter; iter++ )
1150  rv.emplace_back( iter->x, iter->y );
1151  }
1152  }
1153 
1154  return rv;
1155 }
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
int PointCount() const
Function PointCount()
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
const SHAPE_LINE_CHAIN & COutline(int aIndex) const

References SHAPE_POLY_SET::CIterate(), SHAPE_POLY_SET::COutline(), DRAWSEGMENT::m_Poly, SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::PointCount().

Referenced by GRID_HELPER::computeAnchors(), PCB_PARSER::parseD_PAD(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), DRAWSEGMENT::TransformShapeWithClearanceToPolygon(), and POINT_EDITOR::updatePoints().

◆ ClassOf()

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

Definition at line 54 of file class_edge_mod.h.

55  {
56  return aItem && PCB_MODULE_EDGE_T == aItem->Type();
57  }
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_MODULE_EDGE_T, and EDA_ITEM::Type().

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 233 of file base_struct.h.

233 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), LIB_PIN_TOOL::CreateImagePins(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_EDIT_FRAME::DeleteAnnotation(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 245 of file base_struct.h.

246  {
248  DO_NOT_DRAW );
249  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:114
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:125
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:128
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:127
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:123
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:233
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:129
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:122

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 154 of file view_item.h.

155  {
157  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:162
#define NULL

References KIGFX::VIEW_ITEM::m_viewPrivData, and NULL.

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

◆ Clone()

EDA_ITEM * EDGE_MODULE::Clone ( ) const
overridevirtual

Function Clone creates 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 DRAWSEGMENT.

Definition at line 141 of file class_edge_mod.cpp.

142 {
143  return new EDGE_MODULE( *this );
144 }
EDGE_MODULE(MODULE *parent, STROKE_T aShape=S_SEGMENT)

References EDGE_MODULE().

◆ computeArcBBox()

void DRAWSEGMENT::computeArcBBox ( EDA_RECT aBBox) const
protectedinherited

Definition at line 955 of file class_drawsegment.cpp.

956 {
957  // Do not include the center, which is not necessarily
958  // inside the BB of a arc with a small angle
959  aBBox.SetOrigin( m_End );
960 
961  wxPoint end = m_End;
962  RotatePoint( &end, m_Start, -m_Angle );
963  aBBox.Merge( end );
964 
965  // Determine the starting quarter
966  // 0 right-bottom
967  // 1 left-bottom
968  // 2 left-top
969  // 3 right-top
970  unsigned int quarter = 0; // assume right-bottom
971 
972  if( m_End.x < m_Start.x )
973  {
974  if( m_End.y <= m_Start.y )
975  quarter = 2;
976  else // ( m_End.y > m_Start.y )
977  quarter = 1;
978  }
979  else if( m_End.x >= m_Start.x )
980  {
981  if( m_End.y < m_Start.y )
982  quarter = 3;
983  else if( m_End.x == m_Start.x )
984  quarter = 1;
985  }
986 
987  int radius = GetRadius();
988  int angle = (int) GetArcAngleStart() % 900 + m_Angle;
989  bool directionCW = ( m_Angle > 0 ); // Is the direction of arc clockwise?
990 
991  // Make the angle positive, so we go clockwise and merge points belonging to the arc
992  if( !directionCW )
993  {
994  angle = 900 - angle;
995  quarter = ( quarter + 3 ) % 4; // -1 modulo arithmetic
996  }
997 
998  while( angle > 900 )
999  {
1000  switch( quarter )
1001  {
1002  case 0: aBBox.Merge( wxPoint( m_Start.x, m_Start.y + radius ) ); break; // down
1003  case 1: aBBox.Merge( wxPoint( m_Start.x - radius, m_Start.y ) ); break; // left
1004  case 2: aBBox.Merge( wxPoint( m_Start.x, m_Start.y - radius ) ); break; // up
1005  case 3: aBBox.Merge( wxPoint( m_Start.x + radius, m_Start.y ) ); break; // right
1006  }
1007 
1008  if( directionCW )
1009  ++quarter;
1010  else
1011  quarter += 3; // -1 modulo arithmetic
1012 
1013  quarter %= 4;
1014  angle -= 900;
1015  }
1016 }
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
double GetArcAngleStart() const
function GetArcAngleStart()
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)

References PNS::angle(), DRAWSEGMENT::GetArcAngleStart(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::m_Angle, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Start, EDA_RECT::Merge(), RotatePoint(), EDA_RECT::SetOrigin(), wxPoint::x, and wxPoint::y.

Referenced by DRAWSEGMENT::GetBoundingBox(), and DRAWSEGMENT::ViewBBox().

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Function DeleteStructure deletes this object after removing from its parent if it has one.

Definition at line 118 of file class_board_item.cpp.

119 {
120  auto parent = GetParent();
121 
122  if( parent )
123  parent->Remove( this );
124 
125  delete this;
126 }
BOARD_ITEM_CONTAINER * GetParent() const

References BOARD_ITEM::GetParent().

Referenced by BOARD::PadDelete(), and DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

◆ Duplicate()

BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlineinherited

Function Duplicate creates a copy of a BOARD_ITEM.

Definition at line 208 of file class_board_item.h.

209  {
210  EDA_ITEM* dupe = Clone();
211  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
212 
213  return static_cast<BOARD_ITEM*>( dupe );
214  }
virtual EDA_ITEM * Clone() const
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: common.h:68
const KIID m_Uuid
Definition: base_struct.h:162
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References EDA_ITEM::Clone(), and EDA_ITEM::m_Uuid.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), EDIT_TOOL::Duplicate(), GPCB_PLUGIN::FootprintLoad(), PCB_IO::FootprintLoad(), PCB_IO::FootprintSave(), ARRAY_CREATOR::Invoke(), and FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD().

◆ Flip() [1/2]

void EDGE_MODULE::Flip ( const wxPoint aCentre,
bool  aFlipLeftRight 
)
overridevirtual

Flip entity relative to aCentre.

The item is mirrored, and layer changed to the paired corresponding layer if it is on a paired layer. This function should be called only from MODULE::Flip because it is not usual to flip an item alone, without flipping the parent footprint (consider Mirror() instead).

Reimplemented from DRAWSEGMENT.

Definition at line 147 of file class_edge_mod.cpp.

148 {
149  wxPoint pt( 0, 0 );
150 
151  switch( GetShape() )
152  {
153  case S_ARC:
154  SetAngle( -GetAngle() );
156 
157  default:
158  case S_SEGMENT:
159  case S_CURVE:
160  // If Start0 and Start are equal (ie: ModEdit), then flip both sets around the
161  // centre point.
162  if( m_Start == m_Start0 )
163  pt = aCentre;
164 
165  if( aFlipLeftRight )
166  {
167  MIRROR( m_Start.x, aCentre.x );
168  MIRROR( m_End.x, aCentre.x );
169  MIRROR( m_BezierC1.x, aCentre.x );
170  MIRROR( m_BezierC2.x, aCentre.x );
171  MIRROR( m_Start0.x, pt.x );
172  MIRROR( m_End0.x, pt.x );
173  MIRROR( m_Bezier0_C1.x, pt.x );
174  MIRROR( m_Bezier0_C2.x, pt.x );
175  }
176  else
177  {
178  MIRROR( m_Start.y, aCentre.y );
179  MIRROR( m_End.y, aCentre.y );
180  MIRROR( m_BezierC1.y, aCentre.y );
181  MIRROR( m_BezierC2.y, aCentre.y );
182  MIRROR( m_Start0.y, pt.y );
183  MIRROR( m_End0.y, pt.y );
184  MIRROR( m_Bezier0_C1.y, pt.y );
185  MIRROR( m_Bezier0_C2.y, pt.y );
186  }
187 
189  break;
190 
191  case S_POLYGON:
192  // polygon corners coordinates are relative to the footprint position, orientation 0
193  m_Poly.Mirror( aFlipLeftRight, !aFlipLeftRight );
194  break;
195  }
196 
197  // DRAWSEGMENT items are not usually on copper layers, but it can happen in microwave apps.
198  // However, currently, only on Front or Back layers.
199  // So the copper layers count is not taken in account
200  SetLayer( FlipLayer( GetLayer() ) );
201 }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.
#define KI_FALLTHROUGH
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
STROKE_T GetShape() const
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
usual segment : line with rounded ends
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
wxPoint m_End0
End point, relative to module origin, orient 0.
wxPoint m_BezierC1
Bezier Control Point 1.
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
Arcs (with rounded ends)
Bezier Curve.
double GetAngle() const
wxPoint m_BezierC2
Bezier Control Point 2.
void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
int m_Width
thickness of lines ...
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References FlipLayer(), DRAWSEGMENT::GetAngle(), BOARD_ITEM::GetLayer(), DRAWSEGMENT::GetShape(), KI_FALLTHROUGH, m_Bezier0_C1, m_Bezier0_C2, DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, m_End0, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Start, m_Start0, DRAWSEGMENT::m_Width, MIRROR(), SHAPE_POLY_SET::Mirror(), DRAWSEGMENT::RebuildBezierToSegmentsPointsList(), S_ARC, S_CURVE, S_POLYGON, S_SEGMENT, DRAWSEGMENT::SetAngle(), BOARD_ITEM::SetLayer(), wxPoint::x, and wxPoint::y.

◆ Flip() [2/2]

void BOARD_ITEM::Flip ( const VECTOR2I aCentre,
bool  aFlipLeftRight 
)
inlineinherited

Definition at line 324 of file class_board_item.h.

325  {
326  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
327  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Function Flip Flip this object, i.e.

References BOARD_ITEM::Flip(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 84 of file inspectable.h.

85  {
87  TYPE_ID thisType = TYPE_HASH( *this );
88  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
89  return object ? aProperty->getter( object ) : wxAny();
90  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual wxAny getter(void *aObject) const =0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns type-id of the Owner class.

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

Referenced by 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 93 of file inspectable.h.

94  {
96  TYPE_ID thisType = TYPE_HASH( *this );
97  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
98  return object ? aProperty->get<T>( object ) : T();
99  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns 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 102 of file inspectable.h.

103  {
105  TYPE_ID thisType = TYPE_HASH( *this );
106  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
107  boost::optional<T> ret;
108 
109  if( prop )
110  {
111  void* object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
112 
113  if( object )
114  ret = prop->get<T>( object );
115  }
116 
117  return ret;
118  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
T get(void *aObject)
Definition: property.h:273
virtual size_t OwnerHash() const =0
Returns 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().

◆ GetAngle()

◆ GetArcAngleStart()

double DRAWSEGMENT::GetArcAngleStart ( ) const
inherited

function GetArcAngleStart()

Returns
the angle of the starting point of this arc, between 0 and 3600 in 0.1 deg

Definition at line 392 of file class_drawsegment.cpp.

393 {
394  // due to the Y axis orient atan2 needs - y value
395  double angleStart = ArcTangente( GetArcStart().y - GetCenter().y,
396  GetArcStart().x - GetCenter().x );
397 
398  // Normalize it to 0 ... 360 deg, to avoid discontinuity for angles near 180 deg
399  // because 180 deg and -180 are very near angles when ampping betewwen -180 ... 180 deg.
400  // and this is not easy to handle in calculations
401  NORMALIZE_ANGLE_POS( angleStart );
402 
403  return angleStart;
404 }
wxPoint GetArcStart() const
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:257
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162
wxPoint GetCenter() const override
Function GetCenter()

References ArcTangente(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), and NORMALIZE_ANGLE_POS().

Referenced by DRAWSEGMENT::computeArcBBox(), KIGFX::PCB_PAINTER::draw(), and DRAWSEGMENT::HitTest().

◆ GetArcEnd()

wxPoint DRAWSEGMENT::GetArcEnd ( ) const
inherited

Definition at line 348 of file class_drawsegment.cpp.

349 {
350  wxPoint endPoint( m_End ); // start of arc
351 
352  switch( m_Shape )
353  {
354  case S_ARC:
355  // rotate the starting point of the arc, given by m_End, through the
356  // angle m_Angle to get the ending point of the arc.
357  // m_Start is the arc centre
358  endPoint = m_End; // m_End = start point of arc
359  RotatePoint( &endPoint, m_Start, -m_Angle );
360  break;
361 
362  default:
363  break;
364  }
365 
366  return endPoint; // after rotation, the end of the arc.
367 }
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.

References DRAWSEGMENT::m_Angle, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, RotatePoint(), and S_ARC.

Referenced by GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), findPoint(), EDIT_POINTS_FACTORY::Make(), POINT_EDITOR::updateItem(), and POINT_EDITOR::updatePoints().

◆ GetArcMid()

wxPoint DRAWSEGMENT::GetArcMid ( ) const
inherited

Definition at line 370 of file class_drawsegment.cpp.

371 {
372  wxPoint endPoint( m_End );
373 
374  switch( m_Shape )
375  {
376  case S_ARC:
377  // rotate the starting point of the arc, given by m_End, through half
378  // the angle m_Angle to get the middle of the arc.
379  // m_Start is the arc centre
380  endPoint = m_End; // m_End = start point of arc
381  RotatePoint( &endPoint, m_Start, -m_Angle / 2.0 );
382  break;
383 
384  default:
385  break;
386  }
387 
388  return endPoint; // after rotation, the end of the arc.
389 }
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.

References DRAWSEGMENT::m_Angle, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, RotatePoint(), and S_ARC.

Referenced by EDIT_POINTS_FACTORY::Make(), POINT_EDITOR::updateItem(), and POINT_EDITOR::updatePoints().

◆ GetArcStart()

◆ GetBezControl1()

◆ GetBezControl2()

◆ GetBezier0_C1()

const wxPoint& EDGE_MODULE::GetBezier0_C1 ( ) const
inline

Definition at line 115 of file class_edge_mod.h.

115 { return m_Bezier0_C1; }
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.

References m_Bezier0_C1.

Referenced by PCB_IO::format().

◆ GetBezier0_C2()

const wxPoint& EDGE_MODULE::GetBezier0_C2 ( ) const
inline

Definition at line 118 of file class_edge_mod.h.

118 { return m_Bezier0_C2; }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.

References m_Bezier0_C2.

Referenced by PCB_IO::format().

◆ GetBezierPoints()

const std::vector<wxPoint>& DRAWSEGMENT::GetBezierPoints ( ) const
inlineinherited

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 48 of file class_board_item.cpp.

49 {
50  if( Type() == PCB_T )
51  return (BOARD*) this;
52 
53  BOARD_ITEM* parent = GetParent();
54 
55  if( parent )
56  return parent->GetBoard();
57 
58  return NULL;
59 }
Definition: typeinfo.h:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
#define NULL
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
BOARD_ITEM_CONTAINER * GetParent() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParent(), NULL, PCB_T, and EDA_ITEM::Type().

Referenced by D_PAD::BuildEffectiveShapes(), ZONE_CONTAINER::BuildSmoothedPoly(), checkClearancePadToPad(), checkClearanceSegmToPad(), TEXTE_PCB::Flip(), TRACK::Flip(), ARC::Flip(), VIA::Flip(), ZONE_CONTAINER::Flip(), BOARD_ITEM::GetBoard(), MODULE::GetBoundingPoly(), BOARD_CONNECTED_ITEM::GetClearance(), GetConstraint(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE_CONTAINER::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), VIA::GetSelectMenuText(), D_PAD::GetSelectMenuText(), ZONE_CONTAINER::GetSelectMenuText(), D_PAD::GetSolderMaskMargin(), D_PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), insideArea(), insideCourtyard(), D_PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD_CONNECTED_ITEM::SetNetCode(), ZONE_CONTAINER::TransformOutlinesShapeWithClearanceToPolygon(), ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(), MODULE::ViewBBox(), and D_PAD::ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT DRAWSEGMENT::GetBoundingBox ( ) const
overridevirtualinherited

Function GetBoundingBox returns 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 524 of file class_drawsegment.cpp.

525 {
526  EDA_RECT bbox;
527 
528  bbox.SetOrigin( m_Start );
529 
530  switch( m_Shape )
531  {
532  case S_RECT:
533  {
534  std::vector<wxPoint> pts;
535  GetRectCorners( &pts );
536 
537  bbox = EDA_RECT(); // re-init for merging
538 
539  for( wxPoint& pt : pts )
540  bbox.Merge( pt );
541  }
542  break;
543 
544  case S_SEGMENT:
545  bbox.SetEnd( m_End );
546  break;
547 
548  case S_CIRCLE:
549  bbox.Inflate( GetRadius() );
550  break;
551 
552  case S_ARC:
553  computeArcBBox( bbox );
554  break;
555 
556  case S_POLYGON:
557  if( m_Poly.IsEmpty() )
558  break;
559  {
560  MODULE* module = GetParentModule();
561  bbox = EDA_RECT(); // re-init for merging
562 
563  for( auto iter = m_Poly.CIterate(); iter; iter++ )
564  {
565  wxPoint pt ( iter->x, iter->y );
566 
567  if( module ) // Transform, if we belong to a module
568  {
569  RotatePoint( &pt, module->GetOrientation() );
570  pt += module->GetPosition();
571  }
572 
573  bbox.Merge( pt );
574  }
575  }
576  break;
577 
578  case S_CURVE:
579  bbox.Merge( m_BezierC1 );
580  bbox.Merge( m_BezierC2 );
581  bbox.Merge( m_End );
582  break;
583 
584  default:
585  wxFAIL_MSG( "DRAWSEGMENT::GetBoundingBox not implemented for "
586  + STROKE_T_asString( m_Shape ) );
587  break;
588  }
589 
590  bbox.Inflate( ((m_Width+1) / 2) + 1 );
591  bbox.Normalize();
592 
593  return bbox;
594 }
double GetOrientation() const
Definition: class_module.h:221
void Merge(const EDA_RECT &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
usual segment : line with rounded ends
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_BezierC1
Bezier Control Point 1.
segment with non rounded ends
wxPoint m_Start
Line start point or Circle and Arc center.
void computeArcBBox(EDA_RECT &aBBox) const
wxPoint m_End
Line end point or circle and arc start point.
void SetEnd(int x, int y)
Definition: eda_rect.h:192
Arcs (with rounded ends)
MODULE * GetParentModule() const
Function GetParentModule returns a pointer to the parent module, or NULL if DRAWSEGMENT does not belo...
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
void Normalize()
Function Normalize ensures that the height ant width are positive.
static wxString STROKE_T_asString(STROKE_T a)
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxPoint m_BezierC2
Bezier Control Point 2.
wxPoint GetPosition() const override
Definition: class_module.h:216
int m_Width
thickness of lines ...
void GetRectCorners(std::vector< wxPoint > *pts) const
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.

References SHAPE_POLY_SET::CIterate(), DRAWSEGMENT::computeArcBBox(), MODULE::GetOrientation(), DRAWSEGMENT::GetParentModule(), MODULE::GetPosition(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetRectCorners(), EDA_RECT::Inflate(), SHAPE_POLY_SET::IsEmpty(), DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, DRAWSEGMENT::m_Width, EDA_RECT::Merge(), EDA_RECT::Normalize(), RotatePoint(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), and STROKE_T_asString().

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::HitTest(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), and DRC::testCopperDrawItem().

◆ GetCenter()

wxPoint DRAWSEGMENT::GetCenter ( ) const
overridevirtualinherited

Function GetCenter()

This defaults to the same point as returned by GetPosition(), unless overridden

Returns
centre point of the item

Reimplemented from BOARD_ITEM.

Definition at line 317 of file class_drawsegment.cpp.

318 {
319  wxPoint c;
320 
321  switch( m_Shape )
322  {
323  case S_ARC:
324  case S_CIRCLE:
325  c = m_Start;
326  break;
327 
328  case S_SEGMENT:
329  // Midpoint of the line
330  c = ( GetStart() + GetEnd() ) / 2;
331  break;
332 
333  case S_POLYGON:
334  case S_RECT:
335  case S_CURVE:
336  c = GetBoundingBox().Centre();
337  break;
338 
339  default:
340  wxFAIL_MSG( "DRAWSEGMENT::GetCentre not implemented for " + STROKE_T_asString( m_Shape ) );
341  break;
342  }
343 
344  return c;
345 }
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
segment with non rounded ends
wxPoint m_Start
Line start point or Circle and Arc center.
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.
Bezier Curve.
static wxString STROKE_T_asString(STROKE_T a)
wxPoint Centre() const
Definition: eda_rect.h:62
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References EDA_RECT::Centre(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::GetEnd(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, and STROKE_T_asString().

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), GRAPHICS_CLEANER::areEquivalent(), GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), export_vrml_drawsegment(), DRAWSEGMENT::GetArcAngleStart(), DRAWSEGMENT::GetFocusPosition(), DRAWSEGMENT::HitTest(), idf_export_outline(), GRAPHICS_CLEANER::isNullSegment(), EDIT_POINTS_FACTORY::Make(), DRAWSEGMENT::MakeEffectiveShapes(), EAGLE_PLUGIN::packageRectangle(), PCB_PARSER::parseD_PAD(), DRAWSEGMENT::TransformShapeWithClearanceToPolygon(), POINT_EDITOR::updateItem(), and POINT_EDITOR::updatePoints().

◆ GetClass()

wxString EDGE_MODULE::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from DRAWSEGMENT.

Definition at line 135 of file class_edge_mod.h.

136  {
137  return wxT( "MGRAPHIC" );
138  }

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

238  {
239  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
241 
242  return m_Flags & mask;
243  }
#define IS_NEW
New item, just created.
Definition: base_struct.h:117
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:126
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: base_struct.h:130
#define IS_MOVED
Item being moved.
Definition: base_struct.h:116

References IS_DRAGGED, IS_MOVED, IS_NEW, IS_PASTED, IS_RESIZED, IS_WIRE_IMAGE, EDA_ITEM::m_Flags, and STRUCT_DELETED.

Referenced by SCH_EDIT_TOOL::ChangeTextType(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), LIB_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_COMPONENT::GetMsgPanelInfo(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetEffectiveShape()

std::shared_ptr< SHAPE > DRAWSEGMENT::GetEffectiveShape ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER) const
overridevirtualinherited

Function GetEffectiveShape Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.

This routine returns a COMPOUND shape (set of simple shapes which make up the pad fod use with routing, collision determiniation, etc).

Note that this list can contain a SHAPE_SIMPLE (a simple single-outline non-intersecting polygon), but should never contain a SHAPE_POLY_SET (a complex polygon consisting of multiple outlines and/or holes).

Parameters
aLayerin case of items spanning multiple layers, only the shapes belonging to aLayer will be returned. Pass UNDEFINED_LAYER to return shapes for all layers.

Reimplemented from BOARD_ITEM.

Definition at line 1135 of file class_drawsegment.cpp.

1136 {
1137  return std::shared_ptr<SHAPE>( new SHAPE_COMPOUND( MakeEffectiveShapes() ) );
1138 }
std::vector< SHAPE * > MakeEffectiveShapes() const
Makes a set of SHAPE objects representing the DRAWSEGMENT.

References DRAWSEGMENT::MakeEffectiveShapes().

Referenced by test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem().

◆ GetEnd()

◆ GetEnd0()

const wxPoint& EDGE_MODULE::GetEnd0 ( ) const
inline

Definition at line 112 of file class_edge_mod.h.

112 { return m_End0; }
wxPoint m_End0
End point, relative to module origin, orient 0.

References m_End0.

Referenced by FootprintWriteShape(), PCB_IO::format(), hash_eda(), DSN::SPECCTRA_DB::makeIMAGE(), and GPCB_FPL_CACHE::parseMODULE().

◆ GetEndX()

int DRAWSEGMENT::GetEndX ( )
inlineinherited

Definition at line 146 of file class_drawsegment.h.

146 { return m_End.x; }
wxPoint m_End
Line end point or circle and arc start point.

References DRAWSEGMENT::m_End, and wxPoint::x.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC().

◆ GetEndY()

int DRAWSEGMENT::GetEndY ( )
inlineinherited

Definition at line 145 of file class_drawsegment.h.

145 { return m_End.y; }
wxPoint m_End
Line end point or circle and arc start point.

References DRAWSEGMENT::m_End, and wxPoint::y.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC().

◆ GetFlags()

◆ GetFocusPosition()

const wxPoint DRAWSEGMENT::GetFocusPosition ( ) const
inlineoverridevirtualinherited

Function GetFocusPosition similar to GetPosition, but allows items to return their visual center rather than their anchor.

Reimplemented from EDA_ITEM.

Definition at line 191 of file class_drawsegment.h.

192  {
193  return GetCenter();
194  }
wxPoint GetCenter() const override
Function GetCenter()

References DRAWSEGMENT::GetCenter().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Function GetLayer returns the primary layer this item is on.

Reimplemented in ZONE_CONTAINER.

Definition at line 180 of file class_board_item.h.

180 { return m_Layer; }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer(), DIMENSION::AdjustDimensionDetails(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanupSegments(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), CreateRoutesSection(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DRC::doPadToPadsDrc(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::Exchange_Module(), export_vrml_drawsegment(), export_vrml_edge_module(), export_vrml_module(), export_vrml_pcbtext(), export_vrml_text_module(), export_vrml_tracks(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DIMENSION::Flip(), DRAWSEGMENT::Flip(), MODULE::Flip(), ARC::Flip(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::formatLayer(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), BOARD_CONNECTED_ITEM::GetClearance(), ZONE_CONTAINER::GetLayer(), test::DRC_TEST_PROVIDER_CLEARANCE_BASE::getLocation(), DRC::GetLocation(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), D_PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalModulePlacement(), BOARD::GetPad(), TEXT_MOD_GRID_TABLE::GetValueAsLong(), SELECTION_TOOL::GuessSelectionCandidates(), idf_export_module(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), D_PAD::IsFlipped(), BOARD_ITEM::IsOnCopperLayer(), IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), TRACK::cmp_tracks::operator()(), DRAWSEGMENT::cmp_drawings::operator()(), BOARD_ITEM::ptr_cmp::operator()(), MODULE::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotTextePcb(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), SELECTION_TOOL::Selectable(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperTextAndGraphics(), DRC::testCopperTextAndGraphics(), DRC::testDisabledLayers(), AR_AUTOPLACER::testModuleOnBoard(), DRC::testPadClearances(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), MODULE::TransformGraphicShapesWithClearanceToPolygonSet(), TRACK::ViewBBox(), TRACK::ViewGetLayers(), TEXTE_MODULE::ViewGetLayers(), TEXTE_MODULE::ViewGetLOD(), MODULE_ZONE_CONTAINER::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Function GetLayerName returns the name of the PCB layer on which the item resides.

Returns
wxString containing the layer name associated with this item.

Definition at line 62 of file class_board_item.cpp.

63 {
64  BOARD* board = GetBoard();
65 
66  if( board )
67  return board->GetLayerName( m_Layer );
68 
69  // If no parent, return standard name
71 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
PCB_LAYER_ID m_Layer
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Function GetStandardLayerName returns an "English Standard" name of a PCB layer when given aLayerNumb...
Definition: class_board.h:650

References BOARD_ITEM::GetBoard(), BOARD::GetLayerName(), BOARD::GetStandardLayerName(), and BOARD_ITEM::m_Layer.

Referenced by PCB_IO::format(), PCB_IO::formatLayer(), TEXTE_PCB::GetMsgPanelInfo(), TEXTE_MODULE::GetMsgPanelInfo(), DRAWSEGMENT::GetMsgPanelInfo(), TEXTE_PCB::GetSelectMenuText(), GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION::GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXT_MOD_GRID_TABLE::GetValue(), MODULE::ResolveTextVar(), and DRC::testDisabledLayers().

◆ GetLayerSet()

virtual LSET BOARD_ITEM::GetLayerSet ( ) const
inlinevirtualinherited

Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segment or VIA physically resides.

Returns
int - a layer mask, see layers_id_colors_visibility.h.

Reimplemented in VIA, D_PAD, and ZONE_CONTAINER.

Definition at line 188 of file class_board_item.h.

188 { return LSET( m_Layer ); }
PCB_LAYER_ID m_Layer
LSET is a set of PCB_LAYER_IDs.

References BOARD_ITEM::m_Layer.

Referenced by GRID_HELPER::BestSnapAnchor(), build_pad_testpoints(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), DRAWING_TOOL::DrawVia(), hash_board_item(), and CN_VISITOR::operator()().

◆ GetLength()

double DRAWSEGMENT::GetLength ( ) const
inherited

Function GetLength returns the length of the track using the hypotenuse calculation.

Returns
double - the length of the track

Definition at line 76 of file class_drawsegment.cpp.

77 {
78  double length = 0.0;
79 
80  switch( m_Shape )
81  {
82  case S_CURVE:
83  for( size_t ii = 1; ii < m_BezierPoints.size(); ++ii )
84  length += GetLineLength( m_BezierPoints[ii - 1], m_BezierPoints[ii] );
85 
86  break;
87 
88  case S_SEGMENT:
89  length = GetLineLength( GetStart(), GetEnd() );
90  break;
91 
92  default:
93  wxASSERT_MSG( false, "DRAWSEGMENT::GetLength not implemented for shape"
94  + ShowShape( GetShape() ) );
95  break;
96  }
97 
98  return length;
99 }
static wxString ShowShape(STROKE_T aShape)
Function ShowShape converts the enum STROKE_T integer value to a wxString.
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:206
STROKE_T GetShape() const
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
STROKE_T m_Shape
Shape: line, Circle, Arc.
Bezier Curve.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
std::vector< wxPoint > m_BezierPoints

References DRAWSEGMENT::GetEnd(), GetLineLength(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::m_BezierPoints, DRAWSEGMENT::m_Shape, S_CURVE, S_SEGMENT, and BOARD_ITEM::ShowShape().

Referenced by DRAWSEGMENT::GetMsgPanelInfo().

◆ GetMenuImage()

BITMAP_DEF EDGE_MODULE::GetMenuImage ( ) const
overridevirtual

Function GetMenuImage returns 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 DRAWSEGMENT.

Definition at line 135 of file class_edge_mod.cpp.

136 {
137  return show_mod_edge_xpm;
138 }
const BITMAP_OPAQUE show_mod_edge_xpm[1]

References show_mod_edge_xpm.

◆ GetMsgPanelInfo()

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

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Parameters
aListis the list to populate.

Reimplemented from DRAWSEGMENT.

Definition at line 105 of file class_edge_mod.cpp.

106 {
107  wxString msg;
108 
109  MODULE* module = (MODULE*) m_Parent;
110 
111  if( !module )
112  return;
113 
114  BOARD* board = (BOARD*) module->GetParent();
115 
116  if( !board )
117  return;
118 
119  aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
120 
121  // append the features shared with the base class
122  DRAWSEGMENT::GetMsgPanelInfo( aFrame, aList );
123 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
const wxString GetReference() const
Function GetReference.
Definition: class_module.h:444
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
BOARD_ITEM_CONTAINER * GetParent() const

References _, DARKCYAN, DRAWSEGMENT::GetMsgPanelInfo(), BOARD_ITEM::GetParent(), MODULE::GetReference(), and EDA_ITEM::m_Parent.

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 174 of file class_board_item.h.

174 { return (BOARD_ITEM_CONTAINER*) m_Parent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
Abstract interface for BOARD_ITEMs capable of storing other items inside.

References EDA_ITEM::m_Parent.

Referenced by POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), BOARD_ITEM::DeleteStructure(), 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::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), EditToolSelectionFilter(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), MARKER_PCB::GetColorLayer(), GetMsgPanelInfo(), GetSelectMenuText(), TEXTE_MODULE::GetSelectMenuText(), TEXTE_PCB::GetShownText(), TEXTE_MODULE::GetShownText(), SELECTION_TOOL::GuessSelectionCandidates(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), IsParentFlipped(), TEXTE_MODULE::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), SwapItemData(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem(), DRC::testCopperDrawItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), MARKER_PCB::ViewGetLayers(), MODULE_ZONE_CONTAINER::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentModule()

MODULE * DRAWSEGMENT::GetParentModule ( ) const
inherited

Function GetParentModule returns a pointer to the parent module, or NULL if DRAWSEGMENT does not belong to a module.

Returns
MODULE* - pointer to the parent module or NULL.

Definition at line 414 of file class_drawsegment.cpp.

415 {
416  if( !m_Parent || m_Parent->Type() != PCB_MODULE_T )
417  return NULL;
418 
419  return (MODULE*) m_Parent;
420 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
class MODULE, a footprint
Definition: typeinfo.h:89
#define NULL
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References EDA_ITEM::m_Parent, NULL, PCB_MODULE_T, and EDA_ITEM::Type().

Referenced by ConvertOutlineToPolygon(), KIGFX::PCB_PAINTER::draw(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::GetRectCorners(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ GetPointCount()

int DRAWSEGMENT::GetPointCount ( ) const
inherited
Returns
the number of corners of the polygonal shape

Definition at line 1170 of file class_drawsegment.cpp.

1171 {
1172  // return the number of corners of the polygonal shape
1173  // this shape is expected to be only one polygon without hole
1174  if( GetPolyShape().OutlineCount() )
1175  return GetPolyShape().VertexCount( 0 );
1176 
1177  return 0;
1178 }
int VertexCount(int aOutline=-1, int aHole=-1) const
Returns the number of vertices in a given outline/hole
SHAPE_POLY_SET & GetPolyShape()

References DRAWSEGMENT::GetPolyShape(), and SHAPE_POLY_SET::VertexCount().

Referenced by GRAPHICS_CLEANER::isNullSegment().

◆ GetPolyShape() [1/2]

◆ GetPolyShape() [2/2]

const SHAPE_POLY_SET& DRAWSEGMENT::GetPolyShape ( ) const
inlineinherited

Definition at line 220 of file class_drawsegment.h.

220 { return m_Poly; }
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.

References DRAWSEGMENT::m_Poly.

◆ GetPosition()

wxPoint DRAWSEGMENT::GetPosition ( ) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 67 of file class_drawsegment.cpp.

68 {
69  if( m_Shape == S_POLYGON )
70  return (wxPoint) m_Poly.CVertex( 0 );
71  else
72  return m_Start;
73 }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
wxPoint m_Start
Line start point or Circle and Arc center.
STROKE_T m_Shape
Shape: line, Circle, Arc.

References SHAPE_POLY_SET::CVertex(), DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, and S_POLYGON.

Referenced by ConvertOutlineToPolygon().

◆ GetRadius()

int DRAWSEGMENT::GetRadius ( ) const
inlineinherited

Function GetRadius returns the radius of this item Has meaning only for arc and circle.

Definition at line 172 of file class_drawsegment.h.

173  {
174  double radius = GetLineLength( m_Start, m_End );
175 
176  // don't allow degenerate arcs
177  return std::max( 1, KiROUND( radius ) );
178  }
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:206
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
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:68

References GetLineLength(), KiROUND(), DRAWSEGMENT::m_End, and DRAWSEGMENT::m_Start.

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), DRAWSEGMENT::computeArcBBox(), ConvertOutlineToPolygon(), KIGFX::PCB_PAINTER::draw(), DRAWSEGMENT::GetBoundingBox(), hash_eda(), DRAWSEGMENT::HitTest(), idf_export_outline(), GRAPHICS_CLEANER::isNullSegment(), DRAWSEGMENT::MakeEffectiveShapes(), PCB_PARSER::parseD_PAD(), DRAWSEGMENT::Scale(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ GetRectCorners()

void DRAWSEGMENT::GetRectCorners ( std::vector< wxPoint > *  pts) const
inherited

Definition at line 921 of file class_drawsegment.cpp.

922 {
923  MODULE* module = GetParentModule();
924  wxPoint topLeft = GetStart();
925  wxPoint botRight = GetEnd();
926 
927  // Un-rotate rect topLeft and botRight
928  if( module && KiROUND( module->GetOrientation() ) % 900 != 0 )
929  {
930  topLeft -= module->GetPosition();
931  RotatePoint( &topLeft, -module->GetOrientation() );
932 
933  botRight -= module->GetPosition();
934  RotatePoint( &botRight, -module->GetOrientation() );
935  }
936 
937  // Set up the un-rotated 4 corners
938  pts->emplace_back( topLeft );
939  pts->emplace_back( botRight.x, topLeft.y );
940  pts->emplace_back( botRight );
941  pts->emplace_back( topLeft.x, botRight.y );
942 
943  // Now re-rotate the 4 corners to get a diamond
944  if( module && KiROUND( module->GetOrientation() ) % 900 != 0 )
945  {
946  for( wxPoint& pt : *pts )
947  {
948  RotatePoint( &pt,module->GetOrientation() );
949  pt += module->GetPosition();
950  }
951  }
952 }
double GetOrientation() const
Definition: class_module.h:221
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
MODULE * GetParentModule() const
Function GetParentModule returns a pointer to the parent module, or NULL if DRAWSEGMENT does not belo...
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:68
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
wxPoint GetPosition() const override
Definition: class_module.h:216

References DRAWSEGMENT::GetEnd(), MODULE::GetOrientation(), DRAWSEGMENT::GetParentModule(), MODULE::GetPosition(), DRAWSEGMENT::GetStart(), KiROUND(), RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by BOARD_ADAPTER::AddShapeWithClearanceToContainer(), ConvertOutlineToPolygon(), KIGFX::PCB_PAINTER::draw(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::HitTest(), DRAWSEGMENT::MakeEffectiveShapes(), BRDITEMS_PLOTTER::PlotDrawSegment(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ GetSelectMenuText()

wxString EDGE_MODULE::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Function GetSelectMenuText returns 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 DRAWSEGMENT.

Definition at line 126 of file class_edge_mod.cpp.

127 {
128  return wxString::Format( _( "Graphic %s of %s on %s" ),
129  ShowShape( m_Shape ),
130  ((MODULE*) GetParent())->GetReference(),
131  GetLayerName() );
132 }
static wxString ShowShape(STROKE_T aShape)
Function ShowShape converts the enum STROKE_T integer value to a wxString.
STROKE_T m_Shape
Shape: line, Circle, Arc.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:33
BOARD_ITEM_CONTAINER * GetParent() const
wxString GetLayerName() const
Function GetLayerName returns the name of the PCB layer on which the item resides.

References _, Format(), BOARD_ITEM::GetLayerName(), BOARD_ITEM::GetParent(), DRAWSEGMENT::m_Shape, and BOARD_ITEM::ShowShape().

◆ GetShape()

◆ GetStart()

◆ GetStart0()

const wxPoint& EDGE_MODULE::GetStart0 ( ) const
inline

Definition at line 109 of file class_edge_mod.h.

109 { return m_Start0; }
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.

References m_Start0.

Referenced by FootprintWriteShape(), PCB_IO::format(), hash_eda(), and DSN::SPECCTRA_DB::makeIMAGE().

◆ GetStartX()

int DRAWSEGMENT::GetStartX ( )
inlineinherited

Definition at line 135 of file class_drawsegment.h.

135 { return m_Start.x; }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start, and wxPoint::x.

◆ GetStartY()

int DRAWSEGMENT::GetStartY ( )
inlineinherited

Definition at line 134 of file class_drawsegment.h.

134 { return m_Start.y; }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start, and wxPoint::y.

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 216 of file base_struct.h.

217  {
218  return m_Status & type;
219  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by TRACK::GetMsgPanelInfoBase_Common(), and TRACK::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 229 of file base_struct.h.

229 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetType()

int DRAWSEGMENT::GetType ( ) const
inlineinherited

Definition at line 115 of file class_drawsegment.h.

115 { return m_Type; }
int m_Type
Used in complex associations ( Dimensions.. )

References DRAWSEGMENT::m_Type.

Referenced by hash_eda().

◆ GetWidth()

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ HasFlag()

◆ HitTest() [1/2]

bool DRAWSEGMENT::HitTest ( const wxPoint aPosition,
int  aAccuracy = 0 
) const
overridevirtualinherited

Function HitTest tests 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 597 of file class_drawsegment.cpp.

598 {
599  int maxdist = aAccuracy + ( m_Width / 2 );
600 
601  switch( m_Shape )
602  {
603  case S_CIRCLE:
604  {
605  int radius = GetRadius();
606  int dist = KiROUND( EuclideanNorm( aPosition - GetCenter() ) );
607 
608  if( m_Width == 0 ) // Filled circle hit-test
609  {
610  if( dist <= radius + maxdist )
611  return true;
612  }
613  else // Ring hit-test
614  {
615  if( abs( radius - dist ) <= maxdist )
616  return true;
617  }
618  }
619  break;
620 
621  case S_ARC:
622  {
623  wxPoint relPos = aPosition - GetCenter();
624  int radius = GetRadius();
625  int dist = KiROUND( EuclideanNorm( relPos ) );
626 
627  if( abs( radius - dist ) <= maxdist )
628  {
629  // For arcs, the test point angle must be >= arc angle start
630  // and <= arc angle end
631  // However angle values > 360 deg are not easy to handle
632  // so we calculate the relative angle between arc start point and teast point
633  // this relative arc should be < arc angle if arc angle > 0 (CW arc)
634  // and > arc angle if arc angle < 0 (CCW arc)
635  double arc_angle_start = GetArcAngleStart(); // Always 0.0 ... 360 deg, in 0.1 deg
636 
637  double arc_hittest = ArcTangente( relPos.y, relPos.x );
638 
639  // Calculate relative angle between the starting point of the arc, and the test point
640  arc_hittest -= arc_angle_start;
641 
642  // Normalise arc_hittest between 0 ... 360 deg
643  NORMALIZE_ANGLE_POS( arc_hittest );
644 
645  // Check angle: inside the arc angle when it is > 0
646  // and outside the not drawn arc when it is < 0
647  if( GetAngle() >= 0.0 )
648  {
649  if( arc_hittest <= GetAngle() )
650  return true;
651  }
652  else
653  {
654  if( arc_hittest >= (3600.0 + GetAngle()) )
655  return true;
656  }
657  }
658  }
659  break;
660 
661  case S_CURVE:
662  ((DRAWSEGMENT*)this)->RebuildBezierToSegmentsPointsList( m_Width );
663 
664  for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
665  {
666  if( TestSegmentHit( aPosition, m_BezierPoints[i-1], m_BezierPoints[i], maxdist ) )
667  return true;
668  }
669  break;
670 
671  case S_SEGMENT:
672  if( TestSegmentHit( aPosition, m_Start, m_End, maxdist ) )
673  return true;
674  break;
675 
676  case S_RECT:
677  {
678  std::vector<wxPoint> pts;
679  GetRectCorners( &pts );
680 
681  if( m_Width == 0 ) // Filled rect hit-test
682  {
683  SHAPE_POLY_SET poly;
684  poly.NewOutline();
685 
686  for( const wxPoint& pt : pts )
687  poly.Append( pt );
688 
689  if( poly.Collide( VECTOR2I( aPosition ), maxdist ) )
690  return true;
691  }
692  else // Open rect hit-test
693  {
694  if( TestSegmentHit( aPosition, pts[0], pts[1], maxdist )
695  || TestSegmentHit( aPosition, pts[1], pts[2], maxdist )
696  || TestSegmentHit( aPosition, pts[2], pts[3], maxdist )
697  || TestSegmentHit( aPosition, pts[3], pts[0], maxdist ) )
698  {
699  return true;
700  }
701  }
702  }
703  break;
704 
705  case S_POLYGON:
706  {
707  if( !IsPolygonFilled() )
708  {
710  return m_Poly.CollideEdge( VECTOR2I( aPosition ), dummy, maxdist );
711  }
712  else
713  return m_Poly.Collide( VECTOR2I( aPosition ), maxdist );
714  }
715  break;
716 
717  default:
718  wxFAIL_MSG( "DRAWSEGMENT::HitTest (point) not implemented for "
719  + STROKE_T_asString( m_Shape ) );
720  break;
721  }
722 
723  return false;
724 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
double GetArcAngleStart() const
function GetArcAngleStart()
Struct VERTEX_INDEX.
usual segment : line with rounded ends
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:257
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:129
segment with non rounded ends
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
SHAPE_POLY_SET.
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
int NewOutline()
Creates a new empty polygon in the set and returns its index
bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr) const override
Function Collide Checks whether the point aP is either inside or on the edge of the polygon set.
static wxString STROKE_T_asString(STROKE_T a)
double GetAngle() const
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Function CollideEdge Checks whether aPoint collides with any edge of any of the contours of the polyg...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
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:68
int m_Width
thickness of lines ...
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:162
void GetRectCorners(std::vector< wxPoint > *pts) const
bool IsPolygonFilled() const
Polygonal shape is not always filled.
wxPoint GetCenter() const override
Function GetCenter()
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
std::vector< wxPoint > m_BezierPoints

References SHAPE_POLY_SET::Append(), ArcTangente(), SHAPE_POLY_SET::Collide(), SHAPE_POLY_SET::CollideEdge(), dummy(), EuclideanNorm(), DRAWSEGMENT::GetAngle(), DRAWSEGMENT::GetArcAngleStart(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetRectCorners(), DRAWSEGMENT::IsPolygonFilled(), KiROUND(), DRAWSEGMENT::m_BezierPoints, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, DRAWSEGMENT::m_Width, SHAPE_POLY_SET::NewOutline(), NORMALIZE_ANGLE_POS(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, STROKE_T_asString(), TestSegmentHit(), wxPoint::x, and wxPoint::y.

Referenced by DRC::doTrackDrc(), and GENERAL_COLLECTOR::Inspect().

◆ HitTest() [2/2]

bool DRAWSEGMENT::HitTest ( const EDA_RECT aRect,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtualinherited

Function HitTest tests 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 727 of file class_drawsegment.cpp.

728 {
729  EDA_RECT arect = aRect;
730  arect.Normalize();
731  arect.Inflate( aAccuracy );
732 
733  EDA_RECT arcRect;
734  EDA_RECT bb = GetBoundingBox();
735 
736  switch( m_Shape )
737  {
738  case S_CIRCLE:
739  // Test if area intersects or contains the circle:
740  if( aContained )
741  return arect.Contains( bb );
742  else
743  {
744  // If the rectangle does not intersect the bounding box, this is a much quicker test
745  if( !aRect.Intersects( bb ) )
746  {
747  return false;
748  }
749  else
750  {
751  return arect.IntersectsCircleEdge( GetCenter(), GetRadius(), GetWidth() );
752  }
753  }
754  break;
755 
756  case S_ARC:
757  // Test for full containment of this arc in the rect
758  if( aContained )
759  {
760  return arect.Contains( bb );
761  }
762  // Test if the rect crosses the arc
763  else
764  {
765  arcRect = bb.Common( arect );
766 
767  /* All following tests must pass:
768  * 1. Rectangle must intersect arc BoundingBox
769  * 2. Rectangle must cross the outside of the arc
770  */
771  return arcRect.Intersects( arect ) &&
773  }
774  break;
775 
776  case S_RECT:
777  if( aContained )
778  {
779  return arect.Contains( bb );
780  }
781  else
782  {
783  std::vector<wxPoint> pts;
784  GetRectCorners( &pts );
785 
786  // Account for the width of the lines
787  arect.Inflate( GetWidth() / 2 );
788  return ( arect.Intersects( pts[0], pts[1] )
789  || arect.Intersects( pts[1], pts[2] )
790  || arect.Intersects( pts[2], pts[3] )
791  || arect.Intersects( pts[3], pts[0] ) );
792  }
793 
794  break;
795 
796  case S_SEGMENT:
797  if( aContained )
798  {
799  return arect.Contains( GetStart() ) && aRect.Contains( GetEnd() );
800  }
801  else
802  {
803  // Account for the width of the line
804  arect.Inflate( GetWidth() / 2 );
805  return arect.Intersects( GetStart(), GetEnd() );
806  }
807 
808  break;
809 
810  case S_POLYGON:
811  if( aContained )
812  {
813  return arect.Contains( bb );
814  }
815  else
816  {
817  // Fast test: if aRect is outside the polygon bounding box,
818  // rectangles cannot intersect
819  if( !arect.Intersects( bb ) )
820  return false;
821 
822  // Account for the width of the line
823  arect.Inflate( GetWidth() / 2 );
824  int count = m_Poly.TotalVertices();
825 
826  for( int ii = 0; ii < count; ii++ )
827  {
828  auto vertex = m_Poly.CVertex( ii );
829  auto vertexNext = m_Poly.CVertex( ( ii + 1 ) % count );
830 
831  // Test if the point is within aRect
832  if( arect.Contains( ( wxPoint ) vertex ) )
833  return true;
834 
835  // Test if this edge intersects aRect
836  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
837  return true;
838  }
839  }
840  break;
841 
842  case S_CURVE:
843  if( aContained )
844  {
845  return arect.Contains( bb );
846  }
847  else
848  {
849  // Fast test: if aRect is outside the polygon bounding box,
850  // rectangles cannot intersect
851  if( !arect.Intersects( bb ) )
852  return false;
853 
854  // Account for the width of the line
855  arect.Inflate( GetWidth() / 2 );
856  unsigned count = m_BezierPoints.size();
857 
858  for( unsigned ii = 1; ii < count; ii++ )
859  {
860  wxPoint vertex = m_BezierPoints[ii-1];
861  wxPoint vertexNext = m_BezierPoints[ii];
862 
863  // Test if the point is within aRect
864  if( arect.Contains( ( wxPoint ) vertex ) )
865  return true;
866 
867  // Test if this edge intersects aRect
868  if( arect.Intersects( vertex, vertexNext ) )
869  return true;
870  }
871  }
872  break;
873 
874 
875  default:
876  wxFAIL_MSG( "DRAWSEGMENT::HitTest (rect) not implemented for "
877  + STROKE_T_asString( m_Shape ) );
878  break;
879  }
880 
881  return false;
882 }
int TotalVertices() const
Returns total number of vertices stored in the set.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
bool IntersectsCircleEdge(const wxPoint &aCenter, const int aRadius, const int aWidth) const
IntersectsCircleEdge Tests for intersection between this rect and the edge (radius) of a circle.
EDA_RECT Common(const EDA_RECT &aRect) const
Function Common returns the area that is common with another rectangle.
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
bool Contains(const wxPoint &aPoint) const
Function Contains.
segment with non rounded ends
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
int GetWidth() const
void Normalize()
Function Normalize ensures that the height ant width are positive.
static wxString STROKE_T_asString(STROKE_T a)
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
void GetRectCorners(std::vector< wxPoint > *pts) const
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
wxPoint GetCenter() const override
Function GetCenter()
std::vector< wxPoint > m_BezierPoints
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

References EDA_RECT::Common(), EDA_RECT::Contains(), SHAPE_POLY_SET::CVertex(), DRAWSEGMENT::GetBoundingBox(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::GetEnd(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetRectCorners(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::GetWidth(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_RECT::IntersectsCircleEdge(), DRAWSEGMENT::m_BezierPoints, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, EDA_RECT::Normalize(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, STROKE_T_asString(), and SHAPE_POLY_SET::TotalVertices().

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsConnected()

virtual bool BOARD_ITEM::IsConnected ( ) const
inlinevirtualinherited

Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.

Returns
True if the object is of BOARD_CONNECTED_ITEM type, false otherwise.

Reimplemented in BOARD_CONNECTED_ITEM.

Definition at line 141 of file class_board_item.h.

142  {
143  return false;
144  }

Referenced by CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), and CONNECTIVITY_DATA::MarkItemNetAsDirty().

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 201 of file base_struct.h.

201 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:119
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_DRAGGED, and EDA_ITEM::m_Flags.

Referenced by DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 286 of file base_struct.h.

286 { return m_forceVisible; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

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

◆ IsLocked()

virtual bool BOARD_ITEM::IsLocked ( ) const
inlinevirtualinherited

Function IsLocked.

Returns
bool - true if the object is locked, else false

Reimplemented in MODULE, and TRACK.

Definition at line 253 of file class_board_item.h.

254  {
255  // only MODULEs & TRACKs can be locked at this time.
256  return false;
257  }

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCBNEW_CONTROL::DeleteItemCursor(), EditToolSelectionFilter(), GENERAL_COLLECTOR::Inspect(), SELECTION_TOOL::itemPassesFilter(), and PCB_EDITOR_CONTROL::modifyLockSelected().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 198 of file base_struct.h.

198 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsOnCopperLayer()

virtual bool BOARD_ITEM::IsOnCopperLayer ( ) const
inlinevirtualinherited
Returns
true if the object is on any copper layer, false otherwise.

Reimplemented in TRACK, D_PAD, and ZONE_CONTAINER.

Definition at line 149 of file class_board_item.h.

150  {
151  return IsCopperLayer( GetLayer() );
152  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References BOARD_ITEM::GetLayer(), and IsCopperLayer().

Referenced by CN_CONNECTIVITY_ALGO::Add(), and BOARD_CONNECTED_ITEM::SetNetCode().

◆ IsOnLayer()

virtual bool BOARD_ITEM::IsOnLayer ( PCB_LAYER_ID  aLayer) const
inlinevirtualinherited

Function IsOnLayer tests to see if this object is on the given layer.

Is virtual so objects like D_PAD, which reside on multiple layers can do their own form of testing.

Parameters
aLayerThe layer to test for.
Returns
bool - true if on given layer, else false.

Reimplemented in D_PAD, VIA, ZONE_CONTAINER, MARKER_PCB, and MARKER_PCB.

Definition at line 233 of file class_board_item.h.

234  {
235  return m_Layer == aLayer;
236  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by BOARD_ADAPTER::createLayers(), GENERAL_COLLECTOR::Inspect(), and onLayer().

◆ IsParentFlipped()

bool EDGE_MODULE::IsParentFlipped ( ) const

Definition at line 203 of file class_edge_mod.cpp.

204 {
205  if( GetParent() && GetParent()->GetLayer() == B_Cu )
206  return true;
207  return false;
208 }
BOARD_ITEM_CONTAINER * GetParent() const
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.

References B_Cu, BOARD_ITEM::GetLayer(), and BOARD_ITEM::GetParent().

Referenced by ViewGetLOD().

◆ IsPolygonFilled()

bool DRAWSEGMENT::IsPolygonFilled ( ) const
inlineinherited

◆ IsPolyShapeValid()

bool DRAWSEGMENT::IsPolyShapeValid ( ) const
inherited
Returns
true if the polygonal shape is valid (has more than 2 points)

Definition at line 1158 of file class_drawsegment.cpp.

1159 {
1160  // return true if the polygonal shape is valid (has more than 2 points)
1161  if( GetPolyShape().OutlineCount() == 0 )
1162  return false;
1163 
1164  const SHAPE_LINE_CHAIN& outline = ((SHAPE_POLY_SET&)GetPolyShape()).Outline( 0 );
1165 
1166  return outline.PointCount() > 2;
1167 }
int PointCount() const
Function PointCount()
SHAPE_POLY_SET.
SHAPE_POLY_SET & GetPolyShape()
SHAPE_LINE_CHAIN.

References DRAWSEGMENT::GetPolyShape(), and SHAPE_LINE_CHAIN::PointCount().

Referenced by export_vrml_polygon(), PCB_IO::format(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

Definition at line 501 of file base_struct.h.

501 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 204 of file base_struct.h.

204 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:118

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Function IsTrack tests to see if this object is a track or via (or microvia).

form of testing.

Returns
bool - true if a track or via, else false.

Definition at line 244 of file class_board_item.h.

245  {
246  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
247  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_TRACE_T, PCB_VIA_T, and EDA_ITEM::Type().

◆ IsType()

bool EDGE_MODULE::IsType ( const KICAD_T  aScanTypes[]) const
inlineoverridevirtual

Function IsType Checks whether the item is one of the listed types.

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

Reimplemented from DRAWSEGMENT.

Definition at line 59 of file class_edge_mod.h.

60  {
61  if( BOARD_ITEM::IsType( aScanTypes ) )
62  return true;
63 
64  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
65  {
66  if( *p == PCB_LOCATE_GRAPHIC_T )
67  return true;
68  else if( *p == PCB_LOCATE_BOARD_EDGE_T )
69  return m_Layer == Edge_Cuts;
70  }
71 
72  return false;
73  }
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
PCB_LAYER_ID m_Layer
virtual bool IsType(const KICAD_T aScanTypes[]) const
Function IsType Checks whether the item is one of the listed types.
Definition: base_struct.h:262

References Edge_Cuts, EOT, EDA_ITEM::IsType(), BOARD_ITEM::m_Layer, PCB_LOCATE_BOARD_EDGE_T, and PCB_LOCATE_GRAPHIC_T.

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 202 of file base_struct.h.

202 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

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

Definition at line 383 of file base_struct.h.

387  {
388  for( auto it : aList )
389  {
390  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
392  return SEARCH_RESULT::QUIT;
393  }
394 
396  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::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

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T )

This changes first parameter to avoid the DList and use std::vector instead

Definition at line 404 of file base_struct.h.

406  {
407  for( auto it : aList )
408  {
409  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
411  return SEARCH_RESULT::QUIT;
412  }
413 
415  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ LayerMaskDescribe()

wxString BOARD_ITEM::LayerMaskDescribe ( const BOARD aBoard,
LSET  aMask 
)
staticprotectedinherited

Helper function Return a string (to be shown to the user) describing a layer mask.

The BOARD is needed because layer names are (somewhat) customizable

Definition at line 74 of file class_board_item.cpp.

75 {
76  // Try to be smart and useful. Check all copper first.
77  if( aMask[F_Cu] && aMask[B_Cu] )
78  return _( "All copper layers" );
79 
80  // Check for copper.
81  auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
82 
83  for( int i = 0; i < 3; i++ )
84  {
85  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
86  {
87  if( layer[ bit ] )
88  {
89  wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
90 
91  if( aMask.count() > 1 )
92  layerInfo << _( " and others" );
93 
94  return layerInfo;
95  }
96  }
97 
98  // No copper; first, check for technicals and then for all layers.
99  if( i < 1 ) // first, check for technicals
100  layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
101  else // then check for all other layers
102  layer = aMask;
103  }
104 
105  // No copper, no technicals: no layer
106  return _( "no layers" );
107 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
LSET GetEnabledLayers() const
Function GetEnabledLayers is a proxy function that calls the corresponding function in m_BoardSetting...
static LSET AllTechMask()
Function AllTechMask returns a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:782
#define _(s)
Definition: 3d_actions.cpp:33

References _, LSET::AllCuMask(), LSET::AllTechMask(), B_Cu, F_Cu, BOARD::GetEnabledLayers(), BOARD::GetLayerName(), PCB_LAYER_ID_COUNT, and PCBNEW_LAYER_ID_START.

Referenced by D_PAD::GetMsgPanelInfo(), and D_PAD::GetSelectMenuText().

◆ MakeEffectiveShapes()

std::vector< SHAPE * > DRAWSEGMENT::MakeEffectiveShapes ( ) const
inherited

Makes a set of SHAPE objects representing the DRAWSEGMENT.

Caller owns the objects.

Definition at line 1029 of file class_drawsegment.cpp.

1030 {
1031  std::vector<SHAPE*> effectiveShapes;
1032 
1033  switch( m_Shape )
1034  {
1035  case S_ARC:
1036  {
1037  SHAPE_ARC arc( GetCenter(), GetArcStart(), (double) GetAngle() / 10.0 );
1038  SHAPE_LINE_CHAIN l = arc.ConvertToPolyline();
1039 
1040  for( int i = 0; i < l.SegmentCount(); i++ )
1041  {
1042  effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ).A,
1043  l.Segment( i ).B, m_Width ) );
1044  }
1045 
1046  break;
1047  }
1048 
1049  case S_SEGMENT:
1050  effectiveShapes.emplace_back( new SHAPE_SEGMENT( GetStart(), GetEnd(), m_Width ) );
1051  break;
1052 
1053  case S_RECT:
1054  {
1055  std::vector<wxPoint> pts;
1056  GetRectCorners( &pts );
1057 
1058  if( m_Width == 0 )
1059  {
1060  effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) );
1061  }
1062  else
1063  {
1064  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[0], pts[1], m_Width ) );
1065  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[1], pts[2], m_Width ) );
1066  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[2], pts[3], m_Width ) );
1067  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[3], pts[0], m_Width ) );
1068  }
1069  }
1070  break;
1071 
1072  case S_CIRCLE:
1073  {
1074  if( m_Width == 0 )
1075  {
1076  effectiveShapes.emplace_back( new SHAPE_CIRCLE( GetCenter(), GetRadius() ) );
1077  }
1078  else
1079  {
1080  // SHAPE_CIRCLE has no ConvertToPolyline() method, so use a 360.0 SHAPE_ARC
1081  SHAPE_ARC circle( GetCenter(), GetEnd(), 360.0 );
1082  SHAPE_LINE_CHAIN l = circle.ConvertToPolyline();
1083 
1084  for( int i = 0; i < l.SegmentCount(); i++ )
1085  {
1086  effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ).A,
1087  l.Segment( i ).B, m_Width ) );
1088  }
1089  }
1090 
1091  break;
1092  }
1093 
1094  case S_CURVE:
1095  {
1096  auto bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
1097  wxPoint start_pt = bezierPoints[0];
1098 
1099  for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )
1100  {
1101  wxPoint end_pt = bezierPoints[jj];
1102  effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, m_Width ) );
1103  start_pt = end_pt;
1104  }
1105 
1106  break;
1107  }
1108 
1109  case S_POLYGON:
1110  {
1112 
1113  if( IsPolygonFilled() )
1114  {
1115  effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
1116  }
1117  else
1118  {
1119  for( int i = 0; i < l.SegmentCount(); i++ )
1120  effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ) ) );
1121  }
1122  }
1123  break;
1124 
1125  default:
1126  wxFAIL_MSG( "DRAWSEGMENT::MakeEffectiveShapes unsupported DRAWSEGMENT shape: "
1127  + STROKE_T_asString( m_Shape ) );
1128  break;
1129  }
1130 
1131  return effectiveShapes;
1132 }
wxPoint GetArcStart() const
SHAPE_SIMPLE.
Definition: shape_simple.h:42
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
segment with non rounded ends
Arcs (with rounded ends)
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
SHAPE_POLY_SET & GetPolyShape()
Bezier Curve.
int SegmentCount() const
Function SegmentCount()
int GetWidth() const
const std::vector< wxPoint > buildBezierToSegmentsPointsList(int aMinSegLen) const
static wxString STROKE_T_asString(STROKE_T a)
double GetAngle() const
SEG Segment(int aIndex)
Function Segment()
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
VECTOR2I A
Definition: seg.h:47
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
int m_Width
thickness of lines ...
void GetRectCorners(std::vector< wxPoint > *pts) const
bool IsPolygonFilled() const
Polygonal shape is not always filled.
wxPoint GetCenter() const override
Function GetCenter()
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, DRAWSEGMENT::buildBezierToSegmentsPointsList(), SHAPE_ARC::ConvertToPolyline(), SHAPE_POLY_SET::COutline(), DRAWSEGMENT::GetAngle(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::GetEnd(), DRAWSEGMENT::GetPolyShape(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetRectCorners(), DRAWSEGMENT::GetStart(), DRAWSEGMENT::GetWidth(), DRAWSEGMENT::IsPolygonFilled(), DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Width, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SHAPE_LINE_CHAIN::Segment(), SHAPE_LINE_CHAIN::SegmentCount(), and STROKE_T_asString().

Referenced by DRAWSEGMENT::GetEffectiveShape(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), and DRC::testCopperDrawItem().

◆ Matches() [1/2]

virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData 
)
inlinevirtualinherited

Function Matches compares 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_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_SHEET_PIN, SCH_FIELD, SCH_PIN, TEXTE_MODULE, SCH_MARKER, MARKER_PCB, MARKER_PCB, and TEXTE_PCB.

Definition at line 457 of file base_struct.h.

458  {
459  return false;
460  }

Referenced by SCH_EDITOR_CONTROL::HasMatch(), TEXTE_PCB::Matches(), MARKER_PCB::Matches(), SCH_MARKER::Matches(), TEXTE_MODULE::Matches(), SCH_PIN::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), SCH_TEXT::Matches(), and SCH_EDITOR_CONTROL::ReplaceAndFindNext().

◆ Matches() [2/2]

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

Function Matches compares 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 145 of file base_struct.cpp.

146 {
147  wxString text = aText;
148  wxString searchText = aSearchData.GetFindString();
149 
150  // Don't match if searching for replaceable item and the item doesn't support text replace.
151  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
152  return false;
153 
154  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
155  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
156 
157  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
158  {
159  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
160  return text.Matches( searchText );
161 
162  return text.MakeUpper().Matches( searchText.MakeUpper() );
163  }
164 
165  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
166  return aText.Find( searchText ) != wxNOT_FOUND;
167 
168  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
169 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:501

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

◆ Mirror()

void EDGE_MODULE::Mirror ( const wxPoint aCentre,
bool  aMirrorAroundXAxis 
)

Mirror an edge of the footprint.

Do not change the layer This is a footprint shape modification. (should be only called by a footprint editing function)

Definition at line 210 of file class_edge_mod.cpp.

211 {
212  // Mirror an edge of the footprint. the layer is not modified
213  // This is a footprint shape modification.
214  switch( GetShape() )
215  {
216  case S_ARC:
217  SetAngle( -GetAngle() );
219 
220  default:
221  case S_CURVE:
222  case S_SEGMENT:
223  if( aMirrorAroundXAxis )
224  {
225  MIRROR( m_Start0.y, aCentre.y );
226  MIRROR( m_End0.y, aCentre.y );
227  MIRROR( m_Bezier0_C1.y, aCentre.y );
228  MIRROR( m_Bezier0_C2.y, aCentre.y );
229  }
230  else
231  {
232  MIRROR( m_Start0.x, aCentre.x );
233  MIRROR( m_End0.x, aCentre.x );
234  MIRROR( m_Bezier0_C1.x, aCentre.x );
235  MIRROR( m_Bezier0_C2.x, aCentre.x );
236  }
237 
238  for( unsigned ii = 0; ii < m_BezierPoints.size(); ii++ )
239  {
240  if( aMirrorAroundXAxis )
241  MIRROR( m_BezierPoints[ii].y, aCentre.y );
242  else
243  MIRROR( m_BezierPoints[ii].x, aCentre.x );
244  }
245 
246  break;
247 
248  case S_POLYGON:
249  // polygon corners coordinates are always relative to the
250  // footprint position, orientation 0
251  m_Poly.Mirror( !aMirrorAroundXAxis, aMirrorAroundXAxis );
252  break;
253  }
254 
255  SetDrawCoord();
256 }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.
#define KI_FALLTHROUGH
STROKE_T GetShape() const
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
wxPoint m_End0
End point, relative to module origin, orient 0.
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:175
Arcs (with rounded ends)
Bezier Curve.
double GetAngle() const
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.
std::vector< wxPoint > m_BezierPoints

References DRAWSEGMENT::GetAngle(), DRAWSEGMENT::GetShape(), KI_FALLTHROUGH, m_Bezier0_C1, m_Bezier0_C2, DRAWSEGMENT::m_BezierPoints, m_End0, DRAWSEGMENT::m_Poly, m_Start0, MIRROR(), SHAPE_POLY_SET::Mirror(), S_ARC, S_CURVE, S_POLYGON, S_SEGMENT, DRAWSEGMENT::SetAngle(), SetDrawCoord(), wxPoint::x, and wxPoint::y.

◆ Move() [1/2]

void EDGE_MODULE::Move ( const wxPoint aMoveVector)
overridevirtual

Move an edge of the footprint.

This is a footprint shape modification. (should be only called by a footprint editing function)

Reimplemented from DRAWSEGMENT.

Definition at line 269 of file class_edge_mod.cpp.

270 {
271  // Move an edge of the footprint.
272  // This is a footprint shape modification.
273  m_Start0 += aMoveVector;
274  m_End0 += aMoveVector;
275  m_Bezier0_C1 += aMoveVector;
276  m_Bezier0_C2 += aMoveVector;
277 
278  switch( GetShape() )
279  {
280  default:
281  break;
282 
283  case S_POLYGON:
284  // polygon corners coordinates are always relative to the
285  // footprint position, orientation 0
286  m_Poly.Move( VECTOR2I( aMoveVector ) );
287 
288  break;
289  }
290 
291  SetDrawCoord();
292 }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.
STROKE_T GetShape() const
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
wxPoint m_End0
End point, relative to module origin, orient 0.
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.
void Move(const VECTOR2I &aVector) override
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.

References DRAWSEGMENT::GetShape(), m_Bezier0_C1, m_Bezier0_C2, m_End0, DRAWSEGMENT::m_Poly, m_Start0, SHAPE_POLY_SET::Move(), S_POLYGON, and SetDrawCoord().

Referenced by PAD_TOOL::explodePad(), and MODULE::MoveAnchorPosition().

◆ Move() [2/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 292 of file class_board_item.h.

293  {
294  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
295  }
virtual void Move(const wxPoint &aMoveVector)
Function Move move this object.

References BOARD_ITEM::Move(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator<()

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 199 of file base_struct.cpp.

200 {
201  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
202  GetChars( GetClass() ) ) );
203 
204  return false;
205 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205

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

◆ RebuildBezierToSegmentsPointsList()

void DRAWSEGMENT::RebuildBezierToSegmentsPointsList ( int  aMinSegLen)
inherited

Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has meaning only for S_CURVE DRAW_SEGMENT shape.

Parameters
aMinSegLenis the min length of segments approximating the shape. the last segment can be shorter This param avoid having too many very short segment in list. a good value is m_Width/2 to m_Width

Definition at line 291 of file class_drawsegment.cpp.

292 {
293  // Has meaning only for S_CURVE DRAW_SEGMENT shape
294  if( m_Shape != S_CURVE )
295  {
296  m_BezierPoints.clear();
297  return;
298  }
299  // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
301 }
STROKE_T m_Shape
Shape: line, Circle, Arc.
Bezier Curve.
const std::vector< wxPoint > buildBezierToSegmentsPointsList(int aMinSegLen) const
std::vector< wxPoint > m_BezierPoints

References DRAWSEGMENT::buildBezierToSegmentsPointsList(), DRAWSEGMENT::m_BezierPoints, DRAWSEGMENT::m_Shape, and S_CURVE.

Referenced by ConvertOutlineToPolygon(), Flip(), GRAPHICS_CLEANER::isNullSegment(), SetDrawCoord(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and POINT_EDITOR::updateItem().

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs 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 172 of file base_struct.cpp.

173 {
174  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
175 
176  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
177  aSearchData.GetFindString() :
178  aSearchData.GetFindString().Upper() );
179 
180  if( result == wxNOT_FOUND )
181  return false;
182 
183  wxString prefix = aText.Left( result );
184  wxString suffix;
185 
186  if( aSearchData.GetFindString().length() + result < aText.length() )
187  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
188 
189  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
190  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
191  GetChars( suffix ) );
192 
193  aText = prefix + aSearchData.GetReplaceString() + suffix;
194 
195  return true;
196 }
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:153

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs 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_SHEET_PIN, SCH_FIELD, and SCH_PIN.

Definition at line 489 of file base_struct.h.

489 { return false; }

◆ Rotate() [1/2]

void EDGE_MODULE::Rotate ( const wxPoint aRotCentre,
double  aAngle 
)
overridevirtual

Rotate an edge of the footprint.

This is a footprint shape modification. (should be only called by a footprint editing function )

Reimplemented from DRAWSEGMENT.

Definition at line 258 of file class_edge_mod.cpp.

259 {
260  // We should rotate the relative coordinates, but to avoid duplicate code do the base class
261  // rotation of draw coordinates, which is acceptable because in module editor, m_Pos0 = m_Pos
262  DRAWSEGMENT::Rotate( aRotCentre, aAngle );
263 
264  // and now update the relative coordinates, which are the reference in most transforms.
265  SetLocalCoord();
266 }
void SetLocalCoord()
Set relative coordinates from draw coordinates.
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.

References DRAWSEGMENT::Rotate(), and SetLocalCoord().

Referenced by PAD_TOOL::explodePad(), and EAGLE_PLUGIN::packageRectangle().

◆ Rotate() [2/2]

void BOARD_ITEM::Rotate ( const VECTOR2I aRotCentre,
double  aAngle 
)
inlineinherited

Definition at line 308 of file class_board_item.h.

309  {
310  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
311  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Function Rotate Rotate this object.

References BOARD_ITEM::Rotate(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ Scale()

void DRAWSEGMENT::Scale ( double  aScale)
inherited

Definition at line 133 of file class_drawsegment.cpp.

134 {
135  auto scalePt = [&]( wxPoint& pt )
136  {
137  pt.x = KiROUND( pt.x * aScale );
138  pt.y = KiROUND( pt.y * aScale );
139  };
140 
141  int radius = GetRadius();
142 
143  scalePt( m_Start );
144  scalePt( m_End );
145 
146  // specific parameters:
147  switch( m_Shape )
148  {
149  case S_CURVE:
150  scalePt( m_BezierC1 );
151  scalePt( m_BezierC2 );
152  break;
153 
154  case S_CIRCLE: // ring or circle
155  m_End.x = m_Start.x + KiROUND( radius * aScale );
156  m_End.y = m_Start.y;
157  break;
158 
159  case S_POLYGON: // polygon
160  {
161  std::vector<wxPoint> pts;
162 
163  for( const VECTOR2I& pt : m_Poly.Outline( 0 ).CPoints() )
164  {
165  pts.emplace_back( pt );
166  scalePt( pts.back() );
167  }
168 
169  SetPolyPoints( pts );
170  }
171  break;
172 
173  default:
174  break;
175  }
176 }
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
polygon (not yet used for tracks, but could be in microwave apps)
wxPoint m_BezierC1
Bezier Control Point 1.
wxPoint m_Start
Line start point or Circle and Arc center.
const std::vector< VECTOR2I > & CPoints() const
wxPoint m_End
Line end point or circle and arc start point.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
wxPoint m_BezierC2
Bezier Control Point 2.
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:68

References SHAPE_LINE_CHAIN::CPoints(), DRAWSEGMENT::GetRadius(), KiROUND(), DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, SHAPE_POLY_SET::Outline(), S_CIRCLE, S_CURVE, S_POLYGON, DRAWSEGMENT::SetPolyPoints(), wxPoint::x, and wxPoint::y.

◆ Set() [1/3]

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

Definition at line 40 of file inspectable.h.

41  {
43  TYPE_ID thisType = TYPE_HASH( *this );
44  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
45 
46  if( object )
47  aProperty->setter( object, aValue );
48 
49  return object != nullptr;
50  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
virtual void setter(void *aObject, wxAny &aValue)=0
Provides class metadata.
Definition: property_mgr.h:58
virtual size_t OwnerHash() const =0
Returns 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 53 of file inspectable.h.

54  {
56  TYPE_ID thisType = TYPE_HASH( *this );
57  void* object = propMgr.TypeCast( this, thisType, aProperty->OwnerHash() );
58 
59  if( object )
60  aProperty->set<T>( object, aValue );
61 
62  return object != nullptr;
63  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:266
virtual size_t OwnerHash() const =0
Returns 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 66 of file inspectable.h.

67  {
69  TYPE_ID thisType = TYPE_HASH( *this );
70  PROPERTY_BASE* prop = propMgr.GetProperty( thisType, aProperty );
71  void* object = nullptr;
72 
73  if( prop )
74  {
75  object = propMgr.TypeCast( this, thisType, prop->OwnerHash() );
76 
77  if( object )
78  prop->set<T>( object, aValue );
79  }
80 
81  return object != nullptr;
82  }
static PROPERTY_MANAGER & Instance()
Definition: property_mgr.h:61
#define TYPE_HASH(x)
Macro to generate unique identifier for a type
Definition: property.h:53
size_t TYPE_ID
Unique type identifier
Definition: property_mgr.h:38
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Casts a type to another type.
T
enum T contains all this lexer's tokens.
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Returns a property for a specific type.
Provides class metadata.
Definition: property_mgr.h:58
void set(void *aObject, T aValue)
Definition: property.h:266
virtual size_t OwnerHash() const =0
Returns 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().

◆ SetAngle()

void DRAWSEGMENT::SetAngle ( double  aAngle)
inherited

Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.

Parameters
aAngleis tenths of degrees, but will soon be degrees.

Definition at line 407 of file class_drawsegment.cpp.

408 {
409  // m_Angle must be >= -360 and <= +360 degrees
410  m_Angle = NormalizeAngle360Max( aAngle );
411 }
T NormalizeAngle360Max(T Angle)
Normalize angle to be >=-360.0 and <= 360.0 Angle can be equal to -360 or +360.
Definition: trigo.h:226
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.

References DRAWSEGMENT::m_Angle, and NormalizeAngle360Max().

Referenced by D_PAD::AddPrimitiveArc(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToModule(), DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), PAD_TOOL::explodePad(), Flip(), ALTIUM_PCB::HelperCreateBoardOutline(), EAGLE_PLUGIN::loadPlain(), Mirror(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), GPCB_FPL_CACHE::parseMODULE(), PAD_TOOL::recombinePad(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), updateArcFromConstructionMgr(), and POINT_EDITOR::updateItem().

◆ SetArcStart()

void DRAWSEGMENT::SetArcStart ( const wxPoint aArcStartPoint)
inlineinherited

Initialize the start arc point.

can be used for circles to initialize one point of the cicumference

Definition at line 184 of file class_drawsegment.h.

185  { m_End = aArcStartPoint; }
wxPoint m_End
Line end point or circle and arc start point.

References DRAWSEGMENT::m_End.

Referenced by D_PAD::AddPrimitiveArc(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParsePad6NonCopper(), ALTIUM_PCB::ParseArcs6Data(), updateArcFromConstructionMgr(), and POINT_EDITOR::updateItem().

◆ SetBezControl1()

void DRAWSEGMENT::SetBezControl1 ( const wxPoint aPoint)
inlineinherited

◆ SetBezControl2()

void DRAWSEGMENT::SetBezControl2 ( const wxPoint aPoint)
inlineinherited

◆ SetBezier0_C1()

void EDGE_MODULE::SetBezier0_C1 ( const wxPoint aPoint)
inline

Definition at line 114 of file class_edge_mod.h.

114 { m_Bezier0_C1 = aPoint; }
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.

References m_Bezier0_C1.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetBezier0_C2()

void EDGE_MODULE::SetBezier0_C2 ( const wxPoint aPoint)
inline

Definition at line 117 of file class_edge_mod.h.

117 { m_Bezier0_C2 = aPoint; }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.

References m_Bezier0_C2.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetBezierPoints()

void DRAWSEGMENT::SetBezierPoints ( const std::vector< wxPoint > &  aPoints)
inlineinherited

Definition at line 229 of file class_drawsegment.h.

230  {
231  m_BezierPoints = aPoints;
232  }
std::vector< wxPoint > m_BezierPoints

References DRAWSEGMENT::m_BezierPoints.

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCenter()

void DRAWSEGMENT::SetCenter ( const wxPoint aCenterPoint)
inlineinherited

For arcs and circles:

Definition at line 189 of file class_drawsegment.h.

189 { m_Start = aCenterPoint; }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start.

Referenced by D_PAD::AddPrimitiveArc(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParsePad6NonCopper(), ALTIUM_PCB::ParseArcs6Data(), updateArcFromConstructionMgr(), and POINT_EDITOR::updateItem().

◆ SetDrawCoord()

void EDGE_MODULE::SetDrawCoord ( )

Set draw coordinates (absolute values ) from relative coordinates.

Must be called when a relative coordinate has changed in order to see the changes on screen

Definition at line 78 of file class_edge_mod.cpp.

79 {
80  MODULE* module = (MODULE*) m_Parent;
81 
82  m_Start = m_Start0;
83  m_End = m_End0;
86 
87  if( module )
88  {
89  RotatePoint( &m_Start.x, &m_Start.y, module->GetOrientation() );
90  RotatePoint( &m_End.x, &m_End.y, module->GetOrientation() );
93 
94  m_Start += module->GetPosition();
95  m_End += module->GetPosition();
96  m_BezierC1 += module->GetPosition();
97  m_BezierC2 += module->GetPosition();
98  }
99 
101 }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.
double GetOrientation() const
Definition: class_module.h:221
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_End0
End point, relative to module origin, orient 0.
wxPoint m_BezierC1
Bezier Control Point 1.
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
wxPoint m_BezierC2
Bezier Control Point 2.
wxPoint GetPosition() const override
Definition: class_module.h:216
int m_Width
thickness of lines ...
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.

References MODULE::GetOrientation(), MODULE::GetPosition(), m_Bezier0_C1, m_Bezier0_C2, DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, m_End0, EDA_ITEM::m_Parent, DRAWSEGMENT::m_Start, m_Start0, DRAWSEGMENT::m_Width, DRAWSEGMENT::RebuildBezierToSegmentsPointsList(), RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), LEGACY_PLUGIN::loadMODULE_EDGE(), Mirror(), Move(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageWire(), GPCB_FPL_CACHE::parseMODULE(), PCB_PARSER::parseMODULE_unchecked(), and MODULE::SetPosition().

◆ SetEnd()

◆ SetEnd0()

◆ SetEndX()

void DRAWSEGMENT::SetEndX ( int  x)
inlineinherited

Definition at line 149 of file class_drawsegment.h.

149 { m_End.x = x; }
wxPoint m_End
Line end point or circle and arc start point.

References DRAWSEGMENT::m_End, and wxPoint::x.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and POINT_EDITOR::updateItem().

◆ SetEndY()

void DRAWSEGMENT::SetEndY ( int  y)
inlineinherited

Definition at line 148 of file class_drawsegment.h.

148 { m_End.y = y; }
wxPoint m_End
Line end point or circle and arc start point.

References DRAWSEGMENT::m_End, and wxPoint::y.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and POINT_EDITOR::updateItem().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 232 of file base_struct.h.

232 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Definition: base_struct.h:176

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), TRACKS_CLEANER::cleanupSegments(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), LIB_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), 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(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag 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 284 of file base_struct.h.

284 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: base_struct.h:175

References EDA_ITEM::m_forceVisible.

◆ SetLayer()

virtual void BOARD_ITEM::SetLayer ( PCB_LAYER_ID  aLayer)
inlinevirtualinherited

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number. is virtual because some items (in fact: class DIMENSION) have a slightly different initialization

Reimplemented in ZONE_CONTAINER, and DIMENSION.

Definition at line 197 of file class_board_item.h.

198  {
199  // trap any invalid layers, then go find the caller and fix it.
200  // wxASSERT( unsigned( aLayer ) < unsigned( NB_PCB_LAYERS ) );
201  m_Layer = aLayer;
202  }
PCB_LAYER_ID m_Layer

References BOARD_ITEM::m_Layer.

Referenced by PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), DIMENSION::AdjustDimensionDetails(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), ZONE_FILLER::buildCopperItemClearances(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewModule(), MICROWAVE_TOOL::createPolygonShape(), DRC::doTrackDrc(), DRAWING_TOOL::drawArc(), PAD_TOOL::explodePad(), PCB_TARGET::Flip(), TEXTE_PCB::Flip(), Flip(), TRACK::Flip(), TEXTE_MODULE::Flip(), DRAWSEGMENT::Flip(), MODULE::Flip(), ARC::Flip(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadMODULE_TEXT(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), main(), DSN::SPECCTRA_DB::makeTRACK(), GRAPHICS_CLEANER::mergeRects(), MODULE_DESC::MODULE_DESC(), DIALOG_FOOTPRINT_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAddField(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageSMD(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), GPCB_FPL_CACHE::parseMODULE(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), DIALOG_PAD_PROPERTIES::redraw(), CLIPBOARD_IO::SaveSelection(), DIMENSION::SetLayer(), TEXT_MOD_GRID_TABLE::SetValueAsLong(), GLOBAL_EDIT_TOOL::swapBoardItem(), DRC::testPadClearances(), TEXTE_MODULE::TEXTE_MODULE(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetLocalCoord()

void EDGE_MODULE::SetLocalCoord ( )

Set relative coordinates from draw coordinates.

Call in only when the geometry or the footprint is modified and therefore the relative coordinates have to be updated from the draw coordinates.

Definition at line 53 of file class_edge_mod.cpp.

54 {
55  MODULE* module = (MODULE*) m_Parent;
56 
57  if( module == NULL )
58  {
59  m_Start0 = m_Start;
60  m_End0 = m_End;
63  return;
64  }
65 
66  m_Start0 = m_Start - module->GetPosition();
67  m_End0 = m_End - module->GetPosition();
68  m_Bezier0_C1 = m_BezierC1 - module->GetPosition();
69  m_Bezier0_C2 = m_BezierC2 - module->GetPosition();
70  double angle = module->GetOrientation();
72  RotatePoint( &m_End0.x, &m_End0.y, -angle );
75 }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to module origin, orient 0.
double GetOrientation() const
Definition: class_module.h:221
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint m_End0
End point, relative to module origin, orient 0.
wxPoint m_BezierC1
Bezier Control Point 1.
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to module origin, orient 0.
wxPoint m_Start
Line start point or Circle and Arc center.
#define NULL
wxPoint m_End
Line end point or circle and arc start point.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
wxPoint m_BezierC2
Bezier Control Point 2.
wxPoint GetPosition() const override
Definition: class_module.h:216
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.

References PNS::angle(), MODULE::GetOrientation(), MODULE::GetPosition(), m_Bezier0_C1, m_Bezier0_C2, DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, m_End0, EDA_ITEM::m_Parent, DRAWSEGMENT::m_Start, m_Start0, NULL, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by PAD_TOOL::explodePad(), PCBNEW_CONTROL::Paste(), pasteModuleItemsToModEdit(), and Rotate().

◆ SetLocked()

virtual void BOARD_ITEM::SetLocked ( bool  aLocked)
inlinevirtualinherited

Function SetLocked modifies 'lock' status for of the item.

Reimplemented in MODULE, and TRACK.

Definition at line 263 of file class_board_item.h.

264  {
265  // only MODULEs & TRACKs can be locked at this time.
266  }

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), PCB_EDITOR_CONTROL::modifyLockSelected(), ALTIUM_PCB::ParsePads6Data(), ALTIUM_PCB::ParsePolygons6Data(), and CLIPBOARD_IO::SaveSelection().

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

Definition at line 87 of file base_struct.cpp.

88 {
90 
91  // If this a child object, then the parent modification state also needs to be set.
92  if( m_Parent )
94 }
void SetModified()
Definition: base_struct.cpp:87
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:113
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232

References IS_CHANGED, EDA_ITEM::m_Parent, EDA_ITEM::SetFlags(), and EDA_ITEM::SetModified().

Referenced by SCH_COMPONENT::ClearAnnotation(), LIB_PIN_TOOL::EditPinProperties(), LEGACY_PLUGIN::loadZONE_CONTAINER(), SCH_LINE::Move(), SCH_COMPONENT::Move(), SCH_LINE::MoveEnd(), SCH_LINE::MoveStart(), LIB_PIN::MoveTo(), PCB_EDIT_FRAME::OpenProjectFiles(), ALTIUM_PCB::Parse(), LIB_PART::RemoveDrawItem(), SCH_COMPONENT::SetConvert(), SCH_COMPONENT::SetLibId(), EDA_ITEM::SetModified(), LIB_FIELD::SetName(), SCH_COMPONENT::SetTransform(), and SCH_COMPONENT::SetUnit().

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Definition at line 196 of file base_struct.h.

196 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174

References EDA_ITEM::m_Parent.

Referenced by MODULE::Add(), BOARD::Add(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), BOARD_NETLIST_UPDATER::addNewComponent(), SCH_SHEET::AddPin(), LIB_CONTROL::AddSymbolToSchematic(), SCH_SCREEN::Append(), LIB_FIELD::Copy(), LIB_EDIT_FRAME::CreateNewPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), SCH_EDIT_TOOL::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_PART::Flatten(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::GetModule(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), SCH_SEXPR_PLUGIN::loadHierarchy(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), MODULE::operator=(), LIB_PART::operator=(), PCB_PARSER::parseMODULE_unchecked(), SCH_SEXPR_PARSER::ParseSchematic(), SCH_SEXPR_PARSER::ParseSymbol(), LIB_EDIT_TOOL::Paste(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), pasteModuleItemsToModEdit(), SCH_DRAWING_TOOLS::PlaceComponent(), PCB_EDITOR_CONTROL::PlaceModule(), 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_PART::SetFields(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), SwapItemData(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary().

◆ SetPolyPoints()

void DRAWSEGMENT::SetPolyPoints ( const std::vector< wxPoint > &  aPoints)
inherited

Definition at line 1019 of file class_drawsegment.cpp.

1020 {
1022  m_Poly.NewOutline();
1023 
1024  for ( const wxPoint& p : aPoints )
1025  m_Poly.Append( p.x, p.y );
1026 }
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
int NewOutline()
Creates a new empty polygon in the set and returns its index
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), DRAWSEGMENT::m_Poly, SHAPE_POLY_SET::NewOutline(), and SHAPE_POLY_SET::RemoveAllContours().

Referenced by D_PAD::AddPrimitivePoly(), PCAD2KICAD::PCB_POLYGON::AddToModule(), MICROWAVE_TOOL::createPolygonShape(), ALTIUM_PCB::HelperParsePad6NonCopper(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), ALTIUM_PCB::ParseFills6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), DRAWSEGMENT::Scale(), and DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow().

◆ SetPolyShape()

void DRAWSEGMENT::SetPolyShape ( const SHAPE_POLY_SET aShape)
inlineinherited

Definition at line 227 of file class_drawsegment.h.

227 { m_Poly = aShape; }
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.

References DRAWSEGMENT::m_Poly.

Referenced by PAD_TOOL::explodePad(), and PAD_TOOL::recombinePad().

◆ SetPosition()

void DRAWSEGMENT::SetPosition ( const wxPoint aPos)
overridevirtualinherited

Implements BOARD_ITEM.

Definition at line 61 of file class_drawsegment.cpp.

62 {
63  m_Start = aPos;
64 }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start.

◆ SetSelected()

◆ SetShape()

◆ SetStart()

◆ SetStart0()

◆ SetStartX()

void DRAWSEGMENT::SetStartX ( int  x)
inlineinherited

Definition at line 138 of file class_drawsegment.h.

138 { m_Start.x = x; }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start, and wxPoint::x.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and POINT_EDITOR::updateItem().

◆ SetStartY()

void DRAWSEGMENT::SetStartY ( int  y)
inlineinherited

Definition at line 137 of file class_drawsegment.h.

137 { m_Start.y = y; }
wxPoint m_Start
Line start point or Circle and Arc center.

References DRAWSEGMENT::m_Start, and wxPoint::y.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and POINT_EDITOR::updateItem().

◆ SetState()

void EDA_ITEM::SetState ( int  type,
int  state 
)
inlineinherited

Definition at line 221 of file base_struct.h.

222  {
223  if( state )
224  m_Status |= type; // state = ON or OFF
225  else
226  m_Status &= ~type;
227  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by LEGACY_PLUGIN::loadTrackList(), TRACKS_CLEANER::mergeCollinearSegments(), SELECTION_TOOL::selectConnectedTracks(), and TRACK::SetLocked().

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 230 of file base_struct.h.

230 { m_Status = aStatus; }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetType()

void DRAWSEGMENT::SetType ( int  aType)
inlineinherited

Definition at line 114 of file class_drawsegment.h.

114 { m_Type = aType; }
int m_Type
Used in complex associations ( Dimensions.. )

References DRAWSEGMENT::m_Type.

◆ SetWidth()

void DRAWSEGMENT::SetWidth ( int  aWidth)
inlineinherited

Definition at line 103 of file class_drawsegment.h.

103 { m_Width = aWidth; }
int m_Width
thickness of lines ...

References DRAWSEGMENT::m_Width.

Referenced by D_PAD::AddPrimitiveArc(), D_PAD::AddPrimitiveCircle(), D_PAD::AddPrimitiveCurve(), D_PAD::AddPrimitivePoly(), D_PAD::AddPrimitiveRect(), D_PAD::AddPrimitiveSegment(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToModule(), PCAD2KICAD::PCB_ARC::AddToModule(), PCAD2KICAD::PCB_POLYGON::AddToModule(), MICROWAVE_TOOL::createMicrowaveInductor(), MICROWAVE_TOOL::createPolygonShape(), DRAWING_TOOL::drawArc(), DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), PAD_TOOL::explodePad(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Center(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), EAGLE_PLUGIN::loadPlain(), GRAPHICS_CLEANER::mergeRects(), DIALOG_PAD_PROPERTIES::onAddPrimitive(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseFills6Data(), GPCB_FPL_CACHE::parseMODULE(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTracks6Data(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), PAD_TOOL::recombinePad(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), and DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 207 of file base_struct.h.

207 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:232
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:121

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 124 of file class_board_item.h.

125  {
126  wxPoint p( aX, GetY() );
127  SetPosition( p );
128  }
virtual void SetPosition(const wxPoint &aPos)=0
int GetY() const

References BOARD_ITEM::GetY(), and BOARD_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ SetY()

void BOARD_ITEM::SetY ( int  aY)
inlineinherited

Definition at line 130 of file class_board_item.h.

131  {
132  wxPoint p( GetX(), aY );
133  SetPosition( p );
134  }
virtual void SetPosition(const wxPoint &aPos)=0
int GetX() const

References BOARD_ITEM::GetX(), and BOARD_ITEM::SetPosition().

Referenced by BOARD_ITEM_DESC::BOARD_ITEM_DESC(), and TRACK_VIA_DESC::TRACK_VIA_DESC().

◆ ShowShape()

wxString BOARD_ITEM::ShowShape ( STROKE_T  aShape)
staticinherited

Function ShowShape converts the enum STROKE_T integer value to a wxString.

Definition at line 33 of file class_board_item.cpp.

34 {
35  switch( aShape )
36  {
37  case S_SEGMENT: return _( "Line" );
38  case S_RECT: return _( "Rect" );
39  case S_ARC: return _( "Arc" );
40  case S_CIRCLE: return _( "Circle" );
41  case S_CURVE: return _( "Bezier Curve" );
42  case S_POLYGON: return _( "Polygon" );
43  default: return wxT( "??" );
44  }
45 }
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
segment with non rounded ends
Arcs (with rounded ends)
Bezier Curve.
#define _(s)
Definition: 3d_actions.cpp:33

References _, S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, and S_SEGMENT.

Referenced by ConvertOutlineToPolygon(), DRAWSEGMENT::GetLength(), GetSelectMenuText(), DRAWSEGMENT::GetSelectMenuText(), DSN::SPECCTRA_DB::makeIMAGE(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().

◆ Sort()

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

Function Sort is a 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 520 of file base_struct.h.

520 { return *aLeft < *aRight; }

◆ SwapData()

void DRAWSEGMENT::SwapData ( BOARD_ITEM aImage)
overridevirtualinherited

Swap data between aItem and aImage.

aItem and aImage should have the same type Used in undo redo command to swap values between an item and its copy Only values like layer, size .. which are modified by editing are swapped

Parameters
aImage= the item image which contains data to swap

Reimplemented from BOARD_ITEM.

Definition at line 1181 of file class_drawsegment.cpp.

1182 {
1183  DRAWSEGMENT* image = dynamic_cast<DRAWSEGMENT*>( aImage );
1184  assert( image );
1185 
1186  std::swap( m_Width, image->m_Width );
1187  std::swap( m_Start, image->m_Start );
1188  std::swap( m_End, image->m_End );
1189  std::swap( m_Shape, image->m_Shape );
1190  std::swap( m_Type, image->m_Type );
1191  std::swap( m_Angle, image->m_Angle );
1192  std::swap( m_BezierC1, image->m_BezierC1 );
1193  std::swap( m_BezierC2, image->m_BezierC2 );
1194  std::swap( m_BezierPoints, image->m_BezierPoints );
1195  std::swap( m_Poly, image->m_Poly );
1196  std::swap( m_Layer, image->m_Layer );
1197  std::swap( m_Flags, image->m_Flags );
1198  std::swap( m_Status, image->m_Status );
1199  std::swap( m_Parent, image->m_Parent );
1200  std::swap( m_forceVisible, image->m_forceVisible );
1201 }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:174
SHAPE_POLY_SET m_Poly
Stores the S_POLYGON shape.
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
wxPoint m_BezierC1
Bezier Control Point 1.
PCB_LAYER_ID m_Layer
wxPoint m_Start
Line start point or Circle and Arc center.
wxPoint m_End
Line end point or circle and arc start point.
STATUS_FLAGS m_Status
Definition: base_struct.h:173
STROKE_T m_Shape
Shape: line, Circle, Arc.
int m_Type
Used in complex associations ( Dimensions.. )
STATUS_FLAGS m_Flags
Definition: base_struct.h:176
wxPoint m_BezierC2
Bezier Control Point 2.
int m_Width
thickness of lines ...
bool m_forceVisible
Definition: base_struct.h:175
std::vector< wxPoint > m_BezierPoints

References DRAWSEGMENT::m_Angle, DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_BezierPoints, DRAWSEGMENT::m_End, EDA_ITEM::m_Flags, EDA_ITEM::m_forceVisible, BOARD_ITEM::m_Layer, EDA_ITEM::m_Parent, DRAWSEGMENT::m_Poly, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, EDA_ITEM::m_Status, DRAWSEGMENT::m_Type, and DRAWSEGMENT::m_Width.

◆ TransformShapeWithClearanceToPolygon()

void DRAWSEGMENT::TransformShapeWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
int  aClearanceValue,
int  aError = ARC_HIGH_DEF,
bool  ignoreLineWidth = false 
) const
overridevirtualinherited

Function TransformShapeWithClearanceToPolygon Convert the draw segment to a closed polygon Used in filling zones calculations Circles and arcs are approximated by segments.

Parameters
aCornerBuffer= a buffer to store the polygon
aClearanceValue= the clearance around the pad
aError= the maximum deviation from a true arc
ignoreLineWidth= used for edge cut items where the line width is only for visualization

Reimplemented from BOARD_ITEM.

Definition at line 354 of file board_items_to_polygon_shape_transform.cpp.

357 {
358  int width = ignoreLineWidth ? 0 : m_Width;
359 
360  width += 2 * aClearanceValue;
361 
362  // Creating a reliable clearance shape for circles and arcs is not so easy, due to
363  // the error created by segment approximation.
364  // for a circle this is not so hard: create a polygon from a circle slightly bigger:
365  // thickness = width + s_error_max, and radius = initial radius + s_error_max/2
366  // giving a shape with a suitable internal radius and external radius
367  // For an arc this is more tricky: TODO
368 
369  switch( m_Shape )
370  {
371  case S_CIRCLE:
372  if( width == 0 )
373  TransformCircleToPolygon( aCornerBuffer, GetCenter(), GetRadius(), aError );
374  else
375  TransformRingToPolygon( aCornerBuffer, GetCenter(), GetRadius(), aError, width );
376  break;
377 
378  case S_RECT:
379  {
380  std::vector<wxPoint> pts;
381  GetRectCorners( &pts );
382 
383  if( width == 0 )
384  {
385  aCornerBuffer.NewOutline();
386 
387  for( const wxPoint& pt : pts )
388  aCornerBuffer.Append( pt );
389  }
390 
391  if( width > 0 )
392  {
393  // Add in segments
394  TransformSegmentToPolygon( aCornerBuffer, pts[0], pts[1], aError, width );
395  TransformSegmentToPolygon( aCornerBuffer, pts[1], pts[2], aError, width );
396  TransformSegmentToPolygon( aCornerBuffer, pts[2], pts[3], aError, width );
397  TransformSegmentToPolygon( aCornerBuffer, pts[3], pts[0], aError, width );
398  }
399  }
400  break;
401 
402  case S_ARC:
403  TransformArcToPolygon( aCornerBuffer, GetCenter(), GetArcStart(), m_Angle, aError, width );
404  break;
405 
406  case S_SEGMENT:
407  TransformOvalToPolygon( aCornerBuffer, m_Start, m_End, width, aError );
408  break;
409 
410  case S_POLYGON:
411  if( IsPolyShapeValid() )
412  {
413  // The polygon is expected to be a simple polygon
414  // not self intersecting, no hole.
415  MODULE* module = GetParentModule(); // NULL for items not in footprints
416  double orientation = module ? module->GetOrientation() : 0.0;
417  wxPoint offset;
418 
419  if( module )
420  offset = module->GetPosition();
421 
422  // Build the polygon with the actual position and orientation:
423  std::vector< wxPoint> poly;
424  poly = BuildPolyPointsList();
425 
426  for( wxPoint& point : poly )
427  {
428  RotatePoint( &point, orientation );
429  point += offset;
430  }
431 
432  if( IsPolygonFilled() || width == 0 )
433  {
434  aCornerBuffer.NewOutline();
435 
436  for( wxPoint& point : poly )
437  aCornerBuffer.Append( point.x, point.y );
438  }
439 
440  if( width > 0 )
441  {
442  wxPoint pt1( poly[ poly.size() - 1] );
443 
444  for( wxPoint pt2 : poly )
445  {
446  if( pt2 != pt1 )
447  TransformSegmentToPolygon( aCornerBuffer, pt1, pt2, aError, width );
448 
449  pt1 = pt2;
450  }
451  }
452  }
453  break;
454 
455  case S_CURVE: // Bezier curve
456  {
457  std::vector<wxPoint> ctrlPoints = { m_Start, m_BezierC1, m_BezierC2, m_End };
458  BEZIER_POLY converter( ctrlPoints );
459  std::vector< wxPoint> poly;
460  converter.GetPoly( poly, m_Width );
461 
462  if( width != 0 )
463  {
464  for( unsigned ii = 1; ii < poly.size(); ii++ )
465  TransformSegmentToPolygon( aCornerBuffer, poly[ii-1], poly[ii], aError, width );
466  }
467  }
468  break;
469 
470  default:
471  wxFAIL_MSG( "DRAWSEGMENT::TransformShapeWithClearanceToPolygon no implementation for "
472  + STROKE_T_asString( m_Shape ) );
473  break;
474  }
475 }
double GetOrientation() const
Definition: class_module.h:221
wxPoint GetArcStart() const
polygon (not yet used for tracks, but could be in microwave apps)
usual segment : line with rounded ends
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aError, int aWidth)
Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segmen...
double m_Angle
Used only for Arcs: Arc angle in 1/10 deg.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
wxPoint m_BezierC1
Bezier Control Point 1.
segment with non rounded ends
wxPoint m_Start
Line start point or Circle and Arc center.
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aError)
convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSeg...
wxPoint m_End
Line end point or circle and arc start point.
Arcs (with rounded ends)
MODULE * GetParentModule() const
Function GetParentModule returns a pointer to the parent module, or NULL if DRAWSEGMENT does not belo...
STROKE_T m_Shape
Shape: line, Circle, Arc.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Bezier Curve.
int NewOutline()
Creates a new empty polygon in the set and returns its index
static wxString STROKE_T_asString(STROKE_T a)
Bezier curves to polygon converter.
Definition: bezier_curves.h:35
void TransformCircleToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.
wxPoint m_BezierC2
Bezier Control Point 2.
bool IsPolyShapeValid() const
void TransformSegmentToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aError, int aWidth)
Function TransformRoundedEndsSegmentToPolygon convert a segment with rounded ends to a polygon Conver...
void TransformRingToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aError, int aWidth)
Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segme...
wxPoint GetPosition() const override
Definition: class_module.h:216
int m_Width
thickness of lines ...
void GetRectCorners(std::vector< wxPoint > *pts) const
bool IsPolygonFilled() const
Polygonal shape is not always filled.
wxPoint GetCenter() const override
Function GetCenter()
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), DRAWSEGMENT::BuildPolyPointsList(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), MODULE::GetOrientation(), DRAWSEGMENT::GetParentModule(), BEZIER_POLY::GetPoly(), MODULE::GetPosition(), DRAWSEGMENT::GetRadius(), DRAWSEGMENT::GetRectCorners(), DRAWSEGMENT::IsPolygonFilled(), DRAWSEGMENT::IsPolyShapeValid(), DRAWSEGMENT::m_Angle, DRAWSEGMENT::m_BezierC1, DRAWSEGMENT::m_BezierC2, DRAWSEGMENT::m_End, DRAWSEGMENT::m_Shape, DRAWSEGMENT::m_Start, DRAWSEGMENT::m_Width, SHAPE_POLY_SET::NewOutline(), RotatePoint(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, STROKE_T_asString(), TransformArcToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), TransformRingToPolygon(), and TransformSegmentToPolygon().

Referenced by ZONE_FILLER::addKnockout(), BOARD_ADAPTER::AddShapeWithClearanceToContainer(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseTracks6Data(), PAD_TOOL::recombinePad(), BOARD_ADAPTER::transformGraphicModuleEdgeToPolygonSet(), and MODULE::TransformGraphicShapesWithClearanceToPolygonSet().

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 193 of file base_struct.h.

193 { return m_StructType; }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:170

References EDA_ITEM::m_StructType.

Referenced by MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), 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(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_SELECT_NET_FROM_LIST::buildNetsList(), SCH_SCREENS::buildScreenList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), 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_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), CN_VISITOR::checkZoneItemConnection(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), SCH_NO_CONNECT::ClassOf(), TEXTE_PCB::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_PIN::ClassOf(), MARKER_PCB::ClassOf(), ClassOf(), SCH_LINE::ClassOf(), PCB_TARGET::ClassOf(), SCH_FIELD::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), ZONE_CONTAINER::ClassOf(), SCH_BITMAP::ClassOf(), D_PAD::ClassOf(), DIMENSION::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), SCH_SHEET_PIN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_SCREEN::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), SCH_TEXT::ClassOf(), SCH_SHEET::ClassOf(), BOARD::ClassOf(), ARC::ClassOf(), SCH_LABEL::ClassOf(), VIA::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), LIB_ITEM::compare(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), DIALOG_TEXT_PROPERTIES::convertKIIDsToReferences(), SCHEMATIC::ConvertKIIDsToRefs(), MODULE::CoverageRatio(), BOARD_ADAPTER::createLayers(), PCB_BASE_FRAME::CreateNewModule(), SCH_DRAWING_TOOLS::createNewText(), BOARD_ADAPTER::createNewTrack(), D_PAD::D_PAD(), SCH_SCREEN::DeleteItem(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), 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(), test::DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc(), DRC::doTrackDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), CN_ITEM::Dump(), EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(),