KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_painter.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2019-2020 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef SCH_PAINTER_H
24#define SCH_PAINTER_H
25
26#include <sch_render_settings.h>
27#include <sch_symbol.h>
28
29#include <gal/painter.h>
30
31
32class SCH_PIN;
33class LIB_SYMBOL;
34class SCH_SYMBOL;
35class SCH_FIELD;
36class SCH_GROUP;
37class SCH_JUNCTION;
38class SCH_LABEL;
39class SCH_TEXT;
40class SCH_TEXTBOX;
41class SCH_TABLE;
42class SCH_HIERLABEL;
44class SCH_GLOBALLABEL;
45class SCH_SHEET;
46class SCH_SHEET_PIN;
47class SCH_SHAPE;
48class SCH_MARKER;
49class SCH_NO_CONNECT;
50class SCH_LINE;
52class SCH_BITMAP;
53class SCHEMATIC;
54
55namespace KIGFX
56{
57class GAL;
58class SCH_PAINTER;
59
60
64class SCH_PAINTER : public PAINTER
65{
66public:
67 SCH_PAINTER( GAL* aGal );
68
70 virtual bool Draw( const VIEW_ITEM*, int ) override;
71
73 virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
74
75 void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
76
77private:
78 void drawItemBoundingBox( const EDA_ITEM* aItem );
79 void draw( const EDA_ITEM*, int, bool aDimmed );
80 void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
81 void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
82 int aBodyStyle = 0, bool aDimmed = false );
83 void draw( const SCH_SYMBOL* aSymbol, int aLayer );
84 void draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed );
85 void draw( const SCH_JUNCTION* aJct, int aLayer );
86 void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
87 void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
88 void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
89 void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
90 void draw( const SCH_LABEL* aLabel, int aLayer, bool aDimmed );
91 void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer, bool aDimmed );
92 void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
93 void draw( const SCH_GLOBALLABEL* aLabel, int aLayer, bool aDimmed );
94 void draw( const SCH_SHEET* aSheet, int aLayer );
95 void draw( const SCH_NO_CONNECT* aNC, int aLayer );
96 void draw( const SCH_MARKER* aMarker, int aLayer );
97 void draw( const SCH_BITMAP* aBitmap, int aLayer );
98 void draw( const SCH_LINE* aLine, int aLayer );
99 void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
100 void draw( const SCH_GROUP* aGroup, int aLayer );
101
102 void drawPinDanglingIndicator( const SCH_PIN& aPin, const COLOR4D& aColor, bool aDrawingShadows,
103 bool aBrightened );
104
105 void drawLocalPowerIcon( const VECTOR2D& aPos, double aSize, bool aRotate,
106 const COLOR4D& aColor, bool aDrawingShadows, bool aBrightened );
111 void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
112 bool aDangling, bool aDrawingShadows, bool aBrightened );
113
115 void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
116
117 int internalPinDecoSize( const SCH_PIN &aPin );
118 int externalPinDecoSize( const SCH_PIN &aPin );
119
121 bool nonCached( const EDA_ITEM* aItem );
122
123 bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
124
125 float getShadowWidth( bool aForHighlight ) const;
126 COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
127 bool aDimmed = false, bool aIgnoreNets = false ) const;
128 KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
129 float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
130 bool aDrawingWireColorHighlights = false ) const;
131 float getTextThickness( const SCH_ITEM* aItem ) const;
132
133 int getOperatingPointTextSize() const;
134
135 void triLine( const VECTOR2D& a, const VECTOR2D& b, const VECTOR2D& c );
136
137 wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
138
139 void drawLine( const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint, LINE_STYLE aLineStyle,
140 bool aDrawDirectLine = false, int aWidth = 0 );
141
142public:
143 static std::vector<KICAD_T> g_ScaledSelectionTypes;
144
145private:
148};
149
150}; // namespace KIGFX
151
152
153#endif // SCH_PAINTER_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:89
FONT is an abstract base class for both outline and stroke fonts.
Definition font.h:94
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Abstract interface for drawing on a 2D-surface.
PAINTER(GAL *aGal)
Initialize this object for painting on any of the polymorphic GRAPHICS_ABSTRACTION_LAYER* derivatives...
Definition painter.cpp:29
Contains methods for drawing schematic-specific items.
Definition sch_painter.h:65
virtual SCH_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition sch_painter.h:73
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.
void drawPinDanglingIndicator(const SCH_PIN &aPin, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
float getTextThickness(const SCH_ITEM *aItem) const
void drawLocalPowerIcon(const VECTOR2D &aPos, double aSize, bool aRotate, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
Draw an local power pin indicator icon.
float getShadowWidth(bool aForHighlight) const
COLOR4D getRenderColor(const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false, bool aIgnoreNets=false) const
int externalPinDecoSize(const SCH_PIN &aPin)
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
wxString expandLibItemTextVars(const wxString &aSourceText, const SCH_SYMBOL *aSymbolContext)
static std::vector< KICAD_T > g_ScaledSelectionTypes
SCHEMATIC * m_schematic
void drawLine(const VECTOR2I &aStartPoint, const VECTOR2I &aEndPoint, LINE_STYLE aLineStyle, bool aDrawDirectLine=false, int aWidth=0)
int getOperatingPointTextSize() const
float getLineWidth(const SCH_ITEM *aItem, bool aDrawingShadows, bool aDrawingWireColorHighlights=false) const
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
void SetSchematic(SCHEMATIC *aSchematic)
Definition sch_painter.h:75
SCH_RENDER_SETTINGS m_schSettings
void drawAnchor(const VECTOR2I &aPos, bool aDrawingShadows)
Draw anchor indicating the anchor position of text objects, local labels, or fields.
bool nonCached(const EDA_ITEM *aItem)
Indicates the item is drawn on a non-cached layer in OpenGL.
void drawDanglingIndicator(const VECTOR2I &aPos, const COLOR4D &aColor, int aWidth, bool aDangling, bool aDrawingShadows, bool aBrightened)
Draw the target (an open square) for a wire or label which has no connection or is being moved.
void drawItemBoundingBox(const EDA_ITEM *aItem)
int internalPinDecoSize(const SCH_PIN &aPin)
bool isUnitAndConversionShown(const SCH_ITEM *aItem) const
An abstract base class for deriving all objects that can be added to a VIEW.
Definition view_item.h:82
Define a library symbol object.
Definition lib_symbol.h:79
Holds all the data relating to one schematic.
Definition schematic.h:90
Object to handle a bitmap image that can be inserted in a schematic.
Definition sch_bitmap.h:36
Base class for a bus or wire entry.
A set of SCH_ITEMs (i.e., without duplicates).
Definition sch_group.h:48
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:38
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:44
Schematic symbol object.
Definition sch_symbol.h:69
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
LINE_STYLE
Dashed line types.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682