Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Util::Unit Class Reference

#include <units.h>

Inheritance diagram for Inkscape::Util::Unit:

Public Member Functions

 Unit ()
 
 Unit (UnitType type, double factor, Glib::ustring name, Glib::ustring name_plural, Glib::ustring abbr, Glib::ustring description)
 
void clear ()
 
bool isAbsolute () const
 
int defaultDigits () const
 Returns the suggested precision to use for displaying numbers of this unit.
 
bool compatibleWith (Unit const *u) const
 Checks if a unit is compatible with the specified unit.
 
bool compatibleWith (Glib::ustring const &) const
 
bool compatibleWith (char const *) const
 
bool operator== (Unit const &other) const
 Check if units are equal.
 
int svgUnit () const
 Get SVG unit code.
 
double convert (double from_dist, Unit const *to) const
 Convert value from this unit.
 
double convert (double from_dist, Glib::ustring const &to) const
 
double convert (double from_dist, char const *to) const
 
UnitMetric const * getUnitMetric () const
 Get the ways this unit is subdivided in rulers.
 

Public Attributes

UnitType type
 
double factor
 
Glib::ustring name
 
Glib::ustring name_plural
 
Glib::ustring abbr
 
Glib::ustring description
 
Glib::ustring metric_name
 

Detailed Description

Definition at line 50 of file units.h.

Constructor & Destructor Documentation

◆ Unit() [1/2]

Inkscape::Util::Unit::Unit ( )

Definition at line 150 of file units.cpp.

References Inkscape::Util::UNIT_TYPE_DIMENSIONLESS.

Referenced by clear().

◆ Unit() [2/2]

Inkscape::Util::Unit::Unit ( UnitType  type,
double  factor,
Glib::ustring  name,
Glib::ustring  name_plural,
Glib::ustring  abbr,
Glib::ustring  description 
)

Definition at line 160 of file units.cpp.

References factor.

Member Function Documentation

◆ clear()

void Inkscape::Util::Unit::clear ( )

Definition at line 176 of file units.cpp.

References Unit().

◆ compatibleWith() [1/3]

bool Inkscape::Util::Unit::compatibleWith ( char const *  ) const

◆ compatibleWith() [2/3]

bool Inkscape::Util::Unit::compatibleWith ( Glib::ustring const &  u) const

Definition at line 207 of file units.cpp.

References compatibleWith(), and Inkscape::Util::UnitTable::get().

◆ compatibleWith() [3/3]

bool Inkscape::Util::Unit::compatibleWith ( Unit const *  u) const

Checks if a unit is compatible with the specified unit.

Definition at line 192 of file units.cpp.

References type, and Inkscape::Util::UNIT_TYPE_DIMENSIONLESS.

Referenced by compatibleWith(), Inkscape::Util::Quantity::compatibleWith(), and Inkscape::Preferences::Entry::isConvertibleTo().

◆ convert() [1/3]

double Inkscape::Util::Unit::convert ( double  from_dist,
char const *  to 
) const

Definition at line 248 of file units.cpp.

References convert(), and Inkscape::Util::UnitTable::get().

◆ convert() [2/3]

double Inkscape::Util::Unit::convert ( double  from_dist,
Glib::ustring const &  to 
) const

Definition at line 244 of file units.cpp.

References convert(), and Inkscape::Util::UnitTable::get().

◆ convert() [3/3]

double Inkscape::Util::Unit::convert ( double  from_dist,
Unit const *  to 
) const

Convert value from this unit.

Definition at line 229 of file units.cpp.

References factor, type, and Inkscape::Util::UNIT_TYPE_DIMENSIONLESS.

Referenced by convert(), convert(), Inkscape::Util::Quantity::convert(), and Inkscape::PaperSize::findPaperSize().

◆ defaultDigits()

int Inkscape::Util::Unit::defaultDigits ( ) const

Returns the suggested precision to use for displaying numbers of this unit.

