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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef SCH_PAINTER_H
28#define SCH_PAINTER_H
29
30#include <sch_render_settings.h>
31#include <sch_symbol.h>
32
33#include <gal/painter.h>
34
35
36class SCH_PIN;
37class LIB_SYMBOL;
38class SCH_SYMBOL;
39class SCH_FIELD;
40class SCH_GROUP;
41class SCH_JUNCTION;
42class SCH_LABEL;
43class SCH_TEXT;
44class SCH_TEXTBOX;
45class SCH_TABLE;
46class SCH_HIERLABEL;
48class SCH_GLOBALLABEL;
49class SCH_SHEET;
50class SCH_SHEET_PIN;
51class SCH_SHAPE;
52class SCH_MARKER;
53class SCH_NO_CONNECT;
54class SCH_LINE;
56class SCH_BITMAP;
57class SCHEMATIC;
58
59namespace KIGFX
60{
61class GAL;
62class SCH_PAINTER;
63
64
68class SCH_PAINTER : public PAINTER
69{
70public:
71 SCH_PAINTER( GAL* aGal );
72
74 virtual bool Draw( const VIEW_ITEM*, int ) override;
75
77 virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
78
79 void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
80
81private:
82 void drawItemBoundingBox( const EDA_ITEM* aItem );
83 void draw( const EDA_ITEM*, int, bool aDimmed );
84 void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
85 void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
86 int aBodyStyle = 0, bool aDimmed = false );
87 void draw( const SCH_SYMBOL* aSymbol, int aLayer );
88 void draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed );
89 void draw( const SCH_JUNCTION* aJct, int aLayer );
90 void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
91 void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
92 void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
93 void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
94 void draw( const SCH_LABEL* aLabel, int aLayer, bool aDimmed );
95 void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer, bool aDimmed );
96 void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
97 void draw( const SCH_GLOBALLABEL* aLabel, int aLayer, bool aDimmed );
98 void draw( const SCH_SHEET* aSheet, int aLayer );
99 void draw( const SCH_NO_CONNECT* aNC, int aLayer );
100 void draw( const SCH_MARKER* aMarker, int aLayer );
101 void draw( const SCH_BITMAP* aBitmap, int aLayer );
102 void draw( const SCH_LINE* aLine, int aLayer );
103 void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
104 void draw( const SCH_GROUP* aGroup, int aLayer );
105
106 void drawPinDanglingIndicator( const SCH_PIN& aPin, const COLOR4D& aColor, bool aDrawingShadows,
107 bool aBrightened );
108
109 void drawLocalPowerIcon( const VECTOR2D& aPos, double aSize, bool aRotate,
110 const COLOR4D& aColor, bool aDrawingShadows, bool aBrightened );
115 void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
116 bool aDangling, bool aDrawingShadows, bool aBrightened );
117
119 void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
120
121 int internalPinDecoSize( const SCH_PIN &aPin );
122 int externalPinDecoSize( const SCH_PIN &aPin );
123
125 bool nonCached( const EDA_ITEM* aItem );
126
127 bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
128
129 float getShadowWidth( bool aForHighlight ) const;
130 COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
131 bool aDimmed = false, bool aIgnoreNets = false ) const;
132 KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
133 float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows,
134 bool aDrawingWireColorHighlights = false ) const;
135 float getTextThickness( const SCH_ITEM* aItem ) const;
136
137 int getOperatingPointTextSize() const;
138
139 void triLine( const VECTOR2D& a, const VECTOR2D& b, const VECTOR2D& c );
140
141 wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
142
143public:
144 static std::vector<KICAD_T> g_ScaledSelectionTypes;
145
146private:
149};
150
151}; // namespace KIGFX
152
153
154#endif // SCH_PAINTER_H
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:97
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition: eda_text.h:79
FONT is an abstract base class for both outline and stroke fonts.
Definition: font.h:131
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Abstract interface for drawing on a 2D-surface.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:59
Contains methods for drawing schematic-specific items.
Definition: sch_painter.h:69
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:77
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
Definition: sch_painter.h:144
SCHEMATIC * m_schematic
Definition: sch_painter.h:148
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:79
SCH_RENDER_SETTINGS m_schSettings
Definition: sch_painter.h:147
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:86
Define a library symbol object.
Definition: lib_symbol.h:85
Holds all the data relating to one schematic.
Definition: schematic.h:87
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:38
A set of SCH_ITEMs (i.e., without duplicates).
Definition: sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet_pin.h:66
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:47
Schematic symbol object.
Definition: sch_symbol.h:75
The Cairo implementation of the graphics abstraction layer.
Definition: eda_group.h:33