KiCad PCB EDA Suite
|
#include <preview_items/ruler_item.h>
#include <preview_items/preview_utils.h>
#include <gal/graphics_abstraction_layer.h>
#include <layer_ids.h>
#include <gal/painter.h>
#include <view/view.h>
#include <trigo.h>
Go to the source code of this file.
Classes | |
struct | TICK_FORMAT |
Description of a "tick format" for a scale factor - how many ticks there are between medium/major ticks and how each scale relates to the last one. More... | |
Functions | |
static int | getShadowLayer (KIGFX::GAL *aGal) |
static void | drawCursorStrings (KIGFX::VIEW *aView, const VECTOR2D &aCursor, const VECTOR2D &aRulerVec, const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, bool aDrawingDropShadows, bool aFlipX, bool aFlipY) |
static double | getTickLineWidth (const TEXT_DIMS &textDims, bool aDrawingDropShadows) |
static TICK_FORMAT | getTickFormatForScale (double aScale, double &aTickSpace, EDA_UNITS aUnits) |
void | drawTicksAlongLine (KIGFX::VIEW *aView, const VECTOR2D &aOrigin, const VECTOR2D &aLine, double aMinorTickLen, const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, bool aDrawingDropShadows) |
Draw labelled ticks on a line. | |
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. | |
Variables | |
static const double | maxTickDensity = 10.0 |
static const double | midTickLengthFactor = 1.5 |
static const double | majorTickLengthFactor = 2.5 |
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.
aGal | the GAL to draw on |
aOrigin | start of line to draw ticks on |
aLine | line vector |
aTickLen | length of ticks in IU |
aNumDivisions | number of parts to divide the line into |
Definition at line 267 of file ruler_item.cpp.
References ANGLE_90, BOX2< Vec >::Contains(), KIGFX::GAL::DrawLine(), VECTOR2< T >::EuclideanNorm(), KIGFX::PREVIEW::GetConstantGlyphHeight(), KIGFX::VIEW::GetGAL(), BOX2< Vec >::GetPosition(), BOX2< Vec >::GetSize(), getTickLineWidth(), KIGFX::VIEW::GetViewport(), BOX2< Vec >::Inflate(), KIGFX::VIEW::IsMirroredX(), VECTOR2< T >::Resize(), RotatePoint(), and KIGFX::GAL::SetLineWidth().
Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
|
static |
Definition at line 55 of file ruler_item.cpp.
References EDA_ANGLE::AsDegrees(), DEGREES, KIGFX::PREVIEW::DimensionLabel(), KIGFX::PREVIEW::DrawTextNextToCursor(), VECTOR2< T >::EuclideanNorm(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
void drawTicksAlongLine | ( | KIGFX::VIEW * | aView, |
const VECTOR2D & | aOrigin, | ||
const VECTOR2D & | aLine, | ||
double | aMinorTickLen, | ||
const EDA_IU_SCALE & | aIuScale, | ||
EDA_UNITS | aUnits, | ||
bool | aDrawingDropShadows | ||
) |
Draw labelled ticks on a line.
Ticks are spaced according to a maximum density. Minor ticks are not labelled.
aGal | the GAL to draw on |
aOrigin | start of line to draw ticks on |
aLine | line vector |
aMinorTickLen | length of minor ticks in IU |
Definition at line 150 of file ruler_item.cpp.
References ANGLE_0, ANGLE_180, ANGLE_90, BOX2< Vec >::Contains(), EDA_ANGLE::Cos(), KIFONT::METRICS::Default(), KIGFX::PREVIEW::DimensionLabel(), KIFONT::FONT::Draw(), KIGFX::GAL::DrawLine(), VECTOR2< T >::EuclideanNorm(), KIGFX::PREVIEW::GetConstantGlyphHeight(), KIFONT::FONT::GetFont(), KIGFX::VIEW::GetGAL(), BOX2< Vec >::GetPosition(), BOX2< Vec >::GetSize(), getTickFormatForScale(), KIGFX::VIEW::GetViewport(), KIGFX::GAL::GetWorldScale(), KIGFX::PREVIEW::TEXT_DIMS::GlyphSize, GR_TEXT_H_ALIGN_LEFT, GR_TEXT_H_ALIGN_RIGHT, BOX2< Vec >::Inflate(), KIGFX::VIEW::IsMirroredX(), TEXT_ATTRIBUTES::m_Angle, TEXT_ATTRIBUTES::m_Halign, TEXT_ATTRIBUTES::m_Mirrored, TEXT_ATTRIBUTES::m_Size, TEXT_ATTRIBUTES::m_StrokeWidth, TICK_FORMAT::majorStep, majorTickLengthFactor, TICK_FORMAT::midStep, midTickLengthFactor, VECTOR2< T >::Resize(), RotatePoint(), KIGFX::GAL::SetLineWidth(), KIGFX::PREVIEW::TEXT_DIMS::ShadowWidth, EDA_ANGLE::Sin(), KIGFX::PREVIEW::TEXT_DIMS::StrokeWidth, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
|
static |
Definition at line 46 of file ruler_item.cpp.
References KIGFX::GAL::IsCairoEngine(), LAYER_GP_OVERLAY, and LAYER_SELECT_OVERLAY.
Referenced by KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
|
static |
Definition at line 107 of file ruler_item.cpp.
References TICK_FORMAT::divisionBase, EDA_UNIT_UTILS::IsImperialUnit(), and maxTickDensity.
Referenced by drawTicksAlongLine().
|
static |
Definition at line 84 of file ruler_item.cpp.
References KIGFX::PREVIEW::TEXT_DIMS::ShadowWidth, and KIGFX::PREVIEW::TEXT_DIMS::StrokeWidth.
Referenced by drawBacksideTicks(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
|
static |
Definition at line 36 of file ruler_item.cpp.
Referenced by drawTicksAlongLine(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().
|
static |
Definition at line 34 of file ruler_item.cpp.
Referenced by getTickFormatForScale().
|
static |
Definition at line 35 of file ruler_item.cpp.
Referenced by drawTicksAlongLine(), and KIGFX::PREVIEW::RULER_ITEM::ViewDraw().