74 const int minSnapLineLength = 10;
78 const auto drawLineIfNotAlsoSnapLine = [&](
const SEG& aLine )
80 if( !haveSnapLine || !aLine.ApproxCollinear( *
m_snapLine, 1 ) )
92 [&](
const auto& visited )
94 using ItemType = std::decay_t<
decltype( visited )>;
96 if constexpr( std::is_same_v<ItemType, LINE> )
99 std::optional<SEG> segToBoundary =
104 drawLineIfNotAlsoSnapLine( *segToBoundary );
107 else if constexpr( std::is_same_v<ItemType, HALF_LINE> )
110 std::optional<SEG> segToBoundary =
115 drawLineIfNotAlsoSnapLine( *segToBoundary );
118 else if constexpr( std::is_same_v<ItemType, SEG> )
120 drawLineIfNotAlsoSnapLine( visited );
122 else if constexpr( std::is_same_v<ItemType, CIRCLE> )
124 gal.
DrawCircle( visited.Center, visited.Radius );
126 else if constexpr( std::is_same_v<ItemType, SHAPE_ARC> )
128 gal.
DrawArc( visited.GetCenter(), visited.GetRadius(),
129 visited.GetStartAngle(), visited.GetCentralAngle() );
131 else if constexpr( std::is_same_v<ItemType, VECTOR2I> )
143 const int dashSizeBasis = aView->
ToWorld( 12 );
144 const int snapOriginMarkerSize = aView->
ToWorld( 16 );
146 const int omitStartMarkerIfWithinLength = aView->
ToWorld( 8 );
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
constexpr void SetMaximum()
A base class for most all the KiCad significant classes used in schematics and boards.
A color representation with 4 components: red, green, blue, alpha.
std::optional< SEG > m_snapLine
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
COLOR4D m_persistentColor
std::vector< DRAWABLE_INFO > m_drawables
void AddDrawable(const DRAWABLE &aItem, bool aIsPersistent)
std::variant< SEG, LINE, HALF_LINE, CIRCLE, SHAPE_ARC, VECTOR2I > DRAWABLE
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void ViewDraw(int aLayer, VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
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.
Utility functions for drawing compound items (i.e.
@ LAYER_GP_OVERLAY
general purpose overlay
std::optional< SEG > ClipHalfLineToBox(const HALF_LINE &aRay, const BOX2I &aBox)
Get the segment of a half-line that is inside a box, if any.
std::optional< SEG > ClipLineToBox(const LINE &aLine, const BOX2I &aBox)
Get the segment of a line that is inside a box, if any.
The Cairo implementation of the graphics abstraction layer.
void DrawCross(GAL &aGal, const VECTOR2I &aPosition, int aSize)
Draw a cross at a given position.
void DrawDashedLine(GAL &aGal, const SEG &aSeg, double aDashSize)
Draw a dashed line.
Utility functions for working with shapes.
@ NOT_USED
the 3d code uses this value