Property values which are real numbers have an additional feature – units. A unit defines a multiplier used for displaying thu number in the GUI. All property values stored use a canonical internal unit; for example, all coordinates are in millimeters.
The formula for displayed values is:
The units are stored in an array and the properties contain their indices. When the user changes the display unit, he only modifies the property unit index and the internal property value is remains unchanged.
There are properties of the following four quantities:
PQ_LENGTH
for longitudinal properties
PQ_ANGLE
for angular properties
PQ_REFERENCE
for parameters within
PQ_NONE
for non-measurable properties, such as control point weights
The quantity of a property is determined by the type and subtype and can
be found in the following way (for a property prop
):
prop_subtype2quantity[prop->type][prop->subtype]
.
Every quantity has a default unit which is stored in uns unit_default
.
If the unit of a property is PROP_UNIT_MAX
or a deleted unit, the default unit (for
the appropriate quantity) is used instead.
The default unit cannot be PROP_UNIT_MAX
.
Checking whether a certain unit is used in some objects would be too slow. Therefore, a unit cannot be simply deleted. Instead, it is marked as unused and it cannot be assigned to properties any more. If a property that has a deleted unit needs to be displayed, it uses the default unit instead.
The default unit cannot be deleted.