KiCad PCB EDA Suite
GERBER_DRAW_ITEM Class Reference

#include <gerber_draw_item.h>

Inheritance diagram for GERBER_DRAW_ITEM:
EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 GERBER_DRAW_ITEM (GERBER_FILE_IMAGE *aGerberparams)
 
 ~GERBER_DRAW_ITEM ()
 
void SetNetAttributes (const GBR_NETLIST_METADATA &aNetAttributes)
 
const GBR_NETLIST_METADATAGetNetAttributes () const
 
int GetLayer () const
 Function GetLayer returns the layer this item is on. More...
 
bool GetLayerPolarity () const
 
bool GetTextD_CodePrms (int &aSize, wxPoint &aPos, double &aOrientation)
 Returns the best size and orientation to display the D_Code on screen. More...
 
bool GetTextD_CodePrms (double &aSize, VECTOR2D &aPos, double &aOrientation)
 Returns the best size and orientation to display the D_Code in GAL aOrientation is returned in radians. More...
 
bool HasNegativeItems ()
 Function HasNegativeItems. More...
 
void SetLayerParameters ()
 Function SetLayerParameters Initialize parameters from Image and Layer parameters found in the gerber file: m_UnitsMetric, m_MirrorA, m_MirrorB, m_DrawScale, m_DrawOffset. More...
 
void SetLayerPolarity (bool aNegative)
 
void MoveAB (const wxPoint &aMoveVector)
 Function MoveAB move this object. More...
 
void MoveXY (const wxPoint &aMoveVector)
 Function MoveXY move this object. More...
 
const wxPoint GetPosition () const
 Function GetPosition returns the position of this object. More...
 
void SetPosition (const wxPoint &aPos)
 
wxPoint GetABPosition (const wxPoint &aXYPosition) const
 Function GetABPosition returns the image position of aPosition for this object. More...
 
VECTOR2I GetABPosition (const VECTOR2I &aXYPosition) const
 
wxPoint GetXYPosition (const wxPoint &aABPosition) const
 Function GetXYPosition returns the image position of aPosition for this object. More...
 
D_CODEGetDcodeDescr () const
 Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL. More...
 
const EDA_RECT GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
void Print (wxDC *aDC, const wxPoint &aOffset, GBR_DISPLAY_OPTIONS *aOptions)
 
void ConvertSegmentToPolygon ()
 Function ConvertSegmentToPolygon convert a line to an equivalent polygon. More...
 
void PrintGerberPoly (wxDC *aDC, COLOR4D aColor, const wxPoint &aOffset, bool aFilledShape)
 Function PrintGerberPoly a helper function used to print the polygon stored in m_PolyCorners. More...
 
int Shape () const
 
void GetMsgPanelInfo (EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
wxString ShowGBRShape () const
 
bool HitTest (const wxPoint &aRefPos, int aAccuracy=0) const override
 Function HitTest tests if the given wxPoint is within the bounds of this object. More...
 
bool HitTest (const EDA_RECT &aRefArea, bool aContained, int aAccuracy=0) const override
 Function HitTest (overloaded) tests if the given wxRect intersect this object. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 
virtual const BOX2I ViewBBox () const override
 
virtual unsigned int ViewGetLOD (int aLayer, KIGFX::VIEW *aView) const override
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 

More...
 
virtual wxString GetSelectMenuText (EDA_UNITS aUnits) const override
 

More...
 
BITMAP_DEF GetMenuImage () const override
 

More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (timestamp_t aNewTimeStamp)
 
timestamp_t GetTimeStamp () const
 
EDA_ITEMGetParent () const
 
void SetParent (EDA_ITEM *aParent)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
bool HasFlag (STATUS_FLAGS aFlag)
 
STATUS_FLAGS GetEditFlags () const
 
void ClearTempFlags ()
 
void ClearEditFlags ()
 
virtual bool IsType (const KICAD_T aScanTypes[]) const
 Function IsType Checks whether the item is one of the listed types. More...
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 
void ClearViewPrivData ()
 

Static Public Member Functions

template<class T >
static SEARCH_RESULT IterateForward (std::deque< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
template<class T >
static SEARCH_RESULT IterateForward (std::vector< T > &aList, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 IterateForward( EDA_ITEM*, INSPECTOR, void*, const KICAD_T ) More...
 
static bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

bool m_UnitsMetric
 
int m_Shape
 
wxPoint m_Start
 
wxPoint m_End
 
wxPoint m_ArcCentre
 
SHAPE_POLY_SET m_Polygon
 
wxSize m_Size
 
bool m_Flashed
 
int m_DCode
 
wxString m_AperFunction
 
GERBER_FILE_IMAGEm_GerberImageFile
 

Protected Member Functions

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

Protected Attributes

EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
timestamp_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Attributes

bool m_LayerNegative
 
bool m_swapAxis
 
bool m_mirrorA
 
bool m_mirrorB
 
wxRealPoint m_drawScale
 
wxPoint m_layerOffset
 
double m_lyrRotation
 
GBR_NETLIST_METADATA m_netAttributes
 the string given by a TO attribute set in aperture (dcode). More...
 

Detailed Description

Definition at line 68 of file gerber_draw_item.h.

Constructor & Destructor Documentation

◆ GERBER_DRAW_ITEM()

GERBER_DRAW_ITEM::GERBER_DRAW_ITEM ( GERBER_FILE_IMAGE aGerberparams)

Definition at line 40 of file gerber_draw_item.cpp.

40  :
42 {
43  m_GerberImageFile = aGerberImageFile;
45  m_Flashed = false;
46  m_DCode = 0;
47  m_UnitsMetric = false;
48  m_LayerNegative = false;
49  m_swapAxis = false;
50  m_mirrorA = false;
51  m_mirrorB = false;
52  m_drawScale.x = m_drawScale.y = 1.0;
53  m_lyrRotation = 0;
54 
55  if( m_GerberImageFile )
57 }
void SetLayerParameters()
Function SetLayerParameters Initialize parameters from Image and Layer parameters found in the gerber...
#define NULL
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:62
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163
GERBER_FILE_IMAGE * m_GerberImageFile
wxRealPoint m_drawScale

References GBR_SEGMENT, m_DCode, m_drawScale, m_Flashed, m_GerberImageFile, m_LayerNegative, m_lyrRotation, m_mirrorA, m_mirrorB, m_Shape, m_swapAxis, m_UnitsMetric, and SetLayerParameters().

◆ ~GERBER_DRAW_ITEM()

GERBER_DRAW_ITEM::~GERBER_DRAW_ITEM ( )

Definition at line 60 of file gerber_draw_item.cpp.

61 {
62 }

Member Function Documentation

◆ ClearBrightened()

void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 235 of file base_struct.h.

235 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:256

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ ClearEditFlags()

◆ ClearFlags()

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

Definition at line 256 of file base_struct.h.

256 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References EDA_ITEM::m_Flags.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PNS_KICAD_IFACE::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_COMPONENT::ClearAllHighlightFlags(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearEditFlags(), EDA_ITEM::ClearHighlighted(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), EDA_ITEM::ClearTempFlags(), SCH_EDIT_FRAME::ConvertPart(), LIB_EDIT_TOOL::Copy(), MWAVE::CreateMicrowaveInductor(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), KIGFX::SCH_PAINTER::draw(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), PCB_EDIT_FRAME::Exchange_Module(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), KIGFX::SCH_VIEW::HighlightItem(), MODULE_EDITOR_TOOLS::ImportFootprint(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), PCB_BASE_FRAME::PlaceModule(), LIB_PIN_TOOL::PlacePin(), DRAWING_TOOL::PlaceText(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::RollbackPartFromUndo(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_LEGACY_PLUGIN_CACHE::savePin(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ClearHighlighted()

void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 234 of file base_struct.h.

234 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:256

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

◆ ClearSelected()

void EDA_ITEM::ClearSelected ( )
inlineinherited

◆ ClearTempFlags()

void EDA_ITEM::ClearTempFlags ( )
inlineinherited

Definition at line 268 of file base_struct.h.

269  {
271  }
#define IS_LINKED
Used in calculation to mark linked items (temporary use)
Definition: base_struct.h:117
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:131
#define CANDIDATE
flag indicating that the structure is connected
Definition: base_struct.h:130
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:256
#define DO_NOT_DRAW
Used to disable draw function.
Definition: base_struct.h:132
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

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

Referenced by SCH_EDIT_FRAME::PutDataInPreviousState().

◆ ClearViewPrivData()

void KIGFX::VIEW_ITEM::ClearViewPrivData ( )
inlineinherited

Definition at line 153 of file view_item.h.

154  {
156  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:161
#define NULL

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

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

◆ Clone()

EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Function Clone creates a duplicate of this item with linked list members set to NULL.

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

Returns
A clone of the item.

Reimplemented in MODULE_ZONE_CONTAINER, D_PAD, SCH_COMPONENT, ZONE_CONTAINER, MODULE, SCH_SHEET, SCH_HIERLABEL, LIB_PIN, SCH_GLOBALLABEL, SCH_LABEL, VIA, SCH_TEXT, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_LINE, TRACK, SCH_FIELD, SCH_BUS_BUS_ENTRY, SCH_SHEET_PIN, LIB_FIELD, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, EDGE_MODULE, LIB_ARC, TEXTE_PCB, SCH_NO_CONNECT, LIB_POLYLINE, SCH_JUNCTION, SCH_MARKER, PCB_TARGET, LIB_TEXT, LIB_BEZIER, LIB_CIRCLE, LIB_RECTANGLE, and KIGFX::ORIGIN_VIEWITEM.

Definition at line 118 of file base_struct.cpp.

119 {
120  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
121  wxT( ". Bad programmer!" ) );
122 }
#define NULL
virtual wxString GetClass() const =0
Function GetClass returns the class name.

References EDA_ITEM::GetClass(), and NULL.

Referenced by LIB_DRAWING_TOOLS::DrawShape(), LIB_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), LIB_PART::operator=(), LIB_EDIT_TOOL::Paste(), SCH_LEGACY_PLUGIN_CACHE::removeSymbol(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDIT_FRAME::SaveCopyForRepeatItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), LIB_PART::SetUnitCount(), SCH_DRAWING_TOOLS::SingleClickPlace(), COMMIT::Stage(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ ConvertSegmentToPolygon()

void GERBER_DRAW_ITEM::ConvertSegmentToPolygon ( )

Function ConvertSegmentToPolygon convert a line to an equivalent polygon.

Useful when a line is plotted using a rectangular pen. In this case, the usual segment plot function cannot be used

Definition at line 577 of file gerber_draw_item.cpp.

578 {
581 
582  wxPoint start = m_Start;
583  wxPoint end = m_End;
584 
585  // make calculations more easy if ensure start.x < end.x
586  // (only 2 quadrants to consider)
587  if( start.x > end.x )
588  std::swap( start, end );
589 
590  // calculate values relative to start point:
591  wxPoint delta = end - start;
592 
593  // calculate corners for the first quadrant only (delta.x and delta.y > 0 )
594  // currently, delta.x already is > 0.
595  // make delta.y > 0
596  bool change = delta.y < 0;
597 
598  if( change )
599  delta.y = -delta.y;
600 
601  // Now create the full polygon.
602  // Due to previous changes, the shape is always something like
603  // 3 4
604  // 2 5
605  // 1 6
606  wxPoint corner;
607  corner.x -= m_Size.x/2;
608  corner.y -= m_Size.y/2;
609  wxPoint close = corner;
610  m_Polygon.Append( VECTOR2I( corner ) ); // Lower left corner, start point (1)
611  corner.y += m_Size.y;
612  m_Polygon.Append( VECTOR2I( corner ) ); // upper left corner, start point (2)
613 
614  if( delta.x || delta.y)
615  {
616  corner += delta;
617  m_Polygon.Append( VECTOR2I( corner ) ); // upper left corner, end point (3)
618  }
619 
620  corner.x += m_Size.x;
621  m_Polygon.Append( VECTOR2I( corner ) ); // upper right corner, end point (4)
622  corner.y -= m_Size.y;
623  m_Polygon.Append( VECTOR2I( corner ) ); // lower right corner, end point (5)
624 
625  if( delta.x || delta.y )
626  {
627  corner -= delta;
628  m_Polygon.Append( VECTOR2I( corner ) ); // lower left corner, start point (6)
629  }
630 
631  m_Polygon.Append( VECTOR2I( close ) ); // close the shape
632 
633  // Create final polygon:
634  if( change )
635  m_Polygon.Mirror( false, true );
636 
637  m_Polygon.Move( VECTOR2I( start ) );
638 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET m_Polygon
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirrors the line points about y or x (or both)
void Move(const VECTOR2I &aVector) override
int NewOutline()
Creates a new empty polygon in the set and returns its index
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)

References SHAPE_POLY_SET::Append(), m_End, m_Polygon, m_Size, m_Start, SHAPE_POLY_SET::Mirror(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::RemoveAllContours(), wxPoint::x, and wxPoint::y.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), and Print().

◆ GetABPosition() [1/2]

wxPoint GERBER_DRAW_ITEM::GetABPosition ( const wxPoint aXYPosition) const

Function GetABPosition returns the image position of aPosition for this object.

Image position is the value of aPosition, modified by image parameters: offsets, axis selection, scale, rotation

Parameters
aXYPosition= position in X,Y gerber axis
Returns
const wxPoint - The given position in plotter A,B axis.

Definition at line 151 of file gerber_draw_item.cpp.

152 {
153  /* Note: RS274Xrevd_e is obscure about the order of transforms:
154  * For instance: Rotation must be made after or before mirroring ?
155  * Note: if something is changed here, GetYXPosition must reflect changes
156  */
157  wxPoint abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset;
158 
159  if( m_swapAxis )
160  std::swap( abPos.x, abPos.y );
161 
163  abPos.x = KiROUND( abPos.x * m_drawScale.x );
164  abPos.y = KiROUND( abPos.y * m_drawScale.y );
165  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
166 
167  if( rotation )
168  RotatePoint( &abPos, -rotation );
169 
170  // Negate A axis if mirrored
171  if( m_mirrorA )
172  abPos.x = -abPos.x;
173 
174  // abPos.y must be negated when no mirror, because draw axis is top to bottom
175  if( !m_mirrorB )
176  abPos.y = -abPos.y;
177  return abPos;
178 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
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:61
GERBER_FILE_IMAGE * m_GerberImageFile
wxRealPoint m_drawScale

References KiROUND(), m_drawScale, m_GerberImageFile, GERBER_FILE_IMAGE::m_ImageJustifyOffset, GERBER_FILE_IMAGE::m_ImageOffset, GERBER_FILE_IMAGE::m_ImageRotation, m_layerOffset, m_lyrRotation, m_mirrorA, m_mirrorB, m_swapAxis, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), AM_PRIMITIVE::DrawBasicShape(), D_CODE::DrawFlashedPolygon(), D_CODE::DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GetABPosition(), APERTURE_MACRO::GetApertureMacroShape(), GetBoundingBox(), GetTextD_CodePrms(), HitTest(), Print(), and PrintGerberPoly().

◆ GetABPosition() [2/2]

VECTOR2I GERBER_DRAW_ITEM::GetABPosition ( const VECTOR2I aXYPosition) const
inline

Definition at line 210 of file gerber_draw_item.h.

211  {
212  return VECTOR2I( GetABPosition( wxPoint( aXYPosition.x, aXYPosition.y ) ) );
213  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.

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

◆ GetBoundingBox()

const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox ( ) const
overridevirtual

Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

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

Reimplemented from EDA_ITEM.

Definition at line 282 of file gerber_draw_item.cpp.

283 {
284  // return a rectangle which is (pos,dim) in nature. therefore the +1
285  EDA_RECT bbox( m_Start, wxSize( 1, 1 ) );
286  D_CODE* code = GetDcodeDescr();
287 
288  // TODO(JE) GERBER_DRAW_ITEM maybe should actually be a number of subclasses.
289  // Until/unless that is changed, we need to do different things depending on
290  // what is actually being represented by this GERBER_DRAW_ITEM.
291 
292  switch( m_Shape )
293  {
294  case GBR_POLYGON:
295  {
296  auto bb = m_Polygon.BBox();
297  bbox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 );
298  bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
299  break;
300  }
301 
302  case GBR_CIRCLE:
303  {
304  double radius = GetLineLength( m_Start, m_End );
305  bbox.Inflate( radius, radius );
306  break;
307  }
308 
309  case GBR_ARC:
310  {
311  double arc_angle =
312  atan2( double( m_End.y - m_ArcCentre.y ), double( m_End.x - m_ArcCentre.x ) )
313  - atan2( double( m_Start.y - m_ArcCentre.y ), double( m_Start.x - m_ArcCentre.x ) );
314 
315  arc_angle *= 180.0 / M_PI;
316 
317  if( arc_angle < 0.0 )
318  arc_angle += 360.0;
319 
320  if( m_End == m_Start ) // Arc with the end point = start point is expected to be a circle
321  arc_angle = 360.0;
322 
323  SHAPE_ARC arc( m_ArcCentre, m_Start, arc_angle );
324  BOX2I arc_bbox = arc.BBox( m_Size.x / 2 ); // m_Size.x is the line thickness
325  bbox.SetOrigin( arc_bbox.GetX(), arc_bbox.GetY() );
326  bbox.SetWidth( arc_bbox.GetWidth() );
327  bbox.SetHeight( arc_bbox.GetHeight() );
328  break;
329  }
330 
331  case GBR_SPOT_CIRCLE:
332  {
333  if( code )
334  {
335  int radius = code->m_Size.x >> 1;
336  bbox.Inflate( radius, radius );
337  }
338  break;
339  }
340 
341  case GBR_SPOT_RECT:
342  {
343  if( code )
344  bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
345  break;
346  }
347 
348  case GBR_SPOT_OVAL:
349  {
350  if( code )
351  bbox.Inflate( code->m_Size.x, code->m_Size.y );
352  break;
353  }
354 
355  case GBR_SPOT_POLY:
356  {
357  if( code )
358  {
359  if( code->m_Polygon.OutlineCount() == 0 )
360  code->ConvertShapeToPolygon();
361 
362  bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2,
363  code->m_Polygon.BBox().GetHeight() / 2 );
364  }
365  break;
366  }
367  case GBR_SPOT_MACRO:
368  {
369  if( code )
370  {
371  // Update the shape drawings and the bounding box coordiantes:
372  code->GetMacro()->GetApertureMacroShape( this, m_Start );
373  // now the bounding box is valid:
374  bbox = code->GetMacro()->GetBoundingBox();
375  }
376  break;
377  }
378 
379  case GBR_SEGMENT:
380  {
381  if( code && code->m_Shape == APT_RECT )
382  {
383  if( m_Polygon.OutlineCount() > 0 )
384  {
385  auto bb = m_Polygon.BBox();
386  bbox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 );
387  bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
388  }
389  }
390  else
391  {
392  int radius = ( m_Size.x + 1 ) / 2;
393 
394  int ymax = std::max( m_Start.y, m_End.y ) + radius;
395  int xmax = std::max( m_Start.x, m_End.x ) + radius;
396 
397  int ymin = std::min( m_Start.y, m_End.y ) - radius;
398  int xmin = std::min( m_Start.x, m_End.x ) - radius;
399 
400  bbox = EDA_RECT( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
401  }
402 
403  break;
404  }
405  default:
406  wxASSERT_MSG( false, wxT( "GERBER_DRAW_ITEM shape is unknown!" ) );
407  break;
408  }
409 
410  // calculate the corners coordinates in current gerber axis orientations
411  wxPoint org = GetABPosition( bbox.GetOrigin() );
412  wxPoint end = GetABPosition( bbox.GetEnd() );
413 
414  // Set the corners position:
415  bbox.SetOrigin( org );
416  bbox.SetEnd( end );
417  bbox.Normalize();
418 
419  return bbox;
420 }
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
int OutlineCount() const
Returns the number of outlines in the set
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:202
coord_type GetX() const
Definition: box2.h:189
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:52
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
EDA_RECT GetBoundingBox() const
Returns the bounding box of the shape.
Definition: am_primitive.h:231
coord_type GetWidth() const
Definition: box2.h:196
coord_type GetY() const
Definition: box2.h:190
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:301
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void SetOrigin(const Vec &pos)
Definition: box2.h:209
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
coord_type GetHeight() const
Definition: box2.h:197
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
void ConvertShapeToPolygon()
Function ConvertShapeToPolygon convert a shape to an equivalent polygon.
Definition: dcode.cpp:301
const BOX2I BBox(int aClearance=0) const override
Function BBox()

References APT_RECT, SHAPE_ARC::BBox(), SHAPE_POLY_SET::BBox(), D_CODE::ConvertShapeToPolygon(), GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, GetABPosition(), APERTURE_MACRO::GetApertureMacroShape(), APERTURE_MACRO::GetBoundingBox(), GetDcodeDescr(), EDA_RECT::GetEnd(), BOX2< Vec >::GetHeight(), GetLineLength(), D_CODE::GetMacro(), EDA_RECT::GetOrigin(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), EDA_RECT::Inflate(), m_ArcCentre, m_End, m_Polygon, D_CODE::m_Polygon, m_Shape, D_CODE::m_Shape, m_Size, D_CODE::m_Size, m_Start, EDA_RECT::Normalize(), SHAPE_POLY_SET::OutlineCount(), EDA_RECT::SetEnd(), EDA_RECT::SetHeight(), EDA_RECT::SetOrigin(), EDA_RECT::SetWidth(), wxPoint::x, and wxPoint::y.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), HitTest(), and ViewBBox().

◆ GetClass()

wxString GERBER_DRAW_ITEM::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 279 of file gerber_draw_item.h.

280  {
281  return wxT( "GERBER_DRAW_ITEM" );
282  }

◆ GetDcodeDescr()

D_CODE * GERBER_DRAW_ITEM::GetDcodeDescr ( ) const

Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.

Returns
D_CODE* - a pointer to the DCode description (for flashed items).

Definition at line 270 of file gerber_draw_item.cpp.

271 {
272  if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) )
273  return NULL;
274 
275  if( m_GerberImageFile == NULL )
276  return NULL;
277 
279 }
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.
#define LAST_DCODE
Definition: dcode.h:72
#define NULL
#define FIRST_DCODE
Definition: dcode.h:71
GERBER_FILE_IMAGE * m_GerberImageFile

References FIRST_DCODE, GERBER_FILE_IMAGE::GetDCODE(), LAST_DCODE, m_DCode, m_GerberImageFile, and NULL.

Referenced by AM_PRIMITIVE::ConvertShapeToPolygon(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), AM_PRIMITIVE::DrawBasicShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), fillFlashedGBRITEM(), GetBoundingBox(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GetMsgPanelInfo(), AM_PRIMITIVE::GetShapeDim(), GetTextD_CodePrms(), GERBVIEW_CONTROL::HighlightControl(), HitTest(), AM_PRIMITIVE::IsAMPrimitiveExposureOn(), Print(), GERBVIEW_FRAME::Process_Special_Functions(), ShowGBRShape(), and ViewGetLOD().

◆ GetEditFlags()

STATUS_FLAGS EDA_ITEM::GetEditFlags ( ) const
inlineinherited

Definition at line 260 of file base_struct.h.

261  {
265  return m_Flags & mask;
266  }
#define TEMP_SELECTED
flag indicating that the structure has already selected
Definition: base_struct.h:128
#define END_ONPAD
Pcbnew: flag set for track segment ending on a pad.
Definition: base_struct.h:139
#define BEGIN_ONPAD
Pcbnew: flag set for track segment starting on a pad.
Definition: base_struct.h:138
#define EDA_ITEM_ALL_FLAGS
Definition: base_struct.h:154
#define SELECTED
Definition: base_struct.h:127
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143
#define DP_COUPLED
item is coupled with another item making a differential pair
Definition: base_struct.h:145
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
#define IS_DANGLING
indicates a pin is dangling
Definition: base_struct.h:149
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184
#define ENDPOINT
ends. (Used to support dragging.)
Definition: base_struct.h:126
#define STARTPOINT
When a line is selected, these flags indicate which.
Definition: base_struct.h:125

References BEGIN_ONPAD, BRIGHTENED, DP_COUPLED, EDA_ITEM_ALL_FLAGS, END_ONPAD, ENDPOINT, HIGHLIGHTED, IS_DANGLING, EDA_ITEM::m_Flags, SELECTED, STARTPOINT, and TEMP_SELECTED.

Referenced by SCH_EDIT_TOOL::ChangeShape(), EDA_ITEM::ClearEditFlags(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_TOOL::editComponentFieldText(), SCH_EDITOR_CONTROL::EditWithLibEdit(), LIB_MOVE_TOOL::Main(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_EDIT_FRAME::SelectUnit(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_EDIT_PIN::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), and SCH_EDIT_FRAME::TrimWire().

◆ GetFlags()

◆ GetLayer()

int GERBER_DRAW_ITEM::GetLayer ( ) const

Function GetLayer returns the layer this item is on.

Definition at line 78 of file gerber_draw_item.cpp.

79 {
80  // returns the layer this item is on, or 0 if the m_GerberImageFile is NULL.
82 }
GERBER_FILE_IMAGE * m_GerberImageFile

References m_GerberImageFile, and GERBER_FILE_IMAGE::m_GraphicLayer.

Referenced by GetMsgPanelInfo(), GetSelectMenuText(), GERBVIEW_SELECTION_TOOL::selectable(), and ViewGetLayers().

◆ GetLayerPolarity()

bool GERBER_DRAW_ITEM::GetLayerPolarity ( ) const
inline

◆ GetMenuImage()

BITMAP_DEF GERBER_DRAW_ITEM::GetMenuImage ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 759 of file gerber_draw_item.cpp.

760 {
761  if( m_Flashed )
762  return pad_xpm;
763 
764  switch( m_Shape )
765  {
766  case GBR_SEGMENT:
767  case GBR_ARC:
768  case GBR_CIRCLE:
769  return add_line_xpm;
770 
771  case GBR_SPOT_OVAL:
772  case GBR_SPOT_CIRCLE:
773  case GBR_SPOT_RECT:
774  case GBR_SPOT_POLY:
775  case GBR_SPOT_MACRO:
776  // should be handles by m_Flashed == true
777  return pad_xpm;
778 
779  case GBR_POLYGON:
781  }
782 
783  return info_xpm;
784 }
const BITMAP_OPAQUE pad_xpm[1]
Definition: pad.cpp:41
const BITMAP_OPAQUE add_graphical_polygon_xpm[1]
const BITMAP_OPAQUE add_line_xpm[1]
Definition: add_line.cpp:30
const BITMAP_OPAQUE info_xpm[1]
Definition: info.cpp:75

References add_graphical_polygon_xpm, add_line_xpm, GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, info_xpm, m_Flashed, m_Shape, and pad_xpm.

◆ GetMsgPanelInfo()

void GERBER_DRAW_ITEM::GetMsgPanelInfo ( EDA_UNITS  aUnits,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtual

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

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented from EDA_ITEM.

Definition at line 661 of file gerber_draw_item.cpp.

662 {
663  wxString msg;
664  wxString text;
665 
666  msg = ShowGBRShape();
667  aList.emplace_back( _( "Type" ), msg, DARKCYAN );
668 
669  // Display D_Code value with its attributes for items using a DCode:
670  if( m_Shape == GBR_POLYGON ) // Has no DCode, but can have an attribute
671  {
672  msg = _( "Attribute" );
673 
674  if( m_AperFunction.IsEmpty() )
675  text = _( "No attribute" );
676  else
677  text = m_AperFunction;
678  }
679  else
680  {
681  msg.Printf( _( "D Code %d" ), m_DCode );
682  D_CODE* apertDescr = GetDcodeDescr();
683 
684  if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() )
685  text = _( "No attribute" );
686  else
687  text = apertDescr->m_AperFunction;
688  }
689 
690  aList.emplace_back( msg, text, RED );
691 
692  // Display graphic layer name
694  aList.emplace_back( _( "Graphic Layer" ), msg, DARKGREEN );
695 
696  // Display item rotation
697  // The full rotation is Image rotation + m_lyrRotation
698  // but m_lyrRotation is specific to this object
699  // so we display only this parameter
700  msg.Printf( wxT( "%f" ), m_lyrRotation );
701  aList.emplace_back( _( "Rotation" ), msg, BLUE );
702 
703  // Display item polarity (item specific)
704  msg = m_LayerNegative ? _("Clear") : _("Dark");
705  aList.emplace_back( _( "Polarity" ), msg, BLUE );
706 
707  // Display mirroring (item specific)
708  msg.Printf( wxT( "A:%s B:%s" ),
709  m_mirrorA ? _("Yes") : _("No"),
710  m_mirrorB ? _("Yes") : _("No"));
711  aList.emplace_back( _( "Mirror" ), msg, DARKRED );
712 
713  // Display AB axis swap (item specific)
714  msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" );
715  aList.emplace_back( _( "AB axis" ), msg, DARKRED );
716 
717  // Display net info, if exists
719  return;
720 
721  // Build full net info:
722  wxString net_msg;
723  wxString cmp_pad_msg;
724 
726  {
727  net_msg = _( "Net:" );
728  net_msg << " ";
729 
730  if( m_netAttributes.m_Netname.IsEmpty() )
731  net_msg << "<no net>";
732  else
734  }
735 
737  {
739  cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s" ),
742  else
743  cmp_pad_msg.Printf( _( "Cmp: %s Pad: %s Fct %s" ),
747  }
748 
750  {
751  cmp_pad_msg = _( "Cmp:" );
752  cmp_pad_msg << " " << m_netAttributes.m_Cmpref;
753  }
754 
755  aList.emplace_back( net_msg, cmp_pad_msg, DARKCYAN );
756 }
Definition: colors.h:57
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
print info associated to a component (TO.C attribute)
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
const wxString & GetValue()
int GetLayer() const
Function GetLayer returns the layer this item is on.
wxString m_Cmpref
the component reference parent of the data
Definition: colors.h:54
GBR_DATA_FIELD m_PadPinFunction
for a pad: the pin function (defined in schematic)
GBR_DATA_FIELD m_Padname
for a flashed pad: the pad name ((TO.P attribute)
static GERBER_FILE_IMAGE_LIST & GetImagesList()
GBR_NETLIST_METADATA m_netAttributes
the string given by a TO attribute set in aperture (dcode).
wxString m_Netname
for items associated to a net: the netname
Definition: colors.h:60
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE
Definition: dcode.h:105
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define _(s)
Definition: 3d_actions.cpp:31
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:131
print info associated to a flashed pad (TO.P attribute)
print info associated to a net (TO.N attribute)
int m_NetAttribType
the type of net info (used to define the gerber string to create)
wxString ShowGBRShape() const

References _, BLUE, DARKCYAN, DARKGREEN, DARKRED, GBR_NETLIST_METADATA::GBR_NETINFO_CMP, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_PAD, GBR_NETLIST_METADATA::GBR_NETINFO_UNSPECIFIED, GBR_POLYGON, GetDcodeDescr(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), GERBER_FILE_IMAGE_LIST::GetImagesList(), GetLayer(), GBR_DATA_FIELD::GetValue(), GBR_DATA_FIELD::IsEmpty(), m_AperFunction, D_CODE::m_AperFunction, GBR_NETLIST_METADATA::m_Cmpref, m_DCode, m_LayerNegative, m_lyrRotation, m_mirrorA, m_mirrorB, GBR_NETLIST_METADATA::m_NetAttribType, m_netAttributes, GBR_NETLIST_METADATA::m_Netname, GBR_NETLIST_METADATA::m_Padname, GBR_NETLIST_METADATA::m_PadPinFunction, m_Shape, m_swapAxis, RED, ShowGBRShape(), and UnescapeString().

◆ GetNetAttributes()

const GBR_NETLIST_METADATA& GERBER_DRAW_ITEM::GetNetAttributes ( ) const
inline

Definition at line 125 of file gerber_draw_item.h.

125 { return m_netAttributes; }
GBR_NETLIST_METADATA m_netAttributes
the string given by a TO attribute set in aperture (dcode).

References m_netAttributes.

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GERBVIEW_CONTROL::HighlightControl(), and GERBVIEW_FRAME::Process_Special_Functions().

◆ GetParent()

◆ GetPosition()

const wxPoint GERBER_DRAW_ITEM::GetPosition ( ) const
inline

Function GetPosition returns the position of this object.

Returns
const wxPoint& - The position of this object. This function exists mainly to satisfy the virtual GetPosition() in parent class

Definition at line 197 of file gerber_draw_item.h.

197 { return m_Start; }

References m_Start.

◆ GetSelectMenuText()

wxString GERBER_DRAW_ITEM::GetSelectMenuText ( EDA_UNITS  aUnits) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 973 of file gerber_draw_item.cpp.

974 {
975  wxString layerName;
976 
978 
979  return wxString::Format( _( "%s (D%d) on layer %d: %s" ),
980  ShowGBRShape(),
981  m_DCode,
982  GetLayer() + 1,
983  layerName );
984 }
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
int GetLayer() const
Function GetLayer returns the layer this item is on.
static GERBER_FILE_IMAGE_LIST & GetImagesList()
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
#define _(s)
Definition: 3d_actions.cpp:31
wxString ShowGBRShape() const

References _, Format(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), GERBER_FILE_IMAGE_LIST::GetImagesList(), GetLayer(), m_DCode, and ShowGBRShape().

◆ GetState()

int EDA_ITEM::GetState ( int  type) const
inlineinherited

Definition at line 239 of file base_struct.h.

240  {
241  return m_Status & type;
242  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

Referenced by SELECTION_TOOL::expandConnection(), TRACK::GetMsgPanelInfoBase_Common(), TRACK::IsLocked(), TRACK::Print(), and ZONE_CONTAINER::PrintFilledArea().

◆ GetStatus()

STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 252 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

◆ GetTextD_CodePrms() [1/2]

bool GERBER_DRAW_ITEM::GetTextD_CodePrms ( int &  aSize,
wxPoint aPos,
double &  aOrientation 
)

Returns the best size and orientation to display the D_Code on screen.

Parameters
aSizeis a reference to return the text size
aPosis a reference to return the text position
aOrientationis a reference to return the text orientation
Returns
true if the parameters can be calculated, false for unknown D_Code

Definition at line 85 of file gerber_draw_item.cpp.

86 {
87  // calculate the best size and orientation of the D_Code text
88 
89  if( m_DCode <= 0 )
90  return false; // No D_Code for this item
91 
92  if( m_Flashed || m_Shape == GBR_ARC )
93  {
94  aPos = m_Start;
95  }
96  else // it is a line:
97  {
98  aPos = ( m_Start + m_End) / 2;
99  }
100 
101  aPos = GetABPosition( aPos );
102 
103  int size; // the best size for the text
104 
105  if( GetDcodeDescr() )
106  size = GetDcodeDescr()->GetShapeDim( this );
107  else
108  size = std::min( m_Size.x, m_Size.y );
109 
110  aOrientation = TEXT_ANGLE_HORIZ;
111 
112  if( m_Flashed )
113  {
114  // A reasonable size for text is min_dim/3 because most of time this text has 3 chars.
115  aSize = size / 3;
116  }
117  else // this item is a line
118  {
119  wxPoint delta = m_Start - m_End;
120 
121  aOrientation = RAD2DECIDEG( atan2( (double)delta.y, (double)delta.x ) );
122  NORMALIZE_ANGLE_90( aOrientation );
123 
124  // A reasonable size for text is size/2 because text needs margin below and above it.
125  // a margin = size/4 seems good, expecting the line len is large enough to show 3 chars,
126  // that is the case most of time.
127  aSize = size / 2;
128  }
129 
130  return true;
131 }
#define TEXT_ANGLE_HORIZ
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
double RAD2DECIDEG(double rad)
Definition: trigo.h:215
void NORMALIZE_ANGLE_90(T &Angle)
Definition: trigo.h:331
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
int GetShapeDim(GERBER_DRAW_ITEM *aParent)
Function GetShapeDim calculates a value that can be used to evaluate the size of text when displaying...
Definition: dcode.cpp:121

References GBR_ARC, GetABPosition(), GetDcodeDescr(), D_CODE::GetShapeDim(), m_DCode, m_End, m_Flashed, m_Shape, m_Size, m_Start, NORMALIZE_ANGLE_90(), RAD2DECIDEG(), TEXT_ANGLE_HORIZ, wxPoint::x, and wxPoint::y.

Referenced by KIGFX::GERBVIEW_PAINTER::draw(), and GetTextD_CodePrms().

◆ GetTextD_CodePrms() [2/2]

bool GERBER_DRAW_ITEM::GetTextD_CodePrms ( double &  aSize,
VECTOR2D aPos,
double &  aOrientation 
)

Returns the best size and orientation to display the D_Code in GAL aOrientation is returned in radians.

Definition at line 134 of file gerber_draw_item.cpp.

135 {
136  // aOrientation is returned in radians
137  int size;
138  wxPoint pos;
139 
140  if( ! GetTextD_CodePrms( size, pos, aOrientation ) )
141  return false;
142 
143  aPos = pos;
144  aSize = (double) size;
145  aOrientation = DECIDEG2RAD( aOrientation );
146 
147  return true;
148 }
bool GetTextD_CodePrms(int &aSize, wxPoint &aPos, double &aOrientation)
Returns the best size and orientation to display the D_Code on screen.
double DECIDEG2RAD(double deg)
Definition: trigo.h:214

References DECIDEG2RAD(), and GetTextD_CodePrms().

◆ GetTimeStamp()

◆ GetXYPosition()

wxPoint GERBER_DRAW_ITEM::GetXYPosition ( const wxPoint aABPosition) const

Function GetXYPosition returns the image position of aPosition for this object.

Image position is the value of aPosition, modified by image parameters: offsets, axis selection, scale, rotation

Parameters
aABPosition= position in A,B plotter axis
Returns
const wxPoint - The given position in X,Y axis.

Definition at line 181 of file gerber_draw_item.cpp.

182 {
183  // do the inverse transform made by GetABPosition
184  wxPoint xyPos = aABPosition;
185 
186  if( m_mirrorA )
187  xyPos.x = -xyPos.x;
188 
189  if( !m_mirrorB )
190  xyPos.y = -xyPos.y;
191 
192  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
193 
194  if( rotation )
195  RotatePoint( &xyPos, rotation );
196 
197  xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
198  xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
200 
201  if( m_swapAxis )
202  std::swap( xyPos.x, xyPos.y );
203 
204  return xyPos - m_GerberImageFile->m_ImageJustifyOffset;
205 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
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:61
GERBER_FILE_IMAGE * m_GerberImageFile
wxRealPoint m_drawScale

References KiROUND(), m_drawScale, m_GerberImageFile, GERBER_FILE_IMAGE::m_ImageJustifyOffset, GERBER_FILE_IMAGE::m_ImageOffset, GERBER_FILE_IMAGE::m_ImageRotation, m_layerOffset, m_lyrRotation, m_mirrorA, m_mirrorB, m_swapAxis, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by HitTest(), and MoveAB().

◆ HasFlag()

◆ HasNegativeItems()

bool GERBER_DRAW_ITEM::HasNegativeItems ( )

Function HasNegativeItems.

Returns
true if this item or at least one shape (when using aperture macros must be drawn in background color used to optimize screen refresh (when no items are in background color refresh can be faster)

Definition at line 445 of file gerber_draw_item.cpp.

446 {
448 
449  // if isClear is true, this item has negative shape
450  return isClear;
451 }
GERBER_FILE_IMAGE * m_GerberImageFile

References m_GerberImageFile, GERBER_FILE_IMAGE::m_ImageNegative, and m_LayerNegative.

◆ HitTest() [1/2]

bool GERBER_DRAW_ITEM::HitTest ( const wxPoint aRefPos,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if the given wxPoint is within the bounds of this object.

Parameters
aRefPosa wxPoint to test
Returns
bool - true if a hit, else false

Reimplemented from EDA_ITEM.

Definition at line 787 of file gerber_draw_item.cpp.

788 {
789  // In case the item has a very tiny width defined, allow it to be selected
790  const int MIN_HIT_TEST_RADIUS = Millimeter2iu( 0.01 );
791 
792  // calculate aRefPos in XY gerber axis:
793  wxPoint ref_pos = GetXYPosition( aRefPos );
794 
795  SHAPE_POLY_SET poly;
796 
797  switch( m_Shape )
798  {
799  case GBR_POLYGON:
800  poly = m_Polygon;
801  return poly.Contains( VECTOR2I( ref_pos ), 0, aAccuracy );
802 
803  case GBR_SPOT_POLY:
804  poly = GetDcodeDescr()->m_Polygon;
805  poly.Move( VECTOR2I( m_Start ) );
806  return poly.Contains( VECTOR2I( ref_pos ), 0, aAccuracy );
807 
808  case GBR_SPOT_RECT:
809  return GetBoundingBox().Contains( aRefPos );
810 
811  case GBR_ARC:
812  {
813  double radius = GetLineLength( m_Start, m_ArcCentre );
814  VECTOR2D test_radius = VECTOR2D( ref_pos ) - VECTOR2D( m_ArcCentre );
815 
816  int size = ( ( m_Size.x < MIN_HIT_TEST_RADIUS ) ? MIN_HIT_TEST_RADIUS
817  : m_Size.x );
818 
819  // Are we close enough to the radius?
820  bool radius_hit = ( std::fabs( test_radius.EuclideanNorm() - radius) < size );
821 
822  if( radius_hit )
823  {
824  // Now check that we are within the arc angle
825 
826  VECTOR2D start = VECTOR2D( m_Start ) - VECTOR2D( m_ArcCentre );
828 
829  double start_angle = NormalizeAngleRadiansPos( start.Angle() );
830  double end_angle = NormalizeAngleRadiansPos( end.Angle() );
831 
832  if( m_Start == m_End )
833  {
834  start_angle = 0;
835  end_angle = 2 * M_PI;
836  }
837  else if( end_angle < start_angle )
838  {
839  end_angle += 2 * M_PI;
840  }
841 
842  double test_angle = NormalizeAngleRadiansPos( test_radius.Angle() );
843 
844  return ( test_angle > start_angle && test_angle < end_angle );
845  }
846 
847  return false;
848  }
849 
850  case GBR_SPOT_MACRO:
851  // Aperture macro polygons are already in absolute coordinates
852  auto p = GetDcodeDescr()->GetMacro()->GetApertureMacroShape( this, m_Start );
853  return p->Contains( VECTOR2I( aRefPos ), -1, aAccuracy );
854  }
855 
856  // TODO: a better analyze of the shape (perhaps create a D_CODE::HitTest for flashed items)
857  int radius = std::min( m_Size.x, m_Size.y ) >> 1;
858 
859  if( radius < MIN_HIT_TEST_RADIUS )
860  radius = MIN_HIT_TEST_RADIUS;
861 
862  if( m_Flashed )
863  return HitTestPoints( m_Start, ref_pos, radius );
864  else
865  return TestSegmentHit( ref_pos, m_Start, m_End, radius );
866 }
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:202
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const
Returns true if a given subpolygon contains the point aP.
double NormalizeAngleRadiansPos(double Angle)
Definition: trigo.h:276
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET m_Polygon
bool Contains(const wxPoint &aPoint) const
Function Contains.
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:129
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET.
double Angle() const
Function Angle computes the angle of the vector.
Definition: vector2d.h:313
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:161
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:299
wxPoint GetXYPosition(const wxPoint &aABPosition) const
Function GetXYPosition returns the image position of aPosition for this object.

References VECTOR2< T >::Angle(), EDA_RECT::Contains(), SHAPE_POLY_SET::Contains(), VECTOR2< T >::EuclideanNorm(), GBR_ARC, GBR_POLYGON, GBR_SPOT_MACRO, GBR_SPOT_POLY, GBR_SPOT_RECT, APERTURE_MACRO::GetApertureMacroShape(), GetBoundingBox(), GetDcodeDescr(), GetLineLength(), D_CODE::GetMacro(), GetXYPosition(), HitTestPoints(), m_ArcCentre, m_End, m_Flashed, m_Polygon, D_CODE::m_Polygon, m_Shape, m_Size, m_Start, SHAPE_POLY_SET::Move(), NormalizeAngleRadiansPos(), and TestSegmentHit().

◆ HitTest() [2/2]

bool GERBER_DRAW_ITEM::HitTest ( const EDA_RECT aRefArea,
bool  aContained,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest (overloaded) tests if the given wxRect intersect this object.

For now, an ending point must be inside this rect.

Parameters
aRefAreaa wxPoint to test
Returns
bool - true if a hit, else false

Reimplemented from EDA_ITEM.

Definition at line 869 of file gerber_draw_item.cpp.

870 {
871  wxPoint pos = GetABPosition( m_Start );
872 
873  if( aRefArea.Contains( pos ) )
874  return true;
875 
876  pos = GetABPosition( m_End );
877 
878  if( aRefArea.Contains( pos ) )
879  return true;
880 
881  return false;
882 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.

References EDA_RECT::Contains(), GetABPosition(), m_End, and m_Start.

◆ IsBrightened()

bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

◆ IsDragging()

bool EDA_ITEM::IsDragging ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

221 { return m_Flags & IS_DRAGGED; }
#define IS_DRAGGED
Item being dragged.
Definition: base_struct.h:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References IS_DRAGGED, and EDA_ITEM::m_Flags.

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

◆ IsHighlighted()

bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 225 of file base_struct.h.

225 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References HIGHLIGHTED, and EDA_ITEM::m_Flags.

Referenced by SCH_COMPONENT::ClearAllHighlightFlags(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), KIGFX::SCH_PAINTER::getRenderColor(), and KIGFX::SCH_VIEW::HighlightItem().

◆ IsModified()

bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 219 of file base_struct.h.

219 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:116
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References IS_CHANGED, and EDA_ITEM::m_Flags.

Referenced by PCB_EDIT_FRAME::OpenProjectFiles().

◆ IsMoving()

◆ IsNew()

◆ IsReplaceable()

virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

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

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

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

Definition at line 515 of file base_struct.h.

515 { return false; }

Referenced by EDA_ITEM::Matches().

◆ IsResized()

bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

224 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:121

References IS_RESIZED, and EDA_ITEM::m_Flags.

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

◆ IsSelected()

◆ IsType()

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

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

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

Reimplemented in SCH_LABEL, SCH_FIELD, and SCH_LINE.

Definition at line 284 of file base_struct.h.

285  {
286  if( aScanTypes[0] == SCH_LOCATE_ANY_T )
287  return true;
288 
289  for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
290  {
291  if( m_StructType == *p )
292  return true;
293  }
294 
295  return false;
296  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it.
Definition: base_struct.h:172
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

References EOT, EDA_ITEM::m_StructType, and SCH_LOCATE_ANY_T.

Referenced by SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire(), SCH_LINE::IsType(), SCH_FIELD::IsType(), SCH_LABEL::IsType(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::RequestSelection(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EDA_ITEM::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ IsWireImage()

bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 222 of file base_struct.h.

222 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:124
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References IS_WIRE_IMAGE, and EDA_ITEM::m_Flags.

◆ IterateForward() [1/2]

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

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

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

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

Definition at line 397 of file base_struct.h.

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

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

Referenced by GERBER_FILE_IMAGE::Visit(), and BOARD::Visit().

◆ IterateForward() [2/2]

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

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

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

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

Definition at line 418 of file base_struct.h.

420  {
421  for( auto it : aList )
422  {
423  if( static_cast<EDA_ITEM*>( it )->Visit( inspector, testData, scanTypes )
425  return SEARCH_RESULT::QUIT;
426  }
427 
429  }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...

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

◆ Matches() [1/2]

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

Function Matches compares the item against the search criteria in aSearchData.

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

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

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, LIB_PIN, MARKER_PCB, SCH_PIN, SCH_MARKER, TEXTE_MODULE, and TEXTE_PCB.

Definition at line 471 of file base_struct.h.

472  {
473  return false;
474  }

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

◆ Matches() [2/2]

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

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 153 of file base_struct.cpp.

154 {
155  wxString text = aText;
156  wxString searchText = aSearchData.GetFindString();
157 
158  // Don't match if searching for replaceable item and the item doesn't support text replace.
159  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
160  return false;
161 
162  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
163  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
164 
165  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
166  {
167  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
168  return text.Matches( searchText );
169 
170  return text.MakeUpper().Matches( searchText.MakeUpper() );
171  }
172 
173  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
174  return aText.Find( searchText ) != wxNOT_FOUND;
175 
176  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
177 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:515

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

◆ MoveAB()

void GERBER_DRAW_ITEM::MoveAB ( const wxPoint aMoveVector)

Function MoveAB move this object.

Parameters
aMoveVector- the move vector for this object.

Definition at line 423 of file gerber_draw_item.cpp.

424 {
425  wxPoint xymove = GetXYPosition( aMoveVector );
426 
427  m_Start += xymove;
428  m_End += xymove;
429  m_ArcCentre += xymove;
430 
431  m_Polygon.Move( VECTOR2I( xymove ) );
432 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET m_Polygon
void Move(const VECTOR2I &aVector) override
wxPoint GetXYPosition(const wxPoint &aABPosition) const
Function GetXYPosition returns the image position of aPosition for this object.

References GetXYPosition(), m_ArcCentre, m_End, m_Polygon, m_Start, and SHAPE_POLY_SET::Move().

◆ MoveXY()

void GERBER_DRAW_ITEM::MoveXY ( const wxPoint aMoveVector)

Function MoveXY move this object.

Parameters
aMoveVector- the move vector for this object, in XY gerber axis.

Definition at line 435 of file gerber_draw_item.cpp.

436 {
437  m_Start += aMoveVector;
438  m_End += aMoveVector;
439  m_ArcCentre += aMoveVector;
440 
441  m_Polygon.Move( VECTOR2I( aMoveVector ) );
442 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
SHAPE_POLY_SET m_Polygon
void Move(const VECTOR2I &aVector) override

References m_ArcCentre, m_End, m_Polygon, m_Start, and SHAPE_POLY_SET::Move().

Referenced by GERBER_FILE_IMAGE::StepAndRepeatItem().

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

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

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

◆ Print()

void GERBER_DRAW_ITEM::Print ( wxDC *  aDC,
const wxPoint aOffset,
GBR_DISPLAY_OPTIONS aOptions 
)

Definition at line 454 of file gerber_draw_item.cpp.

455 {
456  // used when a D_CODE is not found. default D_CODE to draw a flashed item
457  static D_CODE dummyD_CODE( 0 );
458  bool isFilled;
459  int radius;
460  int halfPenWidth;
461  static bool show_err;
462  D_CODE* d_codeDescr = GetDcodeDescr();
463 
464  if( d_codeDescr == NULL )
465  d_codeDescr = &dummyD_CODE;
466 
468 
469  /* isDark is true if flash is positive and should use a drawing
470  * color other than the background color, else use the background color
471  * when drawing so that an erasure happens.
472  */
474 
475  if( !isDark )
476  {
477  // draw in background color ("negative" color)
478  color = aOptions->m_NegativeDrawColor;
479  }
480 
481  isFilled = aOptions->m_DisplayLinesFill;
482 
483  switch( m_Shape )
484  {
485  case GBR_POLYGON:
486  isFilled = aOptions->m_DisplayPolygonsFill;
487 
488  if( !isDark )
489  isFilled = true;
490 
491  PrintGerberPoly( aDC, color, aOffset, isFilled );
492  break;
493 
494  case GBR_CIRCLE:
495  radius = KiROUND( GetLineLength( m_Start, m_End ) );
496 
497  halfPenWidth = m_Size.x >> 1;
498 
499  if( !isFilled )
500  {
501  // draw the border of the pen's path using two circles, each as narrow as possible
502  GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius - halfPenWidth, 0, color );
503  GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius + halfPenWidth, 0, color );
504  }
505  else // Filled mode
506  {
507  GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius, m_Size.x, color );
508  }
509  break;
510 
511  case GBR_ARC:
512  // Currently, arcs plotted with a rectangular aperture are not supported.
513  // a round pen only is expected.
514  if( !isFilled )
515  {
516  GRArc1( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
518  }
519  else
520  {
521  GRArc1( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
523  }
524 
525  break;
526 
527  case GBR_SPOT_CIRCLE:
528  case GBR_SPOT_RECT:
529  case GBR_SPOT_OVAL:
530  case GBR_SPOT_POLY:
531  case GBR_SPOT_MACRO:
532  isFilled = aOptions->m_DisplayFlashedItemsFill;
533  d_codeDescr->DrawFlashedShape( this, nullptr, aDC, color, m_Start, isFilled );
534  break;
535 
536  case GBR_SEGMENT:
537  /* Plot a line from m_Start to m_End.
538  * Usually, a round pen is used, but some gerber files use a rectangular pen
539  * In fact, any aperture can be used to plot a line.
540  * currently: only a square pen is handled (I believe using a polygon gives a strange plot).
541  */
542  if( d_codeDescr->m_Shape == APT_RECT )
543  {
544  if( m_Polygon.OutlineCount() == 0 )
546 
547  PrintGerberPoly( aDC, color, aOffset, isFilled );
548  }
549  else
550  {
551  if( !isFilled )
552  {
553  GRCSegm( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
554  m_Size.x, color );
555  }
556  else
557  {
559  m_Size.x, color );
560  }
561  }
562 
563  break;
564 
565  default:
566  if( !show_err )
567  {
568  wxMessageBox( wxT( "Trace_Segment() type error" ) );
569  show_err = true;
570  }
571 
572  break;
573  }
574 }
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
int OutlineCount() const
Returns the number of outlines in the set
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:202
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
int color
Definition: DXF_plotter.cpp:61
COLOR4D GetPositiveDrawColor() const
void GRCSegm(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, int aPenSize, COLOR4D Color)
Definition: gr_basic.cpp:312
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:52
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
COLOR4D m_NegativeDrawColor
The color used to draw negative objects, usually the background color, but not always,...
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
#define NULL
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
void ConvertSegmentToPolygon()
Function ConvertSegmentToPolygon convert a line to an equivalent polygon.
void PrintGerberPoly(wxDC *aDC, COLOR4D aColor, const wxPoint &aOffset, bool aFilledShape)
Function PrintGerberPoly a helper function used to print the polygon stored in m_PolyCorners.
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void DrawFlashedShape(GERBER_DRAW_ITEM *aParent, EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, wxPoint aShapePos, bool aFilledShape)
Function DrawFlashedShape Draw the dcode shape for flashed items.
Definition: dcode.cpp:152
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:423
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:596
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:61
GERBER_FILE_IMAGE * m_GerberImageFile
void GRArc1(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int xc, int yc, COLOR4D Color)
Definition: gr_basic.cpp:640
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39

References APT_RECT, color, ConvertSegmentToPolygon(), D_CODE::DrawFlashedShape(), GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, GetABPosition(), GetDcodeDescr(), GetLineLength(), GERBER_FILE_IMAGE::GetPositiveDrawColor(), GRArc1(), GRCircle(), GRCSegm(), GRFilledSegment(), KiROUND(), m_ArcCentre, GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill, GBR_DISPLAY_OPTIONS::m_DisplayLinesFill, GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill, m_End, m_GerberImageFile, GERBER_FILE_IMAGE::m_ImageNegative, m_LayerNegative, GBR_DISPLAY_OPTIONS::m_NegativeDrawColor, m_Polygon, m_Shape, D_CODE::m_Shape, m_Size, m_Start, NULL, SHAPE_POLY_SET::OutlineCount(), and PrintGerberPoly().

◆ PrintGerberPoly()

void GERBER_DRAW_ITEM::PrintGerberPoly ( wxDC *  aDC,
COLOR4D  aColor,
const wxPoint aOffset,
bool  aFilledShape 
)

Function PrintGerberPoly a helper function used to print the polygon stored in m_PolyCorners.

Definition at line 641 of file gerber_draw_item.cpp.

643 {
644  std::vector<wxPoint> points;
645  SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 );
646  int pointCount = poly.PointCount() - 1;
647 
648  points.reserve( pointCount );
649 
650  for( int ii = 0; ii < pointCount; ii++ )
651  {
652  wxPoint p( poly.CPoint( ii ).x, poly.CPoint( ii ).y );
653  points[ii] = p + aOffset;
654  points[ii] = GetABPosition( points[ii] );
655  }
656 
657  GRClosedPoly( nullptr, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
658 }
int PointCount() const
Function PointCount()
SHAPE_POLY_SET m_Polygon
const VECTOR2I & CPoint(int aIndex) const
Function Point()
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
SHAPE_LINE_CHAIN.
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, const wxPoint *Points, bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:552

References SHAPE_LINE_CHAIN::CPoint(), GetABPosition(), GRClosedPoly(), m_Polygon, SHAPE_POLY_SET::Outline(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Print().

◆ Replace() [1/2]

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

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

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

Definition at line 180 of file base_struct.cpp.

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

References GetChars(), and traceFindReplace.

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

◆ Replace() [2/2]

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

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

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

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

Reimplemented in SCH_SHEET, SCH_TEXT, SCH_FIELD, and SCH_SHEET_PIN.

Definition at line 503 of file base_struct.h.

503 { return false; }

◆ SetBrightened()

void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 231 of file base_struct.h.

231 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:143

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), and SCH_EDITOR_CONTROL::UpdateNetHighlighting().

◆ SetFlags()

void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 255 of file base_struct.h.

255 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:184

References EDA_ITEM::m_Flags.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), PCB_BASE_FRAME::AddModuleToBoard(), PCBNEW_CONTROL::AppendBoard(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::ConvertTextType(), SCH_EDIT_FRAME::CreateNewText(), LIB_PIN_TOOL::CreatePin(), SCH_EDIT_FRAME::CreateSheetPin(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), KIGFX::SCH_PAINTER::draw(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), LIB_DRAWING_TOOLS::DrawShape(), SCH_EDIT_TOOL::Duplicate(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_MOVE_TOOL::getConnectedDragItems(), KIGFX::SCH_VIEW::HighlightItem(), EDIT_POINTS_FACTORY::Make(), TRACKS_CLEANER::mergeCollinearSegments(), SCH_MOVE_TOOL::moveItem(), LIB_MOVE_TOOL::moveItem(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), LIB_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_PIN_TOOL::RepeatPin(), LIB_EDIT_FRAME::SaveCopyInUndoList(), EE_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectPoint(), SCH_EDIT_FRAME::SelectUnit(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_LINE_WIRE_BUS_TOOL::startSegments(), WS_DATA_ITEM::SyncDrawItems(), WS_DATA_ITEM_TEXT::SyncDrawItems(), DIALOG_TARGET_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ SetForceVisible()

void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

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

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

Definition at line 306 of file base_struct.h.

306 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:181

References EDA_ITEM::m_forceVisible.

◆ SetHighlighted()

void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 230 of file base_struct.h.

230 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:255
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:142

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

◆ SetLayerParameters()

void GERBER_DRAW_ITEM::SetLayerParameters ( )

Function SetLayerParameters Initialize parameters from Image and Layer parameters found in the gerber file: m_UnitsMetric, m_MirrorA, m_MirrorB, m_DrawScale, m_DrawOffset.

Definition at line 208 of file gerber_draw_item.cpp.

209 {
211  m_swapAxis = m_GerberImageFile->m_SwapAxis; // false if A = X, B = Y;
212 
213  // true if A =Y, B = Y
214  m_mirrorA = m_GerberImageFile->m_MirrorA; // true: mirror / axe A
215  m_mirrorB = m_GerberImageFile->m_MirrorB; // true: mirror / axe B
216  m_drawScale = m_GerberImageFile->m_Scale; // A and B scaling factor
217  m_layerOffset = m_GerberImageFile->m_Offset; // Offset from OF command
218 
219  // Rotation from RO command:
222 }
GERBER_FILE_IMAGE * m_GerberImageFile
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
wxRealPoint m_drawScale

References GERBER_FILE_IMAGE::GetLayerParams(), m_drawScale, m_GerberImageFile, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_LAYER::m_LayerNegative, m_LayerNegative, m_layerOffset, GERBER_FILE_IMAGE::m_LocalRotation, m_lyrRotation, m_mirrorA, GERBER_FILE_IMAGE::m_MirrorA, m_mirrorB, GERBER_FILE_IMAGE::m_MirrorB, GERBER_FILE_IMAGE::m_Offset, GERBER_FILE_IMAGE::m_Scale, m_swapAxis, GERBER_FILE_IMAGE::m_SwapAxis, and m_UnitsMetric.

Referenced by GERBER_DRAW_ITEM().

◆ SetLayerPolarity()

void GERBER_DRAW_ITEM::SetLayerPolarity ( bool  aNegative)
inline

Definition at line 172 of file gerber_draw_item.h.

173  {
174  m_LayerNegative = aNegative;
175  }

References m_LayerNegative.

Referenced by fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), and fillLineGBRITEM().

◆ SetModified()

◆ SetNetAttributes()

void GERBER_DRAW_ITEM::SetNetAttributes ( const GBR_NETLIST_METADATA aNetAttributes)

Definition at line 65 of file gerber_draw_item.cpp.

66 {
67  m_netAttributes = aNetAttributes;
68 
71  m_GerberImageFile->m_ComponentsList.insert( std::make_pair( m_netAttributes.m_Cmpref, 0 ) );
72 
74  m_GerberImageFile->m_NetnamesList.insert( std::make_pair( m_netAttributes.m_Netname, 0 ) );
75 }
print info associated to a component (TO.C attribute)
wxString m_Cmpref
the component reference parent of the data
GBR_NETLIST_METADATA m_netAttributes
the string given by a TO attribute set in aperture (dcode).
wxString m_Netname
for items associated to a net: the netname
std::map< wxString, int > m_NetnamesList
print info associated to a flashed pad (TO.P attribute)
print info associated to a net (TO.N attribute)
GERBER_FILE_IMAGE * m_GerberImageFile
std::map< wxString, int > m_ComponentsList
int m_NetAttribType
the type of net info (used to define the gerber string to create)

References GBR_NETLIST_METADATA::GBR_NETINFO_CMP, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_PAD, GBR_NETLIST_METADATA::m_Cmpref, GERBER_FILE_IMAGE::m_ComponentsList, m_GerberImageFile, GBR_NETLIST_METADATA::m_NetAttribType, m_netAttributes, GBR_NETLIST_METADATA::m_Netname, and GERBER_FILE_IMAGE::m_NetnamesList.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), and fillLineGBRITEM().

◆ SetParent()

◆ SetPosition()

void GERBER_DRAW_ITEM::SetPosition ( const wxPoint aPos)
inline

Definition at line 198 of file gerber_draw_item.h.

198 { m_Start = aPos; }

References m_Start.

◆ SetSelected()

void EDA_ITEM::SetSelected ( )
inlineinherited

◆ SetState()

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

Definition at line 244 of file base_struct.h.

245  {
246  if( state )
247  m_Status |= type; // state = ON or OFF
248  else
249  m_Status &= ~type;
250  }
STATUS_FLAGS m_Status
Definition: base_struct.h:173

References EDA_ITEM::m_Status.

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

◆ SetStatus()

void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited

Definition at line 253 of file base_struct.h.

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

References EDA_ITEM::m_Status.

Referenced by BOARD_NETLIST_UPDATER::UpdateNetlist().

◆ SetTimeStamp()

void EDA_ITEM::SetTimeStamp ( timestamp_t  aNewTimeStamp)
inlineinherited

Definition at line 212 of file base_struct.h.

212 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:178

References EDA_ITEM::m_TimeStamp.

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), Diagnose(), SCH_EDIT_TOOL::Duplicate(), SCH_ITEM::Duplicate(), DIALOG_FOOTPRINT_BOARD_EDITOR::EditFootprint(), EDIT_TOOL::EditFpInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), SCH_EDIT_FRAME::LoadSheetFromFile(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), PCB_PARSER::parseDIMENSION(), SCH_EDITOR_CONTROL::Paste(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_TOOL::RepeatDrawItem(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), and TestMultiunitFootprints().

◆ SetWireImage()

void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 228 of file base_struct.h.

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

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

◆ Shape()

int GERBER_DRAW_ITEM::Shape ( ) const
inline

Definition at line 251 of file gerber_draw_item.h.

251 { return m_Shape; }

References m_Shape.

◆ ShowGBRShape()

wxString GERBER_DRAW_ITEM::ShowGBRShape ( ) const

Definition at line 225 of file gerber_draw_item.cpp.

226 {
227  switch( m_Shape )
228  {
229  case GBR_SEGMENT:
230  return _( "Line" );
231 
232  case GBR_ARC:
233  return _( "Arc" );
234 
235  case GBR_CIRCLE:
236  return _( "Circle" );
237 
238  case GBR_SPOT_OVAL:
239  return wxT( "spot_oval" );
240 
241  case GBR_SPOT_CIRCLE:
242  return wxT( "spot_circle" );
243 
244  case GBR_SPOT_RECT:
245  return wxT( "spot_rect" );
246 
247  case GBR_SPOT_POLY:
248  return wxT( "spot_poly" );
249 
250  case GBR_POLYGON:
251  return wxT( "polygon" );
252 
253  case GBR_SPOT_MACRO:
254  {
255  wxString name = wxT( "apt_macro" );
256  D_CODE* dcode = GetDcodeDescr();
257 
258  if( dcode && dcode->GetMacro() )
259  name << wxT(" ") << dcode->GetMacro()->name;
260 
261  return name;
262  }
263 
264  default:
265  return wxT( "??" );
266  }
267 }
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
wxString name
The name of the aperture macro.
Definition: am_primitive.h:165
D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
const char * name
Definition: DXF_plotter.cpp:60
#define _(s)
Definition: 3d_actions.cpp:31
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157

References _, GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, GetDcodeDescr(), D_CODE::GetMacro(), m_Shape, name, and APERTURE_MACRO::name.

Referenced by GetMsgPanelInfo(), and GetSelectMenuText().

◆ Sort()

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

Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

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

Definition at line 534 of file base_struct.h.

534 { return *aLeft < *aRight; }

◆ Type()

KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

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

Returns
KICAD_T - the type of object.

Definition at line 207 of file base_struct.h.

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

References EDA_ITEM::m_StructType.

Referenced by MODULE::Add(), CN_CONNECTIVITY_ALGO::Add(), BOARD::Add(), CN_CLUSTER::Add(), POINT_EDITOR::addCorner(), CONNECTION_SUBGRAPH::AddItem(), SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded(), ZONE_FILLER::addKnockout(), SCH_SHEET::AddPin(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), CN_ITEM::AnchorCount(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_SCREENS::buildScreenList(), calcArea(), calcMaxArea(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), POINT_EDITOR::canAddCorner(), SCH_JUNCTION::CanConnect(), SCH_NO_CONNECT::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), SCH_SHEET::CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), SCH_MARKER::ClassOf(), SCH_JUNCTION::ClassOf(), TEXTE_PCB::ClassOf(), SCH_NO_CONNECT::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), SCH_PIN::ClassOf(), EDGE_MODULE::ClassOf(), PCB_TARGET::ClassOf(), SCH_LINE::ClassOf(), SCH_FIELD::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), MARKER_PCB::ClassOf(), ZONE_CONTAINER::ClassOf(), TRACK::ClassOf(), SCH_BITMAP::ClassOf(), DIMENSION::ClassOf(), NETINFO_ITEM::ClassOf(), SCH_SHEET_PIN::ClassOf(), MODULE::ClassOf(), SCH_BUS_WIRE_ENTRY::ClassOf(), SCH_SCREEN::ClassOf(), D_PAD::ClassOf(), SCH_COMPONENT::ClassOf(), SCH_BUS_BUS_ENTRY::ClassOf(), BOARD::ClassOf(), SCH_TEXT::ClassOf(), SCH_SHEET::ClassOf(), VIA::ClassOf(), SCH_LABEL::ClassOf(), SCH_GLOBALLABEL::ClassOf(), SCH_HIERLABEL::ClassOf(), TRACKS_CLEANER::cleanupSegments(), LIB_RECTANGLE::compare(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_TEXT::compare(), LIB_POLYLINE::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), GRID_HELPER::computeAnchors(), SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo(), EE_RTREE::contains(), SCH_EDIT_FRAME::ConvertTextType(), MODULE::CoverageRatio(), CINFO3D_VISU::createLayers(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), NETLIST_EXPORTER::CreatePinList(), D_PAD::D_PAD(), SCH_SCREEN::DeleteItem(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDIT_TOOL::DoDelete(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeCentersVertically(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsHorizontally(), ALIGN_DISTRIBUTE_TOOL::doDistributeGapsVertically(), DRC::doTrackDrc(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), CN_ITEM::Dump(), SCH_ITEM::Duplicate(), BOARD::Duplicate(), MODULE::Duplicate(), SCH_EDIT_TOOL::EditField(), LIB_EDIT_TOOL::editTextProperties(), EditToolSelectionFilter(), CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts(), CONNECTION_GRAPH::ercCheckLabels(), NETLIST_EXPORTER::findNextComponent(), EDIT_TOOL::FootprintFilter(), SCH_LEGACY_PLUGIN::Format(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), CN_ITEM::GetAnchor(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_MOVE_TOOL::getConnectedDragItems(), SCH_TEXT::GetConnectionPoints(), CONNECTION_SUBGRAPH::GetDriverPriority(), SCH_TEXT::GetEndPoints(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), CONNECTION_SUBGRAPH::GetNameForDriver(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), KIGFX::SCH_PAINTER::getRenderColor(), PCBNEW_SELECTION::GetTopLeftItem(), SELECTION_TOOL::GuessSelectionCandidates(), EE_SELECTION_TOOL::GuessSelectionCandidates(), hash_eda(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), KIGFX::SCH_VIEW::HighlightItem(), SCH_EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EE_RTREE::insert(), EE_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), SCH_LINE::MergeOverlap(), SCH_EDIT_TOOL::Mirror(), SCH_MOVE_TOOL::moveItem(), SCH_CONNECTION::Name(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), POINT_EDITOR::OnSelectionChange(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), EDIT_TOOL::PadFilter(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::Paste(), SCH_EDITOR_CONTROL::Paste(), DRAWING_TOOL::PlaceImportedGraphics(), SCH_FIELD::Plot(), SCH_SCREEN::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_SCREEN::Print(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SELECTION_TOOL::RebuildSelection(), SCH_BASE_FRAME::RefreshItem(), SCH_BASE_FRAME::RefreshSelection(), EE_RTREE::remove(), MODULE::Remove(), CN_CONNECTIVITY_ALGO::Remove(), BOARD::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), SCH_SHEET::RemovePin(), SCH_EDIT_TOOL::RepeatDrawItem(), CONNECTION_SUBGRAPH::ResolveDrivers(), WS_PROXY_UNDO_ITEM::Restore(), SCH_EDIT_TOOL::Rotate(), SCH_TEXT::Rotate(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), EE_TOOL_BASE< SCH_BASE_FRAME >::saveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SELECTION_TOOL::select(), SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectConnectedTracks(), ITEM_PICKER::SetItem(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), ShowClearance(), BOARD_COMMIT::Stage(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), SCH_FIELD::SwapData(), TRACK::SwapData(), DIMENSION::SwapData(), VIA::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), MODULE::SwapData(), ZONE_CONTAINER::SwapData(), D_PAD::SwapData(), SwapItemData(), TEXTE_MODULE::TEXTE_MODULE(), AR_MATRIX::TraceSegmentPcb(), DIALOG_LABEL_EDITOR::TransferDataFromWindow(), DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataToWindow(), DIALOG_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_LABEL_EDITOR::TransferDataToWindow(), TRACK::TransformShapeWithClearanceToPolygon(), LIB_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), SCH_TEXT::UpdateDanglingState(), EE_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_BRIGHT_BOX::ViewDraw(), SCH_BUS_ENTRY_BASE::ViewGetLayers(), TRACK::Visit(), Visit(), SCH_SHEET::Visit(), SCH_COMPONENT::Visit(), and DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem().

◆ ViewBBox()

const BOX2I GERBER_DRAW_ITEM::ViewBBox ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 915 of file gerber_draw_item.cpp.

916 {
917  EDA_RECT bbox = GetBoundingBox();
918  return BOX2I( VECTOR2I( bbox.GetOrigin() ),
919  VECTOR2I( bbox.GetSize() ) );
920 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:521
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
const wxPoint GetOrigin() const
Definition: eda_rect.h:114
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
const wxSize GetSize() const
Definition: eda_rect.h:103

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

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

◆ ViewDraw()

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

Function ViewDraw() Draws the parts of the object belonging to layer aLayer.

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

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on

Reimplemented in EDIT_POINTS, KIGFX::WS_PROXY_VIEW_ITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, MY_DRAWING, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, KIGFX::VIEW_OVERLAY, KIGFX::ORIGIN_VIEWITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 116 of file view_item.h.

117  {}

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

◆ ViewGetLayers()

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

Reimplemented from EDA_ITEM.

Definition at line 906 of file gerber_draw_item.cpp.

907 {
908  aCount = 2;
909 
910  aLayers[0] = GERBER_DRAW_LAYER( GetLayer() );
911  aLayers[1] = GERBER_DCODE_LAYER( aLayers[0] );
912 }
int GetLayer() const
Function GetLayer returns the layer this item is on.
#define GERBER_DCODE_LAYER(x)
#define GERBER_DRAW_LAYER(x)

References GERBER_DCODE_LAYER, GERBER_DRAW_LAYER, and GetLayer().

◆ ViewGetLOD()

unsigned int GERBER_DRAW_ITEM::ViewGetLOD ( int  aLayer,
KIGFX::VIEW aView 
) const
overridevirtual

Reimplemented from KIGFX::VIEW_ITEM.

Definition at line 923 of file gerber_draw_item.cpp.

924 {
925  // DCodes will be shown only if zoom is appropriate:
926  // Returns the level of detail of the item.
927  // A level of detail (LOD) is the minimal VIEW scale that
928  // is sufficient for an item to be shown on a given layer.
929  if( IsDCodeLayer( aLayer ) )
930  {
931  int size = 0;
932 
933  switch( m_Shape )
934  {
935  case GBR_SPOT_MACRO:
937  break;
938 
939  case GBR_ARC:
940  size = GetLineLength( m_Start, m_ArcCentre );
941  break;
942 
943  default:
944  size = m_Size.x;
945  }
946 
947  // the level of details is chosen experimentally, to show
948  // only a readable text:
949  const int level = Millimeter2iu( 4 );
950  return ( level / ( size + 1 ) );
951  }
952 
953  // Other layers are shown without any conditions
954  return 0;
955 }
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
bool IsDCodeLayer(int aLayer)
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Function GetLineLength returns the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:202
int GetWidth() const
Definition: eda_rect.h:119
EDA_RECT GetBoundingBox() const
Returns the bounding box of the shape.
Definition: am_primitive.h:231
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157

References GBR_ARC, GBR_SPOT_MACRO, APERTURE_MACRO::GetBoundingBox(), GetDcodeDescr(), GetLineLength(), D_CODE::GetMacro(), EDA_RECT::GetWidth(), IsDCodeLayer(), m_ArcCentre, m_Shape, m_Size, and m_Start.

◆ viewPrivData()

◆ Visit()

SEARCH_RESULT GERBER_DRAW_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 958 of file gerber_draw_item.cpp.

959 {
960  KICAD_T stype = *scanTypes;
961 
962  // If caller wants to inspect my type
963  if( stype == Type() )
964  {
965  if( SEARCH_RESULT::QUIT == inspector( this, testData ) )
966  return SEARCH_RESULT::QUIT;
967  }
968 
970 }
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
KICAD_T Type() const
Function Type()
Definition: base_struct.h:207

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

Member Data Documentation

◆ m_AperFunction

wxString GERBER_DRAW_ITEM::m_AperFunction

Definition at line 93 of file gerber_draw_item.h.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), and GetMsgPanelInfo().

◆ m_ArcCentre

◆ m_DCode

◆ m_drawScale

wxRealPoint GERBER_DRAW_ITEM::m_drawScale
private

◆ m_End

◆ m_Flags

◆ m_Flashed

◆ m_forceVisible

bool EDA_ITEM::m_forceVisible
protectedinherited

Set to true to override the visibility setting of the item.

Definition at line 181 of file base_struct.h.

Referenced by EDA_ITEM::initVars(), EDA_ITEM::operator=(), SCH_FIELD::Print(), and EDA_ITEM::SetForceVisible().

◆ m_GerberImageFile

◆ m_LayerNegative

bool GERBER_DRAW_ITEM::m_LayerNegative
private

◆ m_layerOffset

wxPoint GERBER_DRAW_ITEM::m_layerOffset
private

Definition at line 114 of file gerber_draw_item.h.

Referenced by GetABPosition(), GetXYPosition(), and SetLayerParameters().

◆ m_lyrRotation

double GERBER_DRAW_ITEM::m_lyrRotation
private

◆ m_mirrorA

bool GERBER_DRAW_ITEM::m_mirrorA
private

◆ m_mirrorB

bool GERBER_DRAW_ITEM::m_mirrorB
private

◆ m_netAttributes

GBR_NETLIST_METADATA GERBER_DRAW_ITEM::m_netAttributes
private

the string given by a TO attribute set in aperture (dcode).

Stored in each item, because TO is a dynamic object attribute

Definition at line 116 of file gerber_draw_item.h.

Referenced by GetMsgPanelInfo(), GetNetAttributes(), and SetNetAttributes().

◆ m_Parent

◆ m_Polygon

◆ m_Shape

◆ m_Size

◆ m_Start

◆ m_swapAxis

bool GERBER_DRAW_ITEM::m_swapAxis
private

◆ m_TimeStamp

timestamp_t EDA_ITEM::m_TimeStamp
protectedinherited

◆ m_UnitsMetric

bool GERBER_DRAW_ITEM::m_UnitsMetric

Definition at line 76 of file gerber_draw_item.h.

Referenced by GERBER_DRAW_ITEM(), and SetLayerParameters().


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