KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_shape.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) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#pragma once
26
27#include <memory>
28
29#include <core/mirror.h>
30#include <geometry/ellipse.h>
34#include <properties/property.h>
35#include <stroke_params.h>
36#include <trigo.h>
37#include <api/serializable.h>
38
39class LINE_READER;
40class EDA_DRAW_FRAME;
41class FOOTPRINT;
42class MSG_PANEL_ITEM;
43struct EDA_IU_SCALE;
44
45using KIGFX::COLOR4D;
46
59
60
61// WARNING: Do not change these values without updating dialogs that depend on their position values
62enum class FILL_T : int
63{
66 FILLED_WITH_BG_BODYCOLOR, //< Fill with background body color.
67 FILLED_WITH_COLOR, //< Fill with a separate color.
71};
72
73
82
83
92
93
99
100
102{
103public:
104 EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill );
105
107 EDA_SHAPE( const SHAPE& aShape );
108
109 EDA_SHAPE( const EDA_SHAPE& aOther );
110 EDA_SHAPE& operator=( const EDA_SHAPE& aOther );
111
112 EDA_SHAPE( EDA_SHAPE&& ) noexcept = default;
113 EDA_SHAPE& operator=( EDA_SHAPE&& ) noexcept = default;
114
115 virtual ~EDA_SHAPE();
116
117 void SwapShape( EDA_SHAPE* aImage );
118
119 void Serialize( google::protobuf::Any &aContainer ) const override;
120 bool Deserialize( const google::protobuf::Any &aContainer ) override;
121
122 void Serialize( google::protobuf::Any &aContainer, const EDA_IU_SCALE& aScale ) const;
123 bool Deserialize( const google::protobuf::Any& aContainer, const EDA_IU_SCALE& aScale );
124
125 wxString ShowShape() const;
126
127 wxString SHAPE_T_asString() const;
128
129 virtual bool IsProxyItem() const { return m_proxyItem; }
130 virtual void SetIsProxyItem( bool aIsProxy = true ) { m_proxyItem = aIsProxy; }
131
132 bool IsAnyFill() const
133 {
134 return GetFillMode() != FILL_T::NO_FILL;
135 }
136
143
144 bool IsHatchedFill() const
145 {
146 return GetFillMode() == FILL_T::HATCH
149 }
150
151 virtual bool IsFilledForHitTesting() const
152 {
153 return IsSolidFill();
154 }
155
156 virtual void SetFilled( bool aFlag )
157 {
158 setFilled( aFlag );
159 }
160
161 void SetFillMode( FILL_T aFill );
162 FILL_T GetFillMode() const { return m_fill; }
163
166
168 const SHAPE_POLY_SET& GetHatching() const;
169 const std::vector<SEG>& GetHatchLines() const;
170
171 bool IsClosed() const;
172
173 COLOR4D GetFillColor() const { return m_fillColor; }
174 void SetFillColor( const COLOR4D& aColor ) { m_fillColor = aColor; }
175
176 void SetWidth( int aWidth );
177 virtual int GetWidth() const { return m_stroke.GetWidth(); }
178 virtual int GetEffectiveWidth() const { return GetWidth(); }
179 virtual int GetHatchLineWidth() const { return GetEffectiveWidth(); }
180 virtual int GetHatchLineSpacing() const { return GetHatchLineWidth() * 10; }
181
182 void SetLineStyle( const LINE_STYLE aStyle );
183 LINE_STYLE GetLineStyle() const;
184
185 void SetLineColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); }
186 COLOR4D GetLineColor() const { return m_stroke.GetColor(); }
187
188 void SetShape( SHAPE_T aShape ) { m_shape = aShape; }
189 SHAPE_T GetShape() const { return m_shape; }
190
194 const VECTOR2I& GetStart() const { return m_start; }
195 int GetStartY() const { return m_start.y; }
196 int GetStartX() const { return m_start.x; }
197
198 void SetStart( const VECTOR2I& aStart )
199 {
200 m_start = aStart;
201 m_endsSwapped = false;
202 m_hatchingDirty = true;
203 }
204
205 void SetStartY( int y )
206 {
207 m_start.y = y;
208 m_endsSwapped = false;
209 m_hatchingDirty = true;
210 }
211
212 void SetStartX( int x )
213 {
214 m_start.x = x;
215 m_endsSwapped = false;
216 m_hatchingDirty = true;
217 }
218
219 void SetCenterY( int y )
220 {
221 m_end.y += y - m_start.y;
222 m_start.y = y;
223 m_hatchingDirty = true;
224 }
225
226 void SetCenterX( int x )
227 {
228 m_end.x += x - m_start.x;
229 m_start.x = x;
230 m_hatchingDirty = true;
231 }
232
236 const VECTOR2I& GetEnd() const { return m_end; }
237 int GetEndY() const { return m_end.y; }
238 int GetEndX() const { return m_end.x; }
239
240 void SetEnd( const VECTOR2I& aEnd )
241 {
242 m_end = aEnd;
243 m_endsSwapped = false;
244 m_hatchingDirty = true;
245 }
246
247 void SetEndY( int aY )
248 {
249 m_end.y = aY;
250 m_endsSwapped = false;
251 m_hatchingDirty = true;
252 }
253
254 void SetEndX( int aX )
255 {
256 m_end.x = aX;
257 m_endsSwapped = false;
258 m_hatchingDirty = true;
259 }
260
261 void SetRadius( int aX )
262 {
263 m_end = m_start + VECTOR2I( aX, 0 );
264 m_hatchingDirty = true;
265 }
266
267 virtual VECTOR2I GetTopLeft() const { return GetStart(); }
268 virtual VECTOR2I GetBotRight() const { return GetEnd(); }
269
270 virtual void SetTop( int val ) { SetStartY( val ); }
271 virtual void SetLeft( int val ) { SetStartX( val ); }
272 virtual void SetRight( int val ) { SetEndX( val ); }
273 virtual void SetBottom( int val ) { SetEndY( val ); }
274
275 void SetBezierC1( const VECTOR2I& aPt ) { m_bezierC1 = aPt; }
276 const VECTOR2I& GetBezierC1() const { return m_bezierC1; }
277
278 void SetBezierC2( const VECTOR2I& aPt ) { m_bezierC2 = aPt; }
279 const VECTOR2I& GetBezierC2() const { return m_bezierC2; }
280
281 void SetEllipseCenter( const VECTOR2I& aPt )
282 {
283 m_ellipse.Center = aPt;
284 m_hatchingDirty = true;
286 }
287
288 const VECTOR2I& GetEllipseCenter() const { return m_ellipse.Center; }
289
291 {
292 m_ellipse.MajorRadius = aR;
293 m_hatchingDirty = true;
295 }
296
297 int GetEllipseMajorRadius() const { return m_ellipse.MajorRadius; }
298
300 {
301 m_ellipse.MinorRadius = aR;
302 m_hatchingDirty = true;
304 }
305
306 int GetEllipseMinorRadius() const { return m_ellipse.MinorRadius; }
307
309 {
310 m_ellipse.Rotation = aA;
311 m_hatchingDirty = true;
313 }
314
315 EDA_ANGLE GetEllipseRotation() const { return m_ellipse.Rotation; }
316
317 // Meaningful only when m_shape == SHAPE_T::ELLIPSE_ARC.
319 {
320 m_ellipse.StartAngle = aA;
321 m_hatchingDirty = true;
323 }
324
325 EDA_ANGLE GetEllipseStartAngle() const { return m_ellipse.StartAngle; }
326
328 {
329 m_ellipse.EndAngle = aA;
330 m_hatchingDirty = true;
332 }
333
334 EDA_ANGLE GetEllipseEndAngle() const { return m_ellipse.EndAngle; }
335
338 const ELLIPSE<int>& GetEllipse() const { return m_ellipse; }
339
340 VECTOR2I getCenter() const;
341 void SetCenter( const VECTOR2I& aCenter );
342
350 void SetArcAngleAndEnd( const EDA_ANGLE& aAngle, bool aCheckNegativeAngle = false );
351
352 EDA_ANGLE GetArcAngle() const;
353
355
361 bool EndsSwapped() const { return m_endsSwapped; }
362
363 // Some attributes are read only, since they are derived from m_Start, m_End, and m_Angle.
364 // No Set...() function for these attributes.
365
366 VECTOR2I GetArcMid() const;
367 std::vector<VECTOR2I> GetRectCorners() const;
368 std::vector<VECTOR2I> GetCornersInSequence( EDA_ANGLE angle ) const;
369
374 void CalcArcAngles( EDA_ANGLE& aStartAngle, EDA_ANGLE& aEndAngle ) const;
375
376 int GetRadius() const;
377
384 void SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
385
397 void SetCachedArcData( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd,
398 const VECTOR2I& aCenter );
399
400 const std::vector<VECTOR2I>& GetBezierPoints() const { return m_bezierPoints; }
401
408 std::vector<VECTOR2I> GetPolyPoints() const;
409
413 int GetPointCount() const;
414
416 const SHAPE_POLY_SET& GetPolyShape() const;
417
421 bool IsPolyShapeValid() const;
422
423 void SetPolyShape( const SHAPE_POLY_SET& aShape )
424 {
425 GetPolyShape() = aShape;
426
427 for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
428 {
429 if( GetPolyShape().HoleCount( ii ) )
430 {
432 break;
433 }
434 }
435 }
436
437 void SetPolyPoints( const std::vector<VECTOR2I>& aPoints );
438
447 void RebuildBezierToSegmentsPointsList( int aMaxError );
448
457 virtual std::vector<SHAPE*> MakeEffectiveShapes( bool aEdgeOnly = false ) const
458 {
459 return makeEffectiveShapes( aEdgeOnly );
460 }
461
462 virtual std::vector<SHAPE*> MakeEffectiveShapesForHitTesting() const
463 {
464 return makeEffectiveShapes( false, false, true );
465 }
466
467 void ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
468
469 void SetRectangleHeight( const int& aHeight );
470
471 void SetRectangleWidth( const int& aWidth );
472
473 void SetRectangle( const long long int& aHeight, const long long int& aWidth );
474
475 void SetCornerRadius( int aRadius );
476 int GetCornerRadius() const;
477
478 bool IsClockwiseArc() const;
479
483 double GetLength() const;
484
485 int GetRectangleHeight() const;
486 int GetRectangleWidth() const;
487
488 virtual void UpdateHatching() const;
489
502 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
503 ERROR_LOC aErrorLoc, bool ignoreLineWidth = false,
504 bool includeFill = false ) const;
505
506 int Compare( const EDA_SHAPE* aOther ) const;
507
508 double Similarity( const EDA_SHAPE& aOther ) const;
509
510 bool operator==( const EDA_SHAPE& aOther ) const;
511
512protected:
513 wxString getFriendlyName() const;
514
515 void setPosition( const VECTOR2I& aPos );
516 VECTOR2I getPosition() const;
517
518 virtual void setFilled( bool aFlag )
519 {
521 }
522
524 {
525 return SHAPE_POLY_SET();
526 }
527
528 void move( const VECTOR2I& aMoveVector );
529 void rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle );
530 void flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection );
531 void scale( double aScale );
532
533 virtual EDA_ANGLE getDrawRotation() const { return ANGLE_0; }
534
535 const BOX2I getBoundingBox() const;
536
537 void computeArcBBox( BOX2I& aBBox ) const;
538
539 bool hitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
540 bool hitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
541 bool hitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const;
542
543 const std::vector<VECTOR2I> buildBezierToSegmentsPointsList( int aMaxError ) const;
544
545 void beginEdit( const VECTOR2I& aStartPoint );
546 bool continueEdit( const VECTOR2I& aPosition );
547 void calcEdit( const VECTOR2I& aPosition );
548
554 void endEdit( bool aClosed = true );
555 void setEditState( int aState ) { m_editState = aState; }
556
557 virtual bool isMoving() const { return false; }
558
569 // fixme: move to shape_compound
570 std::vector<SHAPE*> makeEffectiveShapes( bool aEdgeOnly, bool aLineChainOnly = false,
571 bool aHittesting = false ) const;
572
574
578
579 virtual int getMaxError() const { return 100; }
580
581 // non-const for PCB_SHAPE
582 SHAPE_POLY_SET& hatching() const;
583 std::vector<SEG>& hatchLines() const;
584
585protected:
586 bool m_endsSwapped; // true if start/end were swapped e.g. SetArcAngleAndEnd
587 SHAPE_T m_shape; // Shape: line, Circle, Arc
588 STROKE_PARAMS m_stroke; // Line style, width, etc.
591
592 mutable std::unique_ptr<EDA_SHAPE_HATCH_CACHE_DATA> m_hatchingCache;
593 mutable bool m_hatchingDirty;
594
595 long long int m_rectangleHeight;
596 long long int m_rectangleWidth;
598
599 VECTOR2I m_start; // Line start point or Circle center
600 VECTOR2I m_end; // Line end point or Circle 3 o'clock point
601
602 VECTOR2I m_arcCenter; // Used only for Arcs: arc end point
603 ARC_MID m_arcMidData; // Used to store originating data
604
605 VECTOR2I m_bezierC1; // Bezier Control Point 1
606 VECTOR2I m_bezierC2; // Bezier Control Point 2
607
608 std::vector<VECTOR2I> m_bezierPoints;
609 ELLIPSE<int> m_ellipse; // Used only for ELLIPSE / ELLIPSE_ARC
610 mutable std::unique_ptr<SHAPE_POLY_SET> m_poly; // Stores the S_POLYGON shape
611
613 bool m_proxyItem; // A shape storing proxy information (ie: a pad
614 // number box, thermal spoke template, etc.)
615};
616
620
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
Generic cubic Bezier representation.
Represent basic circle geometry with utility geometry functions.
Definition circle.h:33
The base class for create windows for drawing purpose.
UI_FILL_MODE GetFillModeProp() const
void SetEllipseRotation(const EDA_ANGLE &aA)
Definition eda_shape.h:308
virtual int GetHatchLineSpacing() const
Definition eda_shape.h:180
EDA_ANGLE GetArcAngle() const
SHAPE_T m_shape
Definition eda_shape.h:587
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false, bool includeFill=false) const
Convert the shape to a closed polygon.
void SetStartX(int x)
Definition eda_shape.h:212
int GetEllipseMinorRadius() const
Definition eda_shape.h:306
bool m_proxyItem
Definition eda_shape.h:613
int m_cornerRadius
Definition eda_shape.h:597
bool m_hatchingDirty
Definition eda_shape.h:593
bool m_endsSwapped
Definition eda_shape.h:586
const VECTOR2I & GetBezierC2() const
Definition eda_shape.h:279
const VECTOR2I & GetEllipseCenter() const
Definition eda_shape.h:288
void SetBezierC2(const VECTOR2I &aPt)
Definition eda_shape.h:278
void SetCenter(const VECTOR2I &aCenter)
VECTOR2I getCenter() const
int GetStartY() const
Definition eda_shape.h:195
void SetFillModeProp(UI_FILL_MODE)
int m_editState
Definition eda_shape.h:612
virtual int getMaxError() const
Definition eda_shape.h:579
virtual VECTOR2I GetTopLeft() const
Definition eda_shape.h:267
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
void SetEllipseCenter(const VECTOR2I &aPt)
Definition eda_shape.h:281
const std::vector< VECTOR2I > buildBezierToSegmentsPointsList(int aMaxError) const
const SHAPE_POLY_SET & GetHatching() const
EDA_ANGLE GetEllipseEndAngle() const
Definition eda_shape.h:334
FILL_T GetFillMode() const
Definition eda_shape.h:162
void SetCornerRadius(int aRadius)
long long int m_rectangleHeight
Definition eda_shape.h:595
int GetEllipseMajorRadius() const
Definition eda_shape.h:297
void SetEllipseStartAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:318
std::unique_ptr< EDA_SHAPE_HATCH_CACHE_DATA > m_hatchingCache
Definition eda_shape.h:592
void SetEndY(int aY)
Definition eda_shape.h:247
virtual int GetEffectiveWidth() const
Definition eda_shape.h:178
std::vector< VECTOR2I > GetPolyPoints() const
Duplicate the polygon outlines into a flat list of VECTOR2I points.
ELLIPSE< int > m_ellipse
Definition eda_shape.h:609
COLOR4D GetLineColor() const
Definition eda_shape.h:186
EDA_SHAPE(EDA_SHAPE &&) noexcept=default
int GetEndX() const
Definition eda_shape.h:238
SHAPE_ELLIPSE buildShapeEllipse() const
std::vector< SHAPE * > makeEffectiveShapes(bool aEdgeOnly, bool aLineChainOnly=false, bool aHittesting=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
int GetRectangleWidth() const
void SetLineStyle(const LINE_STYLE aStyle)
void recalcEllipseArcEndpoints()
When m_shape == ELLIPSE_ARC, recompute m_start/m_end from m_ellipse.
void calcEdit(const VECTOR2I &aPosition)
void SetStartY(int y)
Definition eda_shape.h:205
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition eda_shape.h:457
SHAPE_POLY_SET & GetPolyShape()
void SetCenterY(int y)
Definition eda_shape.h:219
void CalcArcAngles(EDA_ANGLE &aStartAngle, EDA_ANGLE &aEndAngle) const
Calc arc start and end angles such that aStartAngle < aEndAngle.
std::vector< VECTOR2I > GetCornersInSequence(EDA_ANGLE angle) const
EDA_ANGLE GetEllipseRotation() const
Definition eda_shape.h:315
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
virtual bool isMoving() const
Definition eda_shape.h:557
bool operator==(const EDA_SHAPE &aOther) const
int GetRadius() const
SHAPE_T GetShape() const
Definition eda_shape.h:189
void SetPolyShape(const SHAPE_POLY_SET &aShape)
Definition eda_shape.h:423
virtual VECTOR2I GetBotRight() const
Definition eda_shape.h:268
virtual void SetBottom(int val)
Definition eda_shape.h:273
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
const std::vector< SEG > & GetHatchLines() const
void SetRectangleHeight(const int &aHeight)
SHAPE_POLY_SET & hatching() const
bool IsHatchedFill() const
Definition eda_shape.h:144
virtual SHAPE_POLY_SET getHatchingKnockouts() const
Definition eda_shape.h:523
VECTOR2I m_arcCenter
Definition eda_shape.h:602
void SetCenterX(int x)
Definition eda_shape.h:226
virtual void SetFilled(bool aFlag)
Definition eda_shape.h:156
virtual void SetTop(int val)
Definition eda_shape.h:270
virtual bool IsFilledForHitTesting() const
Definition eda_shape.h:151
bool continueEdit(const VECTOR2I &aPosition)
wxString ShowShape() const
void SetEllipseEndAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:327
ARC_MID m_arcMidData
Definition eda_shape.h:603
void SetFillColor(const COLOR4D &aColor)
Definition eda_shape.h:174
int GetEndY() const
Definition eda_shape.h:237
bool hitTest(const VECTOR2I &aPosition, int aAccuracy=0) const
void SetCachedArcData(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCenter)
Set the data used for mid point caching.
void SetEndX(int aX)
Definition eda_shape.h:254
void RebuildBezierToSegmentsPointsList(int aMaxError)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
virtual int GetHatchLineWidth() const
Definition eda_shape.h:179
bool IsSolidFill() const
Definition eda_shape.h:137
void flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
EDA_SHAPE(SHAPE_T aType, int aLineWidth, FILL_T aFill)
Definition eda_shape.cpp:57
std::vector< SEG > & hatchLines() const
void beginEdit(const VECTOR2I &aStartPoint)
VECTOR2I m_start
Definition eda_shape.h:599
int GetPointCount() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:236
bool IsClosed() const
void SetRadius(int aX)
Definition eda_shape.h:261
void SetStart(const VECTOR2I &aStart)
Definition eda_shape.h:198
LINE_STYLE GetLineStyle() const
void endEdit(bool aClosed=true)
Finish editing the shape.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:194
void SetLineColor(const COLOR4D &aColor)
Definition eda_shape.h:185
COLOR4D GetFillColor() const
Definition eda_shape.h:173
void SetRectangle(const long long int &aHeight, const long long int &aWidth)
void SetShape(SHAPE_T aShape)
Definition eda_shape.h:188
void SwapShape(EDA_SHAPE *aImage)
std::vector< VECTOR2I > GetRectCorners() const
std::vector< VECTOR2I > m_bezierPoints
Definition eda_shape.h:608
bool IsAnyFill() const
Definition eda_shape.h:132
void setPosition(const VECTOR2I &aPos)
virtual std::vector< SHAPE * > MakeEffectiveShapesForHitTesting() const
Definition eda_shape.h:462
virtual void setFilled(bool aFlag)
Definition eda_shape.h:518
EDA_ANGLE GetEllipseStartAngle() const
Definition eda_shape.h:325
const std::vector< VECTOR2I > & GetBezierPoints() const
Definition eda_shape.h:400
virtual bool IsProxyItem() const
Definition eda_shape.h:129
void computeArcBBox(BOX2I &aBBox) const
virtual void UpdateHatching() const
void SetEnd(const VECTOR2I &aEnd)
Definition eda_shape.h:240
bool EndsSwapped() const
Have the start and end points been swapped since they were set?
Definition eda_shape.h:361
void SetRectangleWidth(const int &aWidth)
void SetBezierC1(const VECTOR2I &aPt)
Definition eda_shape.h:275
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
virtual void SetLeft(int val)
Definition eda_shape.h:271
double GetLength() const
wxString SHAPE_T_asString() const
int GetStartX() const
Definition eda_shape.h:196
double Similarity(const EDA_SHAPE &aOther) const
const VECTOR2I & GetBezierC1() const
Definition eda_shape.h:276
VECTOR2I m_end
Definition eda_shape.h:600
const BOX2I getBoundingBox() const
virtual EDA_ANGLE getDrawRotation() const
Definition eda_shape.h:533
void SetArcAngleAndEnd(const EDA_ANGLE &aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
int GetRectangleHeight() const
virtual int GetWidth() const
Definition eda_shape.h:177
VECTOR2I getPosition() const
bool IsClockwiseArc() const
STROKE_PARAMS m_stroke
Definition eda_shape.h:588
void SetEllipseMajorRadius(int aR)
Definition eda_shape.h:290
void SetHatchingDirty()
Definition eda_shape.h:167
void setEditState(int aState)
Definition eda_shape.h:555
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
wxString getFriendlyName() const
EDA_SHAPE & operator=(const EDA_SHAPE &aOther)
VECTOR2I m_bezierC1
Definition eda_shape.h:605
FILL_T m_fill
Definition eda_shape.h:589
COLOR4D m_fillColor
Definition eda_shape.h:590
void SetWidth(int aWidth)
EDA_ANGLE GetSegmentAngle() const
virtual void SetRight(int val)
Definition eda_shape.h:272
int GetCornerRadius() const
void SetFillMode(FILL_T aFill)
std::unique_ptr< SHAPE_POLY_SET > m_poly
Definition eda_shape.h:610
virtual void SetIsProxyItem(bool aIsProxy=true)
Definition eda_shape.h:130
long long int m_rectangleWidth
Definition eda_shape.h:596
VECTOR2I m_bezierC2
Definition eda_shape.h:606
void SetEllipseMinorRadius(int aR)
Definition eda_shape.h:299
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
const ELLIPSE< int > & GetEllipse() const
Direct read-only access to the underlying ellipse payload.
Definition eda_shape.h:338
bool IsPolyShapeValid() const
int Compare(const EDA_SHAPE *aOther) const
VECTOR2I GetArcMid() const
Plain ellipse / elliptical-arc data.
Definition ellipse.h:32
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:66
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:54
Interface for objects that can be serialized to Protobuf messages.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
int OutlineCount() const
Return the number of outlines in the set.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
An abstract shape on 2D plane.
Definition shape.h:128
Simple container to manage line stroke parameters.
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
SHAPE_T
Definition eda_shape.h:48
@ ELLIPSE
Definition eda_shape.h:56
@ SEGMENT
Definition eda_shape.h:50
@ ELLIPSE_ARC
Definition eda_shape.h:57
UI_FILL_MODE
Definition eda_shape.h:75
@ REVERSE_HATCH
Definition eda_shape.h:79
@ SOLID
Definition eda_shape.h:77
@ HATCH
Definition eda_shape.h:78
@ NONE
Definition eda_shape.h:76
@ CROSS_HATCH
Definition eda_shape.h:80
FILL_T
Definition eda_shape.h:63
@ FILLED_WITH_COLOR
Definition eda_shape.h:67
@ NO_FILL
Definition eda_shape.h:64
@ REVERSE_HATCH
Definition eda_shape.h:69
@ HATCH
Definition eda_shape.h:68
@ FILLED_WITH_BG_BODYCOLOR
Definition eda_shape.h:66
@ FILLED_SHAPE
Fill with object color.
Definition eda_shape.h:65
@ CROSS_HATCH
Definition eda_shape.h:70
FLIP_DIRECTION
Definition mirror.h:27
#define DECLARE_ENUM_TO_WXANY(type)
Definition property.h:787
const int scale
LINE_STYLE
Dashed line types.
Holding struct to keep originating midpoint.
Definition eda_shape.h:86
VECTOR2I end
Definition eda_shape.h:89
VECTOR2I center
Definition eda_shape.h:90
VECTOR2I start
Definition eda_shape.h:88
VECTOR2I mid
Definition eda_shape.h:87
SHAPE_POLY_SET hatching
Definition eda_shape.h:96
std::vector< SEG > hatchLines
Definition eda_shape.h:97
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687