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

Contains methods for drawing schematic-specific items. More...

#include <sch_painter.h>

Inheritance diagram for KIGFX::SCH_PAINTER:
KIGFX::PAINTER

Public Member Functions

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

Static Public Attributes

static std::vector< KICAD_Tg_ScaledSelectionTypes
 

Protected Attributes

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

Private Member Functions

void drawItemBoundingBox (const EDA_ITEM *aItem)
 
void draw (const EDA_ITEM *, int, bool aDimmed)
 
void draw (const SCH_PIN *aPin, int aLayer, bool aDimmed)
 
void draw (const LIB_SYMBOL *aSymbol, int, bool aDrawFields=true, int aUnit=0, int aBodyStyle=0, bool aDimmed=false)
 
void draw (const SCH_SYMBOL *aSymbol, int aLayer)
 
void draw (const SCH_SHAPE *aShape, int aLayer, bool aDimmed)
 
void draw (const SCH_JUNCTION *aJct, int aLayer)
 
void draw (const SCH_FIELD *aField, int aLayer, bool aDimmed)
 
void draw (const SCH_TEXTBOX *aTextBox, int aLayer, bool aDimmed)
 
void draw (const SCH_TEXT *aText, int aLayer, bool aDimmed)
 
void draw (const SCH_TABLE *aTable, int aLayer, bool aDimmed)
 
void draw (const SCH_LABEL *aLabel, int aLayer)
 
void draw (const SCH_DIRECTIVE_LABEL *aLabel, int aLayer)
 
void draw (const SCH_HIERLABEL *aLabel, int aLayer, bool aDimmed)
 
void draw (const SCH_GLOBALLABEL *aLabel, int aLayer)
 
void draw (const SCH_SHEET *aSheet, int aLayer)
 
void draw (const SCH_NO_CONNECT *aNC, int aLayer)
 
void draw (const SCH_MARKER *aMarker, int aLayer)
 
void draw (const SCH_BITMAP *aBitmap, int aLayer)
 
void draw (const SCH_LINE *aLine, int aLayer)
 
void draw (const SCH_BUS_ENTRY_BASE *aEntry, int aLayer)
 
void drawPinDanglingIndicator (const SCH_PIN &aPin, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
 
void drawDanglingIndicator (const VECTOR2I &aPos, const COLOR4D &aColor, int aWidth, bool aDangling, bool aDrawingShadows, bool aBrightened)
 
void drawAnchor (const VECTOR2I &aPos, bool aDrawingShadows)
 
int internalPinDecoSize (const SCH_PIN &aPin)
 
int externalPinDecoSize (const SCH_PIN &aPin)
 
bool nonCached (const EDA_ITEM *aItem)
 
bool isUnitAndConversionShown (const SCH_ITEM *aItem) const
 
float getShadowWidth (bool aForHighlight) const
 
COLOR4D getRenderColor (const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false) const
 
KIFONT::FONTgetFont (const EDA_TEXT *aText) const
 
float getLineWidth (const SCH_ITEM *aItem, bool aDrawingShadows, bool aDrawingWireColorHighlights=false) const
 
float getTextThickness (const SCH_ITEM *aItem) const
 
int getOperatingPointTextSize () const
 
void triLine (const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
 
wxString expandLibItemTextVars (const wxString &aSourceText, const SCH_SYMBOL *aSymbolContext)
 

Private Attributes

SCH_RENDER_SETTINGS m_schSettings
 
SCHEMATICm_schematic
 

Detailed Description

Contains methods for drawing schematic-specific items.

Definition at line 67 of file sch_painter.h.

Constructor & Destructor Documentation

◆ SCH_PAINTER()

KIGFX::SCH_PAINTER::SCH_PAINTER ( GAL aGal)

Definition at line 137 of file sch_painter.cpp.

Member Function Documentation

◆ draw() [1/20]

◆ draw() [2/20]

void KIGFX::SCH_PAINTER::draw ( const LIB_SYMBOL aSymbol,
int  aLayer,
bool  aDrawFields = true,
int  aUnit = 0,
int  aBodyStyle = 0,
bool  aDimmed = false 
)
private

◆ draw() [3/20]

◆ draw() [4/20]

◆ draw() [5/20]

◆ draw() [6/20]

◆ draw() [7/20]

◆ draw() [8/20]

◆ draw() [9/20]

◆ draw() [10/20]

◆ draw() [11/20]

◆ draw() [12/20]

void KIGFX::SCH_PAINTER::draw ( const SCH_MARKER aMarker,
int  aLayer 
)
private

◆ draw() [13/20]

void KIGFX::SCH_PAINTER::draw ( const SCH_NO_CONNECT aNC,
int  aLayer 
)
private

◆ draw() [14/20]

void KIGFX::SCH_PAINTER::draw ( const SCH_PIN aPin,
int  aLayer,
bool  aDimmed 
)
private

Definition at line 865 of file sch_painter.cpp.

References ANGLE_HORIZONTAL, ANGLE_VERTICAL, BITMAP_FONT_SIZE_THRESHOLD, KIGFX::bitmapText(), KIGFX::boxText(), Clamp_Text_PenSize(), CLOCK, CLOCK_LOW, color, KIGFX::drawAltPinModesIcon(), KIGFX::eeconfig(), externalPinDecoSize(), FALLING_EDGE_CLOCK, PIN_LAYOUT_CACHE::GetAltIconBBox(), KIFONT::FONT::GetFont(), SCH_ITEM::GetFontMetrics(), SCH_PIN::GetLayoutCache(), SCH_PIN::GetLength(), SCH_PIN::GetNameTextSize(), SCH_PIN::GetNumberTextSize(), SCH_PIN::GetOperatingPoint(), SCH_ITEM::GetParentSymbol(), GetPenSizeForDemiBold(), PIN_LAYOUT_CACHE::GetPinElectricalTypeInfo(), PIN_LAYOUT_CACHE::GetPinNameInfo(), PIN_LAYOUT_CACHE::GetPinNumberInfo(), SCH_PIN::GetPinRoot(), SCH_PIN::GetPosition(), SCH_PIN::GetShape(), SCH_PIN::GetType(), KIGFX::GAL::GetWorldScale(), GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER, EDA_ITEM::HasFlag(), INPUT_LOW, internalPinDecoSize(), INVERTED, INVERTED_CLOCK, IS_DANGLING, IS_SHOWN_AS_BITMAP, EDA_ITEM::IsBrightened(), SCH_PIN::IsGlobalPower(), KIFONT::FONT::IsOutline(), EDA_ITEM::IsSelected(), SCH_PIN::IsVisible(), KiROUND(), KIGFX::knockoutText(), LAYER_DANGLING, LAYER_HIDDEN, LAYER_OP_CURRENTS, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, LAYER_PRIVATE_NOTES, LAYER_SELECTION_SHADOWS, LINE, PIN_LAYOUT_CACHE::TEXT_INFO::m_Angle, TEXT_ATTRIBUTES::m_Angle, EESCHEMA_SETTINGS::m_Appearance, TEXT_ATTRIBUTES::m_Color, TEXT_ATTRIBUTES::m_Font, PIN_LAYOUT_CACHE::TEXT_INFO::m_HAlign, TEXT_ATTRIBUTES::m_Halign, TEXT_ATTRIBUTES::m_Size, TEXT_ATTRIBUTES::m_StrokeWidth, PIN_LAYOUT_CACHE::TEXT_INFO::m_Text, PIN_LAYOUT_CACHE::TEXT_INFO::m_TextPosition, PIN_LAYOUT_CACHE::TEXT_INFO::m_TextSize, PIN_LAYOUT_CACHE::TEXT_INFO::m_Thickness, PIN_LAYOUT_CACHE::TEXT_INFO::m_VAlign, TEXT_ATTRIBUTES::m_Valign, NONLOGIC, OUTPUT_LOW, PT_NC, PIN_LAYOUT_CACHE::SetRenderParameters(), EESCHEMA_SETTINGS::APPEARANCE::show_hidden_pins, sign(), KIGFX::strokeText(), TARGET_PIN_RADIUS, VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [15/20]

◆ draw() [16/20]

◆ draw() [17/20]

◆ draw() [18/20]

◆ draw() [19/20]

void KIGFX::SCH_PAINTER::draw ( const SCH_TEXT aText,
int  aLayer,
bool  aDimmed 
)
private

Definition at line 1631 of file sch_painter.cpp.

References ANGLE_0, ANGLE_90, ANGLE_VERTICAL, KIGFX::bitmapText(), BOX2< Vec >::Centre(), color, SCH_ITEM::Connection(), KIGFX::eeconfig(), EDA_TEXT::GetAttributes(), BOX2< Vec >::GetBottom(), SCH_TEXT::GetBoundingBox(), EDA_TEXT::GetDrawPos(), EDA_TEXT::GetDrawRotation(), BOX2< Vec >::GetEnd(), SCH_ITEM::GetFontMetrics(), BOX2< Vec >::GetHeight(), SCH_ITEM::GetLayer(), BOX2< Vec >::GetLeft(), SCH_ITEM::GetParentSymbol(), BOX2< Vec >::GetPosition(), SCH_TEXT::GetPosition(), EDA_TEXT::GetRenderCache(), BOX2< Vec >::GetRight(), SCH_TEXT::GetSchematicTextOffset(), SCH_TEXT::GetShownText(), EDA_TEXT::GetTextBox(), EDA_TEXT::GetTextSize(), BOX2< Vec >::GetTop(), GR_TEXT_H_ALIGN_CENTER, GR_TEXT_H_ALIGN_INDETERMINATE, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER, BOX2< Vec >::Inflate(), IS_SHOWN_AS_BITMAP, EDA_ITEM::IsBrightened(), SCH_CONNECTION::IsBus(), SCH_ITEM::IsConnectivityDirty(), EDA_ITEM::IsForceVisible(), SCH_TEXT::IsHypertext(), KIFONT::FONT::IsOutline(), SCH_ITEM::IsPrivate(), EDA_ITEM::IsRollover(), EDA_ITEM::IsSelected(), EDA_TEXT::IsVisible(), KiROUND(), LAYER_BUS, LAYER_DEVICE, LAYER_GLOBLABEL, LAYER_HIDDEN, LAYER_HIERLABEL, LAYER_HOVERED, LAYER_LOCLABEL, LAYER_NETCLASS_REFS, LAYER_NOTES, LAYER_SELECTION_SHADOWS, LAYER_SHEETLABEL, TEXT_ATTRIBUTES::m_Angle, TEXT_ATTRIBUTES::m_Halign, TEXT_ATTRIBUTES::m_StrokeWidth, TEXT_ATTRIBUTES::m_Underlined, TEXT_ATTRIBUTES::m_Valign, SCH_ITEM::RenderAsBitmap(), RotatePoint(), SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_LABEL_T, SCH_SHEET_PIN_T, SCH_TEXT_T, KIGFX::strokeText(), EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [20/20]

◆ Draw()

bool KIGFX::SCH_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 143 of file sch_painter.cpp.

References draw().

◆ drawAnchor()

void KIGFX::SCH_PAINTER::drawAnchor ( const VECTOR2I aPos,
bool  aDrawingShadows 
)
private

◆ drawDanglingIndicator()

void KIGFX::SCH_PAINTER::drawDanglingIndicator ( const VECTOR2I aPos,
const COLOR4D aColor,
int  aWidth,
bool  aDangling,
bool  aDrawingShadows,
bool  aBrightened 
)
private

◆ drawItemBoundingBox()

◆ drawPinDanglingIndicator()

void KIGFX::SCH_PAINTER::drawPinDanglingIndicator ( const SCH_PIN aPin,
const COLOR4D aColor,
bool  aDrawingShadows,
bool  aBrightened 
)
private

◆ expandLibItemTextVars()

wxString KIGFX::SCH_PAINTER::expandLibItemTextVars ( const wxString &  aSourceText,
const SCH_SYMBOL aSymbolContext 
)
private

Definition at line 2149 of file sch_painter.cpp.

References ExpandTextVars(), and SCH_SYMBOL::ResolveTextVar().

◆ externalPinDecoSize()

int KIGFX::SCH_PAINTER::externalPinDecoSize ( const SCH_PIN aPin)
private

Definition at line 764 of file sch_painter.cpp.

References SCH_PIN::GetNumberTextSize().

◆ getFont()

KIFONT::FONT * KIGFX::SCH_PAINTER::getFont ( const EDA_TEXT aText) const
private

◆ getLineWidth()

float KIGFX::SCH_PAINTER::getLineWidth ( const SCH_ITEM aItem,
bool  aDrawingShadows,
bool  aDrawingWireColorHighlights = false 
) const
private

◆ getOperatingPointTextSize()

int KIGFX::SCH_PAINTER::getOperatingPointTextSize ( ) const
private

Definition at line 544 of file sch_painter.cpp.

References std::abs(), KiROUND(), EDA_IU_SCALE::MilsToIU(), and schIUScale.

◆ getRenderColor()

◆ GetSettings()

virtual SCH_RENDER_SETTINGS * KIGFX::SCH_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 76 of file sch_painter.h.

References m_schSettings.

◆ getShadowWidth()

◆ getTextThickness()

float KIGFX::SCH_PAINTER::getTextThickness ( const SCH_ITEM aItem) const
private

◆ internalPinDecoSize()

int KIGFX::SCH_PAINTER::internalPinDecoSize ( const SCH_PIN aPin)
private

Definition at line 753 of file sch_painter.cpp.

References SCH_PIN::GetNameTextSize(), and SCH_PIN::GetNumberTextSize().

◆ isUnitAndConversionShown()

bool KIGFX::SCH_PAINTER::isUnitAndConversionShown ( const SCH_ITEM aItem) const
private

◆ nonCached()

bool KIGFX::SCH_PAINTER::nonCached ( const EDA_ITEM aItem)
private

Definition at line 281 of file sch_painter.cpp.

References EDA_ITEM::IsSelected().

◆ 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.

◆ SetSchematic()

void KIGFX::SCH_PAINTER::SetSchematic ( SCHEMATIC aSchematic)
inline

Definition at line 78 of file sch_painter.h.

References m_schematic.

◆ triLine()

void KIGFX::SCH_PAINTER::triLine ( const VECTOR2D a,
const VECTOR2D b,
const VECTOR2D c 
)
private

Definition at line 699 of file sch_painter.cpp.

Member Data Documentation

◆ g_ScaledSelectionTypes

std::vector< KICAD_T > KIGFX::SCH_PAINTER::g_ScaledSelectionTypes
static
Initial value:
= {
}
@ SCH_LINE_T
Definition: typeinfo.h:163
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:160
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_FIELD_T
Definition: typeinfo.h:150
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:171
@ SCH_SHEET_T
Definition: typeinfo.h:174
@ SCH_MARKER_T
Definition: typeinfo.h:158
@ SCH_SHAPE_T
Definition: typeinfo.h:149
@ SCH_RULE_AREA_T
Definition: typeinfo.h:170
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:169
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:162
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:173
@ SCH_TEXT_T
Definition: typeinfo.h:151
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_BITMAP_T
Definition: typeinfo.h:164
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
@ SCH_PIN_T
Definition: typeinfo.h:153

Definition at line 133 of file sch_painter.h.

Referenced by SCH_BASE_FRAME::RefreshZoomDependentItems().

◆ m_gal

◆ m_schematic

SCHEMATIC* KIGFX::SCH_PAINTER::m_schematic
private

Definition at line 137 of file sch_painter.h.

Referenced by SetSchematic().

◆ m_schSettings

SCH_RENDER_SETTINGS KIGFX::SCH_PAINTER::m_schSettings
private

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