KiCad PCB EDA Suite
FP_SHAPE Class Reference

#include <fp_shape.h>

Inheritance diagram for FP_SHAPE:
PCB_SHAPE BOARD_ITEM EDA_ITEM KIGFX::VIEW_ITEM INSPECTABLE

Public Member Functions

 FP_SHAPE (FOOTPRINT *parent, PCB_SHAPE_TYPE aShape=PCB_SHAPE_TYPE::SEGMENT)
 
 ~FP_SHAPE ()
 
bool IsType (const KICAD_T aScanTypes[]) const override
 Check whether the item is one of the listed types. More...
 
void SetAngle (double aAngle, bool aUpdateEnd=true) override
 Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees. 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 wxPoint & GetStart0 () const
 
void SetEnd0 (const wxPoint &aPoint)
 
const wxPoint & GetEnd0 () const
 
void SetThirdPoint0 (const wxPoint &aPoint)
 
const wxPoint & GetThirdPoint0 () const
 
void SetBezier0_C1 (const wxPoint &aPoint)
 
const wxPoint & GetBezier0_C1 () const
 
void SetBezier0_C2 (const wxPoint &aPoint)
 
const wxPoint & GetBezier0_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
 Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
wxString GetClass () const override
 Return the class name. More...
 
wxString GetParentAsString () const
 
wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 Return the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
BITMAPS GetMenuImage () const override
 Return a pointer to an image to be used in menus. More...
 
EDA_ITEMClone () const override
 Create a duplicate of this item with linked list members set to NULL. More...
 
double ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 Return the level of detail (LOD) of the item. More...
 
void SetFilled (bool aFlag)
 
bool IsFilled () const
 
void SetWidth (int aWidth)
 
int GetWidth () const
 
double GetAngle () const
 
void SetShape (PCB_SHAPE_TYPE aShape)
 
PCB_SHAPE_TYPE GetShape () const
 
void SetBezControl1 (const wxPoint &aPoint)
 
const wxPoint & GetBezControl1 () const
 
void SetBezControl2 (const wxPoint &aPoint)
 
const wxPoint & GetBezControl2 () const
 
void SetPosition (const wxPoint &aPos) override
 
wxPoint GetPosition () const override
 
const wxPoint & GetStart () 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 wxPoint & GetEnd () 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)
 
const wxPoint & GetThirdPoint () const
 Function GetThirdPoint returns the third point point of the graphic. More...
 
int GetThirdPointY ()
 
int GetThirdPointX ()
 
void SetThirdPoint (const wxPoint &aPoint)
 
void SetThirdPointY (int y)
 
void SetThirdPointX (int x)
 
wxPoint GetCenter () const override
 This defaults to the center of the bounding box if not overridden. More...
 
wxPoint GetArcStart () const
 
wxPoint GetArcEnd () const
 
wxPoint GetArcMid () const
 
std::vector< wxPoint > GetRectCorners () const
 
double GetArcAngleStart () const
 function GetArcAngleStart() More...
 
double GetArcAngleEnd () const
 function GetArcAngleEnd() 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 SetArcEnd (const wxPoint &aArcEndPoint)
 Initialize the end arc point. More...
 
void SetCenter (const wxPoint &aCenterPoint)
 For arcs and circles: More...
 
void SetArcGeometry (const wxPoint &aStart, const wxPoint &aMid, const wxPoint &aEnd)
 Set the three controlling points for an arc. More...
 
const wxPoint GetFocusPosition () const override
 Similar to GetPosition, but allows items to return their visual center rather than their anchor. More...
 
FOOTPRINTGetParentFootprint () const
 Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not belong to a footprint. More...
 
const std::vector< wxPoint > & GetBezierPoints () const
 
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 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 PCB_SHAPE. More...
 
std::shared_ptr< SHAPEGetEffectiveShape (PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
 Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes. More...
 
const EDA_RECT GetBoundingBox () const override
 Return the orthogonal bounding box of this object for display purposes. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy=0) const override
 Test if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained, int aAccuracy=0) const override
 Test if aRect intersects or is contained within the bounding box of an item. More...
 
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, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, 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
 Return 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...
 
void SetParentGroup (PCB_GROUP *aGroup)
 
PCB_GROUPGetParentGroup () const
 
int GetX () const
 
int GetY () const
 
void SetX (int aX)
 
void SetY (int aY)
 
virtual bool IsConnected () const
 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
 Return the primary layer this item is on. More...
 
virtual LSET GetLayerSet () const
 Return a std::bitset of all layers on which the item physically resides. More...
 
virtual void SetLayerSet (LSET aLayers)
 
virtual void SetLayer (PCB_LAYER_ID aLayer)
 Set the layer this item is on. More...
 
virtual BOARD_ITEMDuplicate () const
 Create a copy of this BOARD_ITEM. More...
 
virtual bool IsOnLayer (PCB_LAYER_ID aLayer) const
 Test to see if this object is on the given layer. More...
 
bool IsTrack () const
 Test to see if this object is a track or via (or microvia). More...
 
virtual bool IsLocked () const
 
virtual void SetLocked (bool aLocked)
 Modify the 'lock' status for of the item. More...
 
void DeleteStructure ()
 Delete this object after removing from its parent if it has one. More...
 
virtual BOARDGetBoard () const
 Return the BOARD in which this BOARD_ITEM resides, or NULL if none. More...
 
wxString GetLayerName () const
 Return the name of the PCB layer on which the item resides. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Return the all the layers within the VIEW the object is painted on. More...
 
KICAD_T Type () const
 Returns the type of object. More...
 
virtual void SetParent (EDA_ITEM *aParent)
 
bool IsModified () const
 
bool IsNew () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsEntered () const
 
bool IsResized () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, bool 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) const
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
void SetForceVisible (bool aEnable)
 Set and clear force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
bool IsForceVisible () const
 
virtual SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 May be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
virtual bool Matches (const wxFindReplaceData &aSearchData, void *aAuxData) const
 Compare the item against the search criteria in aSearchData. More...
 
virtual bool Replace (const wxFindReplaceData &aSearchData, void *aAuxData=nullptr)
 Perform a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Override this method in any derived object that supports test find and replace. More...
 
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
 Draw the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 
bool Set (PROPERTY_BASE *aProperty, wxAny &aValue)
 
template<typename T >
bool Set (PROPERTY_BASE *aProperty, T aValue)
 
template<typename T >
bool Set (const wxString &aProperty, T aValue)
 
wxAny Get (PROPERTY_BASE *aProperty)
 
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 (PCB_SHAPE_TYPE aShape)
 Convert the enum #PCB_SHAPE_TYPE_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[])
 This changes first parameter to avoid the DList and use the main queue instead. More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Change first parameter to avoid the DList and use std::vector instead. More...
 
static bool Replace (const wxFindReplaceData &aSearchData, wxString &aText)
 Perform a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

wxPoint m_Start0
 Start point or center, relative to footprint origin, orient 0. More...
 
wxPoint m_End0
 End point, relative to footprint origin, orient 0. More...
 
wxPoint m_ThirdPoint0
 End point for an arc. More...
 
wxPoint m_Bezier0_C1
 Bezier Control Point 1, relative to footprint origin, orient 0. More...
 
wxPoint m_Bezier0_C2
 Bezier Control Point 2, relative to footprint 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< wxPoint > buildBezierToSegmentsPointsList (int aMinSegLen) const
 
virtual wxString layerMaskDescribe () const
 Return a string (to be shown to the user) describing a layer mask. More...
 
bool Matches (const wxString &aText, const wxFindReplaceData &aSearchData) const
 Compare aText against search criteria in aSearchData. More...
 

Protected Attributes

int m_width
 
bool m_filled
 
wxPoint m_start
 
wxPoint m_end
 
wxPoint m_thirdPoint
 
PCB_SHAPE_TYPE m_shape
 
double m_angle
 
wxPoint m_bezierC1
 
wxPoint m_bezierC2
 
std::vector< wxPoint > m_bezierPoints
 
SHAPE_POLY_SET m_poly
 
PCB_LAYER_ID m_layer
 
PCB_GROUPm_group
 
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 39 of file fp_shape.h.

Constructor & Destructor Documentation

◆ FP_SHAPE()

FP_SHAPE::FP_SHAPE ( FOOTPRINT parent,
PCB_SHAPE_TYPE  aShape = PCB_SHAPE_TYPE::SEGMENT 
)

Definition at line 40 of file fp_shape.cpp.

40  :
41  PCB_SHAPE( parent, PCB_FP_SHAPE_T )
42 {
43  m_shape = aShape;
44  m_angle = 0;
45  m_layer = F_SilkS;
46 }
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
double m_angle
Definition: pcb_shape.h:53
PCB_LAYER_ID m_layer
Definition: board_item.h:363
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
PCB_SHAPE(BOARD_ITEM *aParent=NULL, KICAD_T idtype=PCB_SHAPE_T)
Definition: pcb_shape.cpp:46

References F_SilkS, PCB_SHAPE::m_angle, BOARD_ITEM::m_layer, and PCB_SHAPE::m_shape.

Referenced by Clone().

◆ ~FP_SHAPE()

FP_SHAPE::~FP_SHAPE ( )

Definition at line 49 of file fp_shape.cpp.

50 {
51 }

Member Function Documentation

◆ buildBezierToSegmentsPointsList()

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

Definition at line 329 of file pcb_shape.cpp.

330 {
331  std::vector<wxPoint> bezierPoints;
332 
333  // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
334  std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
335  BEZIER_POLY converter( ctrlPoints );
336  converter.GetPoly( bezierPoints, aMinSegLen );
337 
338  return bezierPoints;
339 }
wxPoint m_end
Definition: pcb_shape.h:49
wxPoint m_start
Definition: pcb_shape.h:48
Bezier curves to polygon converter.
Definition: bezier_curves.h:36
wxPoint m_bezierC1
Definition: pcb_shape.h:54
wxPoint m_bezierC2
Definition: pcb_shape.h:55

References BEZIER_POLY::GetPoly(), PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, and PCB_SHAPE::m_start.

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

◆ BuildPolyPointsList()

const std::vector< wxPoint > PCB_SHAPE::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 1198 of file pcb_shape.cpp.

1199 {
1200  std::vector<wxPoint> rv;
1201 
1202  if( m_poly.OutlineCount() )
1203  {
1204  if( m_poly.COutline( 0 ).PointCount() )
1205  {
1206  for ( auto iter = m_poly.CIterate(); iter; iter++ )
1207  rv.emplace_back( iter->x, iter->y );
1208  }
1209  }
1210 
1211  return rv;
1212 }
int OutlineCount() const
Return the number of vertices in a given outline/hole.
int PointCount() const
Function PointCount()
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
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(), PCB_SHAPE::m_poly, SHAPE_POLY_SET::OutlineCount(), and SHAPE_LINE_CHAIN::PointCount().

Referenced by PCB_GRID_HELPER::computeAnchors(), PCB_PARSER::parsePAD(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), PCB_SHAPE::TransformShapeWithClearanceToPolygon(), and PCB_POINT_EDITOR::updatePoints().

◆ ClassOf()

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

Definition at line 49 of file fp_shape.h.

50  {
51  return aItem && PCB_FP_SHAPE_T == aItem->Type();
52  }
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References PCB_FP_SHAPE_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 204 of file eda_item.h.

204 { m_flags &= ~aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

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

◆ ClearSelected()

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 216 of file eda_item.h.

217  {
219  DO_NOT_DRAW );
220  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: eda_item.h:115
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: eda_item.h:104
#define CANDIDATE
flag indicating that the structure is connected
Definition: eda_item.h:117
#define DO_NOT_DRAW
Used to disable draw function.
Definition: eda_item.h:119
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: eda_item.h:112
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:204
#define ENDPOINT
ends. (Used to support dragging.)
Definition: eda_item.h:113
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: eda_item.h:118

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 148 of file view_item.h.

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

References KIGFX::VIEW_ITEM::m_viewPrivData.

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

◆ Clone()

EDA_ITEM * FP_SHAPE::Clone ( ) const
overridevirtual

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

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

Returns
A clone of the item.

Reimplemented from PCB_SHAPE.

Definition at line 136 of file fp_shape.cpp.

137 {
138  return new FP_SHAPE( *this );
139 }
FP_SHAPE(FOOTPRINT *parent, PCB_SHAPE_TYPE aShape=PCB_SHAPE_TYPE::SEGMENT)
Definition: fp_shape.cpp:40

References FP_SHAPE().

◆ computeArcBBox()

void PCB_SHAPE::computeArcBBox ( EDA_RECT aBBox) const
protectedinherited

Definition at line 1008 of file pcb_shape.cpp.

1009 {
1010  // Do not include the center, which is not necessarily
1011  // inside the BB of a arc with a small angle
1012  aBBox.SetOrigin( m_end );
1013 
1014  wxPoint end = m_end;
1015  RotatePoint( &end, m_start, -m_angle );
1016  aBBox.Merge( end );
1017 
1018  // Determine the starting quarter
1019  // 0 right-bottom
1020  // 1 left-bottom
1021  // 2 left-top
1022  // 3 right-top
1023  unsigned int quarter = 0; // assume right-bottom
1024 
1025  if( m_end.x < m_start.x )
1026  {
1027  if( m_end.y <= m_start.y )
1028  quarter = 2;
1029  else // ( m_End.y > m_Start.y )
1030  quarter = 1;
1031  }
1032  else if( m_end.x >= m_start.x )
1033  {
1034  if( m_end.y < m_start.y )
1035  quarter = 3;
1036  else if( m_end.x == m_start.x )
1037  quarter = 1;
1038  }
1039 
1040  int radius = GetRadius();
1041  int angle = (int) GetArcAngleStart() % 900 + m_angle;
1042  bool directionCW = ( m_angle > 0 ); // Is the direction of arc clockwise?
1043 
1044  // Make the angle positive, so we go clockwise and merge points belonging to the arc
1045  if( !directionCW )
1046  {
1047  angle = 900 - angle;
1048  quarter = ( quarter + 3 ) % 4; // -1 modulo arithmetic
1049  }
1050 
1051  while( angle > 900 )
1052  {
1053  switch( quarter )
1054  {
1055  case 0: aBBox.Merge( wxPoint( m_start.x, m_start.y + radius ) ); break; // down
1056  case 1: aBBox.Merge( wxPoint( m_start.x - radius, m_start.y ) ); break; // left
1057  case 2: aBBox.Merge( wxPoint( m_start.x, m_start.y - radius ) ); break; // up
1058  case 3: aBBox.Merge( wxPoint( m_start.x + radius, m_start.y ) ); break; // right
1059  }
1060 
1061  if( directionCW )
1062  ++quarter;
1063  else
1064  quarter += 3; // -1 modulo arithmetic
1065 
1066  quarter %= 4;
1067  angle -= 900;
1068  }
1069 
1070  aBBox.Inflate( m_width ); // Technically m_width / 2, but it doesn't hurt to have the
1071  // bounding box a bit large to account for drawing clearances,
1072  // etc.
1073 }
wxPoint m_end
Definition: pcb_shape.h:49
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
double GetArcAngleStart() const
function GetArcAngleStart()
Definition: pcb_shape.cpp:414
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
double m_angle
Definition: pcb_shape.h:53
wxPoint m_start
Definition: pcb_shape.h:48
int m_width
Definition: pcb_shape.h:46
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References PNS::angle(), PCB_SHAPE::GetArcAngleStart(), PCB_SHAPE::GetRadius(), EDA_RECT::Inflate(), PCB_SHAPE::m_angle, PCB_SHAPE::m_end, PCB_SHAPE::m_start, PCB_SHAPE::m_width, EDA_RECT::Merge(), RotatePoint(), and EDA_RECT::SetOrigin().

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

◆ DeleteStructure()

void BOARD_ITEM::DeleteStructure ( )
inherited

Delete this object after removing from its parent if it has one.

Definition at line 113 of file board_item.cpp.

114 {
115  BOARD_ITEM_CONTAINER* parent = GetParent();
116 
117  if( parent )
118  parent->Remove( this );
119 
120  delete this;
121 }
virtual void Remove(BOARD_ITEM *aItem, REMOVE_MODE aMode=REMOVE_MODE::NORMAL)=0
Removes an item from the container.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168

References BOARD_ITEM::GetParent(), and BOARD_ITEM_CONTAINER::Remove().

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

◆ Duplicate()

virtual BOARD_ITEM* BOARD_ITEM::Duplicate ( ) const
inlinevirtualinherited

Create a copy of this BOARD_ITEM.

Reimplemented in FOOTPRINT.

Definition at line 202 of file board_item.h.

203  {
204  EDA_ITEM* dupe = Clone();
205  const_cast<KIID&>( dupe->m_Uuid ) = KIID();
206 
207  return static_cast<BOARD_ITEM*>( dupe );
208  }
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:81
Definition: kiid.h:44
const KIID m_Uuid
Definition: eda_item.h:525
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150

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

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PCB_GROUP::DeepDuplicate(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), EDIT_TOOL::Duplicate(), and ARRAY_CREATOR::Invoke().

◆ Flip() [1/2]

void FP_SHAPE::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 FOOTPRINT::Flip because it is not usual to flip an item alone, without flipping the parent footprint (consider Mirror() instead).

Reimplemented from PCB_SHAPE.

Definition at line 158 of file fp_shape.cpp.

159 {
160  wxPoint pt( 0, 0 );
161 
162  switch( GetShape() )
163  {
164  case PCB_SHAPE_TYPE::ARC:
165  // Update arc angle but do not yet update m_ThirdPoint0 and m_thirdPoint,
166  // arc center and start point must be updated before calculation arc end.
167  SetAngle( -GetAngle(), false );
169 
170  default:
173  // If Start0 and Start are equal (ie: Footprint Editor), then flip both sets around the
174  // centre point.
175  if( m_start == m_Start0 )
176  pt = aCentre;
177 
178  if( aFlipLeftRight )
179  {
180  MIRROR( m_start.x, aCentre.x );
181  MIRROR( m_end.x, aCentre.x );
182  MIRROR( m_thirdPoint.x, aCentre.x );
183  MIRROR( m_bezierC1.x, aCentre.x );
184  MIRROR( m_bezierC2.x, aCentre.x );
185  MIRROR( m_Start0.x, pt.x );
186  MIRROR( m_End0.x, pt.x );
187  MIRROR( m_ThirdPoint0.x, pt.x );
188  MIRROR( m_Bezier0_C1.x, pt.x );
189  MIRROR( m_Bezier0_C2.x, pt.x );
190  }
191  else
192  {
193  MIRROR( m_start.y, aCentre.y );
194  MIRROR( m_end.y, aCentre.y );
195  MIRROR( m_thirdPoint.y, aCentre.y );
196  MIRROR( m_bezierC1.y, aCentre.y );
197  MIRROR( m_bezierC2.y, aCentre.y );
198  MIRROR( m_Start0.y, pt.y );
199  MIRROR( m_End0.y, pt.y );
200  MIRROR( m_ThirdPoint0.y, pt.y );
201  MIRROR( m_Bezier0_C1.y, pt.y );
202  MIRROR( m_Bezier0_C2.y, pt.y );
203  }
204 
206  break;
207 
209  // polygon corners coordinates are relative to the footprint position, orientation 0
210  m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight );
211  break;
212  }
213 
214  SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
215 }
wxPoint m_end
Definition: pcb_shape.h:49
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:194
PCB_SHAPE_TYPE GetShape() const
Definition: pcb_shape.h:130
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
polygon (not yet used for tracks, but could be in microwave apps)
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
void SetAngle(double aAngle, bool aUpdateEnd=true) override
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: fp_shape.cpp:142
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164
wxPoint m_start
Definition: pcb_shape.h:48
int m_width
Definition: pcb_shape.h:46
double GetAngle() const
Definition: pcb_shape.h:127
usual segment : line with rounded ends
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
Definition: pcb_shape.cpp:316
wxPoint m_bezierC1
Definition: pcb_shape.h:54
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163
Arcs (with rounded ends)
wxPoint m_bezierC2
Definition: pcb_shape.h:55
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

References ARC, CURVE, FlipLayer(), PCB_SHAPE::GetAngle(), BOARD_ITEM::GetBoard(), BOARD_ITEM::GetLayer(), PCB_SHAPE::GetShape(), KI_FALLTHROUGH, m_Bezier0_C1, m_Bezier0_C2, PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, m_End0, PCB_SHAPE::m_poly, PCB_SHAPE::m_start, m_Start0, PCB_SHAPE::m_thirdPoint, m_ThirdPoint0, PCB_SHAPE::m_width, MIRROR(), SHAPE_POLY_SET::Mirror(), POLYGON, PCB_SHAPE::RebuildBezierToSegmentsPointsList(), SEGMENT, SetAngle(), and BOARD_ITEM::SetLayer().

◆ Flip() [2/2]

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

Definition at line 315 of file board_item.h.

316  {
317  Flip( wxPoint( aCentre.x, aCentre.y ), aFlipLeftRight );
318  }
virtual void Flip(const wxPoint &aCentre, bool aFlipLeftRight)
Flip this object, i.e.
Definition: board_item.h:310

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

◆ Get() [1/3]

wxAny INSPECTABLE::Get ( PROPERTY_BASE aProperty)
inlineinherited

Definition at line 86 of file inspectable.h.

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

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

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

◆ Get() [2/3]

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

Definition at line 95 of file inspectable.h.

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

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

◆ Get() [3/3]

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

Definition at line 104 of file inspectable.h.

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

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

◆ GetAngle()

◆ GetArcAngleEnd()

double PCB_SHAPE::GetArcAngleEnd ( ) const
inherited

function GetArcAngleEnd()

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

Definition at line 428 of file pcb_shape.cpp.

429 {
430  // due to the Y axis orient atan2 needs - y value
431  double angleStart = ArcTangente( GetArcEnd().y - GetCenter().y,
432  GetArcEnd().x - GetCenter().x );
433 
434  // Normalize it to 0 ... 360 deg, to avoid discontinuity for angles near 180 deg
435  // because 180 deg and -180 are very near angles when ampping betewwen -180 ... 180 deg.
436  // and this is not easy to handle in calculations
437  NORMALIZE_ANGLE_POS( angleStart );
438 
439  return angleStart;
440 }
wxPoint GetArcEnd() const
Definition: pcb_shape.cpp:374
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:288
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:182

References ArcTangente(), PCB_SHAPE::GetArcEnd(), PCB_SHAPE::GetCenter(), and NORMALIZE_ANGLE_POS().

◆ GetArcAngleStart()

double PCB_SHAPE::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 414 of file pcb_shape.cpp.

415 {
416  // due to the Y axis orient atan2 needs - y value
417  double angleStart = ArcTangente( GetArcStart().y - GetCenter().y,
418  GetArcStart().x - GetCenter().x );
419 
420  // Normalize it to 0 ... 360 deg, to avoid discontinuity for angles near 180 deg
421  // because 180 deg and -180 are very near angles when ampping betewwen -180 ... 180 deg.
422  // and this is not easy to handle in calculations
423  NORMALIZE_ANGLE_POS( angleStart );
424 
425  return angleStart;
426 }
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:288
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:182

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

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

◆ GetArcEnd()

wxPoint PCB_SHAPE::GetArcEnd ( ) const
inherited

Definition at line 374 of file pcb_shape.cpp.

375 {
376  wxPoint endPoint( m_end ); // start of arc
377 
378  switch( m_shape )
379  {
380  case PCB_SHAPE_TYPE::ARC:
381  endPoint = m_thirdPoint;
382  break;
383 
384  default:
385  break;
386  }
387 
388  return endPoint; // after rotation, the end of the arc.
389 }
wxPoint m_end
Definition: pcb_shape.h:49
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References ARC, PCB_SHAPE::m_end, PCB_SHAPE::m_shape, and PCB_SHAPE::m_thirdPoint.

Referenced by PCB_GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), PCB_POINT_EDITOR::editArcEndpointKeepTangent(), PCB_SHAPE::GetArcAngleEnd(), PCB_POINT_EDITOR::makePoints(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), PCB_SHAPE::TransformShapeWithClearanceToPolygon(), and PCB_POINT_EDITOR::updatePoints().

◆ GetArcMid()

wxPoint PCB_SHAPE::GetArcMid ( ) const
inherited

Definition at line 392 of file pcb_shape.cpp.

393 {
394  wxPoint endPoint( m_end );
395 
396  switch( m_shape )
397  {
398  case PCB_SHAPE_TYPE::ARC:
399  // rotate the starting point of the arc, given by m_End, through half
400  // the angle m_Angle to get the middle of the arc.
401  // m_Start is the arc centre
402  endPoint = m_end; // m_End = start point of arc
403  RotatePoint( &endPoint, m_start, -m_angle / 2.0 );
404  break;
405 
406  default:
407  break;
408  }
409 
410  return endPoint; // after rotation, the end of the arc.
411 }
wxPoint m_end
Definition: pcb_shape.h:49
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
double m_angle
Definition: pcb_shape.h:53
wxPoint m_start
Definition: pcb_shape.h:48
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References ARC, PCB_SHAPE::m_angle, PCB_SHAPE::m_end, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, and RotatePoint().

Referenced by PCB_GRID_HELPER::computeAnchors(), PCB_POINT_EDITOR::editArcMidKeepEndpoints(), PCB_POINT_EDITOR::makePoints(), PCB_SHAPE::TransformShapeWithClearanceToPolygon(), and PCB_POINT_EDITOR::updatePoints().

◆ GetArcStart()

◆ GetBezControl1()

◆ GetBezControl2()

◆ GetBezier0_C1()

const wxPoint& FP_SHAPE::GetBezier0_C1 ( ) const
inline

Definition at line 121 of file fp_shape.h.

121 { return m_Bezier0_C1; }
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163

References m_Bezier0_C1.

Referenced by PCB_IO::format().

◆ GetBezier0_C2()

const wxPoint& FP_SHAPE::GetBezier0_C2 ( ) const
inline

Definition at line 124 of file fp_shape.h.

124 { return m_Bezier0_C2; }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164

References m_Bezier0_C2.

Referenced by PCB_IO::format().

◆ GetBezierPoints()

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

Definition at line 253 of file pcb_shape.h.

253 { return m_bezierPoints; }
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57

References PCB_SHAPE::m_bezierPoints.

Referenced by GRAPHICS_CLEANER::areEquivalent(), ConvertOutlineToPolygon(), and GRAPHICS_CLEANER::isNullSegment().

◆ GetBoard()

BOARD * BOARD_ITEM::GetBoard ( ) const
virtualinherited

Return the BOARD in which this BOARD_ITEM resides, or NULL if none.

Definition at line 46 of file board_item.cpp.

47 {
48  if( Type() == PCB_T )
49  return (BOARD*) this;
50 
51  BOARD_ITEM* parent = GetParent();
52 
53  if( parent )
54  return parent->GetBoard();
55 
56  return NULL;
57 }
Definition: typeinfo.h:84
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
#define NULL
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

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

Referenced by PAD::BuildEffectivePolygon(), PAD::BuildEffectiveShapes(), ZONE::BuildSmoothedPoly(), KIGFX::PCB_PAINTER::draw(), exprFromTo(), VIA::FlashLayer(), PAD::FlashLayer(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), VIA::Flip(), ZONE::Flip(), BOARD_ITEM::GetBoard(), FOOTPRINT::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), BOARD_CONNECTED_ITEM::GetEffectiveNetclass(), ZONE::GetInteractingZones(), BOARD_ITEM::GetLayerName(), VIA::GetMinAnnulus(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), TRACK::GetMsgPanelInfo(), TRACK::GetMsgPanelInfoBase_Common(), BOARD_CONNECTED_ITEM::GetNetClass(), BOARD_CONNECTED_ITEM::GetNetnameMsg(), BOARD_CONNECTED_ITEM::GetOwnClearance(), ZONE::GetSelectMenuText(), DRC_ENGINE::GetShape(), FP_TEXT::GetShownText(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), BOARD::GetTrackLength(), TRACK::GetWidthConstraints(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), BOARD_ITEM::layerMaskDescribe(), VIA::layerMaskDescribe(), CONVERT_TOOL::makePolysFromCircles(), PAD::MergePrimitivesAsPolygon(), EAGLE_PLUGIN::packageWire(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), BOARD::ResolveDRCExclusions(), BOARD_CONNECTED_ITEM::SetNetCode(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), TRACK::ViewBBox(), FOOTPRINT::ViewBBox(), VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ GetBoundingBox()

const EDA_RECT PCB_SHAPE::GetBoundingBox ( ) const
overridevirtualinherited

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

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

Reimplemented from EDA_ITEM.

Definition at line 569 of file pcb_shape.cpp.

570 {
571  EDA_RECT bbox;
572 
573  bbox.SetOrigin( m_start );
574 
575  switch( m_shape )
576  {
578  {
579  std::vector<wxPoint> pts = GetRectCorners();
580 
581  bbox = EDA_RECT(); // re-init for merging
582 
583  for( wxPoint& pt : pts )
584  bbox.Merge( pt );
585  }
586  break;
587 
589  bbox.SetEnd( m_end );
590  break;
591 
593  bbox.Inflate( GetRadius() );
594  break;
595 
596  case PCB_SHAPE_TYPE::ARC:
597  computeArcBBox( bbox );
598  break;
599 
601  {
602  if( m_poly.IsEmpty() )
603  break;
604 
605  FOOTPRINT* parentFootprint = GetParentFootprint();
606  bbox = EDA_RECT(); // re-init for merging
607 
608  for( auto iter = m_poly.CIterate(); iter; iter++ )
609  {
610  wxPoint pt( iter->x, iter->y );
611 
612  if( parentFootprint ) // Transform, if we belong to a footprint
613  {
614  RotatePoint( &pt, parentFootprint->GetOrientation() );
615  pt += parentFootprint->GetPosition();
616  }
617 
618  bbox.Merge( pt );
619  }
620  }
621  break;
622 
624  bbox.Merge( m_bezierC1 );
625  bbox.Merge( m_bezierC2 );
626  bbox.Merge( m_end );
627  break;
628 
629  default:
630  wxFAIL_MSG( "PCB_SHAPE::GetBoundingBox not implemented for "
632  break;
633  }
634 
635  bbox.Inflate( m_width / 2 );
636  bbox.Normalize();
637 
638  return bbox;
639 }
wxPoint m_end
Definition: pcb_shape.h:49
void Merge(const EDA_RECT &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: eda_rect.cpp:431
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
bool IsEmpty() const
std::vector< wxPoint > GetRectCorners() const
Definition: pcb_shape.cpp:971
void computeArcBBox(EDA_RECT &aBBox) const
Definition: pcb_shape.cpp:1008
double GetOrientation() const
Definition: footprint.h:186
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
polygon (not yet used for tracks, but could be in microwave apps)
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
void SetEnd(int x, int y)
Definition: eda_rect.h:187
segment with non rounded ends
CONST_ITERATOR CIterate(int aFirst, int aLast, bool aIterateHoles=false) const
wxPoint m_start
Definition: pcb_shape.h:48
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE a)
Definition: board_item.h:59
int m_width
Definition: pcb_shape.h:46
FOOTPRINT * GetParentFootprint() const
Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not ...
Definition: pcb_shape.cpp:479
Handle the component boundary box.
Definition: eda_rect.h:42
usual segment : line with rounded ends
wxPoint GetPosition() const override
Definition: footprint.h:182
wxPoint m_bezierC1
Definition: pcb_shape.h:54
Arcs (with rounded ends)
wxPoint m_bezierC2
Definition: pcb_shape.h:55
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References ARC, CIRCLE, SHAPE_POLY_SET::CIterate(), PCB_SHAPE::computeArcBBox(), CURVE, FOOTPRINT::GetOrientation(), PCB_SHAPE::GetParentFootprint(), FOOTPRINT::GetPosition(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetRectCorners(), EDA_RECT::Inflate(), SHAPE_POLY_SET::IsEmpty(), PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, PCB_SHAPE::m_width, EDA_RECT::Merge(), EDA_RECT::Normalize(), PCB_SHAPE_TYPE_T_asString(), POLYGON, RECT, RotatePoint(), SEGMENT, EDA_RECT::SetEnd(), and EDA_RECT::SetOrigin().

Referenced by BOARD_ADAPTER::addShapeWithClearance(), PCB_SHAPE::GetCenter(), and PCB_SHAPE::HitTest().

◆ GetCenter()

wxPoint PCB_SHAPE::GetCenter ( ) const
overridevirtualinherited

This defaults to the center of the bounding box if not overridden.

Returns
center point of the item

Reimplemented from BOARD_ITEM.

Definition at line 342 of file pcb_shape.cpp.

343 {
344  wxPoint c;
345 
346  switch( m_shape )
347  {
348  case PCB_SHAPE_TYPE::ARC:
350  c = m_start;
351  break;
352 
354  // Midpoint of the line
355  c = ( GetStart() + GetEnd() ) / 2;
356  break;
357 
361  c = GetBoundingBox().Centre();
362  break;
363 
364  default:
365  wxFAIL_MSG( "PCB_SHAPE::GetCentre not implemented for "
367  break;
368  }
369 
370  return c;
371 }
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
polygon (not yet used for tracks, but could be in microwave apps)
segment with non rounded ends
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
wxPoint m_start
Definition: pcb_shape.h:48
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE a)
Definition: board_item.h:59
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_shape.cpp:569
usual segment : line with rounded ends
wxPoint Centre() const
Definition: eda_rect.h:60
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References ARC, EDA_RECT::Centre(), CIRCLE, CURVE, PCB_SHAPE::GetBoundingBox(), PCB_SHAPE::GetEnd(), PCB_SHAPE::GetStart(), PCB_SHAPE::m_shape, PCB_SHAPE::m_start, PCB_SHAPE_TYPE_T_asString(), POLYGON, RECT, and SEGMENT.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), GRAPHICS_CLEANER::areEquivalent(), PCB_GRID_HELPER::computeAnchors(), ConvertOutlineToPolygon(), PCB_SHAPE::GetArcAngleEnd(), PCB_SHAPE::GetArcAngleStart(), PCB_SHAPE::GetFocusPosition(), PCB_SHAPE::HitTest(), idf_export_outline(), GRAPHICS_CLEANER::isNullSegment(), PCB_SHAPE::MakeEffectiveShapes(), PCB_POINT_EDITOR::makePoints(), EAGLE_PLUGIN::packageRectangle(), PCB_PARSER::parsePAD(), PCB_SHAPE::TransformShapeWithClearanceToPolygon(), PCB_POINT_EDITOR::updateItem(), and PCB_POINT_EDITOR::updatePoints().

◆ GetClass()

wxString FP_SHAPE::GetClass ( ) const
inlineoverridevirtual

Return the class name.

Implements EDA_ITEM.

Definition at line 141 of file fp_shape.h.

142  {
143  return wxT( "MGRAPHIC" );
144  }

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 208 of file eda_item.h.

209  {
210  constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED |
212 
213  return m_flags & mask;
214  }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
#define STRUCT_DELETED
flag indication structures to be erased
Definition: eda_item.h:116
#define IS_MOVED
Item being moved.
Definition: eda_item.h:106
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
Definition: eda_item.h:120
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531
#define IS_NEW
New item, just created.
Definition: eda_item.h:107

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

Referenced by EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editFieldText(), SYMBOL_EDITOR_PIN_TOOL::EditPinProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), SCH_COMPONENT::GetMsgPanelInfo(), SELECTION_CONDITIONS::Idle(), SELECTION_CONDITIONS::IdleSelection(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), PAD_TOOL::recombinePad(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), and DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow().

◆ GetEffectiveShape()

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

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 for use with routing, collision determination, etc).

Note
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 1192 of file pcb_shape.cpp.

1193 {
1194  return std::make_shared<SHAPE_COMPOUND>( MakeEffectiveShapes() );
1195 }
std::vector< SHAPE * > MakeEffectiveShapes() const
Makes a set of SHAPE objects representing the PCB_SHAPE.
Definition: pcb_shape.cpp:1086

References PCB_SHAPE::MakeEffectiveShapes().

◆ GetEnd()

◆ GetEnd0()

const wxPoint& FP_SHAPE::GetEnd0 ( ) const
inline

◆ GetEndX()

int PCB_SHAPE::GetEndX ( )
inlineinherited

Definition at line 158 of file pcb_shape.h.

158 { return m_end.x; }
wxPoint m_end
Definition: pcb_shape.h:49

References PCB_SHAPE::m_end.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), and DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run().

◆ GetEndY()

int PCB_SHAPE::GetEndY ( )
inlineinherited

Definition at line 157 of file pcb_shape.h.

157 { return m_end.y; }
wxPoint m_end
Definition: pcb_shape.h:49

References PCB_SHAPE::m_end.

Referenced by DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), and DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run().

◆ GetFlags()

◆ GetFocusPosition()

const wxPoint PCB_SHAPE::GetFocusPosition ( ) const
inlineoverridevirtualinherited

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

Reimplemented from EDA_ITEM.

Definition at line 239 of file pcb_shape.h.

240  {
241  return GetCenter();
242  }
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342

References PCB_SHAPE::GetCenter().

◆ GetLayer()

virtual PCB_LAYER_ID BOARD_ITEM::GetLayer ( ) const
inlinevirtualinherited

Return the primary layer this item is on.

Reimplemented in ZONE.

Definition at line 173 of file board_item.h.

173 { return m_layer; }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by CN_LIST::Add(), BOARD_ADAPTER::addFootprintShapesWithClearance(), GRAPHICS_CLEANER::areEquivalent(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), AR_AUTOPLACER::buildFpAreas(), TRACKS_CLEANER::cleanup(), CreateBoardSection(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), CreateRoutesSection(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), PCB_EDIT_FRAME::ExchangeFootprint(), EXPORTER_PCB_VRML::ExportVrmlFootprint(), extractDiffPairCoupledItems(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), Flip(), FP_TEXT::Flip(), DIMENSION_BASE::Flip(), FOOTPRINT::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), PCB_IO::FootprintSave(), FootprintWriteShape(), PCB_IO::format(), PCB_IO::formatLayer(), FP_TEXT::FP_TEXT(), DSN::SPECCTRA_DB::FromBOARD(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), FOOTPRINT::GetBoundingBox(), ZONE::GetLayer(), getMatchingTextItem(), TRACK::GetMsgPanelInfo(), VIA::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), AR_AUTOPLACER::getOptimalFPPlacement(), BOARD::GetPad(), TRACK::GetWidthConstraints(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), idf_export_footprint(), GENERAL_COLLECTOR::Inspect(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), isEdge(), PAD::IsFlipped(), PNS_KICAD_IFACE::IsItemVisible(), BOARD_ITEM::IsOnCopperLayer(), IsParentFlipped(), FP_TEXT::IsParentFlipped(), itemIsIncludedByFilter(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), TRACK::cmp_tracks::operator()(), BOARD_ITEM::ptr_cmp::operator()(), PCB_SHAPE::cmp_drawings::operator()(), FOOTPRINT::cmp_drawings::operator()(), EAGLE_PLUGIN::packagePad(), BRDITEMS_PLOTTER::PlotBoardGraphicItems(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPcbShape(), BRDITEMS_PLOTTER::PlotPcbTarget(), BRDITEMS_PLOTTER::PlotPcbText(), CONVERT_TOOL::PolyToLines(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PAD_TOOL::recombinePad(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), PCB_SELECTION_TOOL::Selectable(), GLOBAL_EDIT_TOOL::swapBoardItem(), PNS_KICAD_IFACE_BASE::syncArc(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), PNS_KICAD_IFACE_BASE::syncTrack(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::testAgainstEdge(), AR_AUTOPLACER::testFootprintOnBoard(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackAgainstItem(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), BOARD_ADAPTER::transformFPShapesToPolygon(), FOOTPRINT::TransformFPShapesWithClearanceToPolygon(), TRACK::ViewGetLayers(), FP_TEXT::ViewGetLayers(), FP_TEXT::ViewGetLOD(), FP_ZONE::ViewGetLOD(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetLayerName()

wxString BOARD_ITEM::GetLayerName ( ) const
inherited

Return the name of the PCB layer on which the item resides.

Returns
the layer name associated with this item.

Definition at line 60 of file board_item.cpp.

61 {
62  BOARD* board = GetBoard();
63 
64  if( board )
65  return board->GetLayerName( m_layer );
66 
67  // If no parent, return standard name
69 }
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID m_layer
Definition: board_item.h:363
static wxString GetStandardLayerName(PCB_LAYER_ID aLayerId)
Return an "English Standard" name of a PCB layer when given aLayerNumber.
Definition: board.h:676

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

Referenced by PCB_TEXT::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), FP_TEXT::GetMsgPanelInfo(), DIMENSION_BASE::GetMsgPanelInfo(), PCB_SHAPE::GetMsgPanelInfo(), LEADER::GetMsgPanelInfo(), PCB_TEXT::GetSelectMenuText(), GetSelectMenuText(), TRACK::GetSelectMenuText(), DIMENSION_BASE::GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), PCB_TEXT::GetShownText(), and FOOTPRINT::ResolveTextVar().

◆ GetLayerSet()

◆ GetLength()

double PCB_SHAPE::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 77 of file pcb_shape.cpp.

78 {
79  double length = 0.0;
80 
81  switch( m_shape )
82  {
84  for( size_t ii = 1; ii < m_bezierPoints.size(); ++ii )
85  length += GetLineLength( m_bezierPoints[ ii - 1], m_bezierPoints[ii] );
86 
87  break;
88 
90  length = GetLineLength( GetStart(), GetEnd() );
91  break;
92 
94  for( int ii = 0; ii < m_poly.COutline( 0 ).SegmentCount(); ii++ )
95  length += m_poly.COutline( 0 ).CSegment( ii ).Length();
96 
97  break;
98 
100  length = 2 * M_PI * GetRadius() * ( GetAngle() / 3600.0 );
101  break;
102 
103  default:
104  wxASSERT_MSG( false, "PCB_SHAPE::GetLength not implemented for shape"
105  + ShowShape( GetShape() ) );
106  break;
107  }
108 
109  return length;
110 }
int Length() const
Return the length (this).
Definition: seg.h:355
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:223
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
PCB_SHAPE_TYPE GetShape() const
Definition: pcb_shape.h:130
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
polygon (not yet used for tracks, but could be in microwave apps)
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
int SegmentCount() const
Function SegmentCount()
const SEG CSegment(int aIndex) const
Function CSegment()
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
double GetAngle() const
Definition: pcb_shape.h:127
usual segment : line with rounded ends
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
static wxString ShowShape(PCB_SHAPE_TYPE aShape)
Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.
Definition: board_item.cpp:31
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References ARC, SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CSegment(), CURVE, PCB_SHAPE::GetAngle(), PCB_SHAPE::GetEnd(), GetLineLength(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetStart(), SEG::Length(), PCB_SHAPE::m_bezierPoints, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, POLYGON, SEGMENT, SHAPE_LINE_CHAIN::SegmentCount(), and BOARD_ITEM::ShowShape().

Referenced by PCB_SHAPE::GetMsgPanelInfo().

◆ GetMenuImage()

BITMAPS FP_SHAPE::GetMenuImage ( ) const
overridevirtual

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

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

Returns
The menu image associated with the item.

Reimplemented from PCB_SHAPE.

Definition at line 130 of file fp_shape.cpp.

131 {
132  return BITMAPS::show_mod_edge;
133 }

References show_mod_edge.

◆ GetMsgPanelInfo()

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

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

Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 111 of file fp_shape.cpp.

112 {
113  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
114 
115  aList.emplace_back( _( "Footprint" ), fp ? fp->GetReference() : _( "<invalid>" ) );
116 
117  // append the features shared with the base class
118  PCB_SHAPE::GetMsgPanelInfo( aFrame, aList );
119 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
const wxString & GetReference() const
Definition: footprint.h:426
#define _(s)
Definition: 3d_actions.cpp:33
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcb_shape.cpp:488

References _, PCB_SHAPE::GetMsgPanelInfo(), FOOTPRINT::GetReference(), and EDA_ITEM::m_parent.

◆ GetParent()

BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParent ( void  ) const
inlineinherited

Definition at line 168 of file board_item.h.

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

References EDA_ITEM::m_parent.

Referenced by PCB_POINT_EDITOR::addCorner(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PNS_KICAD_IFACE::Commit(), EDIT_TOOL::copyToClipboard(), FOOTPRINT::CoverageRatio(), 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(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), KIGFX::PCB_PAINTER::draw(), EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), PCB_IO::format(), FormatProbeItem(), BOARD_ITEM::GetBoard(), PCB_MARKER::GetColorLayer(), ALIGN_DISTRIBUTE_TOOL::GetSelections(), FP_TEXT::GetSelectMenuText(), PCB_TEXT::GetShownText(), FP_TEXT::GetShownText(), getTopLevelGroup(), insideArea(), GENERAL_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), DRC_ENGINE::IsNetTie(), IsParentFlipped(), FP_TEXT::IsParentFlipped(), LEGACY_PLUGIN::loadMODULE_TEXT(), memberOf(), EDIT_TOOL::MoveExact(), ALTIUM_PCB::ParseTexts6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), POSITION_RELATIVE_TOOL::PositionRelative(), BOARD_COMMIT::Push(), DRC_TEST_PROVIDER_SILK_CLEARANCE::Run(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), CLIPBOARD_IO::SaveSelection(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), SwapItemData(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), PCB_MARKER::ViewGetLayers(), FP_ZONE::ViewGetLOD(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ GetParentAsString()

wxString FP_SHAPE::GetParentAsString ( ) const
inline

Definition at line 146 of file fp_shape.h.

146 { return m_parent->m_Uuid.AsString(); }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
wxString AsString() const
Definition: kiid.cpp:218
const KIID m_Uuid
Definition: eda_item.h:525

References KIID::AsString(), EDA_ITEM::m_parent, and EDA_ITEM::m_Uuid.

Referenced by FP_SHAPE_DESC::FP_SHAPE_DESC().

◆ GetParentFootprint()

FOOTPRINT * PCB_SHAPE::GetParentFootprint ( ) const
inherited

Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not belong to a footprint.

Returns
FOOTPRINT* - pointer to the parent footprint or NULL.

Definition at line 479 of file pcb_shape.cpp.

480 {
481  if( !m_parent || m_parent->Type() != PCB_FOOTPRINT_T )
482  return NULL;
483 
484  return (FOOTPRINT*) m_parent;
485 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
#define NULL
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References EDA_ITEM::m_parent, NULL, PCB_FOOTPRINT_T, and EDA_ITEM::Type().

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

◆ GetParentGroup()

◆ GetPointCount()

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

Definition at line 1227 of file pcb_shape.cpp.

1228 {
1229  // return the number of corners of the polygonal shape
1230  // this shape is expected to be only one polygon without hole
1231  if( GetPolyShape().OutlineCount() )
1232  return GetPolyShape().VertexCount( 0 );
1233 
1234  return 0;
1235 }
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
int VertexCount(int aOutline=-1, int aHole=-1) const
Returns the number of holes in a given outline.

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

Referenced by GRAPHICS_CLEANER::isNullSegment().

◆ GetPolyShape() [1/2]

◆ GetPolyShape() [2/2]

const SHAPE_POLY_SET& PCB_SHAPE::GetPolyShape ( ) const
inlineinherited

Definition at line 269 of file pcb_shape.h.

269 { return m_poly; }
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58

References PCB_SHAPE::m_poly.

◆ GetPosition()

wxPoint PCB_SHAPE::GetPosition ( ) const
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 68 of file pcb_shape.cpp.

69 {
71  return (wxPoint) m_poly.CVertex( 0 );
72  else
73  return m_start;
74 }
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
polygon (not yet used for tracks, but could be in microwave apps)
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
wxPoint m_start
Definition: pcb_shape.h:48
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References SHAPE_POLY_SET::CVertex(), PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, and POLYGON.

Referenced by CONVERT_TOOL::makePolysFromCircles().

◆ GetRadius()

int PCB_SHAPE::GetRadius ( ) const
inlineinherited

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

Definition at line 201 of file pcb_shape.h.

202  {
203  double radius = GetLineLength( m_start, m_end );
204 
205  // don't allow degenerate arcs
206  return std::max( 1, KiROUND( radius ) );
207  }
wxPoint m_end
Definition: pcb_shape.h:49
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:223
wxPoint m_start
Definition: pcb_shape.h:48
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(), PCB_SHAPE::m_end, and PCB_SHAPE::m_start.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), PCB_SHAPE::computeArcBBox(), ConvertOutlineToPolygon(), KIGFX::PCB_PAINTER::draw(), PCB_SHAPE::GetBoundingBox(), PCB_SHAPE::GetLength(), hash_fp_item(), PCB_SHAPE::HitTest(), idf_export_outline(), GRAPHICS_CLEANER::isNullSegment(), PCB_SHAPE::MakeEffectiveShapes(), CONVERT_TOOL::makePolysFromCircles(), PCB_PARSER::parsePAD(), PCB_SHAPE::Scale(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow(), and PCB_SHAPE::TransformShapeWithClearanceToPolygon().

◆ GetRectCorners()

std::vector< wxPoint > PCB_SHAPE::GetRectCorners ( ) const
inherited

Definition at line 971 of file pcb_shape.cpp.

972 {
973  std::vector<wxPoint> pts;
974  FOOTPRINT* parentFootprint = GetParentFootprint();
975  wxPoint topLeft = GetStart();
976  wxPoint botRight = GetEnd();
977 
978  // Un-rotate rect topLeft and botRight
979  if( parentFootprint && KiROUND( parentFootprint->GetOrientation() ) % 900 != 0 )
980  {
981  topLeft -= parentFootprint->GetPosition();
982  RotatePoint( &topLeft, -parentFootprint->GetOrientation() );
983 
984  botRight -= parentFootprint->GetPosition();
985  RotatePoint( &botRight, -parentFootprint->GetOrientation() );
986  }
987 
988  // Set up the un-rotated 4 corners
989  pts.emplace_back( topLeft );
990  pts.emplace_back( botRight.x, topLeft.y );
991  pts.emplace_back( botRight );
992  pts.emplace_back( topLeft.x, botRight.y );
993 
994  // Now re-rotate the 4 corners to get a diamond
995  if( parentFootprint && KiROUND( parentFootprint->GetOrientation() ) % 900 != 0 )
996  {
997  for( wxPoint& pt : pts )
998  {
999  RotatePoint( &pt, parentFootprint->GetOrientation() );
1000  pt += parentFootprint->GetPosition();
1001  }
1002  }
1003 
1004  return pts;
1005 }
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
double GetOrientation() const
Definition: footprint.h:186
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
FOOTPRINT * GetParentFootprint() const
Function GetParentFootprint returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not ...
Definition: pcb_shape.cpp:479
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
wxPoint GetPosition() const override
Definition: footprint.h:182

References PCB_SHAPE::GetEnd(), FOOTPRINT::GetOrientation(), PCB_SHAPE::GetParentFootprint(), FOOTPRINT::GetPosition(), PCB_SHAPE::GetStart(), KiROUND(), and RotatePoint().

Referenced by BOARD_ADAPTER::addShapeWithClearance(), ConvertOutlineToPolygon(), KIGFX::PCB_PAINTER::draw(), PCB_SHAPE::GetBoundingBox(), PCB_SHAPE::HitTest(), PCB_SHAPE::MakeEffectiveShapes(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), and PCB_SHAPE::TransformShapeWithClearanceToPolygon().

◆ GetSelectMenuText()

wxString FP_SHAPE::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from PCB_SHAPE.

Definition at line 122 of file fp_shape.cpp.

123 {
124  return wxString::Format( _( "%s on %s" ),
125  ShowShape( m_shape ),
126  GetLayerName() );
127 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
static wxString ShowShape(PCB_SHAPE_TYPE aShape)
Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.
Definition: board_item.cpp:31
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Definition: board_item.cpp:60
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References _, Format(), BOARD_ITEM::GetLayerName(), PCB_SHAPE::m_shape, and BOARD_ITEM::ShowShape().

◆ GetShape()

PCB_SHAPE_TYPE PCB_SHAPE::GetShape ( ) const
inlineinherited

◆ GetStart()

◆ GetStart0()

const wxPoint& FP_SHAPE::GetStart0 ( ) const
inline

Definition at line 112 of file fp_shape.h.

112 { return m_Start0; }
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160

References m_Start0.

Referenced by FootprintWriteShape(), PCB_IO::format(), CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromDrawsegments(), hash_fp_item(), DSN::SPECCTRA_DB::makeIMAGE(), and CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments().

◆ GetStartX()

int PCB_SHAPE::GetStartX ( )
inlineinherited

Definition at line 147 of file pcb_shape.h.

147 { return m_start.x; }
wxPoint m_start
Definition: pcb_shape.h:48

References PCB_SHAPE::m_start.

Referenced by DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run().

◆ GetStartY()

int PCB_SHAPE::GetStartY ( )
inlineinherited

Definition at line 146 of file pcb_shape.h.

146 { return m_start.y; }
wxPoint m_start
Definition: pcb_shape.h:48

References PCB_SHAPE::m_start.

Referenced by DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 187 of file eda_item.h.

188  {
189  return m_status & type;
190  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_ITEM::IsLocked().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 200 of file eda_item.h.

200 { return m_status; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

◆ GetThirdPoint()

const wxPoint& PCB_SHAPE::GetThirdPoint ( ) const
inlineinherited

Function GetThirdPoint returns the third point point of the graphic.

Definition at line 167 of file pcb_shape.h.

167 { return m_thirdPoint; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ GetThirdPoint0()

const wxPoint& FP_SHAPE::GetThirdPoint0 ( ) const
inline

Definition at line 118 of file fp_shape.h.

118 { return m_ThirdPoint0; }
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162

References m_ThirdPoint0.

◆ GetThirdPointX()

int PCB_SHAPE::GetThirdPointX ( )
inlineinherited

Definition at line 169 of file pcb_shape.h.

169 { return m_thirdPoint.x; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ GetThirdPointY()

int PCB_SHAPE::GetThirdPointY ( )
inlineinherited

Definition at line 168 of file pcb_shape.h.

168 { return m_thirdPoint.y; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ GetWidth()

◆ GetX()

int BOARD_ITEM::GetX ( ) const
inlineinherited

◆ GetY()

int BOARD_ITEM::GetY ( ) const
inlineinherited

◆ HasFlag()

◆ HitTest() [1/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 642 of file pcb_shape.cpp.

643 {
644  int maxdist = aAccuracy + ( m_width / 2 );
645 
646  switch( m_shape )
647  {
649  {
650  int radius = GetRadius();
651  int dist = KiROUND( EuclideanNorm( aPosition - GetCenter() ) );
652 
653  if( IsFilled() ) // Filled circle hit-test
654  {
655  if( dist <= radius + maxdist )
656  return true;
657  }
658  else // Ring hit-test
659  {
660  if( abs( radius - dist ) <= maxdist )
661  return true;
662  }
663  }
664  break;
665 
666  case PCB_SHAPE_TYPE::ARC:
667  {
668  wxPoint relPos = aPosition - GetCenter();
669  int radius = GetRadius();
670  int dist = KiROUND( EuclideanNorm( relPos ) );
671 
672  if( abs( radius - dist ) <= maxdist )
673  {
674  // For arcs, the test point angle must be >= arc angle start
675  // and <= arc angle end
676  // However angle values > 360 deg are not easy to handle
677  // so we calculate the relative angle between arc start point and teast point
678  // this relative arc should be < arc angle if arc angle > 0 (CW arc)
679  // and > arc angle if arc angle < 0 (CCW arc)
680  double arc_angle_start = GetArcAngleStart(); // Always 0.0 ... 360 deg, in 0.1 deg
681 
682  double arc_hittest = ArcTangente( relPos.y, relPos.x );
683 
684  // Calculate relative angle between the starting point of the arc, and the test point
685  arc_hittest -= arc_angle_start;
686 
687  // Normalise arc_hittest between 0 ... 360 deg
688  NORMALIZE_ANGLE_POS( arc_hittest );
689 
690  // Check angle: inside the arc angle when it is > 0
691  // and outside the not drawn arc when it is < 0
692  if( GetAngle() >= 0.0 )
693  {
694  if( arc_hittest <= GetAngle() )
695  return true;
696  }
697  else
698  {
699  if( arc_hittest >= ( 3600.0 + GetAngle() ) )
700  return true;
701  }
702  }
703  }
704  break;
705 
707  const_cast<PCB_SHAPE*>( this )->RebuildBezierToSegmentsPointsList( m_width );
708 
709  for( unsigned int i= 1; i < m_bezierPoints.size(); i++)
710  {
711  if( TestSegmentHit( aPosition, m_bezierPoints[ i - 1], m_bezierPoints[i], maxdist ) )
712  return true;
713  }
714 
715  break;
716 
718  if( TestSegmentHit( aPosition, m_start, m_end, maxdist ) )
719  return true;
720 
721  break;
722 
724  {
725  std::vector<wxPoint> pts = GetRectCorners();
726 
727  if( IsFilled() ) // Filled rect hit-test
728  {
729  SHAPE_POLY_SET poly;
730  poly.NewOutline();
731 
732  for( const wxPoint& pt : pts )
733  poly.Append( pt );
734 
735  if( poly.Collide( VECTOR2I( aPosition ), maxdist ) )
736  return true;
737  }
738  else // Open rect hit-test
739  {
740  if( TestSegmentHit( aPosition, pts[0], pts[1], maxdist )
741  || TestSegmentHit( aPosition, pts[1], pts[2], maxdist )
742  || TestSegmentHit( aPosition, pts[2], pts[3], maxdist )
743  || TestSegmentHit( aPosition, pts[3], pts[0], maxdist ) )
744  {
745  return true;
746  }
747  }
748  }
749  break;
750 
752  if( IsFilled() )
753  {
754  return m_poly.Collide( VECTOR2I( aPosition ), maxdist );
755  }
756  else
757  {
759  return m_poly.CollideEdge( VECTOR2I( aPosition ), dummy, maxdist );
760  }
761 
762  break;
763 
764  default:
765  wxFAIL_MSG( "PCB_SHAPE::HitTest (point) not implemented for "
767  break;
768  }
769 
770  return false;
771 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:148
bool IsFilled() const
Definition: pcb_shape.h:96
wxPoint m_end
Definition: pcb_shape.h:49
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
std::vector< wxPoint > GetRectCorners() const
Definition: pcb_shape.cpp:971
double GetArcAngleStart() const
function GetArcAngleStart()
Definition: pcb_shape.cpp:414
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
void NORMALIZE_ANGLE_POS(T &Angle)
Definition: trigo.h:288
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
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
polygon (not yet used for tracks, but could be in microwave apps)
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
Represent a set of closed polygons.
segment with non rounded ends
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
int NewOutline()
Creates a new hole in a given outline.
wxPoint m_start
Definition: pcb_shape.h:48
bool Collide(const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance,...
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE a)
Definition: board_item.h:59
int m_width
Definition: pcb_shape.h:46
double GetAngle() const
Definition: pcb_shape.h:127
usual segment : line with rounded ends
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
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:182
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), ARC, ArcTangente(), CIRCLE, SHAPE_POLY_SET::Collide(), SHAPE_POLY_SET::CollideEdge(), CURVE, dummy(), EuclideanNorm(), PCB_SHAPE::GetAngle(), PCB_SHAPE::GetArcAngleStart(), PCB_SHAPE::GetCenter(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetRectCorners(), PCB_SHAPE::IsFilled(), KiROUND(), PCB_SHAPE::m_bezierPoints, PCB_SHAPE::m_end, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, PCB_SHAPE::m_width, SHAPE_POLY_SET::NewOutline(), NORMALIZE_ANGLE_POS(), PCB_SHAPE_TYPE_T_asString(), POLYGON, RECT, SEGMENT, and TestSegmentHit().

Referenced by GENERAL_COLLECTOR::Inspect().

◆ HitTest() [2/2]

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 774 of file pcb_shape.cpp.

775 {
776  EDA_RECT arect = aRect;
777  arect.Normalize();
778  arect.Inflate( aAccuracy );
779 
780  EDA_RECT arcRect;
781  EDA_RECT bb = GetBoundingBox();
782 
783  switch( m_shape )
784  {
786  // Test if area intersects or contains the circle:
787  if( aContained )
788  return arect.Contains( bb );
789  else
790  {
791  // If the rectangle does not intersect the bounding box, this is a much quicker test
792  if( !aRect.Intersects( bb ) )
793  {
794  return false;
795  }
796  else
797  {
798  return arect.IntersectsCircleEdge( GetCenter(), GetRadius(), GetWidth() );
799  }
800  }
801  break;
802 
803  case PCB_SHAPE_TYPE::ARC:
804  // Test for full containment of this arc in the rect
805  if( aContained )
806  {
807  return arect.Contains( bb );
808  }
809  // Test if the rect crosses the arc
810  else
811  {
812  arcRect = bb.Common( arect );
813 
814  /* All following tests must pass:
815  * 1. Rectangle must intersect arc BoundingBox
816  * 2. Rectangle must cross the outside of the arc
817  */
818  return arcRect.Intersects( arect ) &&
820  }
821  break;
822 
824  if( aContained )
825  {
826  return arect.Contains( bb );
827  }
828  else
829  {
830  std::vector<wxPoint> pts = GetRectCorners();
831 
832  // Account for the width of the lines
833  arect.Inflate( GetWidth() / 2 );
834  return ( arect.Intersects( pts[0], pts[1] )
835  || arect.Intersects( pts[1], pts[2] )
836  || arect.Intersects( pts[2], pts[3] )
837  || arect.Intersects( pts[3], pts[0] ) );
838  }
839 
840  break;
841 
843  if( aContained )
844  {
845  return arect.Contains( GetStart() ) && aRect.Contains( GetEnd() );
846  }
847  else
848  {
849  // Account for the width of the line
850  arect.Inflate( GetWidth() / 2 );
851  return arect.Intersects( GetStart(), GetEnd() );
852  }
853 
854  break;
855 
857  if( aContained )
858  {
859  return arect.Contains( bb );
860  }
861  else
862  {
863  // Fast test: if aRect is outside the polygon bounding box,
864  // rectangles cannot intersect
865  if( !arect.Intersects( bb ) )
866  return false;
867 
868  // Account for the width of the line
869  arect.Inflate( GetWidth() / 2 );
870  int count = m_poly.TotalVertices();
871 
872  for( int ii = 0; ii < count; ii++ )
873  {
874  auto vertex = m_poly.CVertex( ii );
875  auto vertexNext = m_poly.CVertex(( ii + 1 ) % count );
876 
877  // Test if the point is within aRect
878  if( arect.Contains( ( wxPoint ) vertex ) )
879  return true;
880 
881  // Test if this edge intersects aRect
882  if( arect.Intersects( ( wxPoint ) vertex, ( wxPoint ) vertexNext ) )
883  return true;
884  }
885  }
886  break;
887 
889  if( aContained )
890  {
891  return arect.Contains( bb );
892  }
893  else
894  {
895  // Fast test: if aRect is outside the polygon bounding box,
896  // rectangles cannot intersect
897  if( !arect.Intersects( bb ) )
898  return false;
899 
900  // Account for the width of the line
901  arect.Inflate( GetWidth() / 2 );
902  unsigned count = m_bezierPoints.size();
903 
904  for( unsigned ii = 1; ii < count; ii++ )
905  {
906  wxPoint vertex = m_bezierPoints[ ii - 1];
907  wxPoint vertexNext = m_bezierPoints[ii];
908 
909  // Test if the point is within aRect
910  if( arect.Contains( ( wxPoint ) vertex ) )
911  return true;
912 
913  // Test if this edge intersects aRect
914  if( arect.Intersects( vertex, vertexNext ) )
915  return true;
916  }
917  }
918  break;
919 
920 
921  default:
922  wxFAIL_MSG( "PCB_SHAPE::HitTest (rect) not implemented for "
924  break;
925  }
926 
927  return false;
928 }
int TotalVertices() const
Delete aIdx-th polygon from the set.
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
std::vector< wxPoint > GetRectCorners() const
Definition: pcb_shape.cpp:971
int GetWidth() const
Definition: pcb_shape.h:118
bool IntersectsCircleEdge(const wxPoint &aCenter, const int aRadius, const int aWidth) const
Test for intersection between this rect and the edge (radius) of a circle.
Definition: eda_rect.cpp:330
EDA_RECT Common(const EDA_RECT &aRect) const
Return the area that is common with another rectangle.
Definition: eda_rect.cpp:487
bool Contains(const wxPoint &aPoint) const
Definition: eda_rect.cpp:57
polygon (not yet used for tracks, but could be in microwave apps)
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
segment with non rounded ends
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
void Normalize()
Ensures that the height ant width are positive.
Definition: eda_rect.cpp:35
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE a)
Definition: board_item.h:59
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_shape.cpp:569
Handle the component boundary box.
Definition: eda_rect.h:42
usual segment : line with rounded ends
bool Intersects(const EDA_RECT &aRect) const
Test for a common area between rectangles.
Definition: eda_rect.cpp:150
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
Definition: eda_rect.cpp:363

References ARC, CIRCLE, EDA_RECT::Common(), EDA_RECT::Contains(), CURVE, SHAPE_POLY_SET::CVertex(), PCB_SHAPE::GetBoundingBox(), PCB_SHAPE::GetCenter(), PCB_SHAPE::GetEnd(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetRectCorners(), PCB_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), EDA_RECT::Inflate(), EDA_RECT::Intersects(), EDA_RECT::IntersectsCircleEdge(), PCB_SHAPE::m_bezierPoints, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, EDA_RECT::Normalize(), PCB_SHAPE_TYPE_T_asString(), POLYGON, RECT, SEGMENT, and SHAPE_POLY_SET::TotalVertices().

◆ IsBrightened()

◆ IsConnected()

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 171 of file eda_item.h.

171 { return m_flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: eda_item.h:109
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_DRAGGED, and EDA_ITEM::m_flags.

Referenced by DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES().

◆ IsEntered()

bool EDA_ITEM::IsEntered ( ) const
inlineinherited

Definition at line 174 of file eda_item.h.

174 { return m_flags & ENTERED; }
#define ENTERED
indicates a group has been entered
Definition: eda_item.h:138
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References ENTERED, and EDA_ITEM::m_flags.

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

◆ IsFilled()

bool PCB_SHAPE::IsFilled ( ) const
inlineinherited

Definition at line 96 of file pcb_shape.h.

97  {
98  switch( m_shape )
99  {
103  return m_filled;
104 
106  case PCB_SHAPE_TYPE::ARC:
108  return false;
109 
110  case PCB_SHAPE_TYPE::LAST: // Make CLang compiler happy
111  return false;
112  }
113 
114  return false; // Make GCC compiler happy
115  }
polygon (not yet used for tracks, but could be in microwave apps)
segment with non rounded ends
last value for this list
usual segment : line with rounded ends
bool m_filled
Definition: pcb_shape.h:47
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References ARC, CIRCLE, CURVE, LAST, PCB_SHAPE::m_filled, PCB_SHAPE::m_shape, POLYGON, RECT, and SEGMENT.

Referenced by BOARD_ADAPTER::addShapeWithClearance(), KIGFX::PCB_PAINTER::draw(), PCB_IO::format(), FOOTPRINT::GetCoverageArea(), hash_fp_item(), PCB_SHAPE::HitTest(), PCB_SHAPE::MakeEffectiveShapes(), PCB_PARSER::parsePAD(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), PNS_KICAD_IFACE_BASE::syncGraphicalItem(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataToWindow(), and PCB_SHAPE::TransformShapeWithClearanceToPolygon().

◆ IsForceVisible()

bool EDA_ITEM::IsForceVisible ( ) const
inlineinherited

Definition at line 256 of file eda_item.h.

256 { return m_forceVisible; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

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

◆ IsLocked()

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 168 of file eda_item.h.

168 { return m_flags & IS_CHANGED; }
#define IS_CHANGED
Item was edited, and modified.
Definition: eda_item.h:103
STATUS_FLAGS m_flags
Definition: eda_item.h:531

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, PAD, and ZONE.

Definition at line 144 of file board_item.h.

145  {
146  return IsCopperLayer( GetLayer() );
147  }
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

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

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

◆ IsOnLayer()

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

Test to see if this object is on the given layer.

Virtual so objects like PAD, which reside on multiple layers can do their own form of testing.

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

Reimplemented in PAD, VIA, FOOTPRINT, ZONE, and PCB_GROUP.

Definition at line 231 of file board_item.h.

232  {
233  return m_layer == aLayer;
234  }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by BOARD_ADAPTER::createLayers(), existsOnLayer(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), and PNS_KICAD_IFACE::IsItemVisible().

◆ IsParentFlipped()

bool FP_SHAPE::IsParentFlipped ( ) const

Definition at line 217 of file fp_shape.cpp.

218 {
219  if( GetParent() && GetParent()->GetLayer() == B_Cu )
220  return true;
221  return false;
222 }
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:168
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:173

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

Referenced by ViewGetLOD().

◆ IsPolyShapeValid()

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

Definition at line 1215 of file pcb_shape.cpp.

1216 {
1217  // return true if the polygonal shape is valid (has more than 2 points)
1218  if( GetPolyShape().OutlineCount() == 0 )
1219  return false;
1220 
1221  const SHAPE_LINE_CHAIN& outline = ( (SHAPE_POLY_SET&)GetPolyShape() ).Outline( 0 );
1222 
1223  return outline.PointCount() > 2;
1224 }
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
int PointCount() const
Function PointCount()
Represent a set of closed polygons.
SHAPE_LINE_CHAIN.

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

Referenced by PCB_IO::format(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), and PCB_SHAPE::TransformShapeWithClearanceToPolygon().

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

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

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

Reimplemented in SCH_COMPONENT, SCH_LABEL, SCH_SHEET, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 453 of file eda_item.h.

453 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 175 of file eda_item.h.

175 { return m_flags & IS_RESIZED; }
#define IS_RESIZED
Item being resized.
Definition: eda_item.h:108
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_RESIZED, and EDA_ITEM::m_flags.

◆ IsSelected()

bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 173 of file eda_item.h.

173 { return m_flags & SELECTED; }
#define SELECTED
Definition: eda_item.h:114
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags, and SELECTED.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DS_PROXY_UNDO_ITEM::DS_PROXY_UNDO_ITEM(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_PAINTER::getLineWidth(), KIGFX::SCH_PAINTER::getRenderColor(), KIGFX::SCH_PAINTER::getTextThickness(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), BOARD_COMMIT::Push(), PCB_SELECTION_TOOL::RebuildSelection(), EE_SELECTION_TOOL::RebuildSelection(), RENDER_3D_LEGACY::renderFootprint(), SCH_EDIT_TOOL::Rotate(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), KIGFX::SCH_PAINTER::setDeviceColors(), and GERBVIEW_SELECTION_TOOL::unselect().

◆ IsTrack()

bool BOARD_ITEM::IsTrack ( ) const
inlineinherited

Test to see if this object is a track or via (or microvia).

Returns
true if a track or via, else false.

Definition at line 241 of file board_item.h.

242  {
243  return ( Type() == PCB_TRACE_T ) || ( Type() == PCB_VIA_T );
244  }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

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

◆ IsType()

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

Check whether the item is one of the listed types.

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

Reimplemented from EDA_ITEM.

Definition at line 54 of file fp_shape.h.

55  {
56  if( BOARD_ITEM::IsType( aScanTypes ) )
57  return true;
58 
59  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
60  {
61  if( *p == PCB_LOCATE_GRAPHIC_T )
62  return true;
63  else if( *p == PCB_LOCATE_BOARD_EDGE_T )
64  return m_layer == Edge_Cuts;
65  }
66 
67  return false;
68  }
search types array terminator (End Of Types)
Definition: typeinfo.h:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
virtual bool IsType(const KICAD_T aScanTypes[]) const
Check whether the item is one of the listed types.
Definition: eda_item.h:233
PCB_LAYER_ID m_layer
Definition: board_item.h:363

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

172 { return m_flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References IS_WIRE_IMAGE, and EDA_ITEM::m_flags.

◆ IterateForward() [1/2]

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

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

Definition at line 345 of file eda_item.h.

349  {
350  for( auto it : aList )
351  {
352  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
354  return SEARCH_RESULT::QUIT;
355  }
356 
358  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

Referenced by GERBER_FILE_IMAGE::Visit().

◆ IterateForward() [2/2]

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

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

Definition at line 364 of file eda_item.h.

366  {
367  for( auto it : aList )
368  {
369  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
371  return SEARCH_RESULT::QUIT;
372  }
373 
375  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: eda_item.cpp:91

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

◆ layerMaskDescribe()

wxString BOARD_ITEM::layerMaskDescribe ( ) const
protectedvirtualinherited

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

The BOARD is needed because layer names are customizable.

Reimplemented in VIA.

Definition at line 72 of file board_item.cpp.

73 {
74  BOARD* board = GetBoard();
75  LSET layers = GetLayerSet();
76 
77  // Try to be smart and useful. Check all copper first.
78  if( layers[F_Cu] && layers[B_Cu] )
79  return _( "all copper layers" );
80 
81  LSET copperLayers = layers & board->GetEnabledLayers().AllCuMask();
82  LSET techLayers = layers & board->GetEnabledLayers().AllTechMask();
83 
84  for( LSET testLayers : { copperLayers, techLayers, layers } )
85  {
86  for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
87  {
88  if( testLayers[ bit ] )
89  {
90  wxString layerInfo = board->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
91 
92  if( testLayers.count() > 1 )
93  layerInfo << wxS( " " ) + _( "and others" );
94 
95  return layerInfo;
96  }
97  }
98  }
99 
100  // No copper, no technicals: no layer
101  return _( "no layers" );
102 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:342
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
Definition: board.cpp:447
static LSET AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition: lset.cpp:820
LSET is a set of PCB_LAYER_IDs.
virtual BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:46
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
#define _(s)
Definition: 3d_actions.cpp:33
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:178

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

Referenced by TRACK::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), and PAD::GetSelectMenuText().

◆ MakeEffectiveShapes()

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

Makes a set of SHAPE objects representing the PCB_SHAPE.

Caller owns the objects.

Definition at line 1086 of file pcb_shape.cpp.

1087 {
1088  std::vector<SHAPE*> effectiveShapes;
1089 
1090  switch( m_shape )
1091  {
1092  case PCB_SHAPE_TYPE::ARC:
1093  effectiveShapes.emplace_back( new SHAPE_ARC( GetCenter(), GetArcStart(),
1094  GetAngle() / 10.0, m_width ) );
1095  break;
1096 
1098  effectiveShapes.emplace_back( new SHAPE_SEGMENT( GetStart(), GetEnd(), m_width ) );
1099  break;
1100 
1101  case PCB_SHAPE_TYPE::RECT:
1102  {
1103  std::vector<wxPoint> pts = GetRectCorners();
1104 
1105  if( IsFilled() )
1106  {
1107  effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) );
1108  }
1109 
1110  if( m_width > 0 || !IsFilled() )
1111  {
1112  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[0], pts[1], m_width ) );
1113  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[1], pts[2], m_width ) );
1114  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[2], pts[3], m_width ) );
1115  effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[3], pts[0], m_width ) );
1116  }
1117  }
1118  break;
1119 
1121  {
1122  if( IsFilled() )
1123  {
1124  effectiveShapes.emplace_back( new SHAPE_CIRCLE( GetCenter(), GetRadius() ) );
1125  }
1126 
1127  if( m_width > 0 || !IsFilled() )
1128  {
1129  // SHAPE_CIRCLE has no ConvertToPolyline() method, so use a 360.0 SHAPE_ARC
1130  SHAPE_ARC circle( GetCenter(), GetEnd(), 360.0 );
1131  SHAPE_LINE_CHAIN l = circle.ConvertToPolyline();
1132 
1133  for( int i = 0; i < l.SegmentCount(); i++ )
1134  {
1135  effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ).A,
1136  l.Segment( i ).B, m_width ) );
1137  }
1138  }
1139 
1140  break;
1141  }
1142 
1143  case PCB_SHAPE_TYPE::CURVE:
1144  {
1145  auto bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
1146  wxPoint start_pt = bezierPoints[0];
1147 
1148  for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )
1149  {
1150  wxPoint end_pt = bezierPoints[jj];
1151  effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, m_width ) );
1152  start_pt = end_pt;
1153  }
1154 
1155  break;
1156  }
1157 
1159  {
1161  FOOTPRINT* parentFootprint = dynamic_cast<FOOTPRINT*>( m_parent );
1162 
1163  if( parentFootprint )
1164  {
1165  l.Rotate( -parentFootprint->GetOrientationRadians() );
1166  l.Move( parentFootprint->GetPosition() );
1167  }
1168 
1169  if( IsFilled() )
1170  {
1171  effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
1172  }
1173 
1174  if( m_width > 0 || !IsFilled() )
1175  {
1176  for( int i = 0; i < l.SegmentCount(); i++ )
1177  effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ), m_width ) );
1178  }
1179  }
1180  break;
1181 
1182  default:
1183  wxFAIL_MSG( "PCB_SHAPE::MakeEffectiveShapes unsupported PCB_SHAPE shape: "
1185  break;
1186  }
1187 
1188  return effectiveShapes;
1189 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
bool IsFilled() const
Definition: pcb_shape.h:96
SHAPE_SIMPLE.
Definition: shape_simple.h:43
double GetOrientationRadians() const
Definition: footprint.h:188
SHAPE_POLY_SET & GetPolyShape()
Definition: pcb_shape.h:268
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
Definition: pcb_shape.h:156
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
void Move(const VECTOR2I &aVector) override
std::vector< wxPoint > GetRectCorners() const
Definition: pcb_shape.cpp:971
int GetWidth() const
Definition: pcb_shape.h:118
wxPoint GetArcStart() const
Definition: pcb_shape.h:179
polygon (not yet used for tracks, but could be in microwave apps)
segment with non rounded ends
wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.cpp:342
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
Definition: pcb_shape.h:145
int SegmentCount() const
Function SegmentCount()
void Rotate(double aAngle, const VECTOR2I &aCenter=VECTOR2I(0, 0)) override
Function Rotate rotates all vertices by a given angle.
static wxString PCB_SHAPE_TYPE_T_asString(PCB_SHAPE_TYPE a)
Definition: board_item.h:59
SEG Segment(int aIndex)
Function Segment()
int m_width
Definition: pcb_shape.h:46
SHAPE_LINE_CHAIN.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
VECTOR2I A
Definition: seg.h:49
double GetAngle() const
Definition: pcb_shape.h:127
usual segment : line with rounded ends
wxPoint GetPosition() const override
Definition: footprint.h:182
Arcs (with rounded ends)
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
const std::vector< wxPoint > buildBezierToSegmentsPointsList(int aMinSegLen) const
Definition: pcb_shape.cpp:329
VECTOR2I B
Definition: seg.h:50

References SEG::A, ARC, SEG::B, PCB_SHAPE::buildBezierToSegmentsPointsList(), CIRCLE, SHAPE_ARC::ConvertToPolyline(), SHAPE_POLY_SET::COutline(), CURVE, PCB_SHAPE::GetAngle(), PCB_SHAPE::GetArcStart(), PCB_SHAPE::GetCenter(), PCB_SHAPE::GetEnd(), FOOTPRINT::GetOrientationRadians(), PCB_SHAPE::GetPolyShape(), FOOTPRINT::GetPosition(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetRectCorners(), PCB_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), PCB_SHAPE::IsFilled(), EDA_ITEM::m_parent, PCB_SHAPE::m_shape, PCB_SHAPE::m_width, SHAPE_LINE_CHAIN::Move(), PCB_SHAPE_TYPE_T_asString(), POLYGON, RECT, SHAPE_LINE_CHAIN::Rotate(), SEGMENT, SHAPE_LINE_CHAIN::Segment(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by PCB_SHAPE::GetEffectiveShape(), and PNS_KICAD_IFACE_BASE::syncGraphicalItem().

◆ Matches() [1/2]

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

Compare the item against the search criteria in aSearchData.

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

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

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, ZONE, SCH_PIN, SCH_MARKER, PCB_MARKER, FP_TEXT, and PCB_TEXT.

Definition at line 415 of file eda_item.h.

416  {
417  return false;
418  }

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

◆ Matches() [2/2]

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

Compare aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 116 of file eda_item.cpp.

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

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

◆ Mirror()

void FP_SHAPE::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 224 of file fp_shape.cpp.

225 {
226  // Mirror an edge of the footprint. the layer is not modified
227  // This is a footprint shape modification.
228 
229  switch( GetShape() )
230  {
231  case PCB_SHAPE_TYPE::ARC:
232  // Update arc angle but do not yet update m_ThirdPoint0 and m_thirdPoint,
233  // arc center and start point must be updated before calculation arc end.
234  SetAngle( -GetAngle(), false );
236 
237  default:
240  if( aMirrorAroundXAxis )
241  {
242  MIRROR( m_Start0.y, aCentre.y );
243  MIRROR( m_End0.y, aCentre.y );
244  MIRROR( m_ThirdPoint0.y, aCentre.y );
245  MIRROR( m_Bezier0_C1.y, aCentre.y );
246  MIRROR( m_Bezier0_C2.y, aCentre.y );
247  }
248  else
249  {
250  MIRROR( m_Start0.x, aCentre.x );
251  MIRROR( m_End0.x, aCentre.x );
252  MIRROR( m_ThirdPoint0.x, aCentre.x );
253  MIRROR( m_Bezier0_C1.x, aCentre.x );
254  MIRROR( m_Bezier0_C2.x, aCentre.x );
255  }
256 
257  for( unsigned ii = 0; ii < m_bezierPoints.size(); ii++ )
258  {
259  if( aMirrorAroundXAxis )
260  MIRROR( m_bezierPoints[ii].y, aCentre.y );
261  else
262  MIRROR( m_bezierPoints[ii].x, aCentre.x );
263  }
264 
265  break;
266 
268  // polygon corners coordinates are always relative to the
269  // footprint position, orientation 0
270  m_poly.Mirror( !aMirrorAroundXAxis, aMirrorAroundXAxis );
271  break;
272  }
273 
274  SetDrawCoord();
275 }
PCB_SHAPE_TYPE GetShape() const
Definition: pcb_shape.h:130
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
Definition: mirror.h:40
polygon (not yet used for tracks, but could be in microwave apps)
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
void SetAngle(double aAngle, bool aUpdateEnd=true) override
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: fp_shape.cpp:142
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:82
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164
double GetAngle() const
Definition: pcb_shape.h:127
usual segment : line with rounded ends
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
Arcs (with rounded ends)

References ARC, CURVE, PCB_SHAPE::GetAngle(), PCB_SHAPE::GetShape(), KI_FALLTHROUGH, m_Bezier0_C1, m_Bezier0_C2, PCB_SHAPE::m_bezierPoints, m_End0, PCB_SHAPE::m_poly, m_Start0, m_ThirdPoint0, MIRROR(), SHAPE_POLY_SET::Mirror(), POLYGON, SEGMENT, SetAngle(), and SetDrawCoord().

Referenced by EDIT_TOOL::Mirror().

◆ Move() [1/2]

void FP_SHAPE::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 PCB_SHAPE.

Definition at line 289 of file fp_shape.cpp.

290 {
291  // Move an edge of the footprint.
292  // This is a footprint shape modification.
293  m_Start0 += aMoveVector;
294  m_End0 += aMoveVector;
295  m_ThirdPoint0 += aMoveVector;
296  m_Bezier0_C1 += aMoveVector;
297  m_Bezier0_C2 += aMoveVector;
298 
299  switch( GetShape() )
300  {
301  default:
302  break;
303 
305  // polygon corners coordinates are always relative to the
306  // footprint position, orientation 0
307  m_poly.Move( VECTOR2I( aMoveVector ) );
308 
309  break;
310  }
311 
312  SetDrawCoord();
313 }
PCB_SHAPE_TYPE GetShape() const
Definition: pcb_shape.h:130
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
polygon (not yet used for tracks, but could be in microwave apps)
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:82
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163

References PCB_SHAPE::GetShape(), m_Bezier0_C1, m_Bezier0_C2, m_End0, PCB_SHAPE::m_poly, m_Start0, m_ThirdPoint0, SHAPE_POLY_SET::Move(), POLYGON, and SetDrawCoord().

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

◆ Move() [2/2]

void BOARD_ITEM::Move ( const VECTOR2I aMoveVector)
inlineinherited

Definition at line 283 of file board_item.h.

284  {
285  Move( wxPoint( aMoveVector.x, aMoveVector.y ) );
286  }
virtual void Move(const wxPoint &aMoveVector)
Move this object.
Definition: board_item.h:277

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 169 of file eda_item.cpp.

170 {
171  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
172  GetClass() ) );
173 
174  return false;
175 }
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
virtual wxString GetClass() const =0
Return the class name.

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

◆ RebuildBezierToSegmentsPointsList()

void PCB_SHAPE::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 316 of file pcb_shape.cpp.

317 {
318  // Has meaning only for S_CURVE DRAW_SEGMENT shape
320  {
321  m_bezierPoints.clear();
322  return;
323  }
324  // Rebuild the m_BezierPoints vertex list that approximate the Bezier curve
326 }
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
const std::vector< wxPoint > buildBezierToSegmentsPointsList(int aMinSegLen) const
Definition: pcb_shape.cpp:329

References PCB_SHAPE::buildBezierToSegmentsPointsList(), CURVE, PCB_SHAPE::m_bezierPoints, and PCB_SHAPE::m_shape.

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

◆ Replace() [1/2]

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

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

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

Definition at line 143 of file eda_item.cpp.

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

References traceFindReplace.

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

◆ Replace() [2/2]

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

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

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

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

Reimplemented in SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, and SCH_PIN.

Definition at line 442 of file eda_item.h.

443  {
444  return false;
445  }

◆ Rotate() [1/2]

void FP_SHAPE::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 PCB_SHAPE.

Definition at line 277 of file fp_shape.cpp.

278 {
279  // We should rotate the relative coordinates, but to avoid duplicate code do the base class
280  // rotation of draw coordinates, which is acceptable because in the footprint editor
281  // m_Pos0 = m_Pos
282  PCB_SHAPE::Rotate( aRotCentre, aAngle );
283 
284  // and now update the relative coordinates, which are the reference in most transforms.
285  SetLocalCoord();
286 }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle) override
Rotate this object.
Definition: pcb_shape.cpp:198
void SetLocalCoord()
Set relative coordinates from draw coordinates.
Definition: fp_shape.cpp:54

References PCB_SHAPE::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 299 of file board_item.h.

300  {
301  Rotate( wxPoint( aRotCentre.x, aRotCentre.y ), aAngle );
302  }
virtual void Rotate(const wxPoint &aRotCentre, double aAngle)
Rotate this object.
Definition: board_item.h:294

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

◆ Scale()

void PCB_SHAPE::Scale ( double  aScale)
inherited

Definition at line 148 of file pcb_shape.cpp.

149 {
150  auto scalePt = [&]( wxPoint& pt )
151  {
152  pt.x = KiROUND( pt.x * aScale );
153  pt.y = KiROUND( pt.y * aScale );
154  };
155 
156  int radius = GetRadius();
157 
158  scalePt( m_start );
159  scalePt( m_end );
160 
161  // specific parameters:
162  switch( m_shape )
163  {
165  scalePt( m_bezierC1 );
166  scalePt( m_bezierC2 );
167  break;
168 
169  case PCB_SHAPE_TYPE::ARC:
170  scalePt( m_thirdPoint );
171  break;
172 
173  case PCB_SHAPE_TYPE::CIRCLE: // ring or circle
174  m_end.x = m_start.x + KiROUND( radius * aScale );
175  m_end.y = m_start.y;
176  break;
177 
178  case PCB_SHAPE_TYPE::POLYGON: // polygon
179  {
180  std::vector<wxPoint> pts;
181 
182  for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
183  {
184  pts.emplace_back( pt );
185  scalePt( pts.back() );
186  }
187 
188  SetPolyPoints( pts );
189  }
190  break;
191 
192  default:
193  break;
194  }
195 }
wxPoint m_end
Definition: pcb_shape.h:49
int GetRadius() const
Function GetRadius returns the radius of this item Has meaning only for arc and circle.
Definition: pcb_shape.h:201
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
polygon (not yet used for tracks, but could be in microwave apps)
const std::vector< VECTOR2I > & CPoints() const
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
SHAPE_LINE_CHAIN & Outline(int aIndex)
wxPoint m_start
Definition: pcb_shape.h:48
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
wxPoint m_bezierC1
Definition: pcb_shape.h:54
Arcs (with rounded ends)
wxPoint m_bezierC2
Definition: pcb_shape.h:55
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52
void SetPolyPoints(const std::vector< wxPoint > &aPoints)
Definition: pcb_shape.cpp:1076

References ARC, CIRCLE, SHAPE_LINE_CHAIN::CPoints(), CURVE, PCB_SHAPE::GetRadius(), KiROUND(), PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, PCB_SHAPE::m_thirdPoint, SHAPE_POLY_SET::Outline(), POLYGON, and PCB_SHAPE::SetPolyPoints().

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::getDrawSegmentFromVertex().

◆ Set() [1/3]

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

Definition at line 42 of file inspectable.h.

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

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

Referenced by isCoupledDiffPair().

◆ Set() [2/3]

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

Definition at line 55 of file inspectable.h.

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

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

◆ Set() [3/3]

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

Definition at line 68 of file inspectable.h.

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

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

◆ SetAngle()

void FP_SHAPE::SetAngle ( double  aAngle,
bool  aUpdateEnd = true 
)
overridevirtual

Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.

Parameters
aAngleis tenths of degrees, but will soon be degrees.
aUpdateEnd= true to update also arc end coordinates m_thirdPoint and m_ThirdPoint0, so must be called after setting m_Start, m_Start0, m_End and m_End0

Reimplemented from PCB_SHAPE.

Definition at line 142 of file fp_shape.cpp.

143 {
144  // Mark as depreciated.
145  // m_Angle does not define the arc anymore
146  // Update the parent class (updates the global m_ThirdPoint)
147  PCB_SHAPE::SetAngle( aAngle, aUpdateEnd );
148 
149  // Also update the local m_ThirdPoint0 if requested
150  if( aUpdateEnd )
151  {
154  }
155 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
double m_angle
Definition: pcb_shape.h:53
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: pcb_shape.cpp:466

References PCB_SHAPE::m_angle, m_End0, m_Start0, m_ThirdPoint0, RotatePoint(), and PCB_SHAPE::SetAngle().

Referenced by PCAD2KICAD::PCB_ARC::AddToFootprint(), PAD_TOOL::explodePad(), Flip(), Mirror(), EAGLE_PLUGIN::packageWire(), and GPCB_FPL_CACHE::parseFOOTPRINT().

◆ SetArcEnd()

void PCB_SHAPE::SetArcEnd ( const wxPoint &  aArcEndPoint)
inlineinherited

Initialize the end arc point.

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

Definition at line 222 of file pcb_shape.h.

223  {
224  m_thirdPoint = aArcEndPoint;
225  }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

Referenced by PCB_POINT_EDITOR::editArcEndpointKeepCenter(), PCB_POINT_EDITOR::editArcEndpointKeepTangent(), PCB_POINT_EDITOR::editArcMidKeepCenter(), CONVERT_TOOL::SegmentToArc(), PCB_SHAPE::SetArcGeometry(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and updateArcFromConstructionMgr().

◆ SetArcGeometry()

void PCB_SHAPE::SetArcGeometry ( const wxPoint &  aStart,
const wxPoint &  aMid,
const wxPoint &  aEnd 
)
inherited

Set the three controlling points for an arc.

NB: these are NOT what's currently stored, so we have to do some calculations behind the scenes. However, they are what SHOULD be stored.

Definition at line 443 of file pcb_shape.cpp.

444 {
445  SetArcStart( aStart );
446  SetArcEnd( aEnd );
447 
448  // Sadly we currently store center and angle rather than mid. So we have to calculate
449  // those.
450  wxPoint center = GetArcCenter( aStart, aMid, aEnd );
451  VECTOR2D startLine = aStart - center;
452  VECTOR2D endLine = aEnd - center;
453  bool clockwise = GetAngle() > 0;
454  double angle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
455 
456  if( clockwise && angle < 0.0 )
457  angle += 3600.0;
458  else if( !clockwise && angle > 0.0 )
459  angle -= 3600.0;
460 
461  SetAngle( angle, false );
462  SetCenter( center );
463 }
double RAD2DECIDEG(double rad)
Definition: trigo.h:236
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
Definition: pcb_shape.h:229
double Angle() const
Compute the angle of the vector.
Definition: vector2d.h:307
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
double GetAngle() const
Definition: pcb_shape.h:127
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the end arc point.
Definition: pcb_shape.h:222
const VECTOR2I GetArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
Definition: trigo.cpp:450
virtual void SetAngle(double aAngle, bool aUpdateEnd=true)
Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
Definition: pcb_shape.cpp:466
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
Definition: pcb_shape.h:213

References PNS::angle(), VECTOR2< T >::Angle(), PCB_SHAPE::GetAngle(), GetArcCenter(), RAD2DECIDEG(), PCB_SHAPE::SetAngle(), PCB_SHAPE::SetArcEnd(), PCB_SHAPE::SetArcStart(), and PCB_SHAPE::SetCenter().

Referenced by PCB_POINT_EDITOR::editArcMidKeepEndpoints().

◆ SetArcStart()

◆ SetBezControl1()

void PCB_SHAPE::SetBezControl1 ( const wxPoint &  aPoint)
inlineinherited

◆ SetBezControl2()

void PCB_SHAPE::SetBezControl2 ( const wxPoint &  aPoint)
inlineinherited

◆ SetBezier0_C1()

void FP_SHAPE::SetBezier0_C1 ( const wxPoint &  aPoint)
inline

Definition at line 120 of file fp_shape.h.

120 { m_Bezier0_C1 = aPoint; }
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163

References m_Bezier0_C1.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetBezier0_C2()

void FP_SHAPE::SetBezier0_C2 ( const wxPoint &  aPoint)
inline

Definition at line 123 of file fp_shape.h.

123 { m_Bezier0_C2 = aPoint; }
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164

References m_Bezier0_C2.

Referenced by DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow().

◆ SetBezierPoints()

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

Definition at line 278 of file pcb_shape.h.

279  {
280  m_bezierPoints = aPoints;
281  }
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57

References PCB_SHAPE::m_bezierPoints.

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

◆ SetCenter()

◆ SetDrawCoord()

void FP_SHAPE::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 82 of file fp_shape.cpp.

83 {
84  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
85 
86  m_start = m_Start0;
87  m_end = m_End0;
91 
92  if( fp )
93  {
94  RotatePoint( &m_start.x, &m_start.y, fp->GetOrientation() );
95  RotatePoint( &m_end.x, &m_end.y, fp->GetOrientation() );
99 
100  m_start += fp->GetPosition();
101  m_end += fp->GetPosition();
102  m_thirdPoint += fp->GetPosition();
103  m_bezierC1 += fp->GetPosition();
104  m_bezierC2 += fp->GetPosition();
105  }
106 
108 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
wxPoint m_end
Definition: pcb_shape.h:49
double GetOrientation() const
Definition: footprint.h:186
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164
wxPoint m_start
Definition: pcb_shape.h:48
int m_width
Definition: pcb_shape.h:46
wxPoint GetPosition() const override
Definition: footprint.h:182
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
Definition: pcb_shape.cpp:316
wxPoint m_bezierC1
Definition: pcb_shape.h:54
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163
wxPoint m_bezierC2
Definition: pcb_shape.h:55

References FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), m_Bezier0_C1, m_Bezier0_C2, PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, m_End0, EDA_ITEM::m_parent, PCB_SHAPE::m_start, m_Start0, PCB_SHAPE::m_thirdPoint, m_ThirdPoint0, PCB_SHAPE::m_width, PCB_SHAPE::RebuildBezierToSegmentsPointsList(), and RotatePoint().

Referenced by PCAD2KICAD::PCB_ARC::AddToFootprint(), PCAD2KICAD::PCB_LINE::AddToFootprint(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), LEGACY_PLUGIN::loadFP_SHAPE(), Mirror(), Move(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageWire(), GPCB_FPL_CACHE::parseFOOTPRINT(), PCB_PARSER::parseFOOTPRINT_unchecked(), and FOOTPRINT::SetPosition().

◆ SetEnd()

◆ SetEnd0()

◆ SetEndX()

◆ SetEndY()

◆ SetFilled()

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 203 of file eda_item.h.

203 { m_flags |= aMask; }
STATUS_FLAGS m_flags
Definition: eda_item.h:531

References EDA_ITEM::m_flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddFootprintToBoard(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SCH_MOVE_TOOL::AlignElements(), PCB_CONTROL::AppendBoard(), FOOTPRINT::BuildPolyCourtyards(), SCH_EDIT_TOOL::ChangeTextType(), GRAPHICS_CLEANER::cleanupSegments(), ConvertOutlineToPolygon(), SCH_EDIT_FRAME::ConvertPart(), SCH_DRAWING_TOOLS::createNewText(), SCH_DRAWING_TOOLS::createSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), EDIT_TOOL::DragArcTrack(), KIGFX::SCH_PAINTER::draw(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SCH_EDIT_TOOL::Duplicate(), PCB_SELECTION_TOOL::EnterGroup(), PCB_SELECTION_TOOL::FilterCollectorForHierarchy(), SCH_MOVE_TOOL::getConnectedDragItems(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), EE_SELECTION_TOOL::Main(), TRACKS_CLEANER::mergeCollinearSegments(), SYMBOL_EDITOR_MOVE_TOOL::moveItem(), SCH_MOVE_TOOL::moveItem(), EE_SELECTION_TOOL::narrowSelection(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), SCH_ALTIUM_PLUGIN::ParseBezier(), SCH_ALTIUM_PLUGIN::ParseBus(), SCH_ALTIUM_PLUGIN::ParseBusEntry(), SCH_ALTIUM_PLUGIN::ParseJunction(), SCH_ALTIUM_PLUGIN::ParseLine(), SCH_ALTIUM_PLUGIN::ParseNetLabel(), SCH_ALTIUM_PLUGIN::ParseNoERC(), SCH_ALTIUM_PLUGIN::ParsePolygon(), SCH_ALTIUM_PLUGIN::ParsePolyline(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_ALTIUM_PLUGIN::ParseRectangle(), SCH_ALTIUM_PLUGIN::ParseRoundRectangle(), SCH_ALTIUM_PLUGIN::ParseSheetSymbol(), SCH_ALTIUM_PLUGIN::ParseWire(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), DRAWING_TOOL::PlaceText(), BACK_ANNOTATE::processNetNameChange(), SCH_EDIT_FRAME::PutDataInPreviousState(), PCB_SELECTION_TOOL::RebuildSelection(), FOOTPRINT::Remove(), BOARD::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), DS_DATA_ITEM::SyncDrawItems(), DS_DATA_ITEM_BITMAP::SyncDrawItems(), DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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

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

Definition at line 254 of file eda_item.h.

254 { m_forceVisible = aEnable; }
bool m_forceVisible
Definition: eda_item.h:530

References EDA_ITEM::m_forceVisible.

Referenced by SCH_EDITOR_CONTROL::UpdateFind().

◆ SetLayer()

virtual void BOARD_ITEM::SetLayer ( PCB_LAYER_ID  aLayer)
inlinevirtualinherited

Set the layer this item is on.

This method is virtual because some items (in fact: class DIMENSION) have a slightly different initialization.

Parameters
aLayerThe layer number.

Reimplemented in DIMENSION_BASE, ZONE, and PCB_GROUP.

Definition at line 194 of file board_item.h.

195  {
196  m_layer = aLayer;
197  }
PCB_LAYER_ID m_layer
Definition: board_item.h:363

References BOARD_ITEM::m_layer.

Referenced by CADSTAR_PCB_ARCHIVE_LOADER::addAttribute(), PNS_KICAD_IFACE::AddItem(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_FOOTPRINT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToFootprint(), PCAD2KICAD::PCB_LINE::AddToFootprint(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), BOARD_CONNECTED_ITEM_DESC::BOARD_CONNECTED_ITEM_DESC(), BOARD_ITEM_DESC::BOARD_ITEM_DESC(), BOOST_AUTO_TEST_CASE(), ZONE_CREATE_HELPER::commitZone(), MICROWAVE_TOOL::createMicrowaveInductor(), PCB_BASE_FRAME::CreateNewFootprint(), MICROWAVE_TOOL::createPolygonShape(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawBoardCharacteristics(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarText(), DRAWING_TOOL::DrawSpecificationStackup(), PAD_TOOL::explodePad(), EDIT_TOOL::FilletTracks(), PCB_TARGET::Flip(), PCB_TEXT::Flip(), TRACK::Flip(), Flip(), FP_TEXT::Flip(), FOOTPRINT::Flip(), ARC::Flip(), PCB_SHAPE::Flip(), FOOTPRINT_DESC::FOOTPRINT_DESC(), FP_TEXT::FP_TEXT(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), initTextTable(), CONVERT_TOOL::LinesToPoly(), LEGACY_PLUGIN::loadFOOTPRINT(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), LEGACY_PLUGIN::loadMODULE_TEXT(), CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), FABMASTER::loadPolygon(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), main(), DSN::SPECCTRA_DB::makeTRACK(), CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromDrawsegments(), GRAPHICS_CLEANER::mergeRects(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField(), DIALOG_FOOTPRINT_PROPERTIES::OnAddField(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), EAGLE_PLUGIN::packageWire(), ALTIUM_PCB::ParseArcs6Data(), ALTIUM_PCB::ParseComponents6Data(), ALTIUM_PCB::ParseFills6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTexts6Data(), ALTIUM_PCB::ParseTracks6Data(), DRAWING_TOOL::PlaceCharacteristics(), DRAWING_TOOL::PlaceStackup(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), CONVERT_TOOL::PolyToLines(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), processTextItem(), PNS_PCBNEW_RULE_RESOLVER::QueryConstraint(), DIALOG_PAD_PROPERTIES::redraw(), CLIPBOARD_IO::SaveSelection(), CONVERT_TOOL::SegmentToArc(), DIMENSION_BASE::SetLayer(), GLOBAL_EDIT_TOOL::swapBoardItem(), TRACK_VIA_DESC::TRACK_VIA_DESC(), DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), and DIALOG_TEXT_PROPERTIES::TransferDataFromWindow().

◆ SetLayerSet()

virtual void BOARD_ITEM::SetLayerSet ( LSET  aLayers)
inlinevirtualinherited

Reimplemented in VIA, PAD, and ZONE.

Definition at line 179 of file board_item.h.

180  {
181  wxFAIL_MSG( "Attempted to SetLayerSet() on a single-layer object." );
182 
183  // Derived classes which support multiple layers must implement this
184  }

Referenced by PANEL_SETUP_LAYERS::TransferDataFromWindow().

◆ SetLocalCoord()

void FP_SHAPE::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 54 of file fp_shape.cpp.

55 {
56  FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
57 
58  if( fp == NULL )
59  {
60  m_Start0 = m_start;
61  m_End0 = m_end;
65  return;
66  }
67 
68  m_Start0 = m_start - fp->GetPosition();
69  m_End0 = m_end - fp->GetPosition();
73  double angle = fp->GetOrientation();
74  RotatePoint( &m_Start0.x, &m_Start0.y, -angle );
75  RotatePoint( &m_End0.x, &m_End0.y, -angle );
79 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
wxPoint m_end
Definition: pcb_shape.h:49
double GetOrientation() const
Definition: footprint.h:186
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:228
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162
#define NULL
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
wxPoint m_Bezier0_C2
Bezier Control Point 2, relative to footprint origin, orient 0.
Definition: fp_shape.h:164
wxPoint m_start
Definition: pcb_shape.h:48
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
wxPoint GetPosition() const override
Definition: footprint.h:182
wxPoint m_bezierC1
Definition: pcb_shape.h:54
wxPoint m_Bezier0_C1
Bezier Control Point 1, relative to footprint origin, orient 0.
Definition: fp_shape.h:163
wxPoint m_bezierC2
Definition: pcb_shape.h:55

References PNS::angle(), FOOTPRINT::GetOrientation(), FOOTPRINT::GetPosition(), m_Bezier0_C1, m_Bezier0_C2, PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_end, m_End0, EDA_ITEM::m_parent, PCB_SHAPE::m_start, m_Start0, PCB_SHAPE::m_thirdPoint, m_ThirdPoint0, NULL, and RotatePoint().

Referenced by PAD_TOOL::explodePad(), ALTIUM_PCB::HelperDrawsegmentSetLocalCoord(), PCB_CONTROL::Paste(), pasteFootprintItemsToFootprintEditor(), and Rotate().

◆ SetLocked()

◆ SetModified()

void EDA_ITEM::SetModified ( )
inherited

◆ SetParent()

virtual void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlinevirtualinherited

Reimplemented in DIMENSION_BASE.

Definition at line 166 of file eda_item.h.

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

References EDA_ITEM::m_parent.

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

◆ SetParentGroup()

void BOARD_ITEM::SetParentGroup ( PCB_GROUP aGroup)
inlineinherited

Definition at line 92 of file board_item.h.

92 { m_group = aGroup; }
PCB_GROUP * m_group
Definition: board_item.h:364

References BOARD_ITEM::m_group.

Referenced by PCB_GROUP::AddItem(), and PCB_GROUP::RemoveItem().

◆ SetPolyPoints()

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

Definition at line 1076 of file pcb_shape.cpp.

1077 {
1079  m_poly.NewOutline();
1080 
1081  for ( const wxPoint& p : aPoints )
1082  m_poly.Append( p.x, p.y );
1083 }
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
int NewOutline()
Creates a new hole in a given outline.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...

References SHAPE_POLY_SET::Append(), PCB_SHAPE::m_poly, SHAPE_POLY_SET::NewOutline(), and SHAPE_POLY_SET::RemoveAllContours().

Referenced by PAD::AddPrimitivePoly(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), MICROWAVE_TOOL::createPolygonShape(), ALTIUM_PCB::HelperParsePad6NonCopper(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), ALTIUM_PCB::ParseFills6Data(), PCB_SHAPE::Scale(), and DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow().

◆ SetPolyShape()

◆ SetPosition()

void PCB_SHAPE::SetPosition ( const wxPoint &  aPos)
overridevirtualinherited

Reimplemented from EDA_ITEM.

Definition at line 62 of file pcb_shape.cpp.

63 {
64  m_start = aPos;
65 }
wxPoint m_start
Definition: pcb_shape.h:48

References PCB_SHAPE::m_start.

◆ SetSelected()

◆ SetShape()

void PCB_SHAPE::SetShape ( PCB_SHAPE_TYPE  aShape)
inlineinherited

◆ SetStart()

◆ SetStart0()

◆ SetStartX()

void PCB_SHAPE::SetStartX ( int  x)
inlineinherited

◆ SetStartY()

void PCB_SHAPE::SetStartY ( int  y)
inlineinherited

◆ SetState()

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

Definition at line 192 of file eda_item.h.

193  {
194  if( state )
195  m_status |= type; // state = ON or OFF
196  else
197  m_status &= ~type;
198  }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 201 of file eda_item.h.

201 { m_status = aStatus; }
STATUS_FLAGS m_status
Definition: eda_item.h:528

References EDA_ITEM::m_status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetThirdPoint()

void PCB_SHAPE::SetThirdPoint ( const wxPoint &  aPoint)
inlineinherited

Definition at line 170 of file pcb_shape.h.

170 { m_thirdPoint = aPoint; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ SetThirdPoint0()

void FP_SHAPE::SetThirdPoint0 ( const wxPoint &  aPoint)
inline

Definition at line 117 of file fp_shape.h.

117 { m_ThirdPoint0 = aPoint; }
wxPoint m_ThirdPoint0
End point for an arc.
Definition: fp_shape.h:162

References m_ThirdPoint0.

◆ SetThirdPointX()

void PCB_SHAPE::SetThirdPointX ( int  x)
inlineinherited

Definition at line 172 of file pcb_shape.h.

172 { m_thirdPoint.x = x; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ SetThirdPointY()

void PCB_SHAPE::SetThirdPointY ( int  y)
inlineinherited

Definition at line 171 of file pcb_shape.h.

171 { m_thirdPoint.y = y; }
wxPoint m_thirdPoint
Definition: pcb_shape.h:50

References PCB_SHAPE::m_thirdPoint.

◆ SetWidth()

void PCB_SHAPE::SetWidth ( int  aWidth)
inlineinherited

Definition at line 117 of file pcb_shape.h.

117 { m_width = aWidth; }
int m_width
Definition: pcb_shape.h:46

References PCB_SHAPE::m_width.

Referenced by PAD::AddPrimitiveArc(), PAD::AddPrimitiveCircle(), PAD::AddPrimitiveCurve(), PAD::AddPrimitivePoly(), PAD::AddPrimitiveRect(), PAD::AddPrimitiveSegment(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToFootprint(), PCAD2KICAD::PCB_LINE::AddToFootprint(), PCAD2KICAD::PCB_POLYGON::AddToFootprint(), ZONE_CREATE_HELPER::commitZone(), MICROWAVE_TOOL::createMicrowaveInductor(), MICROWAVE_TOOL::createPolygonShape(), DRAWING_TOOL::drawArc(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), DRAWSEGMENT_DESC::DRAWSEGMENT_DESC(), PAD_TOOL::explodePad(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), ALTIUM_PCB::HelperCreateBoardOutline(), ALTIUM_PCB::HelperParseDimensions6Datum(), ALTIUM_PCB::HelperParseDimensions6Leader(), ALTIUM_PCB::HelperParsePad6NonCopper(), CONVERT_TOOL::LinesToPoly(), FABMASTER::loadGraphics(), CADSTAR_PCB_ARCHIVE_LOADER::loadNetTracks(), EAGLE_PLUGIN::loadPlain(), FABMASTER::loadPolygon(), 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::parseFOOTPRINT(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), ALTIUM_PCB::ParseTracks6Data(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbTarget(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem(), PAD_TOOL::recombinePad(), CONVERT_TOOL::SegmentToArc(), 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 178 of file eda_item.h.

178 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: eda_item.h:203
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: eda_item.h:111

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ SetX()

void BOARD_ITEM::SetX ( int  aX)
inlineinherited

Definition at line 119 of file board_item.h.

120  {
121  wxPoint p( aX, GetY() );
122  SetPosition( p );
123  }
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:303
int GetY() const
Definition: board_item.h:103

References BOARD_ITEM::GetY(), and EDA_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 125 of file board_item.h.

126  {
127  wxPoint p( GetX(), aY );
128  SetPosition( p );
129  }
virtual void SetPosition(const wxPoint &aPos)
Definition: eda_item.h:303
int GetX() const
Definition: board_item.h:97

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

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

◆ ShowShape()

wxString BOARD_ITEM::ShowShape ( PCB_SHAPE_TYPE  aShape)
staticinherited

Convert the enum #PCB_SHAPE_TYPE_T integer value to a wxString.

Definition at line 31 of file board_item.cpp.

32 {
33  switch( aShape )
34  {
35  case PCB_SHAPE_TYPE::SEGMENT: return _( "Line" );
36  case PCB_SHAPE_TYPE::RECT: return _( "Rect" );
37  case PCB_SHAPE_TYPE::ARC: return _( "Arc" );
38  case PCB_SHAPE_TYPE::CIRCLE: return _( "Circle" );
39  case PCB_SHAPE_TYPE::CURVE: return _( "Bezier Curve" );
40  case PCB_SHAPE_TYPE::POLYGON: return _( "Polygon" );
41  default: return wxT( "??" );
42  }
43 }
polygon (not yet used for tracks, but could be in microwave apps)
segment with non rounded ends
#define _(s)
Definition: 3d_actions.cpp:33
usual segment : line with rounded ends
Arcs (with rounded ends)

References _, ARC, CIRCLE, CURVE, POLYGON, RECT, and SEGMENT.

Referenced by ConvertOutlineToPolygon(), PCB_SHAPE::GetLength(), GetSelectMenuText(), PCB_SHAPE::GetSelectMenuText(), and DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate().

◆ Sort()

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

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

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

Definition at line 471 of file eda_item.h.

471 { return *aLeft < *aRight; }

◆ SwapData()

void PCB_SHAPE::SwapData ( BOARD_ITEM aImage)
overridevirtualinherited

Swap data between aItem and aImage.

aItem and aImage should have the same type.

Used in undo and redo commands to swap values between an item and its copy. Only values like layer, size .. which are modified by editing are swapped.

Parameters
aImagethe item image which contains data to swap.

Reimplemented from BOARD_ITEM.

Definition at line 1238 of file pcb_shape.cpp.

1239 {
1240  PCB_SHAPE* image = dynamic_cast<PCB_SHAPE*>( aImage );
1241  assert( image );
1242 
1243  std::swap( m_width, image->m_width );
1244  std::swap( m_start, image->m_start );
1245  std::swap( m_end, image->m_end );
1246  std::swap( m_thirdPoint, image->m_thirdPoint );
1247  std::swap( m_shape, image->m_shape );
1248  std::swap( m_angle, image->m_angle );
1249  std::swap( m_bezierC1, image->m_bezierC1 );
1250  std::swap( m_bezierC2, image->m_bezierC2 );
1251  std::swap( m_bezierPoints, image->m_bezierPoints );
1252  std::swap( m_poly, image->m_poly );
1253  std::swap( m_layer, image->m_layer );
1254  std::swap( m_flags, image->m_flags );
1255  std::swap( m_status, image->m_status );
1256  std::swap( m_parent, image->m_parent );
1257  std::swap( m_forceVisible, image->m_forceVisible );
1258 }
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Definition: eda_item.h:529
wxPoint m_end
Definition: pcb_shape.h:49
STATUS_FLAGS m_status
Definition: eda_item.h:528
wxPoint m_thirdPoint
Definition: pcb_shape.h:50
SHAPE_POLY_SET m_poly
Definition: pcb_shape.h:58
double m_angle
Definition: pcb_shape.h:53
wxPoint m_start
Definition: pcb_shape.h:48
int m_width
Definition: pcb_shape.h:46
PCB_LAYER_ID m_layer
Definition: board_item.h:363
wxPoint m_bezierC1
Definition: pcb_shape.h:54
std::vector< wxPoint > m_bezierPoints
Definition: pcb_shape.h:57
STATUS_FLAGS m_flags
Definition: eda_item.h:531
bool m_forceVisible
Definition: eda_item.h:530
wxPoint m_bezierC2
Definition: pcb_shape.h:55
PCB_SHAPE_TYPE m_shape
Definition: pcb_shape.h:52

References image, PCB_SHAPE::m_angle, PCB_SHAPE::m_bezierC1, PCB_SHAPE::m_bezierC2, PCB_SHAPE::m_bezierPoints, PCB_SHAPE::m_end, EDA_ITEM::m_flags, EDA_ITEM::m_forceVisible, BOARD_ITEM::m_layer, EDA_ITEM::m_parent, PCB_SHAPE::m_poly, PCB_SHAPE::m_shape, PCB_SHAPE::m_start, EDA_ITEM::m_status, PCB_SHAPE::m_thirdPoint, and PCB_SHAPE::m_width.

◆ TransformShapeWithClearanceToPolygon()

void PCB_SHAPE::TransformShapeWithClearanceToPolygon ( SHAPE_POLY_SET aCornerBuffer,
PCB_LAYER_ID  aLayer,
int  aClearanceValue,
int  aError,
ERROR_LOC  aErrorLoc,
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 416 of file board_items_to_polygon_shape_transform.cpp.

420 {
421  int width = ignoreLineWidth ? 0 : m_width;
422 
423  width += 2 * aClearanceValue;
424 
425  switch( m_shape )
426  {
428  if( IsFilled() )
429  {
430  TransformCircleToPolygon( aCornerBuffer, GetCenter(), GetRadius() + width / 2, aError,
431  aErrorLoc );
432  }
433  else
434  {
435  TransformRingToPolygon( aCornerBuffer, GetCenter(), GetRadius(), width, aError,
436  aErrorLoc );
437  }
438  break;
439 
441  {
442  std::vector<wxPoint>