KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphics_abstraction_layer.cpp
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) 2012 Torsten Hueter, torstenhtr <at> gmx.de
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * Graphics Abstraction Layer (GAL) - base class
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#include <wx/log.h>
24#include <advanced_config.h>
26#include <gal/definitions.h>
27#include <font/font.h>
28
31
32#include <math/util.h> // for KiROUND
33
34#include <algorithm>
35#include <deque>
36#include <cmath>
37#include <limits>
38
39using namespace KIGFX;
40
41
42GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
43 m_options( aDisplayOptions ),
44
45 // m_currentNativeCursor is initialized with KICURSOR::DEFAULT value to avoid
46 // if comparison with uninitialized value on SetNativeCursorStyle method.
47 // Some classes inheriting from GAL has different SetNativeCursorStyle method
48 // implementation and therefore it's called also on constructor
49 // to change the value from DEFAULT to KICURSOR::ARROW
51{
52 // Set the default values for the internal variables
53 SetIsFill( false );
54 SetIsStroke( true );
55 SetFillColor( COLOR4D( 0.0, 0.0, 0.0, 0.0 ) );
56 SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
57 SetLookAtPoint( VECTOR2D( 0, 0 ) );
58 SetZoomFactor( 1.0 );
59 SetRotation( 0.0 );
60
61 // this value for SetWorldUnitLength is only suitable for Pcbnew.
62 // Other editors/viewer must call SetWorldUnitLength with their internal units
63 SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
64
65 // wxDC::GetPPI() reports 96 DPI, but somehow this value
66 // is the closest match to the legacy renderer
67 SetScreenDPI( ADVANCED_CFG::GetCfg().m_ScreenDPI );
69 SetLayerDepth( 0.0 );
70 SetFlip( false, false );
71 SetLineWidth( 1.0f );
72 SetMinLineWidth( 1.0f );
74 SetAxesEnabled( false );
75
76 // Set grid defaults
77 SetGridVisibility( true );
78 SetCoarseGrid( 10 );
79 m_gridLineWidth = 0.5f;
82
83 // Initialize the cursor shape
84 SetCursorColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
87 m_cursorInCanvas = false;
88 SetCursorEnabled( false );
89
90 // Initialize the native widget to an arrow cursor
92
93 // Initialize text properties
95
96 // subscribe for settings updates
97 m_observerLink = m_options.Subscribe( this );
98}
99
100
102{
103}
104
105
107{
108 // defer to the child class first
109 updatedGalDisplayOptions( aOptions );
110
111 // there is no refresh to do at this level
112}
113
114
115void GAL::DrawEllipse( const VECTOR2D& aCenterPoint, double aMajorRadius, double aMinorRadius,
116 const EDA_ANGLE& aRotation )
117{
118 const VECTOR2I intCenter( KiROUND( aCenterPoint.x ), KiROUND( aCenterPoint.y ) );
119
120 SHAPE_ELLIPSE e( intCenter, KiROUND( aMajorRadius ), KiROUND( aMinorRadius ), aRotation );
121
122 SHAPE_LINE_CHAIN chain = e.ConvertToPolyline( std::max( 1, KiROUND( aMajorRadius / 500.0 ) ) );
124}
125
126
127void GAL::DrawEllipseArc( const VECTOR2D& aCenterPoint, double aMajorRadius, double aMinorRadius,
128 const EDA_ANGLE& aRotation, const EDA_ANGLE& aStartAngle, const EDA_ANGLE& aEndAngle )
129{
130 const VECTOR2I intCenter( KiROUND( aCenterPoint.x ), KiROUND( aCenterPoint.y ) );
131
132 SHAPE_ELLIPSE e( intCenter, KiROUND( aMajorRadius ), KiROUND( aMinorRadius ), aRotation, aStartAngle, aEndAngle );
133
134 SHAPE_LINE_CHAIN chain = e.ConvertToPolyline( std::max( 1, KiROUND( aMajorRadius / 500.0 ) ) );
136}
137
138
140{
141 bool refresh = false;
142
143 if( m_options.m_gridStyle != m_gridStyle )
144 {
145 m_gridStyle = m_options.m_gridStyle;
146 refresh = true;
147 }
148
149 if( m_options.m_gridLineWidth != m_gridLineWidth )
150 {
151 m_gridLineWidth = m_options.m_scaleFactor * m_options.m_gridLineWidth + 0.25;
152 refresh = true;
153 }
154
155 if( m_options.m_gridMinSpacing != m_gridMinSpacing )
156 {
157 m_gridMinSpacing = m_options.m_gridMinSpacing;
158 refresh = true;
159 }
160
161 {
162 // For now we only allow 10 or none, but it could be made adjustable (e.g. 5?)
163 const int newInterval = m_options.m_gridShowMajor ? 10 : 0;
164 if( m_gridTick != newInterval )
165 {
166 m_gridTick = newInterval;
167 refresh = true;
168 }
169 }
170
171 if( m_options.m_axesEnabled != m_axesEnabled )
172 {
173 m_axesEnabled = m_options.m_axesEnabled;
174 refresh = true;
175 }
176
177 if( m_options.m_forceDisplayCursor != m_forceDisplayCursor )
178 {
179 m_forceDisplayCursor = m_options.m_forceDisplayCursor;
180 refresh = true;
181 }
182
183 if( m_options.GetCursorMode() != m_crossHairMode )
184 {
185 m_crossHairMode = m_options.GetCursorMode();
186 refresh = true;
187 }
188
189 // tell the derived class if the base class needs an update or not
190 return refresh;
191}
192
193
194void GAL::DrawTrack( const VECTOR2D& aStart, const VECTOR2D& aEnd,
195 double aWidth, const COLOR4D& aColor )
196{
197 SetFillColor( aColor );
198 SetStrokeColor( aColor );
199 SetIsFill( true );
200 SetIsStroke( false );
201 DrawSegment( aStart, aEnd, aWidth );
202}
203
204
206{
207 // Tiny but non-zero - this will always need setting
208 // there is no built-in default
209 SetGlyphSize( { 1, 1 } );
210
213
214 SetFontBold( false );
215 SetFontItalic( false );
216 SetFontUnderlined( false );
217 SetTextMirrored( false );
218}
219
220
222{
224
225 MATRIX3x3D translation;
226 translation.SetIdentity();
227 // We're deliberately dividing integers to avoid fractional pixel offsets.
228 const VECTOR2I layoutSize = GetLayoutPixelSize();
229 translation.SetTranslation( VECTOR2D( layoutSize.x / 2, layoutSize.y / 2 ) );
230
231 MATRIX3x3D rotate;
232 rotate.SetIdentity();
233 rotate.SetRotation( m_rotation );
234
236 scale.SetIdentity();
237 scale.SetScale( VECTOR2D( m_worldScale, m_worldScale ) );
238
239 MATRIX3x3D flip;
240 flip.SetIdentity();
241 flip.SetScale( VECTOR2D( m_globalFlipX ? -1.0 : 1.0, m_globalFlipY ? -1.0 : 1.0 ) );
242
243 MATRIX3x3D lookat;
244 lookat.SetIdentity();
245 lookat.SetTranslation( -m_lookAtPoint );
246
247 m_worldScreenMatrix = translation * rotate * flip * scale * lookat;
249}
250
251
253{
254 const MATRIX3x3D& matrix = GetScreenWorldMatrix();
255
256 VECTOR2D halfSize = VECTOR2D( matrix.GetScale().x * m_screenSize.x * 0.5,
257 matrix.GetScale().y * m_screenSize.y * 0.5 );
258
259 BOX2D extents;
260 extents.SetOrigin( GetLookAtPoint() - halfSize );
261 extents.SetSize( halfSize * 2 );
262
263 return extents;
264}
265
266
268{
269 // just return the current value. This could be cleverer and take
270 // into account other settings in future
271 return m_gridMinSpacing;
272}
273
274
275void GAL::SetGridSources( std::vector<GRID_SOURCE> aSources )
276{
277 std::stable_sort( aSources.begin(), aSources.end(),
278 []( const GRID_SOURCE& a, const GRID_SOURCE& b )
279 {
280 return a.TakesPrecedenceOver( b );
281 } );
282
283 m_gridSources = std::move( aSources );
284}
285
286
288{
289 const VECTOR2D corners[4] = { m_screenWorldMatrix * VECTOR2D( 0, 0 ),
293
294 const double co = std::cos( aSrc.orientation );
295 const double so = std::sin( aSrc.orientation );
296
297 BOX2D bbox;
298
299 for( const VECTOR2D& w : corners )
300 {
301 const VECTOR2D off = w - aSrc.origin;
302 bbox.Merge( VECTOR2D( co * off.x - so * off.y, so * off.x + co * off.y ) );
303 }
304
305 return bbox;
306}
307
308
310{
311 GRID_LATTICE lattice;
312 lattice.tick = aSrc.tick > 0 ? aSrc.tick : static_cast<unsigned>( m_gridTick );
313 lattice.extent = aSrc.extent;
314
315 const double threshold =
317
318 if( aSrc.kind == GRID_SOURCE::KIND::POLAR )
319 {
320 if( aSrc.unbounded )
321 {
322 const BOX2D screen = gridScreenBBox( aSrc );
323 const double farX = std::max( std::abs( screen.GetLeft() ), std::abs( screen.GetRight() ) );
324 const double farY = std::max( std::abs( screen.GetTop() ), std::abs( screen.GetBottom() ) );
325
326 // Bleed past the farthest corner
327 lattice.extent = VECTOR2D( std::hypot( farX, farY ) * 1.01, 2 * M_PI );
328 }
329
330 lattice.pitch.x = AutoSparsePitch( aSrc.pitch.x, lattice.tick, threshold );
331 lattice.pitch.y = aSrc.pitch.y;
332
333 if( lattice.extent.x > 0.0 )
334 lattice.pitch.y = AutoSparsePitch( aSrc.pitch.y, lattice.tick, threshold / lattice.extent.x );
335 }
336 else
337 {
338 // Both axes thin out by the same factor, which keeps the cells' shape
339 const double minPitch = std::min( aSrc.pitch.x, aSrc.pitch.y );
340 const double sparse = AutoSparsePitch( minPitch, lattice.tick, threshold ) / minPitch;
341
342 lattice.pitch = VECTOR2D( aSrc.pitch.x * sparse, aSrc.pitch.y * sparse );
343 }
344
345 return lattice;
346}
347
348
350{
351 COLOR4D color = aSrc.color.a > 0 ? aSrc.color : m_gridColor;
352
353 if( aSrc.highlighted )
355
356 return color;
357}
358
359
361{
362 Save();
363 Translate( aSrc.origin );
364
365 // GAL rotation is counterclockwise and grid orientation clockwise on the screen
366 Rotate( -aSrc.orientation );
367
368 const double rMax = aSrc.extent.x;
369 const double phiMax = aSrc.extent.y;
370
371 if( aSrc.unbounded )
372 {
373 const BOX2D screen = gridScreenBBox( aSrc );
374
375 DrawRectangle( screen.GetOrigin(), screen.GetEnd() );
376 }
377 else if( aSrc.kind == GRID_SOURCE::KIND::CARTESIAN )
378 {
379 DrawRectangle( -aSrc.extent, aSrc.extent );
380 }
381 else if( rMax > 0.0 && phiMax >= 2 * M_PI - 1e-6 )
382 {
383 DrawCircle( VECTOR2D( 0, 0 ), rMax );
384 }
385 else if( rMax > 0.0 && phiMax > 0.0 )
386 {
387 const int segments = std::max( 16, static_cast<int>( phiMax / ( M_PI / 16 ) ) );
388 std::deque<VECTOR2D> sector;
389
390 sector.emplace_back( 0.0, 0.0 );
391
392 for( int ii = 0; ii <= segments; ++ii )
393 {
394 const double phi = phiMax * ii / segments;
395 sector.emplace_back( rMax * std::cos( phi ), rMax * std::sin( phi ) );
396 }
397
398 sector.emplace_back( 0.0, 0.0 );
399 DrawPolygon( sector );
400 }
401
402 Restore();
403}
404
405
406VECTOR2D GAL::GetGridPoint( const VECTOR2D& aPoint ) const
407{
408 // m_gridSources is precedence-ordered by SetGridSources, so the first cursor-snap
409 // source covering aPoint is the one that owns it.
410 for( const GRID_SOURCE& src : m_gridSources )
411 {
412 if( src.snapCursor && src.Contains( aPoint ) )
413 return src.Snap( aPoint );
414 }
415
416 // Display-grid fallback. Grid size 0 = no grid, return aPoint unchanged.
417 double cx = m_gridSize.x > 0.0 ? KiROUND( ( aPoint.x - m_gridOffset.x ) / m_gridSize.x ) *
419 : aPoint.x;
420 double cy = m_gridSize.y > 0.0 ? KiROUND( ( aPoint.y - m_gridOffset.y ) / m_gridSize.y ) *
422 : aPoint.y;
423
424 return VECTOR2D( cx, cy );
425}
426
427
428// MIN_DEPTH must be set to be - (VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER))
429// MAX_DEPTH must be set to be VIEW::VIEW_MAX_LAYERS + abs(VIEW::TOP_LAYER_MODIFIER) -1
430// VIEW_MAX_LAYERS and TOP_LAYER_MODIFIER are defined in view.h.
431// TOP_LAYER_MODIFIER is set as -VIEW_MAX_LAYERS
432// Currently KIGFX::VIEW::VIEW_MAX_LAYERS = MAX_LAYERS_FOR_VIEW
434const int GAL::MAX_DEPTH = 2*MAX_LAYERS_FOR_VIEW - 1;
435const int GAL::GRID_DEPTH = MAX_DEPTH - 1;
436
437
439{
440 COLOR4D color = m_cursorColor;
441
442 // dim the cursor if it's only on because it was forced
443 // (this helps to provide a hint for active tools)
444 if( !m_isCursorEnabled )
445 color.a = color.a * 0.5;
446
447 return color;
448}
449
450
451void GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle )
452{
454
455 if( aText.IsEmpty() )
456 return;
457
459 attrs.m_Angle = aAngle;
460 attrs.m_Mirrored = m_globalFlipX; // Prevent text flipping when view is flipped
461
462 // Bitmap font has different metrics than the stroke font so we compensate a bit before
463 // stroking
464 attrs.m_Size = VECTOR2I( m_attributes.m_Size.x, m_attributes.m_Size.y * 0.95 );
465 attrs.m_StrokeWidth = GetLineWidth() * 0.74;
466
467 font->Draw( this, aText, aPosition, attrs, KIFONT::METRICS::Default() );
468}
469
470
471bool GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
472{
473 if( m_currentNativeCursor == aCursor )
474 return false;
475
476 m_currentNativeCursor = aCursor;
477
478 return true;
479}
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:985
BOX2< VECTOR2D > BOX2D
Definition box2.h:918
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
constexpr const Vec GetEnd() const
Definition box2.h:215
constexpr void SetOrigin(const Vec &pos)
Definition box2.h:240
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:597
constexpr void SetSize(const SizeVec &size)
Definition box2.h:251
constexpr coord_type GetLeft() const
Definition box2.h:231
constexpr const Vec & GetOrigin() const
Definition box2.h:213
constexpr coord_type GetRight() const
Definition box2.h:220
constexpr coord_type GetTop() const
Definition box2.h:232
constexpr coord_type GetBottom() const
Definition box2.h:225
GAL(GAL_DISPLAY_OPTIONS &aOptions)
FONT is an abstract base class for both outline and stroke fonts.
Definition font.h:94
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
Definition font.cpp:144
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
Draw a string.
Definition font.cpp:243
static const METRICS & Default()
Definition font.cpp:49
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
COLOR4D & Brighten(double aFactor)
Makes the color brighter by a given factor.
Definition color4d.h:206
double a
Alpha component.
Definition color4d.h:394
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void DrawEllipseArc(const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle)
Draw an elliptical arc in world coordinates.
bool m_isCursorEnabled
Is the cursor enabled?
virtual void Rotate(double aAngle)
Rotate the context.
BOX2D GetVisibleWorldExtents() const
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
MATRIX3x3D m_worldScreenMatrix
World transformation.
COLOR4D gridSourceColor(const GRID_SOURCE &aSrc) const
The colour a grid source is drawn in, brightened while it is being edited.
void SetVerticalJustify(const GR_TEXT_V_ALIGN_T aVerticalJustify)
void SetFontBold(const bool aBold)
MATRIX3x3D m_screenWorldMatrix
Screen transformation.
void SetFontUnderlined(bool aUnderlined)
virtual VECTOR2I GetLayoutPixelSize() const
Return the size the view is centred in and panned by.
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
bool m_axesEnabled
Should the axes be drawn.
void SetRotation(double aRotation)
Get/set the rotation angle (in radians).
float m_gridLineWidth
Line width of the grid.
void SetFlip(bool xAxis, bool yAxis)
Sets flipping of the screen.
VECTOR2I m_screenSize
Screen size in screen (wx logical) coordinates.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
void OnGalDisplayOptionsChanged(const GAL_DISPLAY_OPTIONS &aOptions) override
Handler for observer settings changes.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
void SetCursorEnabled(bool aCursorEnabled)
Enable/disable cursor.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
virtual bool SetNativeCursorStyle(KICURSOR aCursor, bool aHiDPI)
Set the cursor in the native panel.
GRID_STYLE m_gridStyle
Grid display style.
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
COLOR4D m_cursorColor
Cursor color.
int m_gridMinSpacing
Minimum screen size of the grid (pixels) below which the grid is not drawn.
const VECTOR2D & GetLookAtPoint() const
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void Restore()
Restore the context.
void SetZoomFactor(double aZoomFactor)
void computeWorldScale()
Compute the scaling factor for the world->screen matrix.
GRID_LATTICE gridLattice(const GRID_SOURCE &aSrc) const
Thin a grid source's pitch out until its lines are far enough apart on screen.
void drawGridCoverageShape(const GRID_SOURCE &aSrc)
Draw the area a grid source covers in its own frame with the current fill and stroke.
TEXT_ATTRIBUTES m_attributes
void ResetTextAttributes()
Reset text attributes to default styling.
static const int MIN_DEPTH
Possible depth range.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
double m_rotation
Rotation transformation (radians)
VECTOR2D m_gridSize
The grid size.
COLOR4D getCursorColor() const
Get the actual cursor color to draw.
void SetTextMirrored(const bool aMirrored)
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
void SetCoarseGrid(int aInterval)
Draw every tick line wider.
virtual bool updatedGalDisplayOptions(const GAL_DISPLAY_OPTIONS &aOptions)
Handle updating display options.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
BOX2D gridScreenBBox(const GRID_SOURCE &aSrc) const
VECTOR2D m_gridOffset
The grid offset to compensate cursor position.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
int m_gridTick
Every tick line gets the double width.
double m_worldScale
The scale factor world->screen.
void SetGridSources(std::vector< GRID_SOURCE > aSources)
Set the grid-source list rendered alongside the display grid.
void SetLookAtPoint(const VECTOR2D &aPoint)
Get/set the Point in world space to look at.
VECTOR2D GetGridPoint(const VECTOR2D &aPoint) const
For a given point it returns the nearest point belonging to the grid in world coordinates.
bool m_cursorInCanvas
Is the cursor inside the drawing canvas?
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
virtual void SetMinLineWidth(float aLineWidth)
Set the minimum line width in pixels.
KICURSOR m_currentNativeCursor
Current cursor.
bool m_globalFlipY
Flag for Y axis flipping.
static const int GRID_DEPTH
Depth level on which the grid is drawn.
void SetGlyphSize(const VECTOR2I aSize)
virtual void ComputeWorldScreenMatrix()
Compute the world <-> screen transformation matrix.
virtual void DrawTrack(const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth, const COLOR4D &aColor)
Draw a filled track capsule in aColor without touching the fill and stroke state.
COLOR4D m_gridColor
Color of the grid.
double computeMinGridSpacing() const
Compute minimum grid spacing from the grid settings.
void SetFontItalic(bool aItalic)
std::vector< GRID_SOURCE > m_gridSources
Sources overlayed on the display grid.
virtual void DrawEllipse(const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation)
Draw a closed ellipse.
GAL_DISPLAY_OPTIONS & m_options
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
float GetLineWidth() const
Get the line width.
virtual void Save()
Save the context.
bool m_globalFlipX
Flag for X axis flipping.
KIGFX::CROSS_HAIR_MODE m_crossHairMode
Crosshair drawing mode.
void SetDepthRange(const VECTOR2D &aDepthRange)
Set the range of the layer depth.
VECTOR2D m_lookAtPoint
Point to be looked at in world space.
void SetScreenDPI(double aScreenDPI)
Set the dots per inch of the screen.
bool m_forceDisplayCursor
Always show cursor.
static const int MAX_DEPTH
void SetIdentity()
Set the matrix to the identity matrix.
Definition matrix3x3.h:236
void SetRotation(T aAngle)
Set the rotation components of the matrix.
Definition matrix3x3.h:271
void SetScale(VECTOR2< T > aScale)
Set the scale components of the matrix.
Definition matrix3x3.h:283
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition matrix3x3.h:291
void SetTranslation(VECTOR2< T > aTranslation)
Set the translation components of the matrix.
Definition matrix3x3.h:252
SHAPE_LINE_CHAIN ConvertToPolyline(int aMaxError) const
Build a polyline approximation of the ellipse or arc.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
EDA_ORIENTATION m_Angle
KICURSOR
Definition cursors.h:41
@ ARROW
Definition cursors.h:43
#define MAX_LAYERS_FOR_VIEW
Definition definitions.h:41
MATRIX3x3< double > MATRIX3x3D
Definition matrix3x3.h:469
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:30
@ SMALL_CROSS
Use small cross instead of dots for the grid.
@ LINES
Use lines for the grid.
constexpr double GRID_SELECTED_BRIGHTEN
How far the grid being edited is lifted above its own colour.
double AutoSparsePitch(double aPitch, unsigned aTick, double aThreshold)
Multiply aPitch by aTick until it exceeds aThreshold, so a sub-threshold grid still shows every Nth l...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:461
const int scale
double orientation
Rotation about origin, radians CCW.
VECTOR2D extent
Cartesian: (dx, dy) = size/2 from origin.
VECTOR2D pitch
Cartesian: (dx, dy); polar: (dr, dPhi rad).
VECTOR2D origin
The spacing of a grid source's lattice as it is drawn at the current zoom.
VECTOR2D extent
as GRID_SOURCE::extent, with an unbounded polar grid reaching past the screen
unsigned tick
every tick-th line is a major one
VECTOR2D pitch
along x and y, or of radius and angle for a polar grid
Render-time projection of a grid: GRID_GEOMETRY (kind/origin/pitch/orientation/extent) plus rendering...
unsigned tick
Major-tick interval (0 = inherit default).
bool highlighted
Render with edit-mode emphasis (selected grid).
bool unbounded
No extent; visible range derived from screen corners.
const SHAPE_LINE_CHAIN chain
@ GR_TEXT_H_ALIGN_CENTER
@ GR_TEXT_V_ALIGN_CENTER
#define M_PI
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR2< double > VECTOR2D
Definition vector2d.h:707