46 std::shared_ptr<EDIT_POINTS> points =
m_points.lock();
49 return points->ViewBBox();
56 std::shared_ptr<EDIT_POINTS> points =
m_points.lock();
67 double radius = size * 10.0;
75 std::vector<const EDIT_POINT*> anglePoints;
77 for(
unsigned i = 0; i < points->PointsSize(); ++i )
83 anglePoints.push_back( &point );
89 anglePoints.push_back( prev );
92 anglePoints.push_back(
next );
96 std::sort( anglePoints.begin(), anglePoints.end() );
97 anglePoints.erase( std::unique( anglePoints.begin(), anglePoints.end() ), anglePoints.end() );
112 std::vector<AngleInfo> angles;
113 std::map<int, int> angleCount;
120 if( !( prev &&
next ) )
124 SEG seg2( pt->GetPosition(),
next->GetPosition() );
148 angles.push_back(
info );
153 for(
const AngleInfo& angleInfo : angles )
155 bool isCongruent = angleCount[angleInfo.angle.AsTenthsOfADegree()] > 1;
157 if( angleInfo.isRightAngle )
161 VECTOR2D p1 = angleInfo.center + u1;
162 VECTOR2D p2 = angleInfo.center + u2;
163 VECTOR2D corner = angleInfo.center + u1 + u2;
172 double innerRadius =
radius * 0.6;
175 VECTOR2D p1_inner = angleInfo.center + u1_inner;
176 VECTOR2D p2_inner = angleInfo.center + u2_inner;
177 VECTOR2D corner_inner = angleInfo.center + u1_inner + u2_inner;
179 gal->
DrawLine( p1_inner, corner_inner );
180 gal->
DrawLine( p2_inner, corner_inner );
186 gal->
DrawArc( angleInfo.center,
radius, angleInfo.start, angleInfo.sweep );
191 double innerRadius =
radius * 0.7;
192 gal->
DrawArc( angleInfo.center, innerRadius, angleInfo.start, angleInfo.sweep );
196 VECTOR2D textDir( angleInfo.mid.Cos(), angleInfo.mid.Sin() );
197 wxString label = wxString::Format( wxT(
"%.1f°" ), angleInfo.angle.AsDegrees() );
207 double textClearance = ( absX * textSize.
x + absY * textSize.
y ) / 2.0;
208 double textOffset =
radius + borderSize + textClearance;
int AsTenthsOfADegree() const
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.
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
std::weak_ptr< EDIT_POINTS > m_points
void drawPreviewShape(KIGFX::VIEW *aView) const override
Draw the preview onto the given GAL.
ANGLE_ITEM(const std::shared_ptr< EDIT_POINTS > &aPoints)
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