KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::GERBVIEW_PAINTER Class Reference

Methods for drawing GerbView specific items. More...

#include <gerbview_painter.h>

Inheritance diagram for KIGFX::GERBVIEW_PAINTER:
KIGFX::PAINTER

Public Member Functions

 GERBVIEW_PAINTER (GAL *aGal)
 
virtual GERBVIEW_RENDER_SETTINGSGetSettings () override
 Return a pointer to current settings that are going to be used when drawing items.
 
virtual bool Draw (const VIEW_ITEM *aItem, int aLayer) override
 Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
 
void SetGAL (GAL *aGal)
 Changes Graphics Abstraction Layer used for drawing items for a new one.
 

Protected Member Functions

void draw (GERBER_DRAW_ITEM *aVia, int aLayer)
 
void drawPolygon (GERBER_DRAW_ITEM *aParent, const SHAPE_POLY_SET &aPolygon, bool aFilled, bool aShift=false)
 Helper routine to draw a polygon.
 
void drawFlashedShape (GERBER_DRAW_ITEM *aItem, bool aFilled)
 Helper to draw a flashed shape (aka spot)
 
void drawApertureMacro (GERBER_DRAW_ITEM *aParent, bool aFilled)
 Helper to draw an aperture macro shape.
 
int getLineThickness (int aActualThickness) const
 Get the thickness to draw for a line (e.g.
 

Protected Attributes

GERBVIEW_RENDER_SETTINGS m_gerbviewSettings
 
GALm_gal
 Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
 

Detailed Description

Methods for drawing GerbView specific items.

Definition at line 124 of file gerbview_painter.h.

Constructor & Destructor Documentation

◆ GERBVIEW_PAINTER()

GERBVIEW_PAINTER::GERBVIEW_PAINTER ( GAL aGal)

Definition at line 190 of file gerbview_painter.cpp.

Member Function Documentation

◆ Draw()

bool GERBVIEW_PAINTER::Draw ( const VIEW_ITEM aItem,
int  aLayer 
)
overridevirtual

Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.

Parameters
aItemis an item to be drawn.
aLayertells which layer is currently rendered so that draw functions may know what to draw (eg. for pads there are separate layers for holes, because they have other dimensions then the pad itself.

Implements KIGFX::PAINTER.

Definition at line 208 of file gerbview_painter.cpp.

References draw().

◆ draw()

void GERBVIEW_PAINTER::draw ( GERBER_DRAW_ITEM aVia,
int  aLayer 
)
protected

Definition at line 224 of file gerbview_painter.cpp.

References SHAPE_POLY_SET::AddOutline(), ANGLE_360, APT_RECT, KIGFX::GAL::BitmapText(), SHAPE_POLY_SET::CacheTriangulation(), color, GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoints(), VECTOR2< T >::Distance(), KIGFX::GAL::DrawArcSegment(), KIGFX::GAL::DrawCircle(), drawFlashedShape(), KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawPolygon(), drawPolygon(), KIGFX::GAL::DrawPolyline(), KIGFX::GAL::DrawRectangle(), KIGFX::GAL::DrawSegment(), GBR_ARC, GBR_CIRCLE, GBR_POLYGON, GBR_SEGMENT, GBR_SPOT_CIRCLE, GBR_SPOT_MACRO, GBR_SPOT_OVAL, GBR_SPOT_POLY, GBR_SPOT_RECT, gerbIUScale, GERBER_DRAW_ITEM::GetABPosition(), GERBER_DRAW_ITEM::GetBoundingBox(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), GERBER_DRAW_ITEM::GetDcodeDescr(), BOX2< Vec >::GetEnd(), GERBER_DRAW_ITEM::GetLayerPolarity(), BOX2< Vec >::GetOrigin(), GetSettings(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, gvconfig(), EDA_ITEM::IsBrightened(), IsDCodeLayer(), KIGFX::GAL::IsOpenGlEngine(), SHAPE_POLY_SET::IsTriangulationUpToDate(), GERBER_DRAW_ITEM::m_AbsolutePolygon, D_CODE::m_ApertType, GERBVIEW_SETTINGS::m_Appearance, GERBER_DRAW_ITEM::m_ArcCentre, GERBER_DRAW_ITEM::m_DCode, GERBVIEW_SETTINGS::m_Display, GBR_DISPLAY_OPTIONS::m_DisplayFlashedItemsFill, GBR_DISPLAY_OPTIONS::m_DisplayLinesFill, GBR_DISPLAY_OPTIONS::m_DisplayPolygonsFill, GERBER_DRAW_ITEM::m_End, KIGFX::PAINTER::m_gal, GERBER_DRAW_ITEM::m_GerberImageFile, m_gerbviewSettings, GERBER_FILE_IMAGE::m_ImageNegative, KIGFX::RENDER_SETTINGS::m_outlineWidth, GERBER_DRAW_ITEM::m_ShapeAsPolygon, GERBER_DRAW_ITEM::m_ShapeType, GERBER_DRAW_ITEM::m_Size, GERBER_DRAW_ITEM::m_Start, EDA_IU_SCALE::mmToIU(), SHAPE_POLY_SET::OutlineCount(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::SetClosed(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetNegativeDrawMode(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), GERBVIEW_SETTINGS::APPEARANCE::show_negative_objects, GERBER_DRAW_ITEM::ViewBBox(), and VECTOR2< T >::x.

Referenced by Draw().

◆ drawApertureMacro()

◆ drawFlashedShape()

◆ drawPolygon()

void GERBVIEW_PAINTER::drawPolygon ( GERBER_DRAW_ITEM aParent,
const SHAPE_POLY_SET aPolygon,
bool  aFilled,
bool  aShift = false 
)
protected

Helper routine to draw a polygon.

Parameters
aParentPointer to the draw item for AB Position calculation.
aPolygonthe polygon to draw.
aFilledIf true, draw the polygon as filled, otherwise only outline.
aShiftIf true, draw the polygon relative to the parent item position.

Definition at line 456 of file gerbview_painter.cpp.

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::COutline(), SHAPE_LINE_CHAIN::CPoints(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawPolyline(), GERBER_DRAW_ITEM::GetABPosition(), gvconfig(), KIGFX::PAINTER::m_gal, m_gerbviewSettings, KIGFX::RENDER_SETTINGS::m_outlineWidth, GERBER_DRAW_ITEM::m_Start, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), and KIGFX::GAL::SetLineWidth().

Referenced by draw(), and drawFlashedShape().

◆ getLineThickness()

int GERBVIEW_PAINTER::getLineThickness ( int  aActualThickness) const
protected

Get the thickness to draw for a line (e.g.

0 thickness lines get a minimum value).

Parameters
aActualThicknessline own thickness.
Returns
the thickness to draw.

Definition at line 197 of file gerbview_painter.cpp.

References m_gerbviewSettings, and KIGFX::RENDER_SETTINGS::m_outlineWidth.

◆ GetSettings()

virtual GERBVIEW_RENDER_SETTINGS * KIGFX::GERBVIEW_PAINTER::GetSettings ( )
inlineoverridevirtual

Return a pointer to current settings that are going to be used when drawing items.

Returns
Current rendering settings.

Implements KIGFX::PAINTER.

Definition at line 130 of file gerbview_painter.h.

References m_gerbviewSettings.

Referenced by draw().

◆ SetGAL()

void KIGFX::PAINTER::SetGAL ( GAL aGal)
inlineinherited

Changes Graphics Abstraction Layer used for drawing items for a new one.

Parameters
aGalis the new GAL instance.

Definition at line 76 of file painter.h.

Member Data Documentation

◆ m_gal

GAL* KIGFX::PAINTER::m_gal
protectedinherited

◆ m_gerbviewSettings

GERBVIEW_RENDER_SETTINGS KIGFX::GERBVIEW_PAINTER::m_gerbviewSettings
protected

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