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, see <https://www.gnu.org/licenses/>.
19 */
20
21#pragma once
22
23#include <memory>
24
25#include <core/mirror.h>
26#include <geometry/ellipse.h>
30#include <properties/property.h>
31#include <stroke_params.h>
32#include <trigo.h>
33#include <api/serializable.h>
34
35class LINE_READER;
36class EDA_DRAW_FRAME;
37class FOOTPRINT;
38class MSG_PANEL_ITEM;
39struct EDA_IU_SCALE;
40
41using KIGFX::COLOR4D;
42
55
56
57// WARNING: Do not change these values without updating dialogs that depend on their position values
58enum class FILL_T : int
59{
62 FILLED_WITH_BG_BODYCOLOR, //< Fill with background body color.
63 FILLED_WITH_COLOR, //< Fill with a separate color.
67};
68
69
78
79
88
89
95
96
97class EDA_SHAPE : public SERIALIZABLE
98{
99public:
100 EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill );
101
103 EDA_SHAPE( const SHAPE& aShape );
104
105 EDA_SHAPE( const EDA_SHAPE& aOther );
106 EDA_SHAPE& operator=( const EDA_SHAPE& aOther );
107
108 EDA_SHAPE( EDA_SHAPE&& ) noexcept = default;
109 EDA_SHAPE& operator=( EDA_SHAPE&& ) noexcept = default;
110
111 virtual ~EDA_SHAPE();
112
113 void SwapShape( EDA_SHAPE* aImage );
114
115 void Serialize( google::protobuf::Any &aContainer ) const override;
116 bool Deserialize( const google::protobuf::Any &aContainer ) override;
117
118 void Serialize( google::protobuf::Any &aContainer, const EDA_IU_SCALE& aScale ) const;
119 bool Deserialize( const google::protobuf::Any& aContainer, const EDA_IU_SCALE& aScale );
120
121 wxString ShowShape() const;
122
123 wxString SHAPE_T_asString() const;
124
125 virtual bool IsProxyItem() const { return m_proxyItem; }
126 virtual void SetIsProxyItem( bool aIsProxy = true ) { m_proxyItem = aIsProxy; }
127
128 bool IsAnyFill() const
129 {
130 return GetFillMode() != FILL_T::NO_FILL;
131 }
132
139
140 bool IsHatchedFill() const
141 {
142 return GetFillMode() == FILL_T::HATCH
145 }
146
147 virtual bool IsFilledForHitTesting() const
148 {
149 return IsSolidFill();
150 }
151
152 virtual void SetFilled( bool aFlag )
153 {
154 setFilled( aFlag );
155 }
156
157 void SetFillMode( FILL_T aFill );
158 FILL_T GetFillMode() const { return m_fill; }
159
162
164 const SHAPE_POLY_SET& GetHatching() const;
165 const std::vector<SEG>& GetHatchLines() const;
166
167 bool IsClosed() const;
168
169 COLOR4D GetFillColor() const { return m_fillColor; }
170 void SetFillColor( const COLOR4D& aColor ) { m_fillColor = aColor; }
171
172 virtual void SetWidth( int aWidth );
173 virtual int GetWidth() const { return m_stroke.GetWidth(); }
174 virtual int GetEffectiveWidth() const { return GetWidth(); }
175 virtual int GetHatchLineWidth() const { return GetEffectiveWidth(); }
176 virtual int GetHatchLineSpacing() const { return GetHatchLineWidth() * 10; }
177
178 void SetLineStyle( const LINE_STYLE aStyle );
179 LINE_STYLE GetLineStyle() const;
180
181 void SetLineColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); }
182 COLOR4D GetLineColor() const { return m_stroke.GetColor(); }
183
184 virtual void SetShape( SHAPE_T aShape ) { m_shape = aShape; }
185 SHAPE_T GetShape() const { return m_shape; }
186
190 const VECTOR2I& GetStart() const { return m_start; }
191 int GetStartY() const { return m_start.y; }
192 int GetStartX() const { return m_start.x; }
193
194 virtual void SetStart( const VECTOR2I& aStart )
195 {
196 m_start = aStart;
197 m_endsSwapped = false;
198 m_hatchingDirty = true;
199 }
200
201 void SetStartY( int y )
202 {
203 VECTOR2I s = m_start;
204 s.y = y;
205 SetStart( s );
206 }
207
208 void SetStartX( int x )
209 {
210 VECTOR2I s = m_start;
211 s.x = x;
212 SetStart( s );
213 }
214
215 void SetCenterY( int y )
216 {
217 VECTOR2I newStart = m_start;
218 VECTOR2I newEnd = m_end;
219 newEnd.y += y - m_start.y;
220 newStart.y = y;
221 SetStart( newStart );
222 SetEnd( newEnd );
223 m_hatchingDirty = true;
224 }
225
226 void SetCenterX( int x )
227 {
228 VECTOR2I newStart = m_start;
229 VECTOR2I newEnd = m_end;
230 newEnd.x += x - m_start.x;
231 newStart.x = x;
232 SetStart( newStart );
233 SetEnd( newEnd );
234 m_hatchingDirty = true;
235 }
236
240 const VECTOR2I& GetEnd() const { return m_end; }
241 int GetEndY() const { return m_end.y; }
242 int GetEndX() const { return m_end.x; }
243
244 virtual void SetEnd( const VECTOR2I& aEnd )
245 {
246 m_end = aEnd;
247 m_endsSwapped = false;
248 m_hatchingDirty = true;
249 }
250
251 void SetEndY( int aY )
252 {
253 VECTOR2I e = m_end;
254 e.y = aY;
255 SetEnd( e );
256 }
257
258 void SetEndX( int aX )
259 {
260 VECTOR2I e = m_end;
261 e.x = aX;
262 SetEnd( e );
263 }
264
265 void SetRadius( int aX )
266 {
267 SetEnd( m_start + VECTOR2I( aX, 0 ) );
268 m_hatchingDirty = true;
269 }
270
271 virtual VECTOR2I GetTopLeft() const { return GetStart(); }
272 virtual VECTOR2I GetBotRight() const { return GetEnd(); }
273
274 virtual void SetTop( int val ) { SetStartY( val ); }
275 virtual void SetLeft( int val ) { SetStartX( val ); }
276 virtual void SetRight( int val ) { SetEndX( val ); }
277 virtual void SetBottom( int val ) { SetEndY( val ); }
278
279 virtual void SetBezierC1( const VECTOR2I& aPt ) { m_bezierC1 = aPt; }
280 const VECTOR2I& GetBezierC1() const { return m_bezierC1; }
281
282 virtual void SetBezierC2( const VECTOR2I& aPt ) { m_bezierC2 = aPt; }
283 const VECTOR2I& GetBezierC2() const { return m_bezierC2; }
284
285 virtual void SetEllipseCenter( const VECTOR2I& aPt )
286 {
287 m_ellipse.Center = aPt;
288 m_hatchingDirty = true;
290 }
291
292 const VECTOR2I& GetEllipseCenter() const { return m_ellipse.Center; }
293
294 virtual void SetEllipseMajorRadius( int aR )
295 {
296 m_ellipse.MajorRadius = aR;
297 m_hatchingDirty = true;
299 }
300
301 int GetEllipseMajorRadius() const { return m_ellipse.MajorRadius; }
302
303 virtual void SetEllipseMinorRadius( int aR )
304 {
305 m_ellipse.MinorRadius = aR;
306 m_hatchingDirty = true;
308 }
309
310 int GetEllipseMinorRadius() const { return m_ellipse.MinorRadius; }
311
312 virtual void SetEllipseRotation( const EDA_ANGLE& aA )
313 {
314 m_ellipse.Rotation = aA;
315 m_hatchingDirty = true;
317 }
318
319 EDA_ANGLE GetEllipseRotation() const { return m_ellipse.Rotation; }
320
321 // Meaningful only when m_shape == SHAPE_T::ELLIPSE_ARC.
322 virtual void SetEllipseStartAngle( const EDA_ANGLE& aA )
323 {
324 m_ellipse.StartAngle = aA;
325 m_hatchingDirty = true;
327 }
328
329 EDA_ANGLE GetEllipseStartAngle() const { return m_ellipse.StartAngle; }
330
331 virtual void SetEllipseEndAngle( const EDA_ANGLE& aA )
332 {
333 m_ellipse.EndAngle = aA;
334 m_hatchingDirty = true;
336 }
337
338 EDA_ANGLE GetEllipseEndAngle() const { return m_ellipse.EndAngle; }
339
342 const ELLIPSE<int>& GetEllipse() const { return m_ellipse; }
343
344 VECTOR2I getCenter() const;
345 void SetCenter( const VECTOR2I& aCenter );
346
354 void SetArcAngleAndEnd( const EDA_ANGLE& aAngle, bool aCheckNegativeAngle = false );
355
356 EDA_ANGLE GetArcAngle() const;
357
359
365 bool EndsSwapped() const { return m_endsSwapped; }
366
367 // Some attributes are read only, since they are derived from m_Start, m_End, and m_Angle.
368 // No Set...() function for these attributes.
369
370 VECTOR2I GetArcMid() const;
371 std::vector<VECTOR2I> GetRectCorners() const;
372 virtual std::vector<VECTOR2I> GetCornersInSequence( EDA_ANGLE angle ) const;
373
378 void CalcArcAngles( EDA_ANGLE& aStartAngle, EDA_ANGLE& aEndAngle ) const;
379
380 int GetRadius() const;
381
388 void SetArcGeometry( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
389
401 void SetCachedArcData( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd,
402 const VECTOR2I& aCenter );
403
404 const std::vector<VECTOR2I>& GetBezierPoints() const { return m_bezierPoints; }
405
412 std::vector<VECTOR2I> GetPolyPoints() const;
413
417 int GetPointCount() const;
418
420 const SHAPE_POLY_SET& GetPolyShape() const;
421
425 bool IsPolyShapeValid() const;
426
427 virtual void SetPolyShape( const SHAPE_POLY_SET& aShape )
428 {
429 GetPolyShape() = aShape;
430
431 for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
432 {
433 if( GetPolyShape().HoleCount( ii ) )
434 {
436 break;
437 }
438 }
439 }
440
441 void SetPolyPoints( const std::vector<VECTOR2I>& aPoints );
442
451 void RebuildBezierToSegmentsPointsList( int aMaxError );
453
462 virtual std::vector<SHAPE*> MakeEffectiveShapes( bool aEdgeOnly = false ) const
463 {
464 return makeEffectiveShapes( aEdgeOnly );
465 }
466
467 virtual std::vector<SHAPE*> MakeEffectiveShapesForHitTesting() const
468 {
469 return makeEffectiveShapes( false, false, true );
470 }
471
472 void ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList );
473
474 void SetRectangleHeight( const int& aHeight );
475
476 void SetRectangleWidth( const int& aWidth );
477
478 void SetRectangle( const long long int& aHeight, const long long int& aWidth );
479
480 void SetCornerRadius( int aRadius );
481 int GetCornerRadius() const;
482
483 bool IsClockwiseArc() const;
484
488 double GetLength() const;
489
490 int GetRectangleHeight() const;
491 int GetRectangleWidth() const;
492
493 virtual void UpdateHatching() const;
494
507 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance, int aError,
508 ERROR_LOC aErrorLoc, bool ignoreLineWidth = false,
509 bool includeFill = false ) const;
510
511 int Compare( const EDA_SHAPE* aOther ) const;
512
513 double Similarity( const EDA_SHAPE& aOther ) const;
514
515 bool operator==( const EDA_SHAPE& aOther ) const;
516
517protected:
518 wxString getFriendlyName() const;
519
520 void setPosition( const VECTOR2I& aPos );
521 VECTOR2I getPosition() const;
522
523 virtual void setFilled( bool aFlag )
524 {
526 }
527
529 {
530 return SHAPE_POLY_SET();
531 }
532
533 void move( const VECTOR2I& aMoveVector );
534 void rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle );
535 void flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection );
536 void scale( double aScale );
537
538 virtual EDA_ANGLE getDrawRotation() const { return ANGLE_0; }
539
540 const BOX2I getBoundingBox() const;
541
542 void computeArcBBox( BOX2I& aBBox ) const;
543
544 bool hitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
545 bool hitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const;
546 bool hitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const;
547
548 const std::vector<VECTOR2I> buildBezierToSegmentsPointsList( int aMaxError ) const;
549
550 void beginEdit( const VECTOR2I& aStartPoint );
551 bool continueEdit( const VECTOR2I& aPosition );
552 void calcEdit( const VECTOR2I& aPosition );
553
559 void endEdit( bool aClosed = true );
560 void setEditState( int aState ) { m_editState = aState; }
561
562 virtual bool isMoving() const { return false; }
563
574 // fixme: move to shape_compound
575 std::vector<SHAPE*> makeEffectiveShapes( bool aEdgeOnly, bool aLineChainOnly = false,
576 bool aHittesting = false ) const;
577
579
583
584 virtual int getMaxError() const { return 100; }
585
586 // non-const for PCB_SHAPE
587 SHAPE_POLY_SET& hatching() const;
588 std::vector<SEG>& hatchLines() const;
589
590protected:
591 bool m_endsSwapped; // true if start/end were swapped e.g. SetArcAngleAndEnd
592 SHAPE_T m_shape; // Shape: line, Circle, Arc
593 STROKE_PARAMS m_stroke; // Line style, width, etc.
596
597 mutable std::unique_ptr<EDA_SHAPE_HATCH_CACHE_DATA> m_hatchingCache;
598 mutable bool m_hatchingDirty;
599
600 long long int m_rectangleHeight;
601 long long int m_rectangleWidth;
603
604 VECTOR2I m_start; // Line start point or Circle center
605 VECTOR2I m_end; // Line end point or Circle 3 o'clock point
606
607 VECTOR2I m_arcCenter; // Used only for Arcs: arc end point
608 ARC_MID m_arcMidData; // Used to store originating data
609
610 VECTOR2I m_bezierC1; // Bezier Control Point 1
611 VECTOR2I m_bezierC2; // Bezier Control Point 2
612
613 std::vector<VECTOR2I> m_bezierPoints;
614 ELLIPSE<int> m_ellipse; // Used only for ELLIPSE / ELLIPSE_ARC
615 mutable std::unique_ptr<SHAPE_POLY_SET> m_poly; // Stores the S_POLYGON shape
616
618 bool m_proxyItem; // A shape storing proxy information (ie: a pad
619 // number box, thermal spoke template, etc.)
620};
621
625
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:918
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
virtual int GetHatchLineSpacing() const
Definition eda_shape.h:176
EDA_ANGLE GetArcAngle() const
SHAPE_T m_shape
Definition eda_shape.h:592
virtual void SetEnd(const VECTOR2I &aEnd)
Definition eda_shape.h:244
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:208
int GetEllipseMinorRadius() const
Definition eda_shape.h:310
bool m_proxyItem
Definition eda_shape.h:618
int m_cornerRadius
Definition eda_shape.h:602
bool m_hatchingDirty
Definition eda_shape.h:598
bool m_endsSwapped
Definition eda_shape.h:591
const VECTOR2I & GetBezierC2() const
Definition eda_shape.h:283
const VECTOR2I & GetEllipseCenter() const
Definition eda_shape.h:292
void SetCenter(const VECTOR2I &aCenter)
VECTOR2I getCenter() const
int GetStartY() const
Definition eda_shape.h:191
void SetFillModeProp(UI_FILL_MODE)
int m_editState
Definition eda_shape.h:617
virtual int getMaxError() const
Definition eda_shape.h:584
virtual VECTOR2I GetTopLeft() const
Definition eda_shape.h:271
void rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle)
const std::vector< VECTOR2I > buildBezierToSegmentsPointsList(int aMaxError) const
const SHAPE_POLY_SET & GetHatching() const
EDA_ANGLE GetEllipseEndAngle() const
Definition eda_shape.h:338
FILL_T GetFillMode() const
Definition eda_shape.h:158
void SetCornerRadius(int aRadius)
long long int m_rectangleHeight
Definition eda_shape.h:600
int GetEllipseMajorRadius() const
Definition eda_shape.h:301
std::unique_ptr< EDA_SHAPE_HATCH_CACHE_DATA > m_hatchingCache
Definition eda_shape.h:597
void SetEndY(int aY)
Definition eda_shape.h:251
virtual int GetEffectiveWidth() const
Definition eda_shape.h:174
std::vector< VECTOR2I > GetPolyPoints() const
Duplicate the polygon outlines into a flat list of VECTOR2I points.
ELLIPSE< int > m_ellipse
Definition eda_shape.h:614
COLOR4D GetLineColor() const
Definition eda_shape.h:182
EDA_SHAPE(EDA_SHAPE &&) noexcept=default
int GetEndX() const
Definition eda_shape.h:242
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:201
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
Definition eda_shape.h:462
SHAPE_POLY_SET & GetPolyShape()
void SetCenterY(int y)
Definition eda_shape.h:215
void CalcArcAngles(EDA_ANGLE &aStartAngle, EDA_ANGLE &aEndAngle) const
Calc arc start and end angles such that aStartAngle < aEndAngle.
virtual std::vector< VECTOR2I > GetCornersInSequence(EDA_ANGLE angle) const
EDA_ANGLE GetEllipseRotation() const
Definition eda_shape.h:319
void ShapeGetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
virtual bool isMoving() const
Definition eda_shape.h:562
virtual void SetEllipseEndAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:331
bool operator==(const EDA_SHAPE &aOther) const
int GetRadius() const
SHAPE_T GetShape() const
Definition eda_shape.h:185
virtual void SetBezierC2(const VECTOR2I &aPt)
Definition eda_shape.h:282
virtual VECTOR2I GetBotRight() const
Definition eda_shape.h:272
virtual void SetBottom(int val)
Definition eda_shape.h:277
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:140
virtual SHAPE_POLY_SET getHatchingKnockouts() const
Definition eda_shape.h:528
VECTOR2I m_arcCenter
Definition eda_shape.h:607
void SetCenterX(int x)
Definition eda_shape.h:226
virtual void SetBezierC1(const VECTOR2I &aPt)
Definition eda_shape.h:279
virtual void SetFilled(bool aFlag)
Definition eda_shape.h:152
virtual void SetTop(int val)
Definition eda_shape.h:274
virtual bool IsFilledForHitTesting() const
Definition eda_shape.h:147
virtual void SetEllipseRotation(const EDA_ANGLE &aA)
Definition eda_shape.h:312
bool continueEdit(const VECTOR2I &aPosition)
wxString ShowShape() const
ARC_MID m_arcMidData
Definition eda_shape.h:608
void SetFillColor(const COLOR4D &aColor)
Definition eda_shape.h:170
int GetEndY() const
Definition eda_shape.h:241
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:258
virtual int GetHatchLineWidth() const
Definition eda_shape.h:175
bool IsSolidFill() const
Definition eda_shape.h:133
void flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
EDA_SHAPE(SHAPE_T aType, int aLineWidth, FILL_T aFill)
Definition eda_shape.cpp:53
std::vector< SEG > & hatchLines() const
void beginEdit(const VECTOR2I &aStartPoint)
VECTOR2I m_start
Definition eda_shape.h:604
int GetPointCount() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition eda_shape.h:240
bool IsClosed() const
void SetRadius(int aX)
Definition eda_shape.h:265
LINE_STYLE GetLineStyle() const
void endEdit(bool aClosed=true)
Finish editing the shape.
virtual void SetEllipseCenter(const VECTOR2I &aPt)
Definition eda_shape.h:285
virtual void SetEllipseMinorRadius(int aR)
Definition eda_shape.h:303
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition eda_shape.h:190
virtual void SetEllipseMajorRadius(int aR)
Definition eda_shape.h:294
void SetLineColor(const COLOR4D &aColor)
Definition eda_shape.h:181
COLOR4D GetFillColor() const
Definition eda_shape.h:169
void SetRectangle(const long long int &aHeight, const long long int &aWidth)
virtual void SetShape(SHAPE_T aShape)
Definition eda_shape.h:184
void SwapShape(EDA_SHAPE *aImage)
std::vector< VECTOR2I > GetRectCorners() const
std::vector< VECTOR2I > m_bezierPoints
Definition eda_shape.h:613
bool IsAnyFill() const
Definition eda_shape.h:128
void setPosition(const VECTOR2I &aPos)
virtual std::vector< SHAPE * > MakeEffectiveShapesForHitTesting() const
Definition eda_shape.h:467
virtual void setFilled(bool aFlag)
Definition eda_shape.h:523
EDA_ANGLE GetEllipseStartAngle() const
Definition eda_shape.h:329
const std::vector< VECTOR2I > & GetBezierPoints() const
Definition eda_shape.h:404
virtual bool IsProxyItem() const
Definition eda_shape.h:125
void computeArcBBox(BOX2I &aBBox) const
virtual void UpdateHatching() const
bool EndsSwapped() const
Have the start and end points been swapped since they were set?
Definition eda_shape.h:365
void SetRectangleWidth(const int &aWidth)
virtual void SetEllipseStartAngle(const EDA_ANGLE &aA)
Definition eda_shape.h:322
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:275
double GetLength() const
wxString SHAPE_T_asString() const
int GetStartX() const
Definition eda_shape.h:192
double Similarity(const EDA_SHAPE &aOther) const
const VECTOR2I & GetBezierC1() const
Definition eda_shape.h:280
VECTOR2I m_end
Definition eda_shape.h:605
const BOX2I getBoundingBox() const
virtual EDA_ANGLE getDrawRotation() const
Definition eda_shape.h:538
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:173
VECTOR2I getPosition() const
bool IsClockwiseArc() const
STROKE_PARAMS m_stroke
Definition eda_shape.h:593
void SetHatchingDirty()
Definition eda_shape.h:163
void setEditState(int aState)
Definition eda_shape.h:560
void RebuildBezierToSegmentsPointsList()
Definition eda_shape.h:452
void SetPolyPoints(const std::vector< VECTOR2I > &aPoints)
wxString getFriendlyName() const
EDA_SHAPE & operator=(const EDA_SHAPE &aOther)
VECTOR2I m_bezierC1
Definition eda_shape.h:610
FILL_T m_fill
Definition eda_shape.h:594
COLOR4D m_fillColor
Definition eda_shape.h:595
virtual void SetWidth(int aWidth)
EDA_ANGLE GetSegmentAngle() const
virtual void SetRight(int val)
Definition eda_shape.h:276
int GetCornerRadius() const
void SetFillMode(FILL_T aFill)
std::unique_ptr< SHAPE_POLY_SET > m_poly
Definition eda_shape.h:615
virtual void SetPolyShape(const SHAPE_POLY_SET &aShape)
Definition eda_shape.h:427
virtual void SetIsProxyItem(bool aIsProxy=true)
Definition eda_shape.h:126
virtual void SetStart(const VECTOR2I &aStart)
Definition eda_shape.h:194
long long int m_rectangleWidth
Definition eda_shape.h:601
VECTOR2I m_bezierC2
Definition eda_shape.h:611
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:342
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:101
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition richio.h:62
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
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:124
Simple container to manage line stroke parameters.
static constexpr EDA_ANGLE ANGLE_0
Definition eda_angle.h:411
SHAPE_T
Definition eda_shape.h:44
@ ELLIPSE
Definition eda_shape.h:52
@ SEGMENT
Definition eda_shape.h:46
@ ELLIPSE_ARC
Definition eda_shape.h:53
UI_FILL_MODE
Definition eda_shape.h:71
@ REVERSE_HATCH
Definition eda_shape.h:75
@ SOLID
Definition eda_shape.h:73
@ HATCH
Definition eda_shape.h:74
@ NONE
Definition eda_shape.h:72
@ CROSS_HATCH
Definition eda_shape.h:76
FILL_T
Definition eda_shape.h:59
@ FILLED_WITH_COLOR
Definition eda_shape.h:63
@ NO_FILL
Definition eda_shape.h:60
@ REVERSE_HATCH
Definition eda_shape.h:65
@ HATCH
Definition eda_shape.h:64
@ FILLED_WITH_BG_BODYCOLOR
Definition eda_shape.h:62
@ FILLED_SHAPE
Fill with object color.
Definition eda_shape.h:61
@ CROSS_HATCH
Definition eda_shape.h:66
FLIP_DIRECTION
Definition mirror.h:23
#define DECLARE_ENUM_TO_WXANY(type)
Definition property.h:789
const int scale
LINE_STYLE
Dashed line types.
Holding struct to keep originating midpoint.
Definition eda_shape.h:82
VECTOR2I end
Definition eda_shape.h:85
VECTOR2I center
Definition eda_shape.h:86
VECTOR2I start
Definition eda_shape.h:84
VECTOR2I mid
Definition eda_shape.h:83
SHAPE_POLY_SET hatching
Definition eda_shape.h:92
std::vector< SEG > hatchLines
Definition eda_shape.h:93
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683