KiCad PCB EDA Suite
WS_DRAW_ITEM_BITMAP Class Reference

#include <worksheet_shape_builder.h>

Inheritance diagram for WS_DRAW_ITEM_BITMAP:
WS_DRAW_ITEM_BASE

Public Types

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

Public Member Functions

 WS_DRAW_ITEM_BITMAP (WORKSHEET_DATAITEM *aParent, wxPoint aPos)
 
 WS_DRAW_ITEM_BITMAP ()
 
 ~WS_DRAW_ITEM_BITMAP ()
 
virtual void DrawWsItem (EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
 The function to draw a WS_DRAW_ITEM_BITMAP. More...
 
virtual bool HitTest (const wxPoint &aPosition) const override
 Virtual function return true if the point aPosition is on bitmap. More...
 
virtual bool HitTest (const EDA_RECT &aRect) const override
 Virtual function return true if the rect aRect intersects on the item. More...
 
virtual bool HitTestStartPoint (const wxPoint &aPosition) override
 return true if the point aPosition is on the reference point of this item. More...
 
const wxPointGetPosition ()
 
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 bool HitTestEndPoint (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 Attributes

WS_DRAW_TYPE m_type
 
COLOR4D m_color
 
WORKSHEET_DATAITEMm_parent
 

Private Attributes

wxPoint m_pos
 

Detailed Description

Definition at line 324 of file worksheet_shape_builder.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

WS_DRAW_ITEM_BITMAP::WS_DRAW_ITEM_BITMAP ( WORKSHEET_DATAITEM aParent,
wxPoint  aPos 
)
inline

Definition at line 329 of file worksheet_shape_builder.h.

330  :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, COLOR4D::UNSPECIFIED )
331  {
332  m_pos = aPos;
333  }
WS_DRAW_ITEM_BASE(WORKSHEET_DATAITEM *aParent, WS_DRAW_TYPE aType, COLOR4D aColor)
WS_DRAW_ITEM_BITMAP::WS_DRAW_ITEM_BITMAP ( )
inline

Definition at line 335 of file worksheet_shape_builder.h.

336  :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, COLOR4D::UNSPECIFIED )
337  {
338  }
WS_DRAW_ITEM_BASE(WORKSHEET_DATAITEM *aParent, WS_DRAW_TYPE aType, COLOR4D aColor)
WS_DRAW_ITEM_BITMAP::~WS_DRAW_ITEM_BITMAP ( )
inline

Definition at line 340 of file worksheet_shape_builder.h.

340 {}

Member Function Documentation

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

The function to draw a WS_DRAW_ITEM.

Definition at line 91 of file worksheet_shape_builder.h.

References UNSPECIFIED_DRAWMODE.

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.
void WS_DRAW_ITEM_BITMAP::DrawWsItem ( EDA_RECT aClipBox,
wxDC *  aDC,
const wxPoint aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED 
)
overridevirtual

The function to draw a WS_DRAW_ITEM_BITMAP.

Implements WS_DRAW_ITEM_BASE.

Definition at line 471 of file page_layout_graphic_items.cpp.

References BITMAP_BASE::DrawBitmap(), WS_DRAW_ITEM_BASE::GetParent(), GR_COPY, GRSetDrawMode(), WORKSHEET_DATAITEM_BITMAP::m_ImageBitmap, m_pos, and UNSPECIFIED_DRAWMODE.

473 {
475 
476  if( parent->m_ImageBitmap )
477  {
478  GRSetDrawMode( aDC, ( aDrawMode == UNSPECIFIED_DRAWMODE ) ? GR_COPY : aDrawMode );
479  parent->m_ImageBitmap->DrawBitmap( NULL, aDC, m_pos + aOffset );
480  GRSetDrawMode( aDC, GR_COPY );
481  }
482 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:296
WORKSHEET_DATAITEM * GetParent() const
void DrawBitmap(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPos)
WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::GetParent ( void  ) const
inlineinherited

Definition at line 87 of file worksheet_shape_builder.h.

References WS_DRAW_ITEM_BASE::m_parent.

Referenced by DrawWsItem(), HitTest(), PL_EDITOR_FRAME::Locate(), and PlotWorkSheet().

87 { return m_parent; }
WORKSHEET_DATAITEM * m_parent
const wxPoint& WS_DRAW_ITEM_BITMAP::GetPosition ( )
inline

Definition at line 364 of file worksheet_shape_builder.h.

References m_pos.

Referenced by WS_DRAW_ITEM_LIST::Draw(), and PlotWorkSheet().

364 { return m_pos; }
WS_DRAW_TYPE WS_DRAW_ITEM_BASE::GetType ( ) const
inlineinherited

Definition at line 85 of file worksheet_shape_builder.h.

References WS_DRAW_ITEM_BASE::m_type.

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

85 { return m_type; };
bool WS_DRAW_ITEM_BITMAP::HitTest ( const wxPoint aPosition) const
overridevirtual

Virtual function return true if the point aPosition is on bitmap.

Implements WS_DRAW_ITEM_BASE.

Definition at line 485 of file page_layout_graphic_items.cpp.

References EDA_RECT::Contains(), BITMAP_BASE::GetBoundingBox(), WS_DRAW_ITEM_BASE::GetParent(), WORKSHEET_DATAITEM_BITMAP::m_ImageBitmap, m_pos, and EDA_RECT::Move().

486 {
487  const WORKSHEET_DATAITEM_BITMAP* parent = static_cast<const WORKSHEET_DATAITEM_BITMAP*>( GetParent() );
488 
489  if( parent->m_ImageBitmap == NULL )
490  return false;
491 
492  EDA_RECT rect = parent->m_ImageBitmap->GetBoundingBox();
493  rect.Move( m_pos );
494  return rect.Contains( aPosition );
495 }
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
bool Contains(const wxPoint &aPoint) const
Function Contains.
const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
WORKSHEET_DATAITEM * GetParent() const
Class EDA_RECT handles the component boundary box.
bool WS_DRAW_ITEM_BITMAP::HitTest ( const EDA_RECT aRect) const
overridevirtual

Virtual function return true if the rect aRect intersects on the item.

Implements WS_DRAW_ITEM_BASE.

Definition at line 498 of file page_layout_graphic_items.cpp.

References BITMAP_BASE::GetBoundingBox(), WS_DRAW_ITEM_BASE::GetParent(), EDA_RECT::Intersects(), WORKSHEET_DATAITEM_BITMAP::m_ImageBitmap, m_pos, and EDA_RECT::Move().

499 {
500  const WORKSHEET_DATAITEM_BITMAP* parent = static_cast<const WORKSHEET_DATAITEM_BITMAP*>( GetParent() );
501 
502  if( parent->m_ImageBitmap == NULL )
503  return false;
504 
505  EDA_RECT rect = parent->m_ImageBitmap->GetBoundingBox();
506  rect.Move( m_pos );
507  return rect.Intersects( aRect );
508 }
void Move(const wxPoint &aMoveVector)
Function Move moves the rectangle by the aMoveVector.
const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
WORKSHEET_DATAITEM * GetParent() const
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
virtual bool WS_DRAW_ITEM_BASE::HitTestEndPoint ( const wxPoint aPosition)
inlinevirtualinherited

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  }
bool WS_DRAW_ITEM_BITMAP::HitTestStartPoint ( const wxPoint aPosition)
overridevirtual

return true if the point aPosition is on the reference point of this item.

Implements WS_DRAW_ITEM_BASE.

Definition at line 514 of file page_layout_graphic_items.cpp.

References abs, dist, WORKSHEET_DATAITEM::GetMarkerSizeUi(), m_pos, wxPoint::x, and wxPoint::y.

515 {
516  wxPoint dist = m_pos - aPosition;
517 
518  if( std::abs( dist.x) <= WORKSHEET_DATAITEM::GetMarkerSizeUi()/2 &&
520  return true;
521 
522  return false;
523 }
static const int dist[10][10]
Definition: dist.cpp:57
#define abs(a)
Definition: auxiliary.h:84

Member Data Documentation

COLOR4D WS_DRAW_ITEM_BASE::m_color
protectedinherited

Definition at line 66 of file worksheet_shape_builder.h.

Referenced by WS_DRAW_ITEM_BASE::GetColor().

int WS_DRAW_ITEM_BASE::m_Flags
inherited

Definition at line 61 of file worksheet_shape_builder.h.

Referenced by PL_EDITOR_FRAME::Locate().

WORKSHEET_DATAITEM* WS_DRAW_ITEM_BASE::m_parent
protectedinherited

Definition at line 67 of file worksheet_shape_builder.h.

Referenced by WS_DRAW_ITEM_BASE::GetParent().

wxPoint WS_DRAW_ITEM_BITMAP::m_pos
private

Definition at line 326 of file worksheet_shape_builder.h.

Referenced by DrawWsItem(), GetPosition(), HitTest(), and HitTestStartPoint().

WS_DRAW_TYPE WS_DRAW_ITEM_BASE::m_type
protectedinherited

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