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#include <set>
29
30#include <gal/painter.h>
31
32
33class SCH_PIN;
34class LIB_SYMBOL;
35class SCH_SYMBOL;
36class SCH_FIELD;
37class SCH_GROUP;
38class SCH_JUNCTION;
39class SCH_LABEL;
40class SCH_TEXT;
41class SCH_TEXTBOX;
42class SCH_TABLE;
43class SCH_HIERLABEL;
45class SCH_GLOBALLABEL;
46class SCH_SHEET;
47class SCH_SHEET_PIN;
48class SCH_SHAPE;
49class SCH_MARKER;
50class SCH_NO_CONNECT;
51class SCH_LINE;
53class SCH_BITMAP;
54class SCHEMATIC;
55
56namespace KIGFX
57{
58class GAL;
59class SCH_PAINTER;
60
61
65class SCH_PAINTER : public PAINTER
66{
67public:
68 SCH_PAINTER( GAL* aGal );
69
71 virtual bool Draw( const VIEW_ITEM*, int ) override;
72
74 virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
75
76 void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
77
78private:
79 void drawItemBoundingBox( const EDA_ITEM* aItem );
80 void draw( const EDA_ITEM*, int, bool aDimmed );
81 void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
82 void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
83 int aBodyStyle = 0, bool aDimmed = false );
84 void draw( const SCH_SYMBOL* aSymbol, int aLayer );
85 void draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed );
86 void draw( const SCH_JUNCTION* aJct, int aLayer );
87 void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
88 void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
89 void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
90 void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
91 void draw( const SCH_LABEL* aLabel, int aLayer, bool aDimmed );
92 void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer, bool aDimmed );
93 void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
94 void draw( const SCH_GLOBALLABEL* aLabel, int aLayer, bool aDimmed );
95 void draw( const SCH_SHEET* aSheet, int aLayer );
96 void draw( const SCH_NO_CONNECT* aNC, int aLayer );
97 void draw( const SCH_MARKER* aMarker, int aLayer );
98 void draw( const SCH_BITMAP* aBitmap, int aLayer );
99 void draw( const SCH_LINE* aLine, int aLayer );
100 void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
101 void draw( const SCH_GROUP* aGroup, int aLayer );
102
103 void drawPinDanglingIndicator( const SCH_PIN& aPin, const COLOR4D& aColor, bool aDrawingShadows,
104 bool aBrightened );
105
106 void drawLocalPowerIcon( const VECTOR2D& aPos, double aSize, bool aRotate,
107 const COLOR4D& aColor, bool aDrawingShadows, bool aBrightened );
112 void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
113 bool aDangling, bool aDrawingShadows, bool aBrightened );
114
116 void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
117
118 int internalPinDecoSize( const SCH_PIN &aPin );
119 int externalPinDecoSize( const SCH_PIN &aPin );
120
122 bool nonCached( const EDA_ITEM* aItem );
123
124 bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
125
126 float getShadowWidth( bool aForHighlight ) const;
127 COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
128 bool aDimmed = false, bool aIgnoreNets = false ) const;
129 KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
130 float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
131 bool aDrawingWireColorHighlights = false ) const;
132 float getTextThickness( const SCH_ITEM* aItem ) const;
133
134 int getOperatingPointTextSize() const;
135
136 void triLine( const VECTOR2D& a, const VECTOR2D& b, const VECTOR2D& c );
137
138 wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
139
140 void drawLine( const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint, LINE_STYLE aLineStyle,
141 bool aDrawDirectLine = false, int aWidth = 0 );
142
143public:
144 static std::vector<KICAD_T> g_ScaledSelectionTypes;
145
146private:
149
151 std::set<const SCH_PIN*> m_netChainTerminalPins;
152};
153
154}; // namespace KIGFX
155
156
157#endif // SCH_PAINTER_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
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:66
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:74
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:76
std::set< const SCH_PIN * > m_netChainTerminalPins
Temporary pins standing in for the highlighted chain's terminals during a symbol draw.
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:119
Holds all the data relating to one schematic.
Definition schematic.h:148
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:165
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
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:48
Schematic symbol object.
Definition sch_symbol.h:75
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
LINE_STYLE
Dashed line types.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682