63 double radius = size * 10.0;
71 std::vector<const EDIT_POINT*> anglePoints;
73 for(
unsigned i = 0; i <
m_points->PointsSize(); ++i )
79 anglePoints.push_back( &point );
85 anglePoints.push_back( prev );
88 anglePoints.push_back(
next );
92 std::sort( anglePoints.begin(), anglePoints.end() );
93 anglePoints.erase( std::unique( anglePoints.begin(), anglePoints.end() ), anglePoints.end() );
108 std::vector<AngleInfo> angles;
109 std::map<int, int> angleCount;
116 if( !( prev &&
next ) )
120 SEG seg2( pt->GetPosition(),
next->GetPosition() );
144 angles.push_back(
info );
149 for(
const AngleInfo& angleInfo : angles )
151 bool isCongruent = angleCount[angleInfo.angle.AsTenthsOfADegree()] > 1;
153 if( angleInfo.isRightAngle )
157 VECTOR2D p1 = angleInfo.center + u1;
158 VECTOR2D p2 = angleInfo.center + u2;
159 VECTOR2D corner = angleInfo.center + u1 + u2;
168 double innerRadius =
radius * 0.6;
171 VECTOR2D p1_inner = angleInfo.center + u1_inner;
172 VECTOR2D p2_inner = angleInfo.center + u2_inner;
173 VECTOR2D corner_inner = angleInfo.center + u1_inner + u2_inner;
175 gal->
DrawLine( p1_inner, corner_inner );
176 gal->
DrawLine( p2_inner, corner_inner );
182 gal->
DrawArc( angleInfo.center,
radius, angleInfo.start, angleInfo.sweep );
187 double innerRadius =
radius * 0.7;
188 gal->
DrawArc( angleInfo.center, innerRadius, angleInfo.start, angleInfo.sweep );
192 VECTOR2D textDir( angleInfo.mid.Cos(), angleInfo.mid.Sin() );
193 wxString label = wxString::Format( wxT(
"%.1f°" ), angleInfo.angle.AsDegrees() );
203 double textClearance = ( absX * textSize.
x + absY * textSize.
y ) / 2.0;
204 double textOffset =
radius + borderSize + textClearance;
int AsTenthsOfADegree() const
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
Represent a single point that can be used for modifying items.
static const int POINT_SIZE
Single point size in pixels.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
static const int BORDER_SIZE
Border size when not hovering.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
static const METRICS & Default()
A color representation with 4 components: red, green, blue, alpha.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
const VECTOR2I & GetGlyphSize() const
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void SetGlyphSize(const VECTOR2I aSize)
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
ANGLE_ITEM(EDIT_POINTS *aPoints)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void drawPreviewShape(KIGFX::VIEW *aView) const override
Draw the preview onto the given GAL.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
EDA_ANGLE Angle(const SEG &aOther) const
Determine the smallest angle between two segments.
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc).
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D