KiCad PCB EDA Suite
KIGFX::VIEW_OVERLAY Class Reference

#include <view_overlay.h>

Inheritance diagram for KIGFX::VIEW_OVERLAY:
KIGFX::VIEW_ITEM

Classes

struct  COMMAND
 
struct  COMMAND_ARC
 
struct  COMMAND_CIRCLE
 
struct  COMMAND_LINE
 
struct  COMMAND_SET_COLOR
 
struct  COMMAND_SET_FILL
 
struct  COMMAND_SET_STROKE
 
struct  COMMAND_SET_WIDTH
 

Public Member Functions

 VIEW_OVERLAY ()
 
virtual ~VIEW_OVERLAY ()
 
void Clear ()
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const override
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
void Line (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 
void Line (const SEG &aSeg)
 
void Segment (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
 
void Polyline (std::deque< VECTOR2D > &aPointList)
 
void Circle (const VECTOR2D &aCenterPoint, double aRadius)
 
void Arc (const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
 
void Rectangle (const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
 
void Polygon (const std::deque< VECTOR2D > &aPointList)
 
void SetIsFill (bool aIsFillEnabled)
 
void SetIsStroke (bool aIsStrokeEnabled)
 
void SetFillColor (const COLOR4D &aColor)
 
void SetStrokeColor (const COLOR4D &aColor)
 
void SetLineWidth (double aLineWidth)
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATAviewPrivData () const
 

Private Member Functions

void releaseCommands ()
 

Private Attributes

std::vector< COMMAND * > m_commands
 

Detailed Description

Definition at line 41 of file view_overlay.h.

Constructor & Destructor Documentation

KIGFX::VIEW_OVERLAY::VIEW_OVERLAY ( )

Definition at line 158 of file view_overlay.cpp.

159 {
160 }
KIGFX::VIEW_OVERLAY::~VIEW_OVERLAY ( )
virtual

Definition at line 163 of file view_overlay.cpp.

References releaseCommands().

164 {
165  releaseCommands();
166 }

Member Function Documentation

void KIGFX::VIEW_OVERLAY::Arc ( const VECTOR2D aCenterPoint,
double  aRadius,
double  aStartAngle,
double  aEndAngle 
)

Definition at line 235 of file view_overlay.cpp.

References m_commands.

239 {
240  m_commands.push_back( new COMMAND_ARC( aCenterPoint, aRadius, aStartAngle, aEndAngle ) );
241 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::Circle ( const VECTOR2D aCenterPoint,
double  aRadius 
)

Definition at line 229 of file view_overlay.cpp.

References m_commands.

230 {
231  m_commands.push_back( new COMMAND_CIRCLE( aCenterPoint, aRadius ) );
232 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::Clear ( )

Definition at line 178 of file view_overlay.cpp.

References releaseCommands().

179 {
180  releaseCommands();
181 }
void KIGFX::VIEW_OVERLAY::Line ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)

Definition at line 207 of file view_overlay.cpp.

References m_commands.

Referenced by Line().

208 {
209  m_commands.push_back( new COMMAND_LINE( aStartPoint, aEndPoint ) );
210 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::Line ( const SEG aSeg)

Definition at line 213 of file view_overlay.cpp.

References SEG::A, SEG::B, and Line().

214 {
215  Line( aSeg.A, aSeg.B );
216 }
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
VECTOR2I A
Definition: seg.h:46
VECTOR2I B
Definition: seg.h:47
void KIGFX::VIEW_OVERLAY::Polygon ( const std::deque< VECTOR2D > &  aPointList)

Definition at line 249 of file view_overlay.cpp.

250 {
251 }
void KIGFX::VIEW_OVERLAY::Polyline ( std::deque< VECTOR2D > &  aPointList)

Definition at line 224 of file view_overlay.cpp.

225 {
226 }
void KIGFX::VIEW_OVERLAY::Rectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)

Definition at line 244 of file view_overlay.cpp.

245 {
246 }
void KIGFX::VIEW_OVERLAY::releaseCommands ( )
private

Definition at line 169 of file view_overlay.cpp.

References m_commands.

Referenced by Clear(), and ~VIEW_OVERLAY().

170 {
171  for( auto cmd : m_commands )
172  delete cmd;
173 
174  m_commands.clear();
175 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::Segment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)

Definition at line 219 of file view_overlay.cpp.

220 {
221 }
void KIGFX::VIEW_OVERLAY::SetFillColor ( const COLOR4D aColor)

Definition at line 266 of file view_overlay.cpp.

References m_commands.

267 {
268  m_commands.push_back( new COMMAND_SET_COLOR( false, aColor ) );
269 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::SetIsFill ( bool  aIsFillEnabled)

Definition at line 254 of file view_overlay.cpp.

References m_commands.

255 {
256  m_commands.push_back( new COMMAND_SET_FILL( aIsFillEnabled ) );
257 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::SetIsStroke ( bool  aIsStrokeEnabled)

Definition at line 260 of file view_overlay.cpp.

References m_commands.

261 {
262  m_commands.push_back( new COMMAND_SET_STROKE( aIsStrokeEnabled ) );
263 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::SetLineWidth ( double  aLineWidth)

Definition at line 277 of file view_overlay.cpp.

References m_commands.

278 {
279  m_commands.push_back( new COMMAND_SET_WIDTH( aLineWidth ) );
280 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::SetStrokeColor ( const COLOR4D aColor)

Definition at line 272 of file view_overlay.cpp.

References m_commands.

273 {
274  m_commands.push_back( new COMMAND_SET_COLOR( true, aColor ) );
275 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
const BOX2I KIGFX::VIEW_OVERLAY::ViewBBox ( ) const
overridevirtual

Function ViewBBox() returns the bounding box of the item covering all its layers.

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Definition at line 184 of file view_overlay.cpp.

References BOX2< Vec >::SetMaximum().

185 {
186  BOX2I maxBox;
187 
188  maxBox.SetMaximum();
189  return maxBox;
190 }
void SetMaximum()
Definition: box2.h:71
void KIGFX::VIEW_OVERLAY::ViewDraw ( int  aLayer,
VIEW aView 
) const
overridevirtual

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 from KIGFX::VIEW_ITEM.

Definition at line 193 of file view_overlay.cpp.

References m_commands.

194 {
195  for( const auto& cmd : m_commands )
196  cmd->Execute( aView );
197 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:81
void KIGFX::VIEW_OVERLAY::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtual

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[]

Implements KIGFX::VIEW_ITEM.

Definition at line 200 of file view_overlay.cpp.

References LAYER_GP_OVERLAY.

201 {
202  aLayers[0] = LAYER_GP_OVERLAY;
203  aCount = 1;
204 }
general purpose overlay
virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewGetLOD() Returns the level of detail (LOD) 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.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

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

Definition at line 140 of file view_item.h.

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

141  {
142  // By default always show the item
143  return 0;
144  }

Member Data Documentation

std::vector<COMMAND*> KIGFX::VIEW_OVERLAY::m_commands
private

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