KiCad PCB EDA Suite
GERBER_DRAW_ITEM Class Reference

#include <class_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 ()
 
GERBER_DRAW_ITEMNext () const
 
GERBER_DRAW_ITEMBack () const
 
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 wxPointGetPosition () 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 Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset, GBR_DISPLAY_OPTIONS *aDrawOptions)
 
void ConvertSegmentToPolygon ()
 Function ConvertSegmentToPolygon convert a line to an equivalent polygon. More...
 
void DrawGbrPoly (EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, const wxPoint &aOffset, bool aFilledShape)
 Function DrawGbrPoly a helper function used to draw the polygon stored in m_PolyCorners. More...
 
int Shape () const
 
void GetMsgPanelInfo (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) const override
 Function HitTest tests if the given wxPoint is within the bounds of this object. More...
 
bool HitTest (const EDA_RECT &aRefArea) const
 Function HitTest (overloaded) tests if the given wxRect intersect this object. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
void UnLink ()
 Function UnLink detaches this object from its owner. More...
 
void DeleteStructure ()
 Function DeleteStructure deletes this object after UnLink()ing it from its owner. 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 () const override
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () const
 
EDA_ITEMGetParent () const
 
DHEADGetList () const
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
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
 
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 BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
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...
 
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
 

Static Public Member Functions

static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. 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
 
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_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
time_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 Member Functions

void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 

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 class_gerber_draw_item.h.

Constructor & Destructor Documentation

GERBER_DRAW_ITEM::GERBER_DRAW_ITEM ( GERBER_FILE_IMAGE aGerberparams)

Definition at line 43 of file class_gerber_draw_item.cpp.

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

43  :
45 {
46  m_GerberImageFile = aGerberImageFile;
48  m_Flashed = false;
49  m_DCode = 0;
50  m_UnitsMetric = false;
51  m_LayerNegative = false;
52  m_swapAxis = false;
53  m_mirrorA = false;
54  m_mirrorB = false;
55  m_drawScale.x = m_drawScale.y = 1.0;
56  m_lyrRotation = 0;
57 
58  if( m_GerberImageFile )
60 }
void SetLayerParameters()
Function SetLayerParameters Initialize parameters from Image and Layer parameters found in the gerber...
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType)
Definition: base_struct.cpp:66
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
GERBER_FILE_IMAGE * m_GerberImageFile
GERBER_DRAW_ITEM::~GERBER_DRAW_ITEM ( )

Definition at line 63 of file class_gerber_draw_item.cpp.

64 {
65 }

Member Function Documentation

GERBER_DRAW_ITEM* GERBER_DRAW_ITEM::Back ( ) const
inline

Definition at line 122 of file class_gerber_draw_item.h.

References EDA_ITEM::Pback.

122 { return static_cast<GERBER_DRAW_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::disambiguationMenu().

247 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 268 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_EAGLE_PLUGIN::loadSheet(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

268 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 246 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

246 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearSelected ( )
inlineinherited
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 D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, SCH_LINE, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, TEXTE_PCB, LIB_TEXT, EDGE_MODULE, LIB_POLYLINE, LIB_RECTANGLE, LIB_CIRCLE, SCH_MARKER, PCB_TARGET, LIB_BEZIER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 125 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Duplicate(), CopyMarkedItems(), LIB_PART::CopySelectedItems(), BOARD::Duplicate(), DuplicateStruct(), SCH_SCREEN::ExtractWires(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::RepeatDrawItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), SCH_EDIT_FRAME::SetRepeatItem(), SCH_EDIT_FRAME::SetUndoItem(), LIB_PART::SetUnitCount(), and COMMIT::Stage().

126 {
127  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
128  wxT( ". Bad programmer!" ) );
129 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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 583 of file class_gerber_draw_item.cpp.

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

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

584 {
587 
588  wxPoint start = m_Start;
589  wxPoint end = m_End;
590 
591  // make calculations more easy if ensure start.x < end.x
592  // (only 2 quadrants to consider)
593  if( start.x > end.x )
594  std::swap( start, end );
595 
596  // calculate values relative to start point:
597  wxPoint delta = end - start;
598 
599  // calculate corners for the first quadrant only (delta.x and delta.y > 0 )
600  // currently, delta.x already is > 0.
601  // make delta.y > 0
602  bool change = delta.y < 0;
603 
604  if( change )
605  delta.y = -delta.y;
606 
607  // Now create the full polygon.
608  // Due to previous changes, the shape is always something like
609  // 3 4
610  // 2 5
611  // 1 6
612  wxPoint corner;
613  corner.x -= m_Size.x/2;
614  corner.y -= m_Size.y/2;
615  wxPoint close = corner;
616  m_Polygon.Append( VECTOR2I( corner ) ); // Lower left corner, start point (1)
617  corner.y += m_Size.y;
618  m_Polygon.Append( VECTOR2I( corner ) ); // upper left corner, start point (2)
619 
620  if( delta.x || delta.y)
621  {
622  corner += delta;
623  m_Polygon.Append( VECTOR2I( corner ) ); // upper left corner, end point (3)
624  }
625 
626  corner.x += m_Size.x;
627  m_Polygon.Append( VECTOR2I( corner ) ); // upper right corner, end point (4)
628  corner.y -= m_Size.y;
629  m_Polygon.Append( VECTOR2I( corner ) ); // lower right corner, end point (5)
630 
631  if( delta.x || delta.y )
632  {
633  corner -= delta;
634  m_Polygon.Append( VECTOR2I( corner ) ); // lower left corner, start point (6)
635  }
636 
637  m_Polygon.Append( VECTOR2I( close ) ); // close the shape
638 
639  // Create final polygon:
640  for( auto it = m_Polygon.Iterate( 0 ); it; ++it )
641  {
642  if( change )
643  ( *it ).y = -( *it ).y;
644 
645  *it += start;
646  }
647 }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
SHAPE_POLY_SET m_Polygon
static const int delta[8][2]
Definition: solve.cpp:112
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) ...
void GERBER_DRAW_ITEM::DeleteStructure ( )
inline

Function DeleteStructure deletes this object after UnLink()ing it from its owner.

Definition at line 304 of file class_gerber_draw_item.h.

References UnLink().

305  {
306  UnLink();
307  delete this;
308  }
void UnLink()
Function UnLink detaches this object from its owner.
void GERBER_DRAW_ITEM::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
GR_DRAWMODE  aDrawMode,
const wxPoint aOffset,
GBR_DISPLAY_OPTIONS aDrawOptions 
)

Definition at line 440 of file class_gerber_draw_item.cpp.

References APT_RECT, color, ConvertSegmentToPolygon(), D_CODE::DrawFlashedShape(), DrawGbrPoly(), GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, GetABPosition(), EDA_DRAW_PANEL::GetClipBox(), GetDcodeDescr(), GetLineLength(), GERBER_FILE_IMAGE::GetPositiveDrawColor(), GR_AND, GR_HIGHLIGHT, GRArc1(), GRCircle(), GRCSegm(), GRFilledSegment(), GRLine(), GRSetDrawMode(), 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, and SHAPE_POLY_SET::OutlineCount().

442 {
443  // used when a D_CODE is not found. default D_CODE to draw a flashed item
444  static D_CODE dummyD_CODE( 0 );
445  bool isFilled;
446  int radius;
447  int halfPenWidth;
448  static bool show_err;
449  D_CODE* d_codeDescr = GetDcodeDescr();
450 
451  if( d_codeDescr == NULL )
452  d_codeDescr = &dummyD_CODE;
453 
455 
456  if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
457  color.SetToLegacyHighlightColor();
458 
459  /* isDark is true if flash is positive and should use a drawing
460  * color other than the background color, else use the background color
461  * when drawing so that an erasure happens.
462  */
464 
465  if( !isDark )
466  {
467  // draw in background color ("negative" color)
468  color = aDrawOptions->m_NegativeDrawColor;
469  }
470 
471  GRSetDrawMode( aDC, aDrawMode );
472 
473  isFilled = aDrawOptions->m_DisplayLinesFill;
474 
475  switch( m_Shape )
476  {
477  case GBR_POLYGON:
478  isFilled = aDrawOptions->m_DisplayPolygonsFill;
479 
480  if( !isDark )
481  isFilled = true;
482 
483  DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
484  break;
485 
486  case GBR_CIRCLE:
487  radius = KiROUND( GetLineLength( m_Start, m_End ) );
488 
489  halfPenWidth = m_Size.x >> 1;
490 
491  if( !isFilled )
492  {
493  // draw the border of the pen's path using two circles, each as narrow as possible
494  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
495  radius - halfPenWidth, 0, color );
496  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
497  radius + halfPenWidth, 0, color );
498  }
499  else // Filled mode
500  {
501  GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
502  radius, m_Size.x, color );
503  }
504  break;
505 
506  case GBR_ARC:
507  // Currently, arcs plotted with a rectangular aperture are not supported.
508  // a round pen only is expected.
509 
510 #if 0 // for arc debug only
511  GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
513  GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_End ),
515 #endif
516 
517  if( !isFilled )
518  {
519  GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
521  0, color );
522  }
523  else
524  {
525  GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
527  m_Size.x, color );
528  }
529 
530  break;
531 
532  case GBR_SPOT_CIRCLE:
533  case GBR_SPOT_RECT:
534  case GBR_SPOT_OVAL:
535  case GBR_SPOT_POLY:
536  case GBR_SPOT_MACRO:
537  isFilled = aDrawOptions->m_DisplayFlashedItemsFill;
538  d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color,
539  m_Start, isFilled );
540  break;
541 
542  case GBR_SEGMENT:
543  /* Plot a line from m_Start to m_End.
544  * Usually, a round pen is used, but some gerber files use a rectangular pen
545  * In fact, any aperture can be used to plot a line.
546  * currently: only a square pen is handled (I believe using a polygon gives a strange plot).
547  */
548  if( d_codeDescr->m_Shape == APT_RECT )
549  {
550  if( m_Polygon.OutlineCount() == 0 )
552 
553  DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
554  }
555  else
556  {
557  if( !isFilled )
558  {
559  GRCSegm( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
560  GetABPosition( m_End ), m_Size.x, color );
561  }
562  else
563  {
564  GRFilledSegment( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
565  GetABPosition( m_End ), m_Size.x, color );
566  }
567  }
568 
569  break;
570 
571  default:
572  if( !show_err )
573  {
574  wxMessageBox( wxT( "Trace_Segment() type error" ) );
575  show_err = true;
576  }
577 
578  break;
579  }
580 }
COLOR4D GetPositiveDrawColor() const
void DrawGbrPoly(EDA_RECT *aClipBox, wxDC *aDC, COLOR4D aColor, const wxPoint &aOffset, bool aFilledShape)
Function DrawGbrPoly a helper function used to draw the polygon stored in m_PolyCorners.
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
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:191
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
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:488
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:52
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
COLOR4D m_NegativeDrawColor
The color used to draw negative objects, usually the background color, but not always, when negative objects must be visible.
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
EDA_RECT * GetClipBox()
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color, wxPenStyle aStyle)
Definition: gr_basic.cpp:358
void ConvertSegmentToPolygon()
Function ConvertSegmentToPolygon convert a line to an equivalent polygon.
Class 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:154
void GRFilledSegment(EDA_RECT *aClipBox, wxDC *aDC, wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor)
Definition: gr_basic.cpp:599
void GRCircle(EDA_RECT *ClipBox, wxDC *DC, int xc, int yc, int r, int width, COLOR4D Color)
Definition: gr_basic.cpp:828
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
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:872
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void GERBER_DRAW_ITEM::DrawGbrPoly ( EDA_RECT aClipBox,
wxDC *  aDC,
COLOR4D  aColor,
const wxPoint aOffset,
bool  aFilledShape 
)

Function DrawGbrPoly a helper function used to draw the polygon stored in m_PolyCorners.

Definition at line 650 of file class_gerber_draw_item.cpp.

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

Referenced by Draw().

655 {
656  std::vector<wxPoint> points;
657  SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 );
658  int pointCount = poly.PointCount() - 1;
659 
660  points.reserve( pointCount );
661 
662  for( int ii = 0; ii < pointCount; ii++ )
663  {
664  wxPoint p( poly.Point( ii ).x, poly.Point( ii ).y );
665  points[ii] = p + aOffset;
666  points[ii] = GetABPosition( points[ii] );
667  }
668 
669  GRClosedPoly( aClipBox, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
670 }
int PointCount() const
Function PointCount()
SHAPE_POLY_SET m_Polygon
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, 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:784
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Class SHAPE_LINE_CHAIN.
VECTOR2I & Point(int aIndex)
Function Point()
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
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 154 of file class_gerber_draw_item.cpp.

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(), Draw(), AM_PRIMITIVE::DrawBasicShape(), D_CODE::DrawFlashedPolygon(), D_CODE::DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), DrawGbrPoly(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GetABPosition(), APERTURE_MACRO::GetApertureMacroShape(), GetBoundingBox(), GetTextD_CodePrms(), and HitTest().

155 {
156  /* Note: RS274Xrevd_e is obscure about the order of transforms:
157  * For instance: Rotation must be made after or before mirroring ?
158  * Note: if something is changed here, GetYXPosition must reflect changes
159  */
160  wxPoint abPos = aXYPosition + m_GerberImageFile->m_ImageJustifyOffset;
161 
162  if( m_swapAxis )
163  std::swap( abPos.x, abPos.y );
164 
166  abPos.x = KiROUND( abPos.x * m_drawScale.x );
167  abPos.y = KiROUND( abPos.y * m_drawScale.y );
168  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
169 
170  if( rotation )
171  RotatePoint( &abPos, -rotation );
172 
173  // Negate A axis if mirrored
174  if( m_mirrorA )
175  abPos.x = -abPos.x;
176 
177  // abPos.y must be negated when no mirror, because draw axis is top to bottom
178  if( !m_mirrorB )
179  abPos.y = -abPos.y;
180  return abPos;
181 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
GERBER_FILE_IMAGE * m_GerberImageFile
VECTOR2I GERBER_DRAW_ITEM::GetABPosition ( const VECTOR2I aXYPosition) const
inline

Definition at line 210 of file class_gerber_draw_item.h.

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

211  {
212  return VECTOR2I( GetABPosition( wxPoint( aXYPosition.x, aXYPosition.y ) ) );
213  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
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 285 of file class_gerber_draw_item.cpp.

References APT_RECT, 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(), 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, max, min, EDA_RECT::Move(), EDA_RECT::Normalize(), SHAPE_POLY_SET::OutlineCount(), EDA_RECT::SetEnd(), EDA_RECT::SetOrigin(), wxPoint::x, and wxPoint::y.

Referenced by HitTest(), and ViewBBox().

286 {
287  // return a rectangle which is (pos,dim) in nature. therefore the +1
288  EDA_RECT bbox( m_Start, wxSize( 1, 1 ) );
289  D_CODE* code = GetDcodeDescr();
290 
291  // TODO(JE) GERBER_DRAW_ITEM maybe should actually be a number of subclasses.
292  // Until/unless that is changed, we need to do different things depending on
293  // what is actually being represented by this GERBER_DRAW_ITEM.
294 
295  switch( m_Shape )
296  {
297  case GBR_POLYGON:
298  {
299  auto bb = m_Polygon.BBox();
300  bbox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 );
301  bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
302  break;
303  }
304 
305  case GBR_CIRCLE:
306  {
307  double radius = GetLineLength( m_Start, m_End );
308  bbox.Inflate( radius, radius );
309  break;
310  }
311 
312  case GBR_ARC:
313  {
314  // Note: using a larger-than-necessary BB to simplify computation
315  double radius = GetLineLength( m_Start, m_ArcCentre );
316  bbox.Move( m_ArcCentre - m_Start );
317  bbox.Inflate( radius + m_Size.x, radius + m_Size.x );
318  break;
319  }
320 
321  case GBR_SPOT_CIRCLE:
322  {
323  int radius = code->m_Size.x >> 1;
324  bbox.Inflate( radius, radius );
325  break;
326  }
327 
328  case GBR_SPOT_RECT:
329  {
330  bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
331  break;
332  }
333 
334  case GBR_SPOT_OVAL:
335  {
336  bbox.Inflate( code->m_Size.x, code->m_Size.y );
337  break;
338  }
339 
340  case GBR_SPOT_POLY:
341  {
342  if( code->m_Polygon.OutlineCount() == 0 )
343  code->ConvertShapeToPolygon();
344 
345  bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2, code->m_Polygon.BBox().GetHeight() / 2 );
346  break;
347  }
348  case GBR_SPOT_MACRO:
349  {
350  // Update the shape drawings and the bounding box coordiantes:
351  code->GetMacro()->GetApertureMacroShape( this, m_Start );
352  // now the bounding box is valid:
353  bbox = code->GetMacro()->GetBoundingBox();
354  break;
355  }
356 
357  case GBR_SEGMENT:
358  {
359  if( code && code->m_Shape == APT_RECT )
360  {
361  if( m_Polygon.OutlineCount() > 0 )
362  {
363  auto bb = m_Polygon.BBox();
364  bbox.Inflate( bb.GetWidth() / 2, bb.GetHeight() / 2 );
365  bbox.SetOrigin( bb.GetOrigin().x, bb.GetOrigin().y );
366  }
367  }
368  else
369  {
370  int radius = ( m_Size.x + 1 ) / 2;
371 
372  int ymax = std::max( m_Start.y, m_End.y ) + radius;
373  int xmax = std::max( m_Start.x, m_End.x ) + radius;
374 
375  int ymin = std::min( m_Start.y, m_End.y ) - radius;
376  int xmin = std::min( m_Start.x, m_End.x ) - radius;
377 
378  bbox = EDA_RECT( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
379  }
380 
381  break;
382  }
383  default:
384  wxASSERT_MSG( false, wxT( "GERBER_DRAW_ITEM shape is unknown!" ) );
385  break;
386  }
387 
388  // calculate the corners coordinates in current gerber axis orientations
389  wxPoint org = GetABPosition( bbox.GetOrigin() );
390  wxPoint end = GetABPosition( bbox.GetEnd() );
391 
392  // Set the corners position:
393  bbox.SetOrigin( org );
394  bbox.SetEnd( end );
395  bbox.Normalize();
396 
397  return bbox;
398 }
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:191
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:52
coord_type GetWidth() const
Definition: box2.h:185
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
coord_type GetHeight() const
Definition: box2.h:186
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:266
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define max(a, b)
Definition: auxiliary.h:86
EDA_RECT GetBoundingBox() const
Returns the bounding box of the shape.
void SetOrigin(const Vec &pos)
Definition: box2.h:198
Class EDA_RECT handles the component boundary box.
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
void ConvertShapeToPolygon()
Function ConvertShapeToPolygon convert a shape to an equivalent polygon.
Definition: dcode.cpp:303
wxPoint GetABPosition(const wxPoint &aXYPosition) const
Function GetABPosition returns the image position of aPosition for this object.
const BOX2I BBox(int aClearance=0) const override
Function BBox()
#define min(a, b)
Definition: auxiliary.h:85
wxString GERBER_DRAW_ITEM::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 282 of file class_gerber_draw_item.h.

283  {
284  return wxT( "GERBER_DRAW_ITEM" );
285  }
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 273 of file class_gerber_draw_item.cpp.

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

Referenced by AM_PRIMITIVE::ConvertShapeToPolygon(), KIGFX::GERBVIEW_PAINTER::draw(), 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(), GERBVIEW_FRAME::OnRightClick(), GERBVIEW_FRAME::Process_Special_Functions(), ShowGBRShape(), and ViewGetLOD().

274 {
275  if( (m_DCode < FIRST_DCODE) || (m_DCode > LAST_DCODE) )
276  return NULL;
277 
278  if( m_GerberImageFile == NULL )
279  return NULL;
280 
282 }
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 FIRST_DCODE
Definition: dcode.h:71
GERBER_FILE_IMAGE * m_GerberImageFile
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 269 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow().

269 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
int GERBER_DRAW_ITEM::GetLayer ( ) const

Function GetLayer returns the layer this item is on.

Definition at line 81 of file class_gerber_draw_item.cpp.

References m_GerberImageFile, and GERBER_FILE_IMAGE::m_GraphicLayer.

Referenced by GetMsgPanelInfo(), GetSelectMenuText(), and ViewGetLayers().

82 {
83  // returns the layer this item is on, or 0 if the m_GerberImageFile is NULL.
85 }
GERBER_FILE_IMAGE * m_GerberImageFile
bool GERBER_DRAW_ITEM::GetLayerPolarity ( ) const
inline

Definition at line 133 of file class_gerber_draw_item.h.

References m_LayerNegative.

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

134  {
135  return m_LayerNegative;
136  }
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References EDA_ITEM::m_List.

Referenced by BOARD::CreateLockPoint(), BOARD_ITEM::DeleteStructure(), DHEAD::insert(), BOARD::MarkTrace(), DHEAD::remove(), SwapItemData(), BOARD_ITEM::UnLink(), and UnLink().

223 { return m_List; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:180
BITMAP_DEF EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Function GetMenuImage returns a pointer to an image to be used in menus.

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

Returns
The menu image associated with the item.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_SHEET_PIN, SCH_TEXT, SCH_FIELD, LIB_ARC, SCH_LINE, TEXTE_PCB, LIB_TEXT, SCH_BITMAP, EDGE_MODULE, LIB_POLYLINE, MARKER_PCB, SCH_BUS_ENTRY_BASE, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 282 of file base_struct.cpp.

References dummy_xpm.

Referenced by FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

283 {
284  return dummy_xpm;
285 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56
void GERBER_DRAW_ITEM::GetMsgPanelInfo ( 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 673 of file class_gerber_draw_item.cpp.

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, GetChars(), GetDcodeDescr(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), GERBER_FILE_IMAGE_LIST::GetImagesList(), GetLayer(), 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, m_swapAxis, RED, and ShowGBRShape().

Referenced by GERBVIEW_FRAME::Locate(), and GERBVIEW_FRAME::SetCurItem().

674 {
675  wxString msg;
676  wxString text;
677 
678  msg = ShowGBRShape();
679  aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
680 
681  // Display D_Code value with its attributes:
682  msg.Printf( _( "D Code %d" ), m_DCode );
683  D_CODE* apertDescr = GetDcodeDescr();
684 
685  if( !apertDescr || apertDescr->m_AperFunction.IsEmpty() )
686  text = _( "No attribute" );
687  else
688  text = apertDescr->m_AperFunction;
689 
690  aList.push_back( MSG_PANEL_ITEM( msg, text, RED ) );
691 
692  // Display graphic layer name
694  aList.push_back( MSG_PANEL_ITEM( _( "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.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BLUE ) );
702 
703  // Display item polarity (item specific)
704  msg = m_LayerNegative ? _("Clear") : _("Dark");
705  aList.push_back( MSG_PANEL_ITEM( _( "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.push_back( MSG_PANEL_ITEM( _( "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.push_back( MSG_PANEL_ITEM( _( "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 name>";
732  else
733  net_msg << m_netAttributes.m_Netname;
734  }
735 
737  {
738  cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
741  }
742 
744  {
745  cmp_pad_msg = _( "Cmp:" );
746  cmp_pad_msg << " " << m_netAttributes.m_Cmpref;
747  }
748 
749  aList.push_back( MSG_PANEL_ITEM( net_msg, cmp_pad_msg, DARKCYAN ) );
750 }
Definition: colors.h:57
print info associated to a component (TO.C attribute)
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
wxString m_Cmpref
the component reference parent of the data
Definition: colors.h:54
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
int GetLayer() const
Function GetLayer returns the layer this item is on.
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
wxString ShowGBRShape() const
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
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:92
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
print info associated to a flashed pad (TO.P attribute)
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
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)
const GBR_NETLIST_METADATA& GERBER_DRAW_ITEM::GetNetAttributes ( ) const
inline

Definition at line 125 of file class_gerber_draw_item.h.

References m_netAttributes.

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

125 { return m_netAttributes; }
GBR_NETLIST_METADATA m_netAttributes
the string given by a TO attribute set in aperture (dcode).
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 class_gerber_draw_item.h.

References m_Start.

197 { return m_Start; }
wxString GERBER_DRAW_ITEM::GetSelectMenuText ( ) const
overridevirtual

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 900 of file class_gerber_draw_item.cpp.

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

901 {
902  wxString text, layerName;
903 
905 
906  text.Printf( _( "%s (D%d) on layer %d: %s" ), ShowGBRShape(), m_DCode,
907  GetLayer() + 1, layerName );
908 
909  return text;
910 }
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
int GetLayer() const
Function GetLayer returns the layer this item is on.
wxString ShowGBRShape() const
static GERBER_FILE_IMAGE_LIST & GetImagesList()
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 264 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

264 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:175
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 88 of file class_gerber_draw_item.cpp.

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

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

89 {
90  // calculate the best size and orientation of the D_Code text
91 
92  if( m_DCode <= 0 )
93  return false; // No D_Code for this item
94 
95  if( m_Flashed || m_Shape == GBR_ARC )
96  {
97  aPos = m_Start;
98  }
99  else // it is a line:
100  {
101  aPos = ( m_Start + m_End) / 2;
102  }
103 
104  aPos = GetABPosition( aPos );
105 
106  int size; // the best size for the text
107 
108  if( GetDcodeDescr() )
109  size = GetDcodeDescr()->GetShapeDim( this );
110  else
111  size = std::min( m_Size.x, m_Size.y );
112 
113  aOrientation = TEXT_ANGLE_HORIZ;
114 
115  if( m_Flashed )
116  {
117  // A reasonable size for text is min_dim/3 because most of time this text has 3 chars.
118  aSize = size / 3;
119  }
120  else // this item is a line
121  {
123 
124  aOrientation = RAD2DECIDEG( atan2( (double)delta.y, (double)delta.x ) );
125  NORMALIZE_ANGLE_90( aOrientation );
126 
127  // A reasonable size for text is size/2 because text needs margin below and above it.
128  // a margin = size/4 seems good, expecting the line len is large enough to show 3 chars,
129  // that is the case most of time.
130  aSize = size / 2;
131  }
132 
133  return true;
134 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:90
double RAD2DECIDEG(double rad)
Definition: trigo.h:204
void NORMALIZE_ANGLE_90(T &Angle)
Definition: trigo.h:299
static const int delta[8][2]
Definition: solve.cpp:112
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
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:123
#define min(a, b)
Definition: auxiliary.h:85
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 137 of file class_gerber_draw_item.cpp.

References DECIDEG2RAD(), and GetTextD_CodePrms().

138 {
139  // aOrientation is returned in radians
140  int size;
141  wxPoint pos;
142 
143  if( ! GetTextD_CodePrms( size, pos, aOrientation ) )
144  return false;
145 
146  aPos = pos;
147  aSize = (double) size;
148  aOrientation = DECIDEG2RAD( aOrientation );
149 
150  return true;
151 }
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:203
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 184 of file class_gerber_draw_item.cpp.

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

185 {
186  // do the inverse transform made by GetABPosition
187  wxPoint xyPos = aABPosition;
188 
189  if( m_mirrorA )
190  xyPos.x = -xyPos.x;
191 
192  if( !m_mirrorB )
193  xyPos.y = -xyPos.y;
194 
195  double rotation = m_lyrRotation * 10 + m_GerberImageFile->m_ImageRotation * 10;
196 
197  if( rotation )
198  RotatePoint( &xyPos, rotation );
199 
200  xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
201  xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
203 
204  if( m_swapAxis )
205  std::swap( xyPos.x, xyPos.y );
206 
207  return xyPos - m_GerberImageFile->m_ImageJustifyOffset;
208 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
GERBER_FILE_IMAGE * m_GerberImageFile
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 431 of file class_gerber_draw_item.cpp.

References m_GerberImageFile, GERBER_FILE_IMAGE::m_ImageNegative, and m_LayerNegative.

432 {
434 
435  // if isClear is true, this item has negative shape
436  return isClear;
437 }
GERBER_FILE_IMAGE * m_GerberImageFile
bool GERBER_DRAW_ITEM::HitTest ( const wxPoint aRefPos) 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 753 of file class_gerber_draw_item.cpp.

References EDA_RECT::Contains(), SHAPE_POLY_SET::Contains(), GBR_ARC, GBR_POLYGON, GBR_SPOT_MACRO, GBR_SPOT_POLY, GBR_SPOT_RECT, APERTURE_MACRO::GetApertureMacroShape(), GetBoundingBox(), GetDcodeDescr(), D_CODE::GetMacro(), GetXYPosition(), HitTestPoints(), m_End, m_Flashed, m_Polygon, D_CODE::m_Polygon, m_Shape, m_Size, m_Start, min, SHAPE_POLY_SET::Move(), and TestSegmentHit().

Referenced by GERBVIEW_FRAME::Block_Move().

754 {
755  // calculate aRefPos in XY gerber axis:
756  wxPoint ref_pos = GetXYPosition( aRefPos );
757 
758  SHAPE_POLY_SET poly;
759 
760  switch( m_Shape )
761  {
762  case GBR_POLYGON:
763  poly = m_Polygon;
764  return poly.Contains( VECTOR2I( ref_pos ), 0 );
765 
766  case GBR_SPOT_POLY:
767  poly = GetDcodeDescr()->m_Polygon;
768  poly.Move( m_Start );
769  return poly.Contains( VECTOR2I( ref_pos ), 0 );
770 
771  case GBR_SPOT_RECT:
772  case GBR_ARC:
773  return GetBoundingBox().Contains( aRefPos );
774 
775  case GBR_SPOT_MACRO:
776  // Aperture macro polygons are already in absolute coordinates
777  auto p = GetDcodeDescr()->GetMacro()->GetApertureMacroShape( this, m_Start );
778  for( int i = 0; i < p->OutlineCount(); ++i )
779  {
780  if( p->Contains( VECTOR2I( aRefPos ), i ) )
781  return true;
782  }
783  return false;
784  }
785 
786  // TODO: a better analyze of the shape (perhaps create a D_CODE::HitTest for flashed items)
787  int radius = std::min( m_Size.x, m_Size.y ) >> 1;
788 
789  if( m_Flashed )
790  return HitTestPoints( m_Start, ref_pos, radius );
791  else
792  return TestSegmentHit( ref_pos, m_Start, m_End, radius );
793 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
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:589
SHAPE_POLY_SET m_Polygon
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
SHAPE_POLY_SET * GetApertureMacroShape(const GERBER_DRAW_ITEM *aParent, wxPoint aShapePos)
Function GetApertureMacroShape Calculate the primitive shape for flashed items.
void Move(const VECTOR2I &aVector) override
Class SHAPE_POLY_SET.
bool HitTestPoints(const wxPoint &pointA, const wxPoint &pointB, double threshold)
Test, if two points are near each other.
Definition: trigo.h:150
SHAPE_POLY_SET m_Polygon
Definition: dcode.h:107
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
bool TestSegmentHit(const wxPoint &aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist)
Function TestSegmentHit test for hit on line segment i.e.
Definition: trigo.cpp:142
wxPoint GetXYPosition(const wxPoint &aABPosition) const
Function GetXYPosition returns the image position of aPosition for this object.
bool Contains(const VECTOR2I &aP, int aSubpolyIndex=-1) const
Returns true if a given subpolygon contains the point aP.
#define min(a, b)
Definition: auxiliary.h:85
bool GERBER_DRAW_ITEM::HitTest ( const EDA_RECT aRefArea) const

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

Definition at line 796 of file class_gerber_draw_item.cpp.

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

797 {
798  wxPoint pos = GetABPosition( m_Start );
799 
800  if( aRefArea.Contains( pos ) )
801  return true;
802 
803  pos = GetABPosition( m_End );
804 
805  if( aRefArea.Contains( pos ) )
806  return true;
807 
808  return false;
809 }
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.
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

238 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

References HIGHLIGHTED.

237 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

231 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 230 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

230 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 458 of file base_struct.h.

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

458 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 236 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

236 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:128
bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

References SELECTED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForPin(), KIGFX::PCB_PAINTER::draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), DrawMovingBlockOutlines(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), LIB_EDIT_FRAME::GlobalSetPins(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), MirrorMarkedItems(), MoveMarkedItems(), MoveMarkedItemsExactly(), LIB_TEXT::Plot(), RotateMarkedItems(), SELECTION_TOOL::SanitizeSelection(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::select(), SCH_SCREEN::SelectBlockItems(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), GERBVIEW_SELECTION_TOOL::unselect(), and SELECTION_TOOL::unselect().

235 { return m_Flags & SELECTED; }
#define SELECTED
Definition: base_struct.h:134
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by abortMoveItem(), and SCH_FIELD::Draw().

234 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 132 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
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...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint aFindLocation 
)
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.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 414 of file base_struct.h.

Referenced by SCH_FIND_COLLECTOR::Inspect(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), and SCH_SHEET::Matches().

415  {
416  return false;
417  }
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 184 of file base_struct.cpp.

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

185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
void GERBER_DRAW_ITEM::MoveAB ( const wxPoint aMoveVector)

Function MoveAB move this object.

Parameters
aMoveVector- the move vector for this object.

Definition at line 401 of file class_gerber_draw_item.cpp.

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

Referenced by GERBVIEW_FRAME::Block_Move().

402 {
403  wxPoint xymove = GetXYPosition( aMoveVector );
404 
405  m_Start += xymove;
406  m_End += xymove;
407  m_ArcCentre += xymove;
408 
409  if( m_Polygon.OutlineCount() > 0 )
410  {
411  for( auto it = m_Polygon.Iterate( 0 ); it; ++it )
412  *it += xymove;
413  }
414 }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET m_Polygon
wxPoint GetXYPosition(const wxPoint &aABPosition) const
Function GetXYPosition returns the image position of aPosition for this object.
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 417 of file class_gerber_draw_item.cpp.

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

Referenced by GERBER_FILE_IMAGE::StepAndRepeatItem().

418 {
419  m_Start += aMoveVector;
420  m_End += aMoveVector;
421  m_ArcCentre += aMoveVector;
422 
423  if( m_Polygon.OutlineCount() > 0 )
424  {
425  for( auto it = m_Polygon.Iterate( 0 ); it; ++it )
426  *it += aMoveVector;
427  }
428 }
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
int OutlineCount() const
Returns the number of outlines in the set
SHAPE_POLY_SET m_Polygon
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 241 of file base_struct.cpp.

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

242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
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:92
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
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

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

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

Referenced by SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

212 {
213  wxCHECK_MSG( IsReplaceable(), false,
214  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
215 
216  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
217 
218  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
219  aSearchData.GetFindString() :
220  aSearchData.GetFindString().Upper() );
221 
222  if( result == wxNOT_FOUND )
223  return false;
224 
225  wxString prefix = aText.Left( result );
226  wxString suffix;
227 
228  if( aSearchData.GetFindString().length() + result < aText.length() )
229  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
230 
231  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
232  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
233  GetChars( suffix ) );
234 
235  aText = prefix + aSearchData.GetReplaceString() + suffix;
236 
237  return true;
238 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
const wxString traceFindReplace
Flag to enable find and replace debug tracing.
Definition: base_struct.cpp:58
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:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
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_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 446 of file base_struct.h.

446 { return false; }
void GERBER_DRAW_ITEM::SetBack ( EDA_ITEM aBack)
inlineprivate

Definition at line 74 of file class_gerber_draw_item.h.

References EDA_ITEM::Pback.

74 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 243 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::disambiguationMenu().

243 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 267 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::EditDimension(), LIB_PIN::EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

267 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
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 279 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

279 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 242 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

242 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
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 211 of file class_gerber_draw_item.cpp.

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

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

Definition at line 172 of file class_gerber_draw_item.h.

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

173  {
174  m_LayerNegative = aNegative;
175  }
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

228 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:180
void EDA_ITEM::SetModified ( )
inherited
void GERBER_DRAW_ITEM::SetNetAttributes ( const GBR_NETLIST_METADATA aNetAttributes)

Definition at line 68 of file class_gerber_draw_item.cpp.

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 fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), and fillLineGBRITEM().

69 {
70  m_netAttributes = aNetAttributes;
71 
74  m_GerberImageFile->m_ComponentsList.insert( std::make_pair( m_netAttributes.m_Cmpref, 0 ) );
75 
77  m_GerberImageFile->m_NetnamesList.insert( std::make_pair( m_netAttributes.m_Netname, 0 ) );
78 }
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)
void GERBER_DRAW_ITEM::SetNext ( EDA_ITEM aNext)
inlineprivate

Definition at line 73 of file class_gerber_draw_item.h.

References EDA_ITEM::Pnext.

73 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 227 of file base_struct.h.

Referenced by MODULE::Add(), BOARD::Add(), BOARD_NETLIST_UPDATER::addNewComponent(), LIB_FIELD::Copy(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateSheet(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), SCH_COMPONENT::operator=(), PCB_PARSER::parseMODULE_unchecked(), PCBNEW_CONTROL::PasteItemsFromClipboard(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), SCH_COMPONENT::SCH_COMPONENT(), SCH_SHEET::SCH_SHEET(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), SetSchItemParent(), PCB_EDIT_FRAME::StartMoveModule(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), and SwapItemData().

227 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
void GERBER_DRAW_ITEM::SetPosition ( const wxPoint aPos)
inline

Definition at line 198 of file class_gerber_draw_item.h.

198 { m_Start = aPos; }
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 241 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::selectVisually(), and SELECTION_TOOL::selectVisually().

241 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
void EDA_ITEM::SetTimeStamp ( time_t  aNewTimeStamp)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), DuplicateStruct(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), PCB_BASE_FRAME::LoadModuleFromLibrary(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), SCH_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), and TestDuplicateSheetNames().

217 { m_TimeStamp = aNewTimeStamp; }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 240 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

240 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
int GERBER_DRAW_ITEM::Shape ( ) const
inline

Definition at line 254 of file class_gerber_draw_item.h.

References m_Shape.

254 { return m_Shape; }
wxString GERBER_DRAW_ITEM::ShowGBRShape ( ) const

Definition at line 228 of file class_gerber_draw_item.cpp.

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

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

Referenced by PART_LIB::GetEntryTypePowerNames().

477 { return *aLeft < *aRight; }
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 212 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CLUSTER::Add(), BOARD::Add(), CN_CONNECTIVITY_ALGO::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), HIERARCHY_NAVIG_DLG::BuildTree(), calcArea(), calcMaxArea(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), Collect_TrackSegmentsToDrag(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), LIB_EDIT_FRAME::CreateGraphicItem(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteItemsInList(), DeleteNullTrackSegments(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), POINT_EDITOR::finishItem(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), getAnchorPoint(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsDraggableJunction(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), CN_CONNECTIVITY_ALGO::searchConnections(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_NO_CONNECT::SwapData(), SCH_JUNCTION::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), VIA::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), ZONE_CONTAINER::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and SCH_COMPONENT::Visit().

213  {
214  return m_StructType;
215  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:174
void GERBER_DRAW_ITEM::UnLink ( )
inline

Function UnLink detaches this object from its owner.

Definition at line 291 of file class_gerber_draw_item.h.

References EDA_ITEM::GetList().

Referenced by DeleteStructure().

292  {
294  wxASSERT( list );
295 
296  if( list )
297  list->Remove( this );
298  }
DHEAD * GetList() const
Definition: base_struct.h:223
const BOX2I GERBER_DRAW_ITEM::ViewBBox ( ) const
overridevirtual

Reimplemented from EDA_ITEM.

Definition at line 842 of file class_gerber_draw_item.cpp.

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

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

843 {
844  EDA_RECT bbox = GetBoundingBox();
845  return BOX2I( VECTOR2I( bbox.GetOrigin() ),
846  VECTOR2I( bbox.GetSize() ) );
847 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
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:589
const wxPoint & GetOrigin() const
Class EDA_RECT handles the component boundary box.
const wxSize & GetSize() const
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::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 115 of file view_item.h.

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

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

Reimplemented from EDA_ITEM.

Definition at line 833 of file class_gerber_draw_item.cpp.

References GERBER_DCODE_LAYER, GERBER_DRAW_LAYER, and GetLayer().

834 {
835  aCount = 2;
836 
837  aLayers[0] = GERBER_DRAW_LAYER( GetLayer() );
838  aLayers[1] = GERBER_DCODE_LAYER( aLayers[0] );
839 }
#define GERBER_DCODE_LAYER(x)
int GetLayer() const
Function GetLayer returns the layer this item is on.
#define GERBER_DRAW_LAYER(x)
unsigned int GERBER_DRAW_ITEM::ViewGetLOD ( int  aLayer,
KIGFX::VIEW aView 
) const
overridevirtual

Reimplemented from KIGFX::VIEW_ITEM.

Definition at line 850 of file class_gerber_draw_item.cpp.

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.

851 {
852  // DCodes will be shown only if zoom is appropriate:
853  // Returns the level of detail of the item.
854  // A level of detail (LOD) is the minimal VIEW scale that
855  // is sufficient for an item to be shown on a given layer.
856  if( IsDCodeLayer( aLayer ) )
857  {
858  int size = 0;
859 
860  switch( m_Shape )
861  {
862  case GBR_SPOT_MACRO:
864  break;
865 
866  case GBR_ARC:
867  size = GetLineLength( m_Start, m_ArcCentre );
868  break;
869 
870  default:
871  size = m_Size.x;
872  }
873 
874  // the level of details is chosen experimentally, to show
875  // only a readable text:
876  const int level = Millimeter2iu( 500 );
877  return ( level / ( size + 1 ) );
878  }
879 
880  // Other layers are shown without any conditions
881  return 0;
882 }
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:191
D_CODE * GetDcodeDescr() const
Function GetDcodeDescr returns the GetDcodeDescr of this object, or NULL.
EDA_RECT GetBoundingBox() const
Returns the bounding box of the shape.
int GetWidth() const
APERTURE_MACRO * GetMacro() const
Definition: dcode.h:157
SEARCH_RESULT GERBER_DRAW_ITEM::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtual

>

Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 885 of file class_gerber_draw_item.cpp.

References SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Type().

886 {
887  KICAD_T stype = *scanTypes;
888 
889  // If caller wants to inspect my type
890  if( stype == Type() )
891  {
892  if( SEARCH_QUIT == inspector( this, testData ) )
893  return SEARCH_QUIT;
894  }
895 
896  return SEARCH_CONTINUE;
897 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78

Member Data Documentation

wxRealPoint GERBER_DRAW_ITEM::m_drawScale
private
STATUS_FLAGS EDA_ITEM::m_Flags
protectedinherited

Flag bits for editing and other uses.

Definition at line 189 of file base_struct.h.

Referenced by LIB_CIRCLE::BeginEdit(), LIB_RECTANGLE::BeginEdit(), LIB_POLYLINE::BeginEdit(), LIB_TEXT::BeginEdit(), LIB_ARC::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_CIRCLE::calcEdit(), LIB_POLYLINE::calcEdit(), LIB_RECTANGLE::calcEdit(), LIB_TEXT::calcEdit(), LIB_ARC::calcEdit(), LIB_FIELD::calcEdit(), LIB_TEXT::Clone(), LIB_CIRCLE::ContinueEdit(), LIB_RECTANGLE::ContinueEdit(), LIB_POLYLINE::ContinueEdit(), LIB_TEXT::ContinueEdit(), LIB_ARC::ContinueEdit(), LIB_FIELD::ContinueEdit(), SCH_LINE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), SEGZONE::Draw(), D_PAD::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_ARC::drawGraphic(), DRAWSEGMENT::DRAWSEGMENT(), LIB_CIRCLE::EndEdit(), LIB_RECTANGLE::EndEdit(), LIB_POLYLINE::EndEdit(), LIB_TEXT::EndEdit(), LIB_ARC::EndEdit(), LIB_ITEM::EndEdit(), LIB_FIELD::EndEdit(), EDA_ITEM::GetFlags(), TRACK::GetMsgPanelInfoBase_Common(), SCH_JUNCTION::HitTest(), SCH_LINE::HitTest(), SCH_COMPONENT::HitTest(), LIB_ITEM::InEditMode(), EDA_ITEM::initVars(), SCH_ITEM::IsConnected(), SCH_LINE::Move(), EDA_ITEM::operator=(), SCH_COMPONENT::SCH_COMPONENT(), LIB_PIN::SetConversion(), LIB_PIN::SetLength(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), LIB_PIN::SetType(), and LIB_PIN::SetVisible().

bool EDA_ITEM::m_forceVisible
protectedinherited

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

Definition at line 186 of file base_struct.h.

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

bool GERBER_DRAW_ITEM::m_LayerNegative
private
wxPoint GERBER_DRAW_ITEM::m_layerOffset
private

Definition at line 111 of file class_gerber_draw_item.h.

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

DHEAD* EDA_ITEM::m_List
protectedinherited

which DLIST I am on.

Definition at line 180 of file base_struct.h.

Referenced by EDA_ITEM::GetList(), and EDA_ITEM::initVars().

double GERBER_DRAW_ITEM::m_lyrRotation
private
bool GERBER_DRAW_ITEM::m_mirrorA
private
bool GERBER_DRAW_ITEM::m_mirrorB
private
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 113 of file class_gerber_draw_item.h.

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

bool GERBER_DRAW_ITEM::m_swapAxis
private
bool GERBER_DRAW_ITEM::m_UnitsMetric

Definition at line 78 of file class_gerber_draw_item.h.

Referenced by GERBER_DRAW_ITEM(), and SetLayerParameters().

EDA_ITEM* EDA_ITEM::Pback
protectedinherited

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