KiCad PCB EDA Suite
Loading...
Searching...
No Matches
stroke_params.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <map>
23#include <bitmaps.h>
24#include <units_provider.h>
25#include <gal/color4d.h>
26#include <wx/translation.h>
27#include <geometry/shape.h>
28
29class OUTPUTFORMATTER;
30class MSG_PANEL_ITEM;
31
32namespace KIGFX
33{
34class RENDER_SETTINGS;
35}
36
37
52
53
55{
56 wxString name;
58};
59
60
61// A cover of LINE_STYLE for the properties manager (so that it can have different
62// strings from the normal LINE_STYLE)
72
73
74
78extern const std::map<LINE_STYLE, struct LINE_STYLE_DESC> lineTypeNames;
79
80
81#define DEFAULT_LINE_STYLE_LABEL _( "Solid" )
82#define DEFAULT_WIRE_STYLE_LABEL _( "Default" )
83#define INDETERMINATE_STYLE _( "Leave unchanged" )
84
85
90{
91public:
92 STROKE_PARAMS( int aWidth = 0, LINE_STYLE aLineStyle = LINE_STYLE::DEFAULT,
94 m_width( aWidth ),
95 m_lineStyle( aLineStyle ),
96 m_color( aColor )
97 {
98 }
99
100 int GetWidth() const { return m_width; }
101 void SetWidth( int aWidth ) { m_width = aWidth; }
102
104 void SetLineStyle( LINE_STYLE aLineStyle ) { m_lineStyle = aLineStyle; }
105
106 KIGFX::COLOR4D GetColor() const { return m_color; }
107 void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor; }
108
109 bool operator!=( const STROKE_PARAMS& aOther ) const
110 {
111 return m_width != aOther.m_width
112 || m_lineStyle != aOther.m_lineStyle
113 || m_color != aOther.m_color;
114 }
115
116 void Format( OUTPUTFORMATTER* out, const EDA_IU_SCALE& aIuScale ) const;
117
118 void GetMsgPanelInfo( UNITS_PROVIDER* aUnitsProvider, std::vector<MSG_PANEL_ITEM>& aList,
119 bool aIncludeStyle = true, bool aIncludeWidth = true );
120
121 // Helper functions
122
123 static wxString GetLineStyleToken( LINE_STYLE aStyle );
124
125 static void Stroke( const SHAPE* aShape, LINE_STYLE aLineStyle, int aWidth,
126 const KIGFX::RENDER_SETTINGS* aRenderSettings,
127 const std::function<void( const VECTOR2I& a,
128 const VECTOR2I& b )>& aStroker );
129
130private:
134};
BITMAPS
A list of all bitmap identifiers.
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:398
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
An interface used to output 8 bit text in a convenient way.
Definition richio.h:291
An abstract shape on 2D plane.
Definition shape.h:124
int GetWidth() const
void SetLineStyle(LINE_STYLE aLineStyle)
LINE_STYLE m_lineStyle
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
void GetMsgPanelInfo(UNITS_PROVIDER *aUnitsProvider, std::vector< MSG_PANEL_ITEM > &aList, bool aIncludeStyle=true, bool aIncludeWidth=true)
STROKE_PARAMS(int aWidth=0, LINE_STYLE aLineStyle=LINE_STYLE::DEFAULT, const KIGFX::COLOR4D &aColor=KIGFX::COLOR4D::UNSPECIFIED)
LINE_STYLE GetLineStyle() const
bool operator!=(const STROKE_PARAMS &aOther) const
void Format(OUTPUTFORMATTER *out, const EDA_IU_SCALE &aIuScale) const
KIGFX::COLOR4D GetColor() const
KIGFX::COLOR4D m_color
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
static wxString GetLineStyleToken(LINE_STYLE aStyle)
@ SOLID
Definition eda_shape.h:73
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.
LINE_STYLE
Dashed line types.
WIRE_STYLE
const BITMAPS bitmap
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683