57 bool aDrawingDropShadows,
bool aFlipX,
bool aFlipY )
60 std::vector<wxString> cursorStrings;
70 cursorStrings.push_back(
DimensionLabel( wxT(
"x" ), temp.
x, aUnits ) );
71 cursorStrings.push_back(
DimensionLabel( wxT(
"y" ), temp.
y, aUnits ) );
76 cursorStrings.push_back(
DimensionLabel( wxString::FromUTF8(
"θ" ), degs,
88 if( aDrawingDropShadows )
110 static std::vector<TICK_FORMAT> tickFormats =
128 const auto pixelSpace = aTickSpace * aScale;
133 tickFormat = ( tickFormat + 1 ) % tickFormats.size();
137 return tickFormats[tickFormat];
151 double aMinorTickLen,
EDA_UNITS aUnits,
bool aDrawingDropShadows )
159 int numTicks = (int) std::ceil( aLine.
EuclideanNorm() / tickSpace );
164 double labelAngle = -tickLine.
Angle();
165 double textOffset = 0;
167 if( aDrawingDropShadows )
174 VECTOR2D labelOffset = tickLine.
Resize( majorTickLen - textOffset );
178 textOffset = -textOffset;
179 labelOffset = -labelOffset;
182 if( aLine.
Angle() > 0 )
195 viewport.
Inflate( majorTickLen * 2 );
198 for(
int i = 0; i < numTicks; ++i )
205 double length = aMinorTickLen;
206 bool drawLabel =
false;
224 wxString label =
DimensionLabel( wxEmptyString, tickSpace * i, aUnits,
false );
226 gal->
StrokeText( label, tickPos + labelOffset, labelAngle );
243 double aTickLen,
int aNumDivisions,
bool aDrawingDropShadows )
246 const double backTickSpace = aLine.
EuclideanNorm() / aNumDivisions;
253 viewport.
Inflate( aTickLen * 4 );
256 for(
int i = 0; i < aNumDivisions + 1; ++i )
258 const VECTOR2D backTickPos = aOrigin + aLine.
Resize( backTickSpace * i );
260 if( !viewport.
Contains( backTickPos ) )
264 gal->
DrawLine( backTickPos, backTickPos + backTickVec );
270 bool aFlipX,
bool aFlipY )
272 m_geomMgr( aGeomMgr ),
273 m_userUnits( userUnits ),
320 if( drawingDropShadows )
340 drawBacksideTicks( aView, origin, rulerVec, majorTickLen, 2, drawingDropShadows );
double GetMinDepth() const
Return the minimum depth in the currently used range (the top).
currently selected items overlay
const BOX2I ViewBBox() const override
Return the all the layers within the VIEW the object is painted on.
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Auxiliary items (guides, rule, etc)
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
TEXT_DIMS SetConstantGlyphHeight(KIGFX::GAL *aGal, int aRelativeSize=0)
Set the GAL glyph height to a constant scaled value, so that it always looks the same on screen.
Represent a very simple geometry manager for items that have a start and end point.
the 3d code uses this value
VECTOR2I GetOrigin() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
double RAD2DECIDEG(double rad)
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
wxString DimensionLabel(const wxString &prefix, double aVal, EDA_UNITS aUnits, bool aIncludeUnits=true)
Get a formatted string showing a dimension to a sane precision with an optional prefix and unit suffi...
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
const TWO_POINT_GEOMETRY_MANAGER & m_geomMgr
bool IsImperialUnit(EDA_UNITS aUnit)
virtual void SetLineWidth(float aLineWidth)
Set the line width.
static const double majorTickLengthFactor
static double getTickLineWidth(const TEXT_DIMS &textDims, bool aDrawingDropShadows)
static void drawCursorStrings(KIGFX::VIEW *aView, const VECTOR2D &aCursor, const VECTOR2D &aRulerVec, EDA_UNITS aUnits, bool aDrawingDropShadows, bool aFlipX, bool aFlipY)
const COLOR4D & GetStrokeColor() const
Get the stroke color.
void ResetTextAttributes()
Reset text attributes to default styling.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void PopDepth()
Restore previously stored drawing depth for the depth stack.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
bool Contains(const Vec &aPoint) const
virtual bool IsCairoEngine()
Return true if the GAL engine is a Cairo based type.
static const double midTickLengthFactor
double Angle() const
Compute the angle of the vector.
void drawBacksideTicks(KIGFX::VIEW *aView, const VECTOR2D &aOrigin, const VECTOR2D &aLine, double aTickLen, int aNumDivisions, bool aDrawingDropShadows)
Draw simple ticks on the back of a line such that the line is divided into n parts.
RULER_ITEM(const TWO_POINT_GEOMETRY_MANAGER &m_geomMgr, EDA_UNITS userUnits, bool aFlipX, bool aFlipY)
Return the bounding box of the item covering all its layers.
bool IsMirroredX() const
Return true if view is flipped across the X axis.
const Vec & GetPosition() const
void SetTextMirrored(bool aMirrored)
Set a mirrored property of text.
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
void ViewGetLayers(int aLayers[], int &aCount) const override
void PushDepth()
Store current drawing depth on the depth stack.
A base class for most all the KiCad significant classes used in schematics and boards.
static TICK_FORMAT getTickFormatForScale(double aScale, double &aTickSpace, EDA_UNITS aUnits)
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
const Vec & GetSize() const
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
static const double maxTickDensity
static int getShadowLayer(KIGFX::GAL *aGal)
double GetWorldScale() const
Get the world scale.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
void DrawTextNextToCursor(KIGFX::VIEW *aView, const VECTOR2D &aCursorPos, const VECTOR2D &aTextQuadrant, const std::vector< wxString > &aStrings, bool aDrawingDropShadows)
Draw strings next to the cursor.
void drawTicksAlongLine(KIGFX::VIEW *aView, const VECTOR2D &aOrigin, const VECTOR2D &aLine, double aMinorTickLen, EDA_UNITS aUnits, bool aDrawingDropShadows)
Draw labelled ticks on a line.
Abstract interface for drawing on a 2D-surface.
COLOR4D GetShadowColor(const COLOR4D &aColor)