KiCad PCB EDA Suite
WS_DRAW_ITEM_BASE Class Referenceabstract

#include <worksheet_shape_builder.h>

Inheritance diagram for WS_DRAW_ITEM_BASE:
WS_DRAW_ITEM_BITMAP WS_DRAW_ITEM_LINE WS_DRAW_ITEM_POLYGON WS_DRAW_ITEM_TEXT WS_DRAW_ITEM_RECT

Public Types

enum  WS_DRAW_TYPE {
  wsg_line, wsg_rect, wsg_poly, wsg_text,
  wsg_bitmap
}
 

Public Member Functions

virtual ~WS_DRAW_ITEM_BASE ()
 
COLOR4D GetColor () const
 
WS_DRAW_TYPE GetType () const
 
WORKSHEET_DATAITEMGetParent () const
 
virtual void DrawWsItem (EDA_RECT *aClipBox, wxDC *aDC)
 The function to draw a WS_DRAW_ITEM. More...
 
virtual void DrawWsItem (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED)=0
 More advanced version of DrawWsItem. More...
 
virtual bool HitTest (const wxPoint &aPosition) const =0
 Abstract function: should exist for derived items return true if the point aPosition is on the item. More...
 
virtual bool HitTest (const EDA_RECT &aRect) const =0
 Abstract function: should exist for derived items return true if the rect aRect intersects on the item. More...
 
virtual bool HitTestStartPoint (wxDC *aDC, const wxPoint &aPosition)=0
 Abstract function: should exist for derived items return true if the point aPosition is near the starting point of this item, for items defined by 2 points (segments, rect) or the position of the item, for items having only one point (texts or polygons) the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2. More...
 
virtual bool HitTestEndPoint (wxDC *aDC, const wxPoint &aPosition)
 return true if the point aPosition is near the ending point of this item This is avirtual function which should be overriden for items defien by 2 points the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 More...
 

Public Attributes

int m_Flags
 

Protected Member Functions

 WS_DRAW_ITEM_BASE (WORKSHEET_DATAITEM *aParent, WS_DRAW_TYPE aType, COLOR4D aColor)
 

Protected Attributes

WS_DRAW_TYPE m_type
 
COLOR4D m_color
 
WORKSHEET_DATAITEMm_parent
 

Detailed Description

Definition at line 55 of file worksheet_shape_builder.h.

Member Enumeration Documentation

◆ WS_DRAW_TYPE

Constructor & Destructor Documentation

◆ WS_DRAW_ITEM_BASE()

WS_DRAW_ITEM_BASE::WS_DRAW_ITEM_BASE ( WORKSHEET_DATAITEM aParent,
WS_DRAW_TYPE  aType,
COLOR4D  aColor 
)
inlineprotected

Definition at line 71 of file worksheet_shape_builder.h.

73  {
74  m_type = aType;
75  m_color = aColor;
76  m_parent = aParent;
77  m_Flags = 0;
78  }
WORKSHEET_DATAITEM * m_parent

References m_color, m_Flags, m_parent, and m_type.

◆ ~WS_DRAW_ITEM_BASE()

virtual WS_DRAW_ITEM_BASE::~WS_DRAW_ITEM_BASE ( )
inlinevirtual

Definition at line 81 of file worksheet_shape_builder.h.

81 {}

Member Function Documentation

◆ DrawWsItem() [1/2]

virtual void WS_DRAW_ITEM_BASE::DrawWsItem ( EDA_RECT aClipBox,
wxDC *  aDC 
)
inlinevirtual

The function to draw a WS_DRAW_ITEM.

Definition at line 91 of file worksheet_shape_builder.h.

92  {
93  wxPoint offset( 0, 0 );
94  DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, COLOR4D::UNSPECIFIED );
95  }
virtual void DrawWsItem(EDA_RECT *aClipBox, wxDC *aDC)
The function to draw a WS_DRAW_ITEM.

References UNSPECIFIED_DRAWMODE.

◆ DrawWsItem() [2/2]

virtual void WS_DRAW_ITEM_BASE::DrawWsItem ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint &  aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED 
)
pure virtual

More advanced version of DrawWsItem.

This is what must be defined in the derived type.

Implemented in WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, WS_DRAW_ITEM_RECT, WS_DRAW_ITEM_POLYGON, and WS_DRAW_ITEM_LINE.

◆ GetColor()

◆ GetParent()

WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::GetParent ( void  ) const
inline

◆ GetType()

WS_DRAW_TYPE WS_DRAW_ITEM_BASE::GetType ( ) const
inline

Definition at line 85 of file worksheet_shape_builder.h.

85 { return m_type; };

References m_type.

Referenced by KIGFX::WORKSHEET_VIEWITEM::ViewDraw().

◆ HitTest() [1/2]

virtual bool WS_DRAW_ITEM_BASE::HitTest ( const wxPoint &  aPosition) const
pure virtual

Abstract function: should exist for derived items return true if the point aPosition is on the item.

Implemented in WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, WS_DRAW_ITEM_RECT, WS_DRAW_ITEM_POLYGON, and WS_DRAW_ITEM_LINE.

◆ HitTest() [2/2]

virtual bool WS_DRAW_ITEM_BASE::HitTest ( const EDA_RECT aRect) const
pure virtual

Abstract function: should exist for derived items return true if the rect aRect intersects on the item.

Implemented in WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, WS_DRAW_ITEM_RECT, WS_DRAW_ITEM_POLYGON, and WS_DRAW_ITEM_LINE.

◆ HitTestEndPoint()

virtual bool WS_DRAW_ITEM_BASE::HitTestEndPoint ( wxDC *  aDC,
const wxPoint &  aPosition 
)
inlinevirtual

return true if the point aPosition is near the ending point of this item This is avirtual function which should be overriden for items defien by 2 points the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2

Reimplemented in WS_DRAW_ITEM_RECT, and WS_DRAW_ITEM_LINE.

Definition at line 130 of file worksheet_shape_builder.h.

131  {
132  return false;
133  }

◆ HitTestStartPoint()

virtual bool WS_DRAW_ITEM_BASE::HitTestStartPoint ( wxDC *  aDC,
const wxPoint &  aPosition 
)
pure virtual

Abstract function: should exist for derived items return true if the point aPosition is near the starting point of this item, for items defined by 2 points (segments, rect) or the position of the item, for items having only one point (texts or polygons) the maxi dist is WORKSHEET_DATAITEM::GetMarkerSizeUi()/2.

Implemented in WS_DRAW_ITEM_BITMAP, WS_DRAW_ITEM_TEXT, WS_DRAW_ITEM_RECT, WS_DRAW_ITEM_POLYGON, and WS_DRAW_ITEM_LINE.

Member Data Documentation

◆ m_color

COLOR4D WS_DRAW_ITEM_BASE::m_color
protected

Definition at line 66 of file worksheet_shape_builder.h.

Referenced by GetColor(), and WS_DRAW_ITEM_BASE().

◆ m_Flags

int WS_DRAW_ITEM_BASE::m_Flags

Definition at line 61 of file worksheet_shape_builder.h.

Referenced by PL_EDITOR_FRAME::Locate(), and WS_DRAW_ITEM_BASE().

◆ m_parent

WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::m_parent
protected

Definition at line 67 of file worksheet_shape_builder.h.

Referenced by GetParent(), and WS_DRAW_ITEM_BASE().

◆ m_type

WS_DRAW_TYPE WS_DRAW_ITEM_BASE::m_type
protected

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