4#include <NDEVR/SoftwareService.h>
5#include <NDEVR/Resource.h>
6#include <NDEVR/Pointer.h>
7#include <NDEVR/TranslatedString.h>
8#include <NDEVR/Dictionary.h>
9#include <NDEVR/INIInterface.h>
42 :
UnitOption(unit->name, unit->translatedName())
44 , custom_title(custom_title)
81 , unit_type(unit_type)
223 String orientation_space_name;
224 String coordinate_space_name;
225 String distance_space_name;
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:123
Buffer< ConstPointer< UnitOption > > options(UnitManager &manager) const override
BasicCustomUnit(const String &name, const TranslatedString &title, UnitCategory type)
String m_ini_unit_name
Definition UnitManager.h:135
Resource< ConstPointer< Unit > > m_unit
Definition UnitManager.h:136
TranslatedString m_title
Definition UnitManager.h:134
virtual ConstPointer< Unit > defaultUnit(UnitManager &) const override
virtual void finishReadingINI(UnitManager &manager) override
virtual Resource< ConstPointer< Unit > > & unitResource(UnitManager &manager) override
virtual void prepareForINI(const UnitManager &manager) override
virtual TranslatedString title() const override
Definition UnitManager.h:129
virtual void setupINI(INIFactory &ini) override
A definition of how to describe a particular set of data to a custom category of unit.
Definition UnitManager.h:39
virtual TranslatedString title() const final override
Buffer< ConstPointer< UnitOption > > m_sub_options
Definition UnitManager.h:54
TranslatedString custom_title
Definition UnitManager.h:52
ConstPointer< Unit > base_unit
Definition UnitManager.h:51
BasicUnitOption(const ConstPointer< Unit > &unit, const TranslatedString &custom_title=TranslatedString())
Definition UnitManager.h:41
virtual Buffer< ConstPointer< UnitOption > > & editSubOptions()
Definition UnitManager.h:50
virtual Buffer< ConstPointer< UnitOption > > subOptions() const final override
Definition UnitManager.h:49
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition GraphicsPipeline.h:42
A definition of how to describe coordinate data.
Definition UnitManager.h:61
CoordinateUnitOption(const String &id, const TranslatedString &name)
Definition UnitManager.h:63
virtual ConstPointer< Unit > unit() const final override
A program-defined unit that can be used for some specific task different from a program-wide unit.
Definition UnitManager.h:76
virtual TranslatedString title() const
Definition UnitManager.h:87
virtual void finishReadingINI(UnitManager &)
Definition UnitManager.h:93
virtual ConstPointer< Unit > currentUnit(UnitManager &manager)
virtual void setupINI(INIFactory &)=0
TranslatedString name
Definition UnitManager.h:84
virtual void resetToDefault(UnitManager &)
virtual ConstPointer< Unit > currentUnit()
String id
Definition UnitManager.h:85
virtual void prepareForINI(const UnitManager &)
Definition UnitManager.h:90
UnitCategory unit_type
Definition UnitManager.h:86
CustomUnit(const String &id, const TranslatedString &name, UnitCategory unit_type)
Definition UnitManager.h:78
virtual ~CustomUnit()
Definition UnitManager.h:83
virtual ConstPointer< Unit > defaultUnit(UnitManager &) const =0
virtual Resource< ConstPointer< Unit > > & unitResource(UnitManager &manager)=0
virtual Buffer< ConstPointer< UnitOption > > options(UnitManager &manager) const =0
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:320
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:68
Contains methods for easily reading and writing to an INI file including.
Definition INIInterface.h:45
A unit that mirrors another set unit.
Definition UnitManager.h:103
virtual void finishReadingINI(UnitManager &) override
Definition UnitManager.h:114
virtual void resetToDefault(UnitManager &) override
virtual ConstPointer< Unit > defaultUnit(UnitManager &) const override
ReferenceCustomUnit(const String &id, const TranslatedString &name, UnitCategory unit_type)
Definition UnitManager.h:105
virtual void prepareForINI(const UnitManager &) override
Definition UnitManager.h:111
virtual Resource< ConstPointer< Unit > > & unitResource(UnitManager &manager) override
virtual ~ReferenceCustomUnit()
Definition UnitManager.h:108
virtual void setupINI(INIFactory &) override
Definition UnitManager.h:112
virtual Buffer< ConstPointer< UnitOption > > options(UnitManager &manager) const override
virtual ConstPointer< Unit > currentUnit(UnitManager &manager) override
A core part of the engine, stores variables that can be listened to with ResourceListener which will ...
Definition Toggle.h:41
A class that can subscribe to any number of Resources which will get updates when the Resource(s) hav...
Definition ResourceListener.h:62
Software Service Managers take a Software service to modify the behavior of the software.
Definition SoftwareService.h:15
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Handles a grouping of units that can describe any number of data categories.
Definition UnitManager.h:143
void setupDefaultLatLonOptions()
ConstPointer< Unit > parseUnit(const String &name, UnitCategory type=UnitCategory::e_undefined_unit) const
UnitManager(const UnitManager &manager)
Resource< ConstPointer< Unit > > weight_unit
Definition UnitManager.h:205
void setupDefaultDistanceOptions()
bool canBeMetric(const ConstPointer< Unit > &unit) const
Resource< ConstPointer< Unit > > distance_unit
Definition UnitManager.h:201
void setupDefaultWeightOptions()
void addFormatOption(UnitCategory unit_type, const ConstPointer< UnitOption > &format_option)
static ConstPointer< UnitOption > ActiveOption(const Buffer< ConstPointer< UnitOption > > &options, const ConstPointer< Unit > &unit)
void setToDefaultImperial(bool preserve_spacial)
ConstPointer< Unit > unit(const String &name) const
void getINI(INIFactory &factory) override
Buffer< ConstPointer< UnitOption > > m_area_unit_options
Definition UnitManager.h:213
void tieToManager(const UnitManager &manager)
Buffer< DynamicPointer< CustomUnit > > m_special_units
Definition UnitManager.h:218
ConstPointer< Unit > determineUnit(const Buffer< String > &unit_parts, UnitCategory type) const
static Resource< ConstPointer< Unit > > default_orientation_space_unit
Definition UnitManager.h:208
void setupDefaultAreaOptions()
Resource< ConstPointer< Unit > > volume_unit
Definition UnitManager.h:204
Buffer< ConstPointer< UnitOption > > m_volume_unit_options
Definition UnitManager.h:214
void setupDefaultCoordinateSpaceOptions()
static UnitManager & DefaultManager()
void updateCoordinateBase(const ConstPointer< Unit > &base)
void setUnitOptions(UnitCategory type, const Buffer< ConstPointer< UnitOption > > &options)
Buffer< ConstPointer< UnitOption > > m_weight_unit_options
Definition UnitManager.h:215
Resource< ConstPointer< Unit > > & unitResource(UnitCategory type)
bool hasSpecialUnit(const String &name) const
UnitManager & operator=(const UnitManager &manager)
ConstPointer< Unit > unit(UnitCategory type) const
ConstPointer< Unit > orientationOffsetUnit() const
const Buffer< ConstPointer< UnitOption > > & coordinateSpaceFormatOptions() const
Definition UnitManager.h:173
const Buffer< ConstPointer< UnitOption > > & latLonUnitOptions() const
Definition UnitManager.h:168
void setUnitOptions(UnitCategory type, const Buffer< ConstPointer< Unit > > &options)
void setToDefaultMetric(bool preserve_spacial)
Buffer< ConstPointer< UnitOption > > m_coordinate_format_options
Definition UnitManager.h:216
void prepareForINI(INIFactory &factory) override
const Buffer< ConstPointer< UnitOption > > & angleUnitOptions() const
Definition UnitManager.h:167
void finishReadingINI(INIFactory &factory) override
Buffer< ConstPointer< UnitOption > > unitOptions(UnitCategory units) const
const Buffer< ConstPointer< UnitOption > > & areaUnitOptions() const
Definition UnitManager.h:170
const Buffer< ConstPointer< UnitOption > > & distanceUnitOptions() const
Definition UnitManager.h:169
const Buffer< ConstPointer< UnitOption > > & volumeUnitOptions() const
Definition UnitManager.h:171
ConstPointer< Unit > specialUnit(const String &name)
void setUnit(UnitCategory type, const ConstPointer< Unit > &unit)
Buffer< ConstPointer< UnitOption > > m_angle_unit_options
Definition UnitManager.h:210
void setupDefaultVolumeOptions()
Resource< ConstPointer< Unit > > coordinate_space_unit
Definition UnitManager.h:202
Resource< ConstPointer< Unit > > surface_area_unit
Definition UnitManager.h:203
const Buffer< ConstPointer< UnitOption > > & weightUnitOptions() const
Definition UnitManager.h:172
Resource< ConstPointer< Unit > > lat_lon_unit
Definition UnitManager.h:207
void removeFormatOption(UnitCategory unit_type, const ConstPointer< UnitOption > &format_option)
Resource< ConstPointer< Unit > > temperature_unit
Definition UnitManager.h:206
Dictionary< String, ConstPointer< UnitOption > > m_registered_units
Definition UnitManager.h:217
Resource< ConstPointer< Unit > > & specialUnitResource(const String &name)
void clearUnitOptions(UnitCategory type)
void addSpecialUnit(const DynamicPointer< CustomUnit > &custom_unit)
Buffer< ConstPointer< UnitOption > > m_distance_unit_options
Definition UnitManager.h:212
void setUnitOptionsToDefault(UnitCategory type)
void setupDefaultAngleUnitOptions()
Resource< ConstPointer< Unit > > angle_unit
Definition UnitManager.h:199
Dictionary< String, DynamicPointer< CustomUnit > > m_special_unit_lookup
Definition UnitManager.h:219
Resource< ConstPointer< Unit > > orientation_space_unit
Definition UnitManager.h:200
const Buffer< DynamicPointer< CustomUnit > > & specialUnits() const
Definition UnitManager.h:174
bool canBeImperial(const ConstPointer< Unit > &unit) const
Buffer< ConstPointer< UnitOption > > m_lat_lon_unit_options
Definition UnitManager.h:211
A definition of how to describe a particular set of data to a custom category of unit.
Definition UnitManager.h:17
virtual TranslatedString title() const
Definition UnitManager.h:24
virtual bool hasMemberUnit(const ConstPointer< Unit > &unit) const =0
TranslatedString name
Definition UnitManager.h:31
String id
Definition UnitManager.h:32
virtual ~UnitOption()
Definition UnitManager.h:23
virtual ConstPointer< Unit > unit() const =0
virtual ConstPointer< Unit > unit(const ConstPointer< Unit > &) const
Definition UnitManager.h:27
UnitOption(const String &id, const TranslatedString &name)
Definition UnitManager.h:19
virtual Buffer< ConstPointer< UnitOption > > subOptions() const
Definition UnitManager.h:28
UnitCategory
A category of unit describing what it relates to. Any category can have some number of units defined ...
Definition Unit.h:14
A definition of how to describe and display data. Units can be of any type.
Definition Unit.h:36