KiCad PCB EDA Suite
KIGFX::VIEW_ITEM Class Referenceabstract

Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW. More...

#include <view_item.h>

Inheritance diagram for KIGFX::VIEW_ITEM:
EDA_ITEM KIGFX::VIEW_GROUP BASE_SCREEN BOARD_ITEM BRIGHT_BOX EDIT_POINTS GBR_LAYOUT GERBER_DRAW_ITEM GERBER_FILE_IMAGE GERBER_FILE_IMAGE_LIST GERBER_NEGATIVE_IMAGE_BACKDROP KIGFX::ORIGIN_VIEWITEM KIGFX::PREVIEW::ARC_ASSISTANT KIGFX::PREVIEW::RULER_ITEM KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM KIGFX::RATSNEST_VIEWITEM KIGFX::WORKSHEET_VIEWITEM LIB_ALIAS LIB_ITEM LIB_PART PL_ITEM_LAYOUT ROUTER_PREVIEW_ITEM SCH_ITEM SELECTION

Public Member Functions

 VIEW_ITEM ()
 
virtual ~VIEW_ITEM ()
 
 VIEW_ITEM (const VIEW_ITEM &aOther)=delete
 
VIEW_ITEMoperator= (const VIEW_ITEM &aOther)=delete
 
virtual const BOX2I ViewBBox () const =0
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const =0
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail of the item. More...
 
VIEW_ITEM_DATAviewPrivData () const
 

Private Attributes

VIEW_ITEM_DATAm_viewPrivData
 

Friends

class VIEW
 

Detailed Description

Class VIEW_ITEM - is an abstract base class for deriving all objects that can be added to a VIEW.

It's role is to:

  • communicte geometry, appearance and visibility updates to the associated dynamic VIEW,
  • provide a bounding box for redraw area calculation,
  • (optional) draw the object using the GAL API functions for PAINTER-less implementations. VIEW_ITEM objects are never owned by a VIEW. A single VIEW_ITEM can belong to any number of static VIEWs, but only one dynamic VIEW due to storage of only one VIEW reference.

Definition at line 83 of file view_item.h.

Constructor & Destructor Documentation

KIGFX::VIEW_ITEM::VIEW_ITEM ( )
inline

Definition at line 86 of file view_item.h.

86  : m_viewPrivData( nullptr )
87  {
88  }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:150
VIEW_ITEM::~VIEW_ITEM ( )
virtual

Definition at line 32 of file view_item.cpp.

References m_viewPrivData, and KIGFX::VIEW::OnDestroy().

33 {
34  VIEW::OnDestroy( this );
35  m_viewPrivData = nullptr;
36 }
VIEW_ITEM_DATA * m_viewPrivData
Definition: view_item.h:150
static void OnDestroy(VIEW_ITEM *aItem)
Definition: view.cpp:247
KIGFX::VIEW_ITEM::VIEW_ITEM ( const VIEW_ITEM aOther)
delete

Member Function Documentation

VIEW_ITEM& KIGFX::VIEW_ITEM::operator= ( const VIEW_ITEM aOther)
delete
virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtual

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  {}
virtual void KIGFX::VIEW_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
pure virtual

Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.

For instance, a D_PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]output layer index array
aCountnumber of layer indices in aLayers[]

Implemented in D_PAD, MODULE, EDIT_POINTS, EDA_ITEM, VIA, BOARD_ITEM, TRACK, GERBER_DRAW_ITEM, TEXTE_MODULE, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, KIGFX::VIEW_GROUP, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, and KIGFX::PREVIEW::RULER_ITEM.

Referenced by KIGFX::VIEW::Add(), KIGFX::VIEW::draw(), KIGFX::VIEW::invalidateItem(), KIGFX::VIEW::updateBbox(), and KIGFX::VIEW::updateLayers().

virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtual

Function ViewGetLOD() Returns the level of detail of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Reimplemented in D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TRACK, and TEXTE_MODULE.

Definition at line 134 of file view_item.h.

Referenced by KIGFX::VIEW::drawItem::operator()().

135  {
136  // By default always show the item
137  return 0;
138  }

Friends And Related Function Documentation

friend class VIEW
friend

Definition at line 148 of file view_item.h.

Member Data Documentation

VIEW_ITEM_DATA* KIGFX::VIEW_ITEM::m_viewPrivData
private

Definition at line 150 of file view_item.h.

Referenced by KIGFX::VIEW::Add(), viewPrivData(), and ~VIEW_ITEM().


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