API Documentation
Loading...
Searching...
No Matches
UnitTypes.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: Units
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/String.h>
34#include "DLLInfo.h"
35#include <NDEVR/Unit.h>
36namespace NDEVR
37{
38
39 /**--------------------------------------------------------------------------------------------------
40 \brief A unit that simply references another but with a custom name and ID
41 **/
42 class INIFactory;
44 {
46 ReferenceUnit(String name, TranslatedString translated_id, const Unit& reference)
47 : Unit(name, translated_id)
48 , reference(reference)
49 {
50 axis_abbreviations[0] = reference.axis_abbreviations[0];
51 axis_abbreviations[1] = reference.axis_abbreviations[1];
52 axis_abbreviations[2] = reference.axis_abbreviations[2];
53 axis_abbreviations[3] = reference.axis_abbreviations[3];
54 }
55
56 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, const uint01 direction = X) const override
57 {
58 return reference.convertToUnit(program_space, direction);
59 }
60 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, const uint01 direction = X) const override
61 {
62 return reference.convertToUnit(program_space, direction);
63 }
64 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override
65 {
66 return reference.convertToUnit(program_space);
67 }
68 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override
69 {
70 return reference.convertFromUnit(program_space);
71 }
72 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override
73 {
74 return reference.convertToUnit(program_space);
75 }
76 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override
77 {
78 return reference.convertFromUnit(program_space);
79 }
80 [[nodiscard]] virtual String convertToString(const fltp08& program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override
81 {
82 return reference.convertToString(program_space, add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
83 }
84 virtual void toString(String& s, const fltp08& program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override
85 {
86 reference.toString(s, program_space, add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
87 }
88 [[nodiscard]] virtual fltp08 convertFromString(const String& unit_string, uint01 direction = X) const override
89 {
90 return reference.convertFromString(unit_string, direction);
91 }
92 [[nodiscard]] virtual fltp08 fromString(const String& unit_string, uint01 direction = X) const override
93 {
94 return reference.fromString(unit_string, direction);
95 }
96 [[nodiscard]] virtual const TranslatedString& abbreviation(uint01 direction = X) const override
97 {
98 return reference.abbreviation(direction);
99 }
100
101 [[nodiscard]] virtual String getNextPreferredSeparator(const String& current_string, uint01 direction = X) const override
102 {
103 return reference.getNextPreferredSeparator(current_string, direction);
104 }
105
106 [[nodiscard]] virtual String toFormula(const String& unit_string, uint01 direction = X) const override
107 {
108 return reference.toFormula(unit_string, direction);
109 }
110 [[nodiscard]] virtual fltp08 epsilon(fltp08 value, uint01 direction = X) const override
111 {
112 return reference.epsilon(value, direction);
113 }
114 [[nodiscard]] virtual const Unit* subUnit(uint01 direction) const override
115 {
116 return reference.subUnit(direction);
117 }
118 [[nodiscard]] virtual Matrix<fltp08> matrix() const override
119 {
120 return reference.matrix();
121 }
122 };
123 /**--------------------------------------------------------------------------------------------------
124 \brief A unit that describes a simple scale (think meters vs feet)
125 **/
127 {
130 ScaledUnit(String name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale)
131 : Unit(std::move(name), std::move(translated_id))
132 , scale(scale)
133 , core_abbreviation(abbreviation)
134 {}
135
136 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, const uint01 direction = X) const override
137 {
138 lib_assert(direction < 3, "Out of bounds direction");
139 UNUSED(direction);
140 return program_space * scale;
141 }
142 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, const uint01 direction = X) const override
143 {
144 lib_assert(direction < 3, "Out of bounds direction");
145 UNUSED(direction);//Not used for simple conversions
146 return program_space / scale;
147 }
148 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override
149 {
150 return Vertex<3, fltp08>(scale * program_space);
151 }
152 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override
153 {
154 return Vertex<3, fltp08>(program_space / scale);
155 }
156 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override
157 {
158 return scale * program_space;
159 }
160 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override
161 {
162 return program_space / scale;
163 }
164 [[nodiscard]] virtual String convertToString(const fltp08& program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override
165 {
166 return toString(convertToUnit(program_space, direction), add_comma, min_decimals, max_decimals, min_digits, include_abv, direction);
167 }
168 [[nodiscard]] virtual fltp08 convertFromString(const String& unit_string, uint01 direction = X) const override
169 {
170 return convertFromUnit(fromString(unit_string, direction), direction);
171 }
172 [[nodiscard]] virtual fltp08 fromString(const String& unit_string, uint01 direction = X) const override
173 {
174 UNUSED(direction);
175 return unit_string.getAs<fltp08>();
176 }
177 [[nodiscard]] virtual const TranslatedString& abbreviation(uint01 direction = X) const override
178 {
179 UNUSED(direction);
180 return core_abbreviation;
181 }
182 [[nodiscard]] virtual const Unit* subUnit(uint01) const override
183 {
184 return this;
185 }
186 [[nodiscard]] virtual Matrix<fltp08> matrix() const override
187 {
188 return Matrix<fltp08>::ScalerMatrix(scale);
189 }
190 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;;
191 };
192 /**--------------------------------------------------------------------------------------------------
193 \brief A unit that has both a scale and an offset (think degrees celcius vs fahrenheit)
194 **/
196 {
200 ScaledOffsetUnit(String name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale, fltp08 offset)
201 : Unit(std::move(name), std::move(translated_id))
202 , scale(scale)
203 , offset(offset)
204 , core_abbreviation(abbreviation)
205 {}
206
207 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, const uint01 direction = X) const override
208 {
209 lib_assert(direction < 3, "Out of bounds direction");
210 UNUSED(direction);
211 return program_space * scale + offset;
212 }
213 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, const uint01 direction = X) const override
214 {
215 lib_assert(direction < 3, "Out of bounds direction");
216 UNUSED(direction);//Not used for simple conversions
217 return (program_space - offset) / scale;
218 }
219 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override
220 {
221 return scale * program_space + offset;
222 }
223 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override
224 {
225 return (program_space - offset) / scale;
226 }
227 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override
228 {
229 return scale * program_space + offset;
230 }
231 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override
232 {
233 return (program_space - offset) / scale;
234 }
235
236 [[nodiscard]] virtual const TranslatedString& abbreviation(uint01 direction = X) const override
237 {
238 UNUSED(direction);
239 return core_abbreviation;
240 }
241 [[nodiscard]] virtual const Unit* subUnit(uint01) const override
242 {
243 return this;
244 }
245 [[nodiscard]] virtual Matrix<fltp08> matrix() const override
246 {
247 return Matrix<fltp08>::ScalerMatrix(scale);
248 }
249
250 [[nodiscard]] virtual Unit* clone(const String& new_name, const TranslatedString& new_display_name) const override
251 {
252 ScaledOffsetUnit* unit = new ScaledOffsetUnit(new_name, new_display_name, abbreviation(), scale, offset);
253 unit->axis_abbreviations[0] = axis_name_ids[0];
254 unit->axis_abbreviations[1] = axis_name_ids[1];
255 unit->axis_abbreviations[2] = axis_name_ids[2];
256 unit->axis_abbreviations[3] = axis_name_ids[3];
257 return unit;
258 }
259 };
260 /**--------------------------------------------------------------------------------------------------
261 \brief A unit that has a complex rotational offset. Think northing-easting vs easting-southing
262 **/
264 {
266 MatrixUnit(String name, const TranslatedString& translated_id, const Matrix<fltp08>& mat, const Unit& base)
267 : ReferenceUnit(std::move(name), std::move(translated_id), base)
268 , local_matrix(mat * base.matrix())
269 {}
270
271 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, const uint01 direction = X) const override;
272 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, const uint01 direction = X) const override;
273 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override;
274 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override;
275 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override;
276 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override;
277
278 [[nodiscard]] virtual fltp08 epsilon(fltp08 value, uint01 direction = X) const override;
279 [[nodiscard]] virtual Matrix<fltp08> matrix() const override
280 {
281 return local_matrix;
282 }
283 [[nodiscard]] virtual const Unit* subUnit(uint01) const override
284 {
285 return &reference;
286 }
287 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
288 };
289
290 /**--------------------------------------------------------------------------------------------------
291 \brief A unit that has two parts (Think feet, inches)
292 **/
294 {
295 TwoPartUnit(const String& name, const TranslatedString& translated_id, const TranslatedString& abr_major, const TranslatedString& abr_minor, fltp08 scale, fltp08 sub_unit);
296
297 void toString(String& string, const fltp08& local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override;
298 [[nodiscard]] virtual fltp08 fromString(const String& unit_string, uint01 direction = X) const override;
299 [[nodiscard]] virtual fltp08 epsilon(fltp08 value, uint01 direction) const override;
300
301 [[nodiscard]] virtual String getNextPreferredSeparator(const String& string, uint01 direction) const override;
302
303 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
308 };
309 /**--------------------------------------------------------------------------------------------------
310 Class: AngleUnit
311
312 \brief Contains logic for converting angles into user defined units including up-direction and clockwise-logic.
313 **/
315 {
316 AngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abbreviation, fltp08 scale);
317 protected:
318 AngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abbreviation, fltp08 scale, const Vector<3, bool>& normalized,
319 const Vector<3, fltp08>& upper_limits,
320 const Vector<3, fltp08>& reflexes, const Vector<3, bool>& reflexes_up);
321 public:
322 virtual ~AngleUnit() = default;
323 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, uint01 direction = X) const override;
324 [[nodiscard]] virtual fltp08 normalize(fltp08 value, uint01 direction) const;
325 [[nodiscard]] virtual fltp08 denormalize(fltp08 value, uint01 direction) const;
326 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, uint01 direction = X) const override;
327
328 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override;
329
330 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override;
331
332 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override;
333 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override;
334 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
335 [[nodiscard]] virtual fltp08 epsilon(fltp08 value, uint01 direction = X) const override;
336
340 Vector<3, bool> normalized = Vector<3, bool>(false);
341 Vector<3, bool> reflexes_up = Vector<3, bool>(false);
342 };
343 /**--------------------------------------------------------------------------------------------------
344 \brief An angle unit that contains two-parts (Degrees, Minutes)
345 **/
347 {
348 TwoPartAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abr_major, const TranslatedString& abr_minor, fltp08 sub_unit, const AngleUnit& angle_unit);
349 TwoPartAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abr_major, const TranslatedString& abr_minor, fltp08 sub_unit, fltp08 scale, const Vector<3, bool>& normalized, Vector<3, fltp08> upper_limits, Vector<3, fltp08> reflex_point, Vector<3, bool> reflexes_up);
350 void toString(String& string, const fltp08& local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals,
351 uint04 min_digits, bool use_abv = true, uint01 direction = X) const override;
352
353 fltp08 fromString(const String& unit_string, uint01 direction = X) const override;
354
355
356 String getNextPreferredSeparator(const String& string, uint01 direction = X) const override;
357 fltp08 epsilon(fltp08 value, uint01 direction = X) const override;
358 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
363 };
364
365 /**--------------------------------------------------------------------------------------------------
366 \brief An angle unit that contains two-parts (Degrees, Minutes, Seconds)
367 **/
369 {
370 ThreePartAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abr_major, const TranslatedString& abr_minor_a, const TranslatedString& abr_minor_b, fltp08 sub_unit_a, fltp08 sub_unit_b, const AngleUnit& angle_unit);
371
372 ThreePartAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abr_major, const TranslatedString& abr_minor_a, const TranslatedString& abr_minor_b, fltp08 sub_unit_a, fltp08 sub_unit_b, fltp08 scale, const Vector<3, bool>& normalized, Vector<3, fltp08> upper_limits, Vector<3, fltp08> reflex_point, Vector<3, bool> reflexes_up);
373 void toString(String& string, const fltp08& local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals,
374 uint04 min_digits, bool use_abv = true, uint01 direction = X) const override;
375
376 fltp08 fromString(const String& unit_string, uint01 direction = X) const override;
377
378 String getNextPreferredSeparator(const String& current_string, uint01 direction = X) const override;
379
380 fltp08 epsilon(fltp08 value, uint01 direction = X) const override;
381 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
388 };
389
390 /**--------------------------------------------------------------------------------------------------
391 \brief Degrees, Minutes, Seconds stored in a compact way where degrees and minutes are seperated by
392 a decimal and minutes and secons are always 2 decimals.
393 **/
395 {
396 DDMMSSAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abbreviation, fltp08 scale, const Vector<3, bool>& normalized, const Vector<3, fltp08>& upper_limits, const Vector<3, fltp08>& reflexes, const Vector<3, bool>& reflexes_up);
397 DDMMSSAngleUnit(const String& name, const TranslatedString& translated_name, const TranslatedString& abbreviation, const AngleUnit& unit);
398 void toString(String& string, const fltp08& local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool use_abv = true, uint01 direction = X) const override;
399 fltp08 fromString(const String& unit_string, uint01 direction = X) const override;
400
401 String getNextPreferredSeparator(const String& string, uint01 direction = X) const override;
402 fltp08 epsilon(fltp08 value, uint01 direction = X) const override;
403
404 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
406 };
407 /**--------------------------------------------------------------------------------------------------
408 \brief An Unit that has both a location and elevation (Think Lat/Lon which has meters for elevation)
409 **/
411 {
412 LocationElevationUnit(String name, TranslatedString translated_id, const Unit* location_unit, const Unit* elevation_unit);
413 [[nodiscard]] virtual fltp08 convertToUnit(const fltp08& program_space, uint01 direction = X) const override;
414 [[nodiscard]] virtual fltp08 convertFromUnit(const fltp08& program_space, uint01 direction = X) const override;
415 [[nodiscard]] virtual Vertex<3, fltp08> convertToUnit(const Vertex<3, fltp08>& program_space) const override;
416 [[nodiscard]] virtual Vertex<3, fltp08> convertFromUnit(const Vertex<3, fltp08>& program_space) const override;
417 [[nodiscard]] virtual Ray<3, fltp08> convertToUnit(const Ray<3, fltp08>& program_space) const override;
418 [[nodiscard]] virtual Ray<3, fltp08> convertFromUnit(const Ray<3, fltp08>& program_space) const override;
419 [[nodiscard]] virtual String convertToString(const fltp08& program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override;
420 void toString(String& string, const fltp08& program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv = true, uint01 direction = X) const override;
421 [[nodiscard]] virtual fltp08 convertFromString(const String& unit_string, uint01 direction = X) const override;
422 [[nodiscard]] virtual fltp08 fromString(const String& unit_string, uint01 direction = X) const override;
423 [[nodiscard]] virtual const TranslatedString& abbreviation(uint01 direction = X) const override;
424 [[nodiscard]] virtual String getNextPreferredSeparator(const String& current_string, uint01 direction = X) const override;
425 [[nodiscard]] virtual String toFormula(const String& unit_string, uint01 direction = X) const override;
426 [[nodiscard]] virtual const Unit* subUnit(uint01 direction) const override;
427 [[nodiscard]] virtual Unit* clone(const String& name, const TranslatedString& translated_id) const override;
428 fltp08 epsilon(fltp08 value, uint01 direction) const override;
429 [[nodiscard]] virtual TranslatedString translatedAxisName(uint04 index) const override;
430 [[nodiscard]] virtual Matrix<fltp08> matrix() const override;
433 };
434
435
436}
#define NDEVR_BASE_API
Definition DLLInfo.h:57
#define UNUSED(expr)
Definition BaseValues.hpp:409
#define lib_assert(expression, message)
Definition LibAssert.h:61
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
Definition Matrix.hpp:176
Definition Vertex.hpp:317
The core String class for the NDEVR API.
Definition String.h:69
t_type getAs() const
Converts a string into an object. To use this function an object must have overwritten StringStream<t...
Definition String.h:143
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Definition File.h:211
Contains logic for converting angles into user defined units including up-direction and clockwise-log...
Definition UnitTypes.h:315
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
AngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, fltp08 scale, const Vector< 3, bool > &normalized, const Vector< 3, fltp08 > &upper_limits, const Vector< 3, fltp08 > &reflexes, const Vector< 3, bool > &reflexes_up)
virtual fltp08 convertToUnit(const fltp08 &program_space, uint01 direction=X) const override
virtual fltp08 convertFromUnit(const fltp08 &program_space, uint01 direction=X) const override
AngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, fltp08 scale)
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
virtual ~AngleUnit()=default
virtual fltp08 denormalize(fltp08 value, uint01 direction) const
virtual fltp08 epsilon(fltp08 value, uint01 direction=X) const override
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual fltp08 normalize(fltp08 value, uint01 direction) const
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Degrees, Minutes, Seconds stored in a compact way where degrees and minutes are seperated by a decima...
Definition UnitTypes.h:395
String getNextPreferredSeparator(const String &string, uint01 direction=X) const override
fltp08 epsilon(fltp08 value, uint01 direction=X) const override
DDMMSSAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, const AngleUnit &unit)
fltp08 fromString(const String &unit_string, uint01 direction=X) const override
uint04 max_decimal_digits
Definition UnitTypes.h:405
DDMMSSAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abbreviation, fltp08 scale, const Vector< 3, bool > &normalized, const Vector< 3, fltp08 > &upper_limits, const Vector< 3, fltp08 > &reflexes, const Vector< 3, bool > &reflexes_up)
void toString(String &string, const fltp08 &local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool use_abv=true, uint01 direction=X) const override
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
An Unit that has both a location and elevation (Think Lat/Lon which has meters for elevation)
Definition UnitTypes.h:411
virtual const Unit * subUnit(uint01 direction) const override
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const override
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
void toString(String &string, const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
virtual fltp08 convertToUnit(const fltp08 &program_space, uint01 direction=X) const override
virtual fltp08 convertFromString(const String &unit_string, uint01 direction=X) const override
virtual fltp08 convertFromUnit(const fltp08 &program_space, uint01 direction=X) const override
virtual const TranslatedString & abbreviation(uint01 direction=X) const override
virtual String convertToString(const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
virtual TranslatedString translatedAxisName(uint04 index) const override
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
virtual String toFormula(const String &unit_string, uint01 direction=X) const override
LocationElevationUnit(String name, TranslatedString translated_id, const Unit *location_unit, const Unit *elevation_unit)
fltp08 epsilon(fltp08 value, uint01 direction) const override
virtual Matrix< fltp08 > matrix() const override
virtual String getNextPreferredSeparator(const String &current_string, uint01 direction=X) const override
const Unit * elevation_unit
Definition UnitTypes.h:432
const Unit * location_unit
Definition UnitTypes.h:431
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
A unit that has a complex rotational offset. Think northing-easting vs easting-southing.
Definition UnitTypes.h:264
virtual const Unit * subUnit(uint01) const override
Definition UnitTypes.h:283
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const override
const Matrix< fltp08 > local_matrix
Definition UnitTypes.h:265
virtual fltp08 convertFromUnit(const fltp08 &program_space, const uint01 direction=X) const override
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
MatrixUnit(String name, const TranslatedString &translated_id, const Matrix< fltp08 > &mat, const Unit &base)
Definition UnitTypes.h:266
virtual Matrix< fltp08 > matrix() const override
Definition UnitTypes.h:279
virtual fltp08 epsilon(fltp08 value, uint01 direction=X) const override
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
Definition UnitTypes.h:44
virtual const Unit * subUnit(uint01 direction) const override
Definition UnitTypes.h:114
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const override
Definition UnitTypes.h:92
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:76
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:56
virtual fltp08 convertFromUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:60
virtual fltp08 convertFromString(const String &unit_string, uint01 direction=X) const override
Definition UnitTypes.h:88
virtual const TranslatedString & abbreviation(uint01 direction=X) const override
Definition UnitTypes.h:96
virtual String convertToString(const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
Definition UnitTypes.h:80
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:68
const Unit & reference
Definition UnitTypes.h:45
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:72
ReferenceUnit(String name, TranslatedString translated_id, const Unit &reference)
Definition UnitTypes.h:46
virtual void toString(String &s, const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
Definition UnitTypes.h:84
virtual String toFormula(const String &unit_string, uint01 direction=X) const override
Definition UnitTypes.h:106
virtual Matrix< fltp08 > matrix() const override
Definition UnitTypes.h:118
virtual String getNextPreferredSeparator(const String &current_string, uint01 direction=X) const override
Definition UnitTypes.h:101
virtual fltp08 epsilon(fltp08 value, uint01 direction=X) const override
Definition UnitTypes.h:110
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:64
A unit that has both a scale and an offset (think degrees celcius vs fahrenheit)
Definition UnitTypes.h:196
virtual const Unit * subUnit(uint01) const override
Definition UnitTypes.h:241
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:231
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:207
virtual fltp08 convertFromUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:213
virtual const TranslatedString & abbreviation(uint01 direction=X) const override
Definition UnitTypes.h:236
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:223
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:227
virtual Unit * clone(const String &new_name, const TranslatedString &new_display_name) const override
Definition UnitTypes.h:250
const fltp08 offset
Definition UnitTypes.h:198
virtual Matrix< fltp08 > matrix() const override
Definition UnitTypes.h:245
ScaledOffsetUnit(String name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale, fltp08 offset)
Definition UnitTypes.h:200
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:219
const TranslatedString core_abbreviation
Definition UnitTypes.h:199
const fltp08 scale
Definition UnitTypes.h:197
A unit that describes a simple scale (think meters vs feet)
Definition UnitTypes.h:127
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const override
Definition UnitTypes.h:172
virtual const Unit * subUnit(uint01) const override
Definition UnitTypes.h:182
virtual Ray< 3, fltp08 > convertFromUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:160
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:136
virtual fltp08 convertFromUnit(const fltp08 &program_space, const uint01 direction=X) const override
Definition UnitTypes.h:142
virtual fltp08 convertFromString(const String &unit_string, uint01 direction=X) const override
Definition UnitTypes.h:168
virtual const TranslatedString & abbreviation(uint01 direction=X) const override
Definition UnitTypes.h:177
virtual String convertToString(const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
Definition UnitTypes.h:164
virtual Vertex< 3, fltp08 > convertFromUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:152
ScaledUnit(String name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale)
Definition UnitTypes.h:130
virtual Ray< 3, fltp08 > convertToUnit(const Ray< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:156
virtual Matrix< fltp08 > matrix() const override
Definition UnitTypes.h:186
virtual Vertex< 3, fltp08 > convertToUnit(const Vertex< 3, fltp08 > &program_space) const override
Definition UnitTypes.h:148
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
const TranslatedString core_abbreviation
Definition UnitTypes.h:129
const fltp08 scale
Definition UnitTypes.h:128
An angle unit that contains two-parts (Degrees, Minutes, Seconds)
Definition UnitTypes.h:369
const fltp08 sub_unit_a
Definition UnitTypes.h:385
fltp08 epsilon(fltp08 value, uint01 direction=X) const override
const TranslatedString abr_major
Definition UnitTypes.h:382
const TranslatedString abr_minor_a
Definition UnitTypes.h:383
const TranslatedString abr_minor_b
Definition UnitTypes.h:384
String getNextPreferredSeparator(const String &current_string, uint01 direction=X) const override
fltp08 fromString(const String &unit_string, uint01 direction=X) const override
uint04 max_decimal_digits
Definition UnitTypes.h:387
ThreePartAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abr_major, const TranslatedString &abr_minor_a, const TranslatedString &abr_minor_b, fltp08 sub_unit_a, fltp08 sub_unit_b, fltp08 scale, const Vector< 3, bool > &normalized, Vector< 3, fltp08 > upper_limits, Vector< 3, fltp08 > reflex_point, Vector< 3, bool > reflexes_up)
const fltp08 sub_unit_b
Definition UnitTypes.h:386
void toString(String &string, const fltp08 &local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool use_abv=true, uint01 direction=X) const override
ThreePartAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abr_major, const TranslatedString &abr_minor_a, const TranslatedString &abr_minor_b, fltp08 sub_unit_a, fltp08 sub_unit_b, const AngleUnit &angle_unit)
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
An angle unit that contains two-parts (Degrees, Minutes)
Definition UnitTypes.h:347
TwoPartAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abr_major, const TranslatedString &abr_minor, fltp08 sub_unit, const AngleUnit &angle_unit)
String getNextPreferredSeparator(const String &string, uint01 direction=X) const override
fltp08 epsilon(fltp08 value, uint01 direction=X) const override
const TranslatedString abr_major
Definition UnitTypes.h:359
const TranslatedString abr_minor
Definition UnitTypes.h:360
const fltp08 sub_unit
Definition UnitTypes.h:361
fltp08 fromString(const String &unit_string, uint01 direction=X) const override
uint04 max_decimal_digits
Definition UnitTypes.h:362
TwoPartAngleUnit(const String &name, const TranslatedString &translated_name, const TranslatedString &abr_major, const TranslatedString &abr_minor, fltp08 sub_unit, fltp08 scale, const Vector< 3, bool > &normalized, Vector< 3, fltp08 > upper_limits, Vector< 3, fltp08 > reflex_point, Vector< 3, bool > reflexes_up)
void toString(String &string, const fltp08 &local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool use_abv=true, uint01 direction=X) const override
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
A unit that has two parts (Think feet, inches)
Definition UnitTypes.h:294
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const override
virtual fltp08 epsilon(fltp08 value, uint01 direction) const override
TwoPartUnit(const String &name, const TranslatedString &translated_id, const TranslatedString &abr_major, const TranslatedString &abr_minor, fltp08 scale, fltp08 sub_unit)
const TranslatedString abr_major
Definition UnitTypes.h:304
const TranslatedString abr_minor
Definition UnitTypes.h:305
virtual String getNextPreferredSeparator(const String &string, uint01 direction) const override
const fltp08 sub_unit
Definition UnitTypes.h:306
uint04 max_decimal_digits
Definition UnitTypes.h:307
void toString(String &string, const fltp08 &local_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override
virtual Unit * clone(const String &name, const TranslatedString &translated_id) const override
A definition of how to describe and display data. Units can be of any type.
Definition Unit.h:36
virtual const Unit * subUnit(uint01 direction) const =0
virtual fltp08 convertFromUnit(const fltp08 &unit_space, const uint01 direction=X) const =0
virtual String toFormula(const String &unit_string, uint01 direction=X) const
virtual Matrix< fltp08 > matrix() const =0
virtual fltp08 epsilon(fltp08 value, uint01 direction=X) const
String toString(const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:70
virtual const TranslatedString & abbreviation(uint01 direction=X) const =0
virtual fltp08 convertToUnit(const fltp08 &program_space, const uint01 direction=X) const =0
TranslatedString axis_abbreviations[4]
Definition Unit.h:40
virtual fltp08 convertFromString(const String &unit_string, uint01 direction=X) const
Definition Unit.h:86
virtual String getNextPreferredSeparator(const String &current_string, uint01 direction=X) const
String convertToString(const Angle< t_angle_type > &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const
Definition Unit.h:52
virtual fltp08 fromString(const String &unit_string, uint01 direction=X) const
Definition Unit.h:90