Definition at line 181 of file units.cpp.

References factor.

◆ getUnitMetric()

UnitMetric const * Inkscape::Util::Unit::getUnitMetric ( ) const

Get the ways this unit is subdivided in rulers.

Definition at line 253 of file units.cpp.

References Inkscape::Util::UnitTable::get(), Inkscape::Util::UnitTable::getUnitMetric(), and metric_name.

Referenced by Inkscape::UI::Widget::Ruler::draw_ruler().

◆ isAbsolute()

bool Inkscape::Util::Unit::isAbsolute ( ) const
inline

◆ operator==()

bool Inkscape::Util::Unit::operator== ( Unit const &  other) const

Check if units are equal.

Definition at line 212 of file units.cpp.

References name, and type.

◆ svgUnit()

int Inkscape::Util::Unit::svgUnit ( ) const

Get SVG unit code.

Definition at line 217 of file units.cpp.

References abbr.

Member Data Documentation

◆ abbr

Glib::ustring Inkscape::Util::Unit::abbr

Definition at line 81 of file units.h.

Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup(), Inkscape::UI::Widget::UnitTracker::addUnit(), Inkscape::Util::UnitTable::addUnit(), Inkscape::UI::Widget::calcScaleLineWidth(), Inkscape::UI::Tools::LpeTool::create_measuring_items(), Inkscape::LivePathEffect::LPEMeasureSegments::createLine(), Inkscape::LivePathEffect::LPEMeasureSegments::createTextLabel(), Inkscape::UI::Dialog::Transformation::desktopReplaced(), Inkscape::UI::Dialog::DocumentProperties::display_unit_change(), Inkscape::LivePathEffect::LPETiling::doBeforeEffect(), Inkscape::LivePathEffect::LPEMeasureSegments::doBeforeEffect(), Inkscape::LivePathEffect::LPERuler::doEffect_pwd2(), SPPage::getBleedLabel(), SPPage::getMarginLabel(), Inkscape::LivePathEffect::LPETiling::LPETiling(), Inkscape::Display::SnapIndicator::make_alignment_indicator(), Inkscape::Display::SnapIndicator::make_distribution_indicators(), Inkscape::UI::Toolbar::PageToolbar::PageToolbar(), Inkscape::UI::Widget::UnitTracker::prependUnit(), Inkscape::LivePathEffect::LPERuler::ruler_mark(), Inkscape::UI::Widget::UnitTracker::setActiveUnit(), SPPage::setBleed(), SPNamedView::setDisplayUnit(), SPPage::setMargin(), SPPage::setMarginSide(), Inkscape::UI::Widget::StyleSwatch::setStyle(), Inkscape::UI::Dialog::SingleExport::setupUnits(), Inkscape::Extension::Internal::Metafile::setViewBoxIfMissing(), Inkscape::Util::Quantity::string(), Inkscape::UI::Widget::StrokeStyle::StrokeStyle(), svgUnit(), Inkscape::PaperSize::toDimsString(), Inkscape::UI::Widget::SelectedStyle::update(), Inkscape::UI::Tools::LpeTool::update_measuring_items(), Inkscape::UI::Dialog::DocumentProperties::update_widgets(), and Inkscape::UI::Widget::StrokeStyle::updateLine().

◆ description

Glib::ustring Inkscape::Util::Unit::description

Definition at line 82 of file units.h.

◆ factor

double Inkscape::Util::Unit::factor

◆ metric_name

Glib::ustring Inkscape::Util::Unit::metric_name

Definition at line 83 of file units.h.

Referenced by getUnitMetric().

◆ name

Glib::ustring Inkscape::Util::Unit::name

Definition at line 79 of file units.h.

Referenced by operator==().

◆ name_plural

Glib::ustring Inkscape::Util::Unit::name_plural

Definition at line 80 of file units.h.

◆ type


The documentation for this class was generated from the following files: