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_POINT_POLYGON
 
struct  COMMAND_POINT_POLYLINE
 
struct  COMMAND_POLY_POLYGON
 
struct  COMMAND_POLY_POLYLINE
 
struct  COMMAND_POLYGON
 
struct  COMMAND_POLYLINE
 
struct  COMMAND_RECTANGLE
 
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 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 Polyline (std::deque< VECTOR2D > &aPointList)
 
void Polyline (const VECTOR2D aPointList[], int aListSize)
 
void Polyline (const SHAPE_LINE_CHAIN &aLineChain)
 
void Polygon (const std::deque< VECTOR2D > &aPointList)
 
void Polygon (const SHAPE_POLY_SET &aPolySet)
 
void Polygon (const VECTOR2D aPointList[], int aListSize)
 
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 43 of file view_overlay.h.

Constructor & Destructor Documentation

KIGFX::VIEW_OVERLAY::VIEW_OVERLAY ( )

Definition at line 268 of file view_overlay.cpp.

269 {
270 }
KIGFX::VIEW_OVERLAY::~VIEW_OVERLAY ( )
virtual

Definition at line 273 of file view_overlay.cpp.

References releaseCommands().

274 {
275  releaseCommands();
276 }

Member Function Documentation

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

Definition at line 375 of file view_overlay.cpp.

References m_commands.

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

Definition at line 369 of file view_overlay.cpp.

References m_commands.

370 {
371  m_commands.push_back( new COMMAND_CIRCLE( aCenterPoint, aRadius ) );
372 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Clear ( )

Definition at line 288 of file view_overlay.cpp.

References releaseCommands().

289 {
290  releaseCommands();
291 }
void KIGFX::VIEW_OVERLAY::Line ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)

Definition at line 317 of file view_overlay.cpp.

References m_commands.

Referenced by Line(), and Segment().

318 {
319  m_commands.push_back( new COMMAND_LINE( aStartPoint, aEndPoint ) );
320 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Line ( const SEG aSeg)

Definition at line 323 of file view_overlay.cpp.

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

324 {
325  Line( aSeg.A, aSeg.B );
326 }
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
VECTOR2I A
Definition: seg.h:44
VECTOR2I B
Definition: seg.h:45
void KIGFX::VIEW_OVERLAY::Polygon ( const std::deque< VECTOR2D > &  aPointList)

Definition at line 357 of file view_overlay.cpp.

References m_commands.

358 {
359  m_commands.push_back( new COMMAND_POLYGON( aPointList ) );
360 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Polygon ( const SHAPE_POLY_SET aPolySet)

Definition at line 351 of file view_overlay.cpp.

References m_commands.

352 {
353  m_commands.push_back( new COMMAND_POLY_POLYGON( aPolySet ) );
354 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Polygon ( const VECTOR2D  aPointList[],
int  aListSize 
)

Definition at line 363 of file view_overlay.cpp.

References m_commands.

364 {
365  m_commands.push_back( new COMMAND_POINT_POLYGON( aPointList, aListSize ) );
366 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Polyline ( std::deque< VECTOR2D > &  aPointList)

Definition at line 336 of file view_overlay.cpp.

337 {
338 }
void KIGFX::VIEW_OVERLAY::Polyline ( const VECTOR2D  aPointList[],
int  aListSize 
)

Definition at line 341 of file view_overlay.cpp.

342 {
343 }
void KIGFX::VIEW_OVERLAY::Polyline ( const SHAPE_LINE_CHAIN aLineChain)

Definition at line 346 of file view_overlay.cpp.

347 {
348 }
void KIGFX::VIEW_OVERLAY::Rectangle ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint 
)

Definition at line 382 of file view_overlay.cpp.

References m_commands.

383 {
384  m_commands.push_back( new COMMAND_RECTANGLE( aStartPoint, aEndPoint ) );
385 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::releaseCommands ( )
private

Definition at line 279 of file view_overlay.cpp.

References m_commands.

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

280 {
281  for( auto cmd : m_commands )
282  delete cmd;
283 
284  m_commands.clear();
285 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::Segment ( const VECTOR2D aStartPoint,
const VECTOR2D aEndPoint,
double  aWidth 
)

Definition at line 329 of file view_overlay.cpp.

References Line(), and SetLineWidth().

330 {
331  SetLineWidth( aWidth );
332  Line( aStartPoint, aEndPoint );
333 }
void Line(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
void SetLineWidth(double aLineWidth)
void KIGFX::VIEW_OVERLAY::SetFillColor ( const COLOR4D aColor)

Definition at line 400 of file view_overlay.cpp.

References m_commands.

401 {
402  m_commands.push_back( new COMMAND_SET_COLOR( false, aColor ) );
403 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::SetIsFill ( bool  aIsFillEnabled)

Definition at line 388 of file view_overlay.cpp.

References m_commands.

389 {
390  m_commands.push_back( new COMMAND_SET_FILL( aIsFillEnabled ) );
391 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::SetIsStroke ( bool  aIsStrokeEnabled)

Definition at line 394 of file view_overlay.cpp.

References m_commands.

395 {
396  m_commands.push_back( new COMMAND_SET_STROKE( aIsStrokeEnabled ) );
397 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::SetLineWidth ( double  aLineWidth)

Definition at line 411 of file view_overlay.cpp.

References m_commands.

Referenced by Segment().

412 {
413  m_commands.push_back( new COMMAND_SET_WIDTH( aLineWidth ) );
414 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
void KIGFX::VIEW_OVERLAY::SetStrokeColor ( const COLOR4D aColor)

Definition at line 406 of file view_overlay.cpp.

References m_commands.

407 {
408  m_commands.push_back( new COMMAND_SET_COLOR( true, aColor ) );
409 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
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 294 of file view_overlay.cpp.

References BOX2< Vec >::SetMaximum().

295 {
296  BOX2I maxBox;
297 
298  maxBox.SetMaximum();
299  return maxBox;
300 }
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 303 of file view_overlay.cpp.

References m_commands.

304 {
305  for( const auto& cmd : m_commands )
306  cmd->Execute( aView );
307 }
std::vector< COMMAND * > m_commands
Definition: view_overlay.h:104
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 310 of file view_overlay.cpp.

References LAYER_GP_OVERLAY.

311 {
312  aLayers[0] = LAYER_GP_OVERLAY;
313  aCount = 1;
314 }
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: