opennurbs_defines.h
1 /*
2 // Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved.
3 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
4 // McNeel & Associates.
5 //
6 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
7 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
8 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
9 //
10 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
11 //
12 ////////////////////////////////////////////////////////////////
13 */
14 
15 ////////////////////////////////////////////////////////////////
16 //
17 // Includes all openNURBS toolkit defines and enums.
18 //
19 ////////////////////////////////////////////////////////////////
20 
21 #if !defined(OPENNURBS_DEFINES_INC_)
22 #define OPENNURBS_DEFINES_INC_
23 
24 #if !defined(OPENNURBS_SYSTEM_INC_)
25 #error Include opennurbs_system.h before opennurbs_defines.h
26 #endif
27 
28 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus) || defined(ON_CPLUSPLUS)
29 // C++ extern "C" declaration for C linkage
30 
31 #if !defined(ON_CPLUSPLUS)
32 #define ON_CPLUSPLUS
33 #endif
34 #define ON_EXTERNC extern "C"
35 #define ON_BEGIN_EXTERNC extern "C" {
36 #define ON_END_EXTERNC }
37 
38 #define ON_UINT_FROM_ENUM(e) (static_cast<unsigned int>(e))
39 #define ON_INT_FROM_ENUM(e) ((int)static_cast<unsigned int>(e))
40 
41 #else
42 
43 /* C file - no extern declaration required or permitted */
44 
45 #define ON_EXTERNC
46 #define ON_BEGIN_EXTERNC
47 #define ON_END_EXTERNC
48 
49 #endif
50 
51 
52 /*
53 // Declarations in header (.H) files look like
54 //
55 // ON_DECL type function():
56 // extern ON_EXTERN_DECL type global_variable;
57 // class ON_CLASS classname {};
58 // ON_TEMPLATE template class ON_CLASS template<T>;
59 //
60 */
61 
62 #define ON_ENUM_FROM_UNSIGNED_CASE(e) case (unsigned int)e: return(e); break
63 #define ON_ENUM_TO_STRING_CASE(e) case e: return( ON_String(#e) ); break
64 #define ON_ENUM_TO_WIDE_STRING_CASE(e) case e: return( ON_wString(#e) ); break
65 
66 /* export/import */
67 #if defined(OPENNURBS_EXPORTS)
68 /* compiling opennurbs as some type of dynamic linking library */
69 
70 #if defined(ON_COMPILER_MSC)
71 /* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
72 #define ON_CLASS __declspec(dllexport)
73 #define ON_DECL __declspec(dllexport)
74 #define ON_EXTERN_DECL __declspec(dllexport)
75 #define ON_DLL_TEMPLATE
76 
77 #elif defined(ON_COMPILER_CLANG)
78 /* compiling opennurbs as an Apple shared library */
79 #define ON_CLASS __attribute__ ((visibility ("default")))
80 #define ON_DECL __attribute__ ((visibility ("default")))
81 #define ON_EXTERN_DECL __attribute__ ((visibility ("default")))
82 
83 #else
84 #error fill in your compiler dynamic linking decorations
85 #endif
86 
87 #elif defined(OPENNURBS_IMPORTS)
88 /* dynamically linking with opennurbs in some way */
89 
90 #if defined(ON_COMPILER_MSC)
91 /* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals */
92 #define ON_CLASS __declspec(dllimport)
93 #define ON_DECL __declspec(dllimport)
94 #define ON_EXTERN_DECL __declspec(dllimport)
95 #define ON_DLL_TEMPLATE extern
96 
97 #elif defined(ON_COMPILER_CLANG)
98 /* using opennurbs as an Apple shared library */
99 #define ON_CLASS __attribute__ ((visibility ("default")))
100 #define ON_DECL __attribute__ ((visibility ("default")))
101 #define ON_EXTERN_DECL __attribute__ ((visibility ("default")))
102 
103 #else
104 #error fill in your compiler dynamic linking decorations
105 #endif
106 
107 #else
108 
109 /* compiling or using OpenNurbs as a static library */
110 #define ON_CLASS
111 #define ON_DECL
112 #define ON_EXTERN_DECL
113 
114 #if defined(ON_DLL_TEMPLATE)
115 #undef ON_DLL_TEMPLATE
116 #endif
117 
118 #endif
119 
120 
121 // ON_DEPRECATED is used to mark deprecated functions.
122 #if defined(ON_COMPILER_MSC)
123 #define ON_DEPRECATED __declspec(deprecated)
124 #define ON_DEPRECATED_MSG(s) [[deprecated(s)]]
125 #elif defined(ON_COMPILER_CLANG)
126 #define ON_DEPRECATED __attribute__((deprecated))
127 #define ON_DEPRECATED_MSG(s) [[deprecated(s)]]
128 #else
129 #define ON_DEPRECATED
130 #define ON_DEPRECATED_MSG(s)
131 #endif
132 
133 #if defined(PI)
134 #define ON_PI PI
135 #else
136 #define ON_PI 3.141592653589793238462643
137 #endif
138 
139 #define ON_DEGREES_TO_RADIANS (ON_PI/180.0)
140 #define ON_RADIANS_TO_DEGREES (180.0/ON_PI)
141 
142 /*
143 Parameters:
144  angle_in_radians - [in]
145  Angle measure in radians
146 Returns:
147  Angle measure in degrees
148 */
149 ON_DECL
150 double ON_DegreesFromRadians(
151  double angle_in_radians
152 );
153 
154 /*
155 Parameters:
156  angle_in_degrees - [in]
157  Angle measure in degrees
158 Returns:
159  Angle measure in radians
160 */
161 ON_DECL
162 double ON_RadiansFromDegrees(
163  double angle_in_degrees
164 );
165 
166 #define ON_SQRT2 1.414213562373095048801689
167 #define ON_SQRT3 1.732050807568877293527446
168 #define ON_SQRT3_OVER_2 0.8660254037844386467637230
169 #define ON_1_OVER_SQRT2 0.7071067811865475244008445
170 #define ON_SIN_PI_OVER_12 0.2588190451025207623488990
171 #define ON_COS_PI_OVER_12 0.9659258262890682867497433
172 
173 #define ON_LOG2 0.6931471805599453094172321
174 #define ON_LOG10 2.302585092994045684017991
175 
176 #define ON_ArrayCount(a) (sizeof(a)/sizeof((a)[0]))
177 
178 #if defined(DBL_MAX)
179 #define ON_DBL_MAX DBL_MAX
180 #else
181 #define ON_DBL_MAX 1.7976931348623158e+308
182 #endif
183 
184 #if defined(DBL_MIN)
185 #define ON_DBL_MIN DBL_MIN
186 #else
187 #define ON_DBL_MIN 2.22507385850720200e-308
188 #endif
189 
190 // ON_EPSILON = 2^-52
191 #if defined(DBL_EPSILON)
192 #define ON_EPSILON DBL_EPSILON
193 #else
194 #define ON_EPSILON 2.2204460492503131e-16
195 #endif
196 #define ON_SQRT_EPSILON 1.490116119385000000e-8
197 
198 #if defined(FLT_EPSILON)
199 #define ON_FLOAT_EPSILON FLT_EPSILON
200 #else
201 #define ON_FLOAT_EPSILON 1.192092896e-07
202 #endif
203 #define ON_SQRT_FLOAT_EPSILON 3.452669830725202719e-4
204 
205 /*
206 // In cases where lazy evaluation of a double value is
207 // performed, b-rep tolerances being a notable example,
208 // this value is used to indicate the value has not been
209 // computed. This value must be < -1.0e308. and > -ON_DBL_MAX
210 //
211 // The reasons ON_UNSET_VALUE is a valid finite number are:
212 //
213 // 1) It needs to round trip through fprintf/sscanf.
214 // 2) It needs to persist unchanged through assigment
215 / and not generate exceptions when assigned.
216 // 3) ON_UNSET_VALUE == ON_UNSET_VALUE needs to be true.
217 // 4) ON_UNSET_VALUE != ON_UNSET_VALUE needs to be false.
218 //
219 // Ideally, it would also have these SNaN attributes
220 // * When used in a calculation, a floating point exception
221 // occures.
222 // * No possibility of a valid calculation would generate
223 // ON_UNSET_VALUE.
224 // * float f = (float)ON_UNSET_VALUE would create an invalid
225 // float and generate an exception.
226 */
227 #define ON_UNSET_POSITIVE_VALUE 1.23432101234321e+308
228 #define ON_UNSET_VALUE -ON_UNSET_POSITIVE_VALUE
229 
230 /*
231 // ON_UNSET_FLOAT is used to indicate a texture coordinate
232 // value cannot be calculated or is not well defined.
233 // In hindsight, this value should have been ON_FLT_QNAN
234 // because many calculation convert float texture coordinates
235 // to doubles and the "unset"ness attribute is lost.
236 */
237 #define ON_UNSET_POSITIVE_FLOAT 1.234321e+38f
238 #define ON_UNSET_FLOAT -ON_UNSET_POSITIVE_FLOAT
239 
240 // When unsinged int values are used in a context where
241 // 0 is a valid index and there needs to be a value that
242 // indicates the index is not set, use ON_UNSET_UINT_INDEX.
243 #define ON_UNSET_UINT_INDEX 0xFFFFFFFFU
244 
245 // When signed int values are used in a context where
246 // 0 and small negative values are valid indices and there needs
247 // to be a value that indicates the index is not set,
248 // use ON_UNSET_INT_INDEX. This value is INT_MIN+1
249 #define ON_UNSET_INT_INDEX ((const int)-2147483647)
250 
251 ON_BEGIN_EXTERNC
252 
253 // IEEE 754 special values
254 
255 extern ON_EXTERN_DECL const double ON_DBL_QNAN;
256 extern ON_EXTERN_DECL const double ON_DBL_PINF;
257 extern ON_EXTERN_DECL const double ON_DBL_NINF;
258 
259 extern ON_EXTERN_DECL const float ON_FLT_QNAN;
260 extern ON_EXTERN_DECL const float ON_FLT_PINF;
261 extern ON_EXTERN_DECL const float ON_FLT_NINF;
262 
263 
264 /*
265 Description:
266 Paramters:
267  x - [out] returned value of x is an SNan
268  (signalling not a number).
269 Remarks:
270  Any time an SNaN passes through an Intel FPU, the result
271  is a QNaN (quiet nan) and the invalid operation excpetion
272  flag is set. If this exception is not masked, then the
273  exception handler is invoked.
274 
275  double x, y;
276  ON_DBL_SNAN(&x);
277  y = x; // y = QNAN and invalid op exception occurs
278  z = sin(x) // z = QNAN and invalid op exception occurs
279 
280  So, if you want to reliably initialize doubles to SNaNs,
281  you must use memcpy() or some other method that does not
282  use the Intel FPU.
283 */
284 ON_DECL
285 void ON_DBL_SNAN( double* x );
286 
287 ON_DECL
288 void ON_FLT_SNAN( float* x );
289 
290 /*
291 Returns:
292  ON_UNSET_FLOAT, if x = ON_UNSET_VALUE.
293  ON_UNSET_POSITIVE_FLOAT, if x = ON_UNSET_POSITIVE_VALUE.
294  (float)x, otherwise.
295 */
296 ON_DECL
297 float ON_FloatFromDouble(
298  double x
299 );
300 
301 /*
302 Returns:
303  ON_UNSET_VALUE, if x = ON_UNSET_FLOAT.
304  ON_UNSET_POSITIVE_VALUE, if x = ON_UNSET_POSITIVE_FLOAT.
305  (double)x, otherwise.
306 */
307 ON_DECL
308 double ON_DoubleFromFloat(
309  float x
310 );
311 
312 
313 ON_END_EXTERNC
314 
315 #if defined(ON_CPLUSPLUS)
316 ON_DECL
317 bool ON_IsNullPtr(const void* ptr);
318 
319 ON_DECL
320 bool ON_IsNullPtr(const ON__UINT_PTR ptr);
321 
322 ON_DECL
323 bool ON_IsNullPtr(const ON__INT_PTR ptr);
324 #endif
325 
326 /*
327 // In cases where lazy evaluation of a color value is
328 // performed, this value is used to indicate the value
329 // has not been computed.
330 */
331 #define ON_UNSET_COLOR 0xFFFFFFFF
332 
333 /*
334 // In cases when an absolute "zero" tolerance
335 // is required to compare model space coordinates,
336 // ON_ZERO_TOLERANCE is used. The value of
337 // ON_ZERO_TOLERANCE should be no smaller than
338 // ON_EPSILON and should be several orders of
339 // magnitude smaller than ON_SQRT_EPSILON
340 //
341 */
342 //#define ON_ZERO_TOLERANCE 1.0e-12
343 // ON_ZERO_TOLERANCE = 2^-32
344 #define ON_ZERO_TOLERANCE 2.3283064365386962890625e-10
345 
346 /*
347 // In cases when an relative "zero" tolerance is
348 // required for comparing model space coordinates,
349 // (fabs(a)+fabs(b))*ON_RELATIVE_TOLERANCE is used.
350 // ON_RELATIVE_TOLERANCE should be larger than
351 // ON_EPSILON and smaller than no larger than
352 // ON_ZERO_TOLERANCE*2^-10.
353 //
354 */
355 // ON_RELATIVE_TOLERANCE = 2^-42
356 #define ON_RELATIVE_TOLERANCE 2.27373675443232059478759765625e-13
357 
358 /*
359 // Bugs in geometry calculations involving world coordinates
360 // values > ON_MAXIMUM_WORLD_COORDINATE_VALUE
361 // will be a low priority.
362 */
363 // ON_MAXIMUM_VALUE = 2^27
364 #define ON_MAXIMUM_WORLD_COORDINATE_VALUE 1.34217728e8
365 
366 /*
367 // Any 3d coordinate value >= ON_NONSENSE_WORLD_COORDINATE_VALUE
368 // will be adjusted as needed. Any calculation creating 3d coordinates
369 // with values >= ON_NONSENSE_WORLD_COORDINATE_VALUE should be
370 // inspected for bugs.
371 */
372 // ON_NONSENSE_WORLD_COORDINATE_VALUE = 1.0e100
373 #define ON_NONSENSE_WORLD_COORDINATE_VALUE 1.0e100
374 
375 /*
376 // The default test for deciding if a curvature value should be
377 // treated as zero is
378 // length(curvature) <= ON_ZERO_CURVATURE_TOLERANCE.
379 // ON_ZERO_CURVATURE_TOLERANCE must be set so that
380 // ON_ZERO_CURVATURE_TOLERANCE >= sqrt(3)*ON_ZERO_TOLERANCE
381 // so that K.IsTiny() = true implies |K| <= ON_ZERO_CURVATURE_TOLERANCE
382 */
383 #define ON_ZERO_CURVATURE_TOLERANCE 1.0e-8
384 #define ON_RELATIVE_CURVATURE_TOLERANCE 0.05
385 
386 /* default value for angle tolerances = 1 degree */
387 #define ON_DEFAULT_ANGLE_TOLERANCE (ON_PI/180.0)
388 #define ON_DEFAULT_ANGLE_TOLERANCE_COSINE 0.99984769515639123915701155881391
389 #define ON_MINIMUM_ANGLE_TOLERANCE (ON_DEFAULT_ANGLE_TOLERANCE/10.0)
390 
391 
392 /*
393 */
394 ON_DECL
395 ON__UINT64 ON_SecondsSinceJanOne1970UTC();
397 union ON_U
398 {
399  char b[8]; // 8 bytes
400  ON__INT64 h; // 64 bit integer
401  ON__INT32 i; // 32 bit integer
402  int j[2]; // two 32 bit integers
403  void* p;
404  double d;
405 };
406 
407 #if defined(ON_CPLUSPLUS)
408 
409 // pair of integer indices. This
410 // is intentionally a struct/typedef
411 // rather than a class so that it
412 // can be used in other structs.
413 class ON_CLASS ON_2dex
414 {
415 public:
416  ON_2dex() = default;
417  ~ON_2dex() = default;
418  ON_2dex(const ON_2dex&) = default;
419  ON_2dex& operator=(const ON_2dex&) = default;
420 
421 public:
422  // do not initialize i, j for performance reasons
423  int i;
424  int j;
425 
426  ON_2dex(int i, int j);
427 
428  static const ON_2dex Unset; // (ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX);
429  static const ON_2dex Zero; // (0, 0)
430 };
431 
432 class ON_CLASS ON_2udex
433 {
434 public:
435  ON_2udex() = default;
436  ~ON_2udex() = default;
437  ON_2udex(const ON_2udex&) = default;
438  ON_2udex& operator=(const ON_2udex&) = default;
439 
440 public:
441  // do not initialize i, j for performance reasons
442  unsigned int i;
443  unsigned int j;
444 
445  ON_2udex(unsigned int i, unsigned int j);
446 
447  static const ON_2udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
448  static const ON_2udex Zero; // (0, 0)
449 };
450 
451 class ON_CLASS ON_3dex
452 {
453 public:
454  ON_3dex() = default;
455  ~ON_3dex() = default;
456  ON_3dex(const ON_3dex&) = default;
457  ON_3dex& operator=(const ON_3dex&) = default;
458 
459 public:
460  // do not initialize i, j, k for performance reasons
461  int i;
462  int j;
463  int k;
464 
465  ON_3dex(int i, int j, int k);
466 
467  static const ON_3dex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
468  static const ON_3dex Zero; // (0, 0, 0)
469 };
470 
471 class ON_CLASS ON_3udex
472 {
473 public:
474  ON_3udex() = default;
475  ~ON_3udex() = default;
476  ON_3udex(const ON_3udex&) = default;
477  ON_3udex& operator=(const ON_3udex&) = default;
478 
479 public:
480  // do not initialize i, j, k for performance reasons
481  unsigned int i;
482  unsigned int j;
483  unsigned int k;
484 
485  ON_3udex(unsigned int i, unsigned int j, unsigned int k);
486 
487  static const ON_3udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
488  static const ON_3udex Zero; // (0, 0, 0)
489 };
490 
491 // quadruplet of integer indices.
492 class ON_CLASS ON_4dex
493 {
494 public:
495  ON_4dex() = default;
496  ~ON_4dex() = default;
497  ON_4dex(const ON_4dex&) = default;
498  ON_4dex& operator=(const ON_4dex&) = default;
499 
500 public:
501  // do not initialize i, j, k, l for performance reasons
502  int i;
503  int j;
504  int k;
505  int l;
506 
507  ON_4dex(int i, int j, int k, int l);
508 
509  static const ON_4dex Unset; // (ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX, ON_UNSET_INT_INDEX);
510  static const ON_4dex Zero; // (0, 0, 0, 0)
511 };
512 
513 class ON_CLASS ON_4udex
514 {
515 public:
516  ON_4udex() = default;
517  ~ON_4udex() = default;
518  ON_4udex(const ON_4udex&) = default;
519  ON_4udex& operator=(const ON_4udex&) = default;
520 
521 public:
522  // do not initialize i, j, k, l for performance reasons
523  unsigned int i;
524  unsigned int j;
525  unsigned int k;
526  unsigned int l;
527 
528  ON_4udex(unsigned int i, unsigned int j, unsigned int k, unsigned int l);
529 
530  static const ON_4udex Unset; // (ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX, ON_UNSET_UINT_INDEX);
531  static const ON_4udex Zero; // (0, 0, 0, 0)
532 };
533 
534 
535 enum class ON_StringMapType : int
536 {
537  Identity = 0,
538  UpperCase = 1,
539  LowerCase = 2
540 };
541 
542 enum class ON_StringMapOrdinalType : int
543 {
544  Identity = 0,
545  UpperOrdinal = 1,
546  LowerOrdinal = 2,
547  MinimumOrdinal = 3
548 };
549 
550 ON_DECL
551 ON_StringMapOrdinalType ON_StringMapOrdinalTypeFromStringMapType(
552  ON_StringMapType map_type
553  );
554 
555 // OpenNurbs enums
556 class ON_CLASS ON
557 {
558 public:
559  /*
560  Description:
561  Call before using openNURBS to ensure all class definitions
562  are linked.
563  */
564  static void Begin();
565 
566 
567  /*
568  Description:
569  Call when finished with openNURBS.
570  Remarks:
571  Currently does nothing.
572  */
573  static void End();
574 
575  /*
576  Returns:
577  0: not initialized
578  1: in the body of ON:Begin()
579  2: ON::Begin() has finished.
580  */
581  static unsigned int LibraryStatus();
582 
583  /*
584  Set the library status
585  */
586  static void SetLibraryStatus(unsigned int status);
587 
588  /*
589  Returns:
590  The value of OPENNURBS_VERSION_NUMBER, which is defined in opennurbs_version.h.
591  Remarks:
592  The high bit of this number is set. Do not cast the result as an int.
593  */
594  static
595  unsigned int Version();
596 
597  /*
598  Returns:
599  The value of OPENNURBS_VERSION_MAJOR, which is defined in opennurbs_version.h
600  (0 to 63).
601  */
602  static
603  unsigned int VersionMajor();
604 
605  /*
606  Returns:
607  The value of OPENNURBS_VERSION_MINOR, which is defined in opennurbs_version.h
608  (0 to 127).
609  */
610  static
611  unsigned int VersionMinor();
612 
613  /*
614  Returns:
615  The value of OPENNURBS_VERSION_YEAR, which is defined in opennurbs_version.h
616  > 2014.
617  */
618  static
619  unsigned int VersionYear();
620 
621  /*
622  Returns:
623  The value of OPENNURBS_VERSION_MONTH, which is defined in opennurbs_version.h
624  1 to 12.
625  */
626  static
627  unsigned int VersionMonth();
628 
629  /*
630  Returns:
631  The value of OPENNURBS_VERSION_DAY_OF_MONTH, which is defined in opennurbs_version.h
632  (1 to 31).
633  */
634  static
635  unsigned int VersionDayOfMonth();
636 
637  /*
638  Returns:
639  The value of OPENNURBS_VERSION_HOUR, which is defined in opennurbs_version.h
640  (0 to 23).
641  */
642  static
643  unsigned int VersionHour();
644 
645  /*
646  Returns:
647  The value of OPENNURBS_VERSION_MINUTE, which is defined in opennurbs_version.h
648  (0 to 59).
649  */
650  static
651  unsigned int VersionMinute();
652 
653  /*
654  Returns:
655  The value of OPENNURBS_VERSION_BRANCH, which is defined in opennurbs_version.h
656  0: developer build
657  1: trunk build
658  2: release candidate build
659  3: release build
660  */
661  static
662  unsigned int VersionBranch();
663 
664  /*
665  Description:
666  Get the opennurbs version number as a quartet of values.
667  Parameters:
668  version_quartet - [out]
669  version_quartet[0] = ON::VersionMajor()
670  version_quartet[1] = ON::VersionMinor()
671  version_quartet[2] = (year - 2000)*1000 + day_of_year
672  version_quartet[3] = (hour*1000 + minute*10 + OPENNURBS_VERSION_BRANCH)
673  Returns:
674  The value of OPENNURBS_VERSION_NUMBER, which is defined in opennurbs_version.h.
675  Remarks:
676  The high bit of the returned value is set. Do not cast the result as an int.
677  */
678  static
679  unsigned int VersionGetQuartet(
680  unsigned int version_quartet[4]
681  );
682 
683 
684  /*
685  Returns:
686  The value of OPENNURBS_VERSION_QUARTET_STRING, which is defined in opennurbs_version.h.
687  Remarks:
688  The high bit of this number is set. Do not cast the result as an int.
689  */
690  static
691  const char* VersionQuartetAsString();
692 
693  /*
694  Returns:
695  The value of OPENNURBS_VERSION_QUARTET_WSTRING, which is defined in opennurbs_version.h.
696  Remarks:
697  The high bit of this number is set. Do not cast the result as an int.
698  */
699  static
700  const wchar_t* VersionQuartetAsWideString();
701 
702  /*
703  Returns:
704  Empty string or the git hash of the revison of the source code used to build this application.
705  The git hash is a hexadecimal number represented in UTF-8 string.
706  Remarks:
707  Developer builds return "".
708  Build system builds return the git revsion hash.
709  */
710  static const char* SourceGitRevisionHash();
711 
712  /*
713  Returns:
714  Empty string or the name of the git branch containing the source code used to build this application.
715  Remarks:
716  Developer builds return "".
717  Build system builds return the git branch name or "".
718  */
719  static const char* SourceGitBranchName();
720 
721  /*
722  Returns:
723  A string that identifies the McNeel version control system source code to build this application.
724  Remarks:
725  Developer builds return "".
726  Build system builds return the git <branch name> @ <git revision hash> or "".
727  */
728  static const char* SourceIdentification();
729 
730  //// File open/close for DLL use ///////////////////////////////////////////////
731 
732  static
733  FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
734  const char* filename,
735  const char* filemode
736  );
737 
738  static
739  FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
740  const wchar_t* filename,
741  const wchar_t* filemode
742  );
743 
744  static
745  int CloseFile( // like fclose() - needed when OpenNURBS is used as a DLL
746  FILE* // pointer returned by OpenFile()
747  );
748 
749  static
750  int CloseAllFiles(); // like _fcloseall() - needed when OpenNURBS is used as a DLL
751 
752  /*
753  Description:
754  Uses the flavor of fstat that is appropriate for the platform.
755  Parameters:
756  filename - [in]
757  fp - [in]
758  filesize - [out] (can be nullptr if you do not want filesize)
759  create_time - [out] (can be nullptr if you do not want last create time)
760  lastmodify_time - [out] (can be nullptr if you do not want last modification time)
761  Returns:
762  True if file exists, can be opened for read, and fstat worked.
763  */
764  static
765  bool GetFileStats( const wchar_t* filename,
766  size_t* filesize,
767  time_t* create_time,
768  time_t* lastmodify_time
769  );
770 
771  static
772  bool GetFileStats( FILE* fp,
773  size_t* filesize,
774  time_t* create_time,
775  time_t* lastmodify_time
776  );
777 
778  /*
779  Returns true if pathname is a directory.
780  */
781  static bool IsDirectory( const wchar_t* pathname );
782  static bool IsDirectory( const char* utf8pathname );
783 
784  /*
785  Returns
786  If the file is an opennurbs file, the version of the file
787  is returned (2,3,4,50,...).
788  If the file is not an opennurbs file, 0 is returned.
789  */
790  static int IsOpenNURBSFile( const wchar_t* pathname );
791  static int IsOpenNURBSFile( const char* utf8pathname );
792  static int IsOpenNURBSFile( FILE* fp );
793 
794 #pragma region RH_C_SHARED_ENUM [ON::RuntimeEnvironment] [Rhino.RuntimeEnvironment] [byte]
795  /////////////////////////////////////////////////////////////////
796  /// <summary>
797  /// ON::RuntimeEnvironment identifies a runtime environment (operating system).
798  /// This value is saved in binary archives so appropriate adjustments
799  /// to resources provided by runtime environments, like fonts, can be made
800  /// when an archive created in one runtime environment is used in another.
801  /// </summary>
802  enum class RuntimeEnvironment : unsigned char
803  {
804  ///<summary>
805  /// ON::RuntimeEnvironment::Unset indicates no runtime is set.
806  ///</summary>
807  Unset = 0,
808 
809  ///<summary>
810  /// ON::RuntimeEnvironment::None indicates no runtime.
811  /// This is a different condition from ON::Runtime::Unset.
812  ///</summary>
813  None = 1,
814 
815  ///<summary>
816  /// ON::RuntimeEnvironment::Windows indicates some version of Microsoft Windows.
817  ///</summary>
818  Windows = 2,
819 
820  ///<summary>
821  /// ON::RuntimeEnvironment::Apple indicates some version of Apple OS X or iOS.
822  ///</summary>
823  Apple = 3,
824 
825  ///<summary>
826  /// ON::RuntimeEnvironment::Android indicates some version of Google Android.
827  ///</summary>
828  Android = 4
829  };
830 #pragma endregion
831 
832  static ON::RuntimeEnvironment RuntimeEnvironmentFromUnsigned(
833  unsigned int runtime_environment_as_unsigned
834  );
835 
836  /*
837  Returns:
838  Current runtime environment.
839  */
840  static ON::RuntimeEnvironment CurrentRuntimeEnvironment();
841 
842 
843 #pragma region RH_C_SHARED_ENUM [ON::ReadFileResult] [Rhino.ReadFileResult] [byte]
844  /// <summary>
845  /// ON::ReadFileResult reports what happened when a file read was attempted.
846  /// </summary>
847  enum class ReadFileResult : unsigned char
848  {
849  ///<summary>
850  /// No result is available.
851  ///</summary>
852  Unset = 0,
853 
854  ///<summary>
855  /// Read completed with no errors.
856  ///</summary>
857  Completed = 1,
858 
859  ///<summary>
860  /// Read completed with non fatal errors.
861  ///</summary>
862  CompletedWithErrors = 2,
863 
864  ///<summary>
865  /// Read failed.
866  ///</summary>
867  Failed = 3
868  };
869 #pragma endregion
870 
871  static ON::ReadFileResult ReadFileResultFromUnsigned(
872  unsigned int read_file_result_as_unsigned
873  );
874 
875  /*
876  Returns:
877  True if the value of read_file_result is one indicating partial to complete success.
878  False if read_file_result is ON::ReadFileResult::Unset or ON::ReadFileResult::Failed.
879  */
880  static bool ReadFileCompleted(
881  ON::ReadFileResult read_file_result
882  );
883 
884  /*
885  Returns:
886  True if the value of read_file_result is one indicating total failure.
887  False if read_file_result is ON::ReadFileResult::Unset or a value indicating partial to complete success.
888  */
889  static bool ReadFileFailed(
890  ON::ReadFileResult read_file_result
891  );
892 
893 
894  // Defines the current working space.
895  enum active_space : unsigned char
896  {
897  no_space = 0,
898  model_space = 1, // 3d modeling or "world" space
899  page_space = 2 // page/layout/paper/printing space
900  };
901 
902  static active_space ActiveSpace(int); // convert integer to active_space enum
903 
904 #pragma region RH_C_SHARED_ENUM [ON::LengthUnitSystem] [Rhino.UnitSystem] [byte]
905  // unit_system ///////////////////////////////////////////////////////////////
906  /// <summary>
907  /// ON::LengthUnitSystem identifies a length unit system
908  /// United States customary length units references:
909  /// http://www.nist.gov/pml/wmd/metric/upload/frn-59-5442-1959.pdf
910  /// http://en.wikipedia.org/wiki/United_States_customary_units
911  /// http://en.wikipedia.org/wiki/International_yard_and_pound
912  /// </summary>
913  enum class LengthUnitSystem : unsigned char
914  {
915  ///<summary>
916  /// ON::LengthUnitSystem::None indicates no length unit system. The scale factor
917  /// when converting between a specified unit system and None is always 1.0.
918  /// ON::LengthUnitSystem::None is used as a unit system for models and
919  /// instance defitions that should be imported or referenced with no
920  /// scaling applied.
921  ///</summary>
922  None = 0,
923 
924  ///<summary>
925  /// 1 angstroms = 1.0e-10 meters
926  ///</summary>
927  Angstroms = 12,
928 
929  // SI (metric) units
930 
931  ///<summary>
932  /// 1 nanometer = 1.0e-9 meters
933  ///</summary>
934  Nanometers = 13,
935 
936  ///<summary>
937  /// 1 micron = 1.0e-6 meters
938  ///</summary>
939  Microns = 1,
940 
941  ///<summary>
942  /// 1 millimeter = 1.0e-3 meters
943  ///</summary>
944  Millimeters = 2,
945 
946  ///<summary>
947  /// 1 centimeter = 1.0e-2 meters
948  ///</summary>
949  Centimeters = 3,
950 
951  ///<summary>
952  /// 1 decimeter = 1.0e-1 meters
953  ///</summary>
954  Decimeters = 14,
955 
956  ///<summary>
957  /// SI meter length unit
958  ///</summary>
959  Meters = 4,
960 
961  ///<summary>
962  /// 1 dekameter = 1.0e+1 meters
963  ///</summary>
964  Dekameters = 15, // 1.0e+1 meters
965 
966  ///<summary>
967  /// 1 hectometer = 1.0e+2 meters
968  ///</summary>
969  Hectometers = 16,
970 
971  ///<summary>
972  /// 1 kilometer = 1.0e+3 meters
973  ///</summary>
974  Kilometers = 5,
975 
976  ///<summary>
977  /// 1 megameter = 1.0e+6 meters
978  ///</summary>
979  Megameters = 17,
980 
981  ///<summary>
982  /// 1 gigameter = 1.0e+9 meters
983  ///</summary>
984  Gigameters = 18,
985 
986  ///<summary>
987  /// 1 microinches = 2.54e-8 meters = 1.0e-6 inches
988  ///</summary>
989  Microinches = 6,
990 
991  ///<summary>
992  /// 1 mil = 2.54e-5 meters = 0.001 inches
993  ///</summary>
994  Mils = 7,
995 
996  ///<summary>
997  /// 1 inch = 0.0254 meters = 1/12 foot
998  ///</summary>
999  Inches = 8,
1000 
1001  ///<summary>
1002  /// 1 foot = 0.3048 meters (12 inches)
1003  ///</summary>
1004  Feet = 9,
1005 
1006  ///<summary>
1007  /// 1 foot = 0.3048 meters = 12 inches
1008  ///</summary>
1009  Yards = 19,
1010 
1011  ///<summary>
1012  /// 1 US statute mile = 1609.344 meters = 5280 feet
1013  ///</summary>
1014  Miles = 10,
1015 
1016  ///<summary>
1017  /// 1 printer point = 1/72 inch
1018  ///</summary>
1019  PrinterPoints = 20,
1020 
1021  ///<summary>
1022  /// 1 printer pica = 1/6 inch
1023  ///</summary>
1024  PrinterPicas = 21,
1025 
1026  // terrestrial distances
1027 
1028  ///<summary>
1029  /// 1 nautical mile = 1852 meters
1030  /// Approximately 1 minute of arc on a terrestrial great circle.
1031  /// Reference: http://en.wikipedia.org/wiki/Nautical_mile
1032  ///</summary>
1033  NauticalMiles = 22,
1034 
1035  // astronomical distances
1036 
1037  ///<summary>
1038  /// 1 astronomical unit = 1.4959787e+11 meters
1039  /// An astronomical unit (au) is the mean distance from the
1040  /// center of the earth to the center of the sun.
1041  /// References:
1042  /// http://en.wikipedia.org/wiki/Astronomical_unit (1.4959787e+11 meters)
1043  /// http://units.nist.gov/Pubs/SP811/appenB9.htm (1.495979e+11 meters)
1044  ///</summary>
1045  AstronomicalUnits = 23,
1046 
1047  ///<summary>
1048  /// 1 light year = 9.4607304725808e+15 meters
1049  /// A light year is the distance light travels in one Julian year.
1050  /// The speed of light is exactly 299792458 meters/second.
1051  /// A Julian year is exactly 365.25 * 86400 seconds and is
1052  /// approximately the time it takes for one earth orbit.
1053  /// References:
1054  /// http://en.wikipedia.org/wiki/Light_year (9.4607304725808e+15 meters)
1055  /// http://units.nist.gov/Pubs/SP811/appenB9.htm (9.46073e+15 meters)
1056  ///</summary>
1057  LightYears = 24,
1058 
1059  ///<summary>
1060  /// 1 parsec = 3.08567758e+16 meters
1061  /// References:
1062  /// http://en.wikipedia.org/wiki/Parsec (3.08567758e+16 meters)
1063  /// http://units.nist.gov/Pubs/SP811/appenB9.htm (3.085678e+16)
1064  ///</summary>
1065  Parsecs = 25,
1066 
1067  ///<summary>
1068  /// The name of a custom unit and the conversion to meters
1069  /// are saved in the ON_UnitSystem class.
1070  ///</summary>
1071  CustomUnits = 11,
1072 
1073  ///<summary>
1074  /// The ON::LengthUnitSystem::Unset is used to indicate no unit system is set.
1075  /// This is a differnt condition from ON::LengthUnitSystem::None.
1076  ///</summary>
1077  Unset = 255
1078  };
1079 #pragma endregion
1080 
1081  static ON::LengthUnitSystem LengthUnitSystemFromUnsigned(
1082  unsigned int length_unit_system_as_unsigned
1083  );
1084 
1085  /*
1086  Parameters:
1087  model_serial_number - [in]
1088  One good way to get this value is from ON_ModelComponent::ModelSerialNumber().
1089  ON_DimStyle, ON_Layer, ... are all derived from ON_ModelComponent.
1090  Returns:
1091  The length unit system used by the model
1092  */
1093  static ON::LengthUnitSystem ModelLengthUnitSystem(
1094  ON__UINT_PTR model_serial_number
1095  );
1096 
1097 
1098  static void RegisterModelLengthUnitSystemCallback(
1099  ON::LengthUnitSystem (*func_ModelLengthUnitSystemCallback)(ON__UINT_PTR)
1100  );
1101 
1102 public:
1103 
1104  /*
1105  Returns
1106  True if the length unit is one of
1107  LengthUnitSystem::Angstroms
1108  LengthUnitSystem::Nanometers
1109  LengthUnitSystem::Microns
1110  LengthUnitSystem::Millimeters
1111  LengthUnitSystem::Centimeters
1112  LengthUnitSystem::Decimeters
1113  LengthUnitSystem::Meters
1114  LengthUnitSystem::Dekameters
1115  LengthUnitSystem::Hectometers
1116  LengthUnitSystem::Kilometers
1117  LengthUnitSystem::Megameters
1118  LengthUnitSystem::Gigameters
1119  LengthUnitSystem::NauticalMiles
1120  LengthUnitSystem::AstronomicalUnits
1121  LengthUnitSystem::LightYears
1122  LengthUnitSystem::Parsecs
1123  */
1124  static bool IsMetricLengthUnit(
1125  ON::LengthUnitSystem length_unit_system
1126  );
1127 
1128  /*
1129  Returns
1130  True if the length unit is one of
1131  LengthUnitSystem::Microinches
1132  LengthUnitSystem::Mils
1133  LengthUnitSystem::Inches
1134  LengthUnitSystem::Feet
1135  LengthUnitSystem::Yards
1136  LengthUnitSystem::Miles
1137  LengthUnitSystem::PrinterPoints
1138  LengthUnitSystem::PrinterPicas
1139  */
1140  static bool IsUnitedStatesCustomaryLengthUnit(
1141  ON::LengthUnitSystem length_unit_system
1142  );
1143 
1144  /*
1145  Returns
1146  True if the length unit is one of
1147  LengthUnitSystem::Millimeters
1148  LengthUnitSystem::Centimeters
1149  LengthUnitSystem::Decimeters
1150  LengthUnitSystem::Meters
1151  LengthUnitSystem::Dekameters
1152  LengthUnitSystem::Hectometers
1153  LengthUnitSystem::Kilometers
1154  LengthUnitSystem::Inches
1155  LengthUnitSystem::Feet
1156  LengthUnitSystem::Yards
1157  LengthUnitSystem::Miles
1158  LengthUnitSystem::NauticalMiles
1159  */
1160  static bool IsTerrestrialLengthUnit(
1161  ON::LengthUnitSystem length_unit_system
1162  );
1163 
1164  /*
1165  Returns
1166  True if the length unit is one of
1167  LengthUnitSystem::AstronomicalUnits
1168  LengthUnitSystem::LightYears
1169  LengthUnitSystem::Parsecs
1170  */
1171  static bool IsExtraTerrestrialLengthUnit(
1172  ON::LengthUnitSystem length_unit_system
1173  );
1174 
1175  /*
1176  Returns
1177  True if the length unit is one of
1178  LengthUnitSystem::Angstroms
1179  LengthUnitSystem::Nanometers
1180  LengthUnitSystem::Microns
1181  LengthUnitSystem::Microinches
1182  LengthUnitSystem::Mils
1183  */
1184  static bool IsMicroscopicLengthUnit(
1185  ON::LengthUnitSystem length_unit_system
1186  );
1187 
1188  /*
1189  Returns
1190  True if the length unit is one of
1191  LengthUnitSystem::PrinterPoints
1192  LengthUnitSystem::PrinterPicas
1193  */
1194  static bool IsUnitedStatesPrinterLengthUnit(
1195  ON::LengthUnitSystem length_unit_system
1196  );
1197 
1198  /*
1199  Description:
1200  Scale factor for changing unit "standard" systems.
1201  Parameters:
1202  us_from - [in]
1203  us_to - [in]
1204  For example:
1205 
1206  100.0 = ON::UnitScale( ON::LengthUnitSystem::Meters, ON::LengthUnitSystem::Centimeters )
1207  2.54 = ON::UnitScale( ON::LengthUnitSystem::Inches, ON::LengthUnitSystem::Centimeters )
1208  12.0 = ON::UnitScale( ON::LengthUnitSystem::Feet, ON::LengthUnitSystem::Inches )
1209 
1210  Remarks:
1211  If you are using custom unit systems, use the version
1212  that takes ON_UnitSystem or ON_3dmUnitsAndTolerances
1213  parameters.
1214  */
1215  static double UnitScale(
1216  ON::LengthUnitSystem us_from,
1217  ON::LengthUnitSystem us_to
1218  );
1219  static double UnitScale(
1220  const class ON_UnitSystem& us_from,
1221  const class ON_UnitSystem& us_to
1222  );
1223  static double UnitScale(
1224  ON::LengthUnitSystem us_from,
1225  const class ON_UnitSystem& us_to
1226  );
1227  static double UnitScale(
1228  const class ON_UnitSystem& us_from,
1229  ON::LengthUnitSystem us_to
1230  );
1231  static double UnitScale(
1232  const class ON_3dmUnitsAndTolerances& us_from,
1233  const class ON_3dmUnitsAndTolerances& us_to
1234  );
1235 
1236 
1237 #pragma region RH_C_SHARED_ENUM [ON::AngleUnitSystem] [Rhino.AngleUnitSystem] [byte]
1238  /// <summary>
1239  /// ON::AngleUnitSystem identifies an angle unit system
1240  /// </summary>
1241  enum class AngleUnitSystem : unsigned char
1242  {
1243  ///<summary>
1244  /// ON::AngleUnitSystem::None indicates no angle unit system
1245  /// is specified and model angle unit system should be used.
1246  ///</summary>
1247  None = 0,
1248 
1249  ///<summary>
1250  /// 1 turn = 2pi radians.
1251  ///</summary>
1252  Turns = 1,
1253 
1254  ///<summary>
1255  /// 1 turn = 2pi radians.
1256  ///</summary>
1257  Radians = 2, // 2pi radians = 1 turn
1258 
1259  ///<summary>
1260  /// 360 arc degrees = 1 turn = 2pi radians
1261  ///</summary>
1262  Degrees = 3,
1263 
1264  ///<summary>
1265  /// 60 arc minutes = 1 arc degree
1266  ///</summary>
1267  Minutes = 4,
1268 
1269  ///<summary>
1270  /// 60 arc seconds = 1 arc minute
1271  ///</summary>
1272  Seconds = 5,
1273 
1274  ///<summary>
1275  /// 400 gradians = 2pi radians.
1276  ///</summary>
1277  Gradians = 6,
1278 
1279  ///<summary>
1280  /// The ON::AngleUnitSystem::Unset is used to indicates no angle unit system
1281  /// has been specified in user interface code.
1282  ///</summary>
1283  Unset = 255
1284  };
1285 #pragma endregion
1286 
1287  static ON::AngleUnitSystem AngleUnitSystemFromUnsigned(
1288  unsigned int angle_unit_system_as_unsigned
1289  );
1290 
1291  static double AngleUnitScale(
1292  ON::AngleUnitSystem us_from,
1293  ON::AngleUnitSystem us_to
1294  );
1295 
1296 
1297  /// <summary>
1298  /// ON::EarthCoordinateSystem identifies the standard used to define Earth latitude, longitude, and elevation coordinates.
1299  /// </summary>
1300  enum class EarthCoordinateSystem : unsigned char
1301  {
1302  ///<summary>
1303  /// ON::EarthCoordinateSystem::Unset
1304  ///</summary>
1305  Unset = 0,
1306 
1307  ///<summary>
1308  /// ON::EarthCoordinateSystem::GroundLevel Not well defined, but latitude and longitude will be good enough for architecture sun studies.
1309  ///</summary>
1310  GroundLevel = 1, /// Ground level - coordinates vary with time and location
1311 
1312  ///<summary>
1313  /// ON::EarthCoordinateSystem::MeanSeaLevel Not well defined, but latitude and longitude will be good enough for architecture sun studies.
1314  ///</summary>
1315  MeanSeaLevel = 2,
1316 
1317  ///<summary>
1318  /// ON::EarthCoordinateSystem::CenterOfEarth Not well defined. The Earth's center of mass and center of volume are at different locations.
1319  ///</summary>
1320  CenterOfEarth = 3,
1321 
1322  ///<summary>
1323  /// ON::EarthCoordinateSystem::WGS1984 World Geodetic System 1984 standard. (Current GPS standard.)
1324  ///</summary>
1325  WGS1984 = 5,
1326 
1327  ///<summary>
1328  /// ON::EarthCoordinateSystem::EGM2008 Earth Gravitational Model 2008 standard.
1329  ///</summary>
1330  EGM2008 = 6
1331  };
1332 
1333  static ON::EarthCoordinateSystem EarthCoordinateSystemFromUnsigned(
1334  unsigned int earth_coordinte_system_as_unsigned
1335  );
1336 
1337  /// <summary>
1338  /// ON::ComponentNameConflictResolution identifies a method to use
1339  /// when components are being added to model, the component name must
1340  /// be unique, and the name of the new is already in use in the context.
1341  /// The function ON_ModelComponent::UniqueNameRequired(ON_ModelComponent::Type)
1342  /// can be used to determine if a component requires a unique name.
1343  /// </summary>
1344  enum class ComponentNameConflictResolution : unsigned char
1345  {
1346  ///<summary>
1347  /// A method to resolve name conflicts has not been specified.
1348  ///</summary>
1349  Unset = 0,
1350 
1351  ///<summary>
1352  /// Interactivly ask the user to choose one of the following methods
1353  /// to resolve component name conflicts.
1354  ///</summary>
1355  QueryMethod = 1,
1356 
1357  ///<summary>
1358  /// Use the existing component, discard the new component.
1359  /// All references to the discarded component are changed to reference the
1360  /// the surviving component.
1361  ///</summary>
1362  UseExistingComponent = 2,
1363 
1364  ///<summary>
1365  /// Replace the existing component with the new component.
1366  /// All references to the discarded component are changed reference the
1367  /// the surviving component.
1368  ///</summary>
1369  ReplaceExistingComponent = 3,
1370 
1371  ///<summary>
1372  /// Keep both components.
1373  /// Resolve the name conflict by automatically assigning a name new component.
1374  /// This is typically done by appending an integer to the original name.
1375  ///</summary>
1376  KeepBothComponentsAutomaticRename = 4,
1377 
1378  ///<summary>
1379  /// Keep both components.
1380  /// Resolve the name conflict by interactivly asking for an unused name
1381  /// to assign to the new component.
1382  ///</summary>
1383  KeepBothComponentsQueryRename = 5,
1384 
1385  ///<summary>
1386  /// No name conflict was detected and no special action is required.
1387  /// This can occur when the names in question are unique or unique names are not required.
1388  ///</summary>
1389  NoConflict = 0xFF
1390  };
1391 
1392  static ON::ComponentNameConflictResolution ComponentNameConflictResolutionFromUnsigned(
1393  unsigned int component_name_conflict_resolution_as_unsigned
1394  );
1395 
1396  //// distance_display_mode ///////////////////////////////////
1397 
1398 
1399  // Obsolete - use ON_DimStyle::DimensionLengthDisplay
1400  enum class OBSOLETE_DistanceDisplayMode : unsigned char
1401  {
1402  // Obsolete - Obsolete - use ON_DimStyle::DimensionLengthDisplay::ModelUnits
1403  Decimal = 0,
1404 
1405  // Obsolete - Obsolete - use ON_DimStyle::DimensionLengthDisplay::InchesFractional
1406  Fractional = 1,
1407 
1408  // Obsolete - Obsolete - use ON_DimStyle::DimensionLengthDisplay::FeetAndInches
1409  FeetInches = 2
1410  };
1411 
1412  static ON::OBSOLETE_DistanceDisplayMode DistanceDisplayModeFromUnsigned(
1413  unsigned int distance_display_mode_as_unsigned
1414  );
1415 
1416 
1417  //// point_style ///////////////////////////////////////////////////////////////
1418  enum point_style
1419  {
1420  unknown_point_style = 0,
1421  not_rational = 1,
1422  homogeneous_rational = 2,
1423  euclidean_rational = 3,
1424  intrinsic_point_style = 4, // point format used in definition
1425  point_style_count = 5
1426  };
1427 
1428  static point_style PointStyle(int); // convert integer to point_style enum
1429 
1430  //// knot_style ///////////////////////////////////////////////////////////////
1431  enum knot_style // if a knot vector meets the conditions of two styles,
1432  { // then the style with the lowest value is used
1433  unknown_knot_style = 0, // unknown knot style
1434  uniform_knots = 1, // uniform knots (ends not clamped)
1435  quasi_uniform_knots = 2, // uniform knots (clamped ends, degree >= 2)
1436  piecewise_bezier_knots = 3, // all internal knots have full multiplicity
1437  clamped_end_knots = 4, // clamped end knots (with at least 1 interior non-uniform knot)
1438  non_uniform_knots = 5, // known to be none of the above
1439  knot_style_count = 6
1440  };
1441 
1442  static knot_style KnotStyle(int); // convert integer to knot_style enum
1443 
1444  //// continuity ////////////////////////////////////////////////////////////////
1445  enum class continuity : unsigned int
1446  {
1447  unknown_continuity = 0,
1448 
1449  // These test for parametric continuity. In particular,
1450  // all types of ON_Curves are considered infinitely
1451  // continuous at the start/end of the evaluation domain.
1452  C0_continuous = 1, // continuous function
1453  C1_continuous = 2, // continuous first derivative
1454  C2_continuous = 3, // continuous first and second derivative
1455  G1_continuous = 4, // continuous unit tangent
1456  G2_continuous = 5, // continuous unit tangent and curvature
1457 
1458  // 20 March 2003 Dale Lear added these.
1459  //
1460  // Continuity tests using the following enum values
1461  // are identical to tests using the preceding enum values
1462  // on the INTERIOR of a curve's domain. At the END of
1463  // a curve a "locus" test is performed in place of a
1464  // parametric test. In particular, at the END of a domain,
1465  // all open curves are locus discontinuous. At the END of
1466  // a domain, all closed curves are at least C0_locus_continuous.
1467  // By convention all ON_Curves are considered
1468  // locus continuous at the START of the evaluation domain.
1469  // This convention is not strictly correct, but is was
1470  // adopted to make iterative kink finding tools easier to
1471  // use and so that locus discontinuities are reported once
1472  // at the end parameter of a curve rather than twice.
1473  C0_locus_continuous = 6, // locus continuous function
1474  C1_locus_continuous = 7, // locus continuous first derivative
1475  C2_locus_continuous = 8, // locus continuous first and second derivative
1476  G1_locus_continuous = 9, // locus continuous unit tangent
1477  G2_locus_continuous = 10, // locus continuous unit tangent and curvature
1478 
1479  Cinfinity_continuous = 11, // analytic discontinuity
1480  Gsmooth_continuous = 12 // aesthetic discontinuity
1481  };
1482 
1483  /*
1484  Description:
1485  Convert int to ON::continuity enum value
1486  */
1487  static continuity Continuity(int);
1488 
1489  /*
1490  Description:
1491  Convert int to ON::continuity enum value and
1492  convert the locus flavored values to the parametric
1493  flavored values.
1494  */
1495  static continuity ParametricContinuity(int);
1496 
1497  /*
1498  Description:
1499  Convert int to ON::continuity enum value and
1500  convert the higher order flavored values to
1501  the corresponding C1 or G1 values needed to
1502  test piecewise linear curves.
1503  */
1504  static continuity PolylineContinuity(int);
1505 
1506  //// curve_style ///////////////////////////////////////////////////////////////
1507  enum curve_style
1508  {
1509  unknown_curve_style = 0,
1510  line = 1,
1511  circle = 2,
1512  ellipse = 3, // with distinct foci (not a circle)
1513  parabola = 4,
1514  hyperbola = 5,
1515  planar_polyline = 6, // not a line segment
1516  polyline = 7, // non-planar polyline
1517  planar_freeform_curve = 8, // planar but none of the above
1518  freeform_curve = 9, // known to be none of the above
1519  curve_style_count = 10
1520  };
1521 
1522  static curve_style CurveStyle(int); // convert integer to curve_style enum
1523 
1524  //// surface_style ///////////////////////////////////////////////////////////////
1525  enum surface_style
1526  {
1527  unknown_surface_style = 0,
1528  plane = 1,
1529  circular_cylinder = 2, // portion of right circular cylinder
1530  elliptical_cylinder = 3, // portion of right elliptical cylinder
1531  circular_cone = 4, // portion of right circular cone
1532  elliptical_cone = 5, // portion of right elliptical cone
1533  sphere = 6, // portion of sphere
1534  torus = 7, // portion of torus
1535  surface_of_revolution = 8, // portion of surface of revolution that is none of the above
1536  ruled_surface = 9, // portion of a ruled surface this is none of the above
1537  freeform_surface = 10, // known to be none of the above
1538  surface_style_count = 11
1539  };
1540 
1541  static surface_style SurfaceStyle(int); // convert integer to surface_style enum
1542 
1543  //// sort_algorithm ///////////////////////////////////////////////////////////////
1544  enum class sort_algorithm : unsigned int
1545  {
1546  heap_sort = 0,
1547  quick_sort = 1
1548  };
1549 
1550  static sort_algorithm SortAlgorithm(int); // convert integer to sort_method enum
1551 
1552  //// endian-ness ///////////////////////////////////////////////////////////////
1553  enum class endian : unsigned int
1554  {
1555  little_endian = 0, // least significant byte first or reverse byte order - Intel x86, ...
1556  big_endian = 1 // most significant byte first - Motorola, Sparc, MIPS, ...
1557  };
1558 
1559  static endian Endian(int); // convert integer to endian enum
1560  static endian Endian(); // returns endian-ness of current CPU
1561 
1562  //// archive modes //////////////////////////////////////////////////////////////
1563  enum class archive_mode : unsigned int
1564  {
1565  unset_archive_mode = 0,
1566  read = 1, // all read modes have bit 0x0001 set
1567  write = 2, // all write modes have bit 0x0002 set
1568  readwrite = 3,
1569  read3dm = 5,
1570  write3dm = 6
1571  };
1572  static archive_mode ArchiveMode(int); // convert integer to endian enum
1573 
1574 
1575  //// view projections ///////////////////////////////////////////////////////////
1576 
1577  // The x/y/z_2pt_perspective_view projections are ordinary perspective
1578  // projection. Using these values insures the ON_Viewport member
1579  // fuctions properly constrain the camera up and camera direction vectors
1580  // to preserve the specified perspective vantage.
1581  enum view_projection : unsigned int
1582  {
1583  unknown_view = 0,
1584  parallel_view = 1,
1585  perspective_view = 2
1586  };
1587 
1588  /*
1589  Description:
1590  Converts integer into ON::view_projection enum value.
1591  Parameters:
1592  i - [in]
1593  Returns:
1594  ON::view_projection enum with same value as i.
1595  If i is not an ON::view_projection enum value,
1596  then ON::unknow_view is returned.
1597  */
1598  static view_projection ViewProjection(int i);
1599 
1600  /*
1601  Parameters:
1602  projection - [in]
1603  Returns:
1604  True if projection is ON::perspective_view.
1605  */
1606  static bool IsPerspectiveProjection( ON::view_projection projection );
1607 
1608 
1609  /*
1610  Parameters:
1611  projection - [in]
1612  Returns:
1613  True if projection is ON::parallel_view.
1614  */
1615  static bool IsParallelProjection( ON::view_projection projection );
1616 
1617  //// view coordinates ///////////////////////////////////////////////////////////
1618 
1619  enum coordinate_system
1620  {
1621  world_cs = 0,
1622  camera_cs = 1,
1623  clip_cs = 2,
1624  screen_cs = 3
1625  };
1626 
1627  static coordinate_system CoordinateSystem(int); // convert integer to coordinate_system enum
1628 
1629  //// exception types ///////////////////////////////////////////////////////////
1630  enum exception_type
1631  {
1632  unknown_exception = 0,
1633  out_of_memory,
1634  corrupt_object, // invalid object encountered - continuing would crash or
1635  // result in corrupt object being saved in archive.
1636  unable_to_write_archive, // write operation failed - out of file space/read only mode/...?
1637  unable_to_read_archive, // read operation failed - truncated archive/locked file/... ?
1638  unable_to_seek_archive, // seek operation failed - locked file/size out of bounds/... ?
1639  unexpected_end_of_archive, // truncated archive
1640  unexpected_value_in_archive // corrupt archive?
1641  };
1642  static exception_type ExceptionType(int); // convert integer to exception_type enum
1643 
1644  //// layer mode ///////////////////////////////////////////////////////////
1645  // OBSOLETE
1646  enum layer_mode
1647  {
1648  normal_layer = 0, // visible, objects on layer can be selected and changed
1649  hidden_layer = 1, // not visible, objects on layer cannot be selected or changed
1650  locked_layer = 2, // visible, objects on layer cannot be selected or changed
1651  layer_mode_count = 3
1652  };
1653  static layer_mode LayerMode(int); // convert integer to layer_mode enum
1654 
1655  //// object mode ///////////////////////////////////////////////////////////
1656  enum object_mode
1657  {
1658  normal_object = 0, // object mode comes from layer
1659  hidden_object = 1, // not visible, object cannot be selected or changed
1660  locked_object = 2, // visible, object cannot be selected or changed
1661  idef_object = 3, // object is part of an ON_InstanceDefinition. The
1662  // ON_InstanceDefinition m_object_uuid[] array will
1663  // contain this object attribute's uuid.
1664  object_mode_count = 4
1665  };
1666  static object_mode ObjectMode(int); // convert integer to object_mode enum
1667 
1668  //// object display color /////////////////////////////////////////////////////////
1669  enum object_color_source
1670  {
1671  color_from_layer = 0, // use color assigned to layer
1672  color_from_object = 1, // use color assigned to object
1673  color_from_material = 2, // use diffuse render material color
1674  color_from_parent = 3 // for objects with parents (like objects in instance references, use parent linetype)
1675  // if no parent, treat as color_from_layer
1676  };
1677  static object_color_source ObjectColorSource(int); // convert integer to object_color_source enum
1678 
1679  //// object plot color /////////////////////////////////////////////////////////
1680  enum plot_color_source
1681  {
1682  plot_color_from_layer = 0, // use plot color assigned to layer
1683  plot_color_from_object = 1, // use plot color assigned to object
1684  plot_color_from_display = 2, // use display color
1685  plot_color_from_parent = 3 // for objects with parents (like objects in instance references, use parent plot color)
1686  // if no parent, treat as plot_color_from_layer
1687  };
1688  static plot_color_source PlotColorSource(int); // convert integer to plot_color_source enum
1689 
1690  //// object plot weight /////////////////////////////////////////////////////////
1691  enum plot_weight_source
1692  {
1693  plot_weight_from_layer = 0, // use plot color assigned to layer
1694  plot_weight_from_object = 1, // use plot color assigned to object
1695  plot_weight_from_parent = 3 // for objects with parents (like objects in instance references, use parent plot color)
1696  // if no parent, treat as plot_color_from_layer
1697  };
1698  static plot_weight_source PlotWeightSource(int); // convert integer to plot_color_source enum
1699 
1700  //// object linetype /////////////////////////////////////////////////////////
1701  enum object_linetype_source
1702  {
1703  linetype_from_layer = 0, // use line style assigned to layer
1704  linetype_from_object = 1, // use line style assigned to object
1705  linetype_from_parent = 3 // for objects with parents (like objects in instance references, use parent linetype)
1706  // if not parent, treat as linetype_from_layer.
1707  };
1708  static object_linetype_source ObjectLinetypeSource(int); // convert integer to object_linetype_source enum
1709 
1710  //// object material /////////////////////////////////////////////////////////
1711  enum object_material_source
1712  {
1713  material_from_layer = 0, // use material assigned to layer
1714  material_from_object = 1, // use material assigned to object
1715  material_from_parent = 3 // for objects with parents, like
1716  // definition geometry in instance
1717  // references and faces in polysurfaces,
1718  // this value indicates the material
1719  // definition should come from the parent.
1720  // If the object does not have an
1721  // obvious "parent", then treat
1722  // it the same as material_from_layer.
1723  };
1724  static object_material_source ObjectMaterialSource(int); // convert integer to object_color_source enum
1725 
1726  //// light style /////////////////////////////////////////////////////////////
1727  enum light_style
1728  {
1729  unknown_light_style = 0,
1730  //view_directional_light = 1, // light location and direction in clip coordinates
1731  //view_point_light = 2,
1732  //view_spot_light = 3,
1733  camera_directional_light = 4, // light location and direction in camera coordinates
1734  camera_point_light = 5, // +x points to right, +y points up, +z points towards camera
1735  camera_spot_light = 6,
1736  world_directional_light = 7, // light location and direction in world coordinates
1737  world_point_light = 8,
1738  world_spot_light = 9,
1739  ambient_light = 10, // pure ambient light
1740  world_linear_light = 11,
1741  world_rectangular_light = 12,
1742  light_style_count = 13
1743  };
1744  static light_style LightStyle(int); // convert integer to light_style enum
1745 
1746  //// curvature style /////////////////////////////////////////////////////////
1747  enum curvature_style
1748  {
1749  unknown_curvature_style = 0,
1750  gaussian_curvature = 1,
1751  mean_curvature = 2, // unsigned mean curvature
1752  min_curvature = 3, // minimum unsigned radius of curvature
1753  max_curvature = 4, // maximum unsigned radius of curvature
1754  curvature_style_count = 5
1755  };
1756  static curvature_style CurvatureStyle(int); // convert integer to curvature_style enum
1757 
1758  /////////////////////////////////////////////////////////////////
1759  //
1760  // Legacy V3 display mode enum values.
1761  // Beginning with V4, opennurbs and Rhino us an ON_UUID to identify
1762  // display modes. The standard display mode ids are static
1763  // values in ON_StandardDisplayModeId.
1764  enum v3_display_mode
1765  {
1766  v3_default_display = 0, // default display
1767  v3_wireframe_display = 1, // wireframe display
1768  v3_shaded_display = 2, // shaded display
1769  v3_renderpreview_display = 3 // render preview display
1770  };
1771  static ON::v3_display_mode V3DisplayMode(int); // convert integer to legacy v3_display_mode enum
1772 
1773  enum view_type
1774  {
1775  model_view_type = 0, // standard model space 3d view
1776  page_view_type = 1, // a.k.a "paper space", "plot view", etc.
1777  // A page view must be orthographic,
1778  // the camera frame x,y,z direction must be
1779  // world x,y,z (which means the camera direction
1780  // is always (0,0,-1)).
1781  nested_view_type = 2, // This view is a "model" view that is nested
1782  // in another view. The nesting and parent
1783  // information is saved in ON_3dmView.
1784  };
1785  static view_type ViewType(int); // convert integer to display_mode enum
1786 
1787 
1788  //// texture mapping mode ///////////////////////////////////////////////////
1789  //
1790  // OBSOLETE
1791  enum texture_mode
1792  {
1793  no_texture = 0, // texture disabled
1794  modulate_texture = 1, // modulate with material diffuse color
1795  decal_texture = 2 // decal
1796  };
1797  // OBSOLETE
1798  static texture_mode TextureMode(int); // convert integer to texture_mode enum
1799  // OBSOLETE
1800  //
1801  /////////////////////////////////////////////////////////////////////////////
1802 
1803  //// object_type ///////////////////////////////////////////////////
1804  enum object_type
1805  {
1806  // Use with ON_Object::ObjectType() in situations where
1807  // using a switch() is better than a long string of if else if ...
1808  // if ( ON_Curve::Cast() ) ... else if ( ON_Surface::Cast() ) ...
1809  // ...
1810  unknown_object_type = 0,
1811 
1812  point_object = 1, // some type of ON_Point
1813  pointset_object = 2, // some type of ON_PointCloud, ON_PointGrid, ...
1814  curve_object = 4, // some type of ON_Curve like ON_LineCurve, ON_NurbsCurve, etc.
1815  surface_object = 8, // some type of ON_Surface like ON_PlaneSurface, ON_NurbsSurface, etc.
1816  brep_object = 0x10, // some type of ON_Brep
1817  mesh_object = 0x20, // some type of ON_Mesh
1818  layer_object = 0x40, // some type of ON_Layer
1819  material_object = 0x80, // some type of ON_Material
1820  light_object = 0x100, // some type of ON_Light
1821  annotation_object = 0x200, // some type of ON_Annotation
1822  userdata_object = 0x400, // some type of ON_UserData
1823  instance_definition = 0x800, // some type of ON_InstanceDefinition
1824  instance_reference = 0x1000, // some type of ON_InstanceRef
1825  text_dot = 0x2000, // some type of ON_TextDot
1826  grip_object = 0x4000, // selection filter value - not a real object type
1827  detail_object = 0x8000, // some type of ON_DetailView
1828  hatch_object = 0x10000, // some type of ON_Hatch
1829  morph_control_object = 0x20000, // some type of ON_MorphControl
1830  subd_object = 0x40000, // some type of ON_SubD, ON_SubDRef, ON_SubDComponentRef, ON_SubD....
1831  loop_object = 0x80000, // some type of ON_BrepLoop
1832  brepvertex_filter = 0x100000, // selection filter value - not a real object type
1833  polysrf_filter = 0x200000, // selection filter value - not a real object type
1834  edge_filter = 0x400000, // selection filter value - not a real object type
1835  polyedge_filter = 0x800000, // selection filter value - not a real object type
1836  meshvertex_filter = 0x01000000, // selection filter value - not a real object type
1837  meshedge_filter = 0x02000000, // selection filter value - not a real object type
1838  meshface_filter = 0x04000000, // selection filter for mesh triangle, quad or ngon - not a real object type
1839  meshcomponent_reference = 0x07000000, // an ON_MeshComponentRef to vertex, edge, face, ngon
1840  cage_object = 0x08000000, // some type of ON_NurbsCage
1841  phantom_object = 0x10000000,
1842  clipplane_object = 0x20000000,
1843  extrusion_object = 0x40000000, // some type of ON_Extrusion
1844 
1845  any_object = 0xFFFFFFFF
1846 
1847  // Please discuss any changes with Dale Lear
1848  };
1849 
1850  static object_type ObjectType(int); // convert integer to object_type enum
1851 
1852  //// bitmap_type ///////////////////////////////////////////////////
1853  enum bitmap_type
1854  {
1855  unknown_bitmap_type = 0,
1856  windows_bitmap = 1, // BITMAPINFO style
1857  opengl_bitmap = 2, // unpacked OpenGL RGB or RGBA
1858  png_bitmap = 3
1859  };
1860  static bitmap_type BitmapType(int); // convert integer to bitmap_type enum
1861 
1862  enum object_decoration
1863  {
1864  no_object_decoration = 0,
1865  start_arrowhead = 0x08, // arrow head at start
1866  end_arrowhead = 0x10, // arrow head at end
1867  both_arrowhead = 0x18 // arrow heads at start and end
1868  };
1869  static object_decoration ObjectDecoration(int); // convert integer to line_pattern enum
1870 
1871  enum mesh_type
1872  {
1873  default_mesh = 0,
1874  render_mesh = 1,
1875  analysis_mesh = 2,
1876  preview_mesh = 3,
1877  any_mesh = 4
1878  };
1879  static mesh_type MeshType(int); // convert integer to mesh_type enum
1880 
1881 
1882  // Types of object snapping.
1883  // In situations where more than one type of snap applies,
1884  // snaps with higher value take precedence.
1885  // enum values must be a power of 2.
1886  // ON_ObjRef saves these values in files. Do not change
1887  // the values. The reason for the gaps between the enum
1888  // values is to leave room for future snaps with prededence
1889  // falling between existing snaps
1890  enum osnap_mode
1891  {
1892  os_none = 0,
1893  os_near = 2,
1894  os_focus = 8,
1895  os_center = 0x20,
1896  os_vertex = 0x40,
1897  os_knot = 0x80,
1898  os_quadrant = 0x200,
1899  os_midpoint = 0x800,
1900  os_intersection = 0x2000,
1901  os_end = 0x20000,
1902  os_perpendicular = 0x80000,
1903  os_tangent = 0x200000,
1904  os_point = 0x08000000,
1905  os_all_snaps = 0xFFFFFFFF
1906  };
1907  static osnap_mode OSnapMode(int); // convert integer to osnap_mode enum
1908 
1909 
1910  //// Types of Curves ///////////////////////////////////////////////////////////
1911  enum eCurveType
1912  {
1913  ctCurve, // nothing
1914  ctArc,
1915  ctCircle,
1916  ctLine,
1917  ctNurbs,
1918  ctOnsurface,
1919  ctProxy,
1920  ctPolycurve,
1921  ctPolyline,
1922  };
1923 
1924 
1925  //// surface_loft_end_condition //////////////////////////////////////////////
1926  //
1927  // End condition paramter values for ON_Curve::CreateCubicLoft() and
1928  // ON_Surface::CreateCubicLoft().
1929  enum cubic_loft_end_condition
1930  {
1931  cubic_loft_ec_quadratic = 0,
1932  cubic_loft_ec_linear = 1,
1933  cubic_loft_ec_cubic = 2,
1934  cubic_loft_ec_natural = 3,
1935  cubic_loft_ec_unit_tangent = 4,
1936  cubic_loft_ec_1st_derivative = 5,
1937  cubic_loft_ec_2nd_derivative = 6,
1938  cubic_loft_ec_free_cv = 7
1939  };
1940 
1941  /*
1942  Description:
1943  Convert an integer to cubic_loft_end_condition enum.
1944  Parameters:
1945  i - [in]
1946  Returns:
1947  corresponding cubic_loft_end_condition enum value.
1948  Remarks:
1949  If i does not correspond to a cubic_loft_end_condition
1950  enum value, then cubic_loft_ec_quadratic is returned.
1951  */
1952  static
1953  cubic_loft_end_condition CubicLoftEndCondition(int i);
1954 
1955 
1956 public:
1957 
1958 #pragma region RH_C_SHARED_ENUM [ON::AnnotationType] [Rhino.Geometry.AnnotationType] [byte]
1959 
1960  /// <summary>
1961  /// ON::AnnotationType identifies the type of an annotation object derived from ON_Annotation.
1962  /// </summary>
1963  enum class AnnotationType : unsigned char
1964  {
1965  ///<summary>
1966  /// Not a valid annotation type.
1967  ///</summary>
1968  Unset = 0,
1969 
1970  ///<summary>
1971  /// Linear distance between two points with dimension line parallel to the dimensioned points.
1972  ///</summary>
1973  Aligned = 1,
1974 
1975  ///<summary>
1976  /// Angle bewteen two lines.
1977  ///</summary>
1978  Angular = 2,
1979 
1980  ///<summary>
1981  /// Arc or circle diameter dimension.
1982  ///</summary>
1983  Diameter = 3,
1984 
1985  ///<summary>
1986  /// Arc or circle radius dimension.
1987  ///</summary>
1988  Radius = 4,
1989 
1990  ///<summary>
1991  /// Linear distance between two points with dimension line horizontal, vertical or rotated by a specified amount.
1992  ///</summary>
1993  Rotated = 5,
1994 
1995  ///<summary>
1996  /// Ordinate dimension. Typically used to document an offset distance between the center of a circle and a reference point.
1997  ///</summary>
1998  Ordinate = 6,
1999 
2000  ///<summary>
2001  /// Arc length of a curve.
2002  ///</summary>
2003  ArcLen = 7,
2004 
2005  ///<summary>
2006  /// Center mark dimension. Typically used to document the center of an arc or circle.
2007  ///</summary>
2008  CenterMark = 8,
2009 
2010  ///<summary>
2011  /// Text. Stand alone text with a wide variety of uses.
2012  ///</summary>
2013  Text = 9,
2014 
2015  ///<summary>
2016  /// Leader. Text and a curve with an arrow head.
2017  ///</summary>
2018  Leader = 10,
2019 
2020  ///<summary>
2021  /// Angular3pt. Angle defined by 3 points.
2022  ///</summary>
2023  Angular3pt = 11
2024  };
2025 
2026 #pragma endregion
2027 
2028  static ON::AnnotationType AnnotationTypeFromUnsigned(
2029  unsigned int annotation_type_as_unsigned
2030  );
2031 
2032 
2033 
2034 #pragma region RH_C_SHARED_ENUM [ON::TextVerticalAlignment] [Rhino.DocObjects.TextVerticalAlignment] [byte]
2035  /// <summary>
2036  /// Vertical location of text attach point relative to text
2037  /// </summary>
2038  enum class TextVerticalAlignment : unsigned char
2039  {
2040  ///<summary>
2041  /// Attach to top of an "I" on the first line. (Independent of glyphs being displayed.)
2042  ///</summary>
2043  Top = 0,
2044  ///<summary>
2045  /// Attach to middle of an "I" on the first line. (Independent of glyphs being displayed.)
2046  ///</summary>
2047  MiddleOfTop = 1,
2048  ///<summary>
2049  /// Attach to baseline of first line. (Independent of glyphs being displayed.)
2050  ///</summary>
2051  BottomOfTop = 2,
2052  ///<summary>
2053  /// Attach to middle of text vertical advance. (Independent of glyphs being displayed.)
2054  ///</summary>
2055  Middle = 3,
2056  ///<summary>
2057  /// Attach to middle of an "I" on the last line. (Independent of glyphs being displayed.)
2058  ///</summary>
2059  MiddleOfBottom = 4,
2060  ///<summary>
2061  /// Attach to the basline of the last line. (Independent of glyphs being displayed.)
2062  ///</summary>
2063  Bottom = 5,
2064  ///<summary>
2065  /// Attach to the bottom of the boudning box of the visible glyphs.
2066  ///</summary>
2067  BottomOfBoundingBox = 6, // TODO - changed to BottomOfBoundingBox
2068  };
2069 #pragma endregion
2070 
2071  static ON::TextVerticalAlignment TextVerticalAlignmentFromUnsigned(
2072  unsigned int vertical_alignment_as_unsigned
2073  );
2074 
2075  static ON::TextVerticalAlignment TextVerticalAlignmentFromV5Justification(
2076  unsigned int v5_justification_bits
2077  );
2078 
2079 #pragma region RH_C_SHARED_ENUM [ON::TextHorizontalAlignment] [Rhino.DocObjects.TextHorizontalAlignment] [byte]
2080  /// <summary>
2081  /// Horizontal location of text attach point relative to text
2082  /// </summary>
2083  enum class TextHorizontalAlignment : unsigned char
2084  {
2085  /// <summary>
2086  /// Attach at left of text lines (Independent of glyphs being displayed.)
2087  /// </summary>
2088  Left = 0,
2089  /// <summary>
2090  /// Attach point at center of text horizontal advance (not glyph bounding box)
2091  /// </summary>
2092  Center = 1,
2093  /// <summary>
2094  /// Attach point at right text horizontal advance (not glyph bounding box)
2095  /// </summary>
2096  Right = 2,
2097  };
2098 #pragma endregion
2099 
2100  static ON::TextHorizontalAlignment TextHorizontalAlignmentFromUnsigned(
2101  unsigned int horizontal_alignment_as_unsigned
2102  );
2103 
2104  static ON::TextHorizontalAlignment TextHorizontalAlignmentFromV5Justification(
2105  unsigned int v5_justification_bits
2106  );
2107 
2108 #pragma region RH_C_SHARED_ENUM [ON::TextOrientation] [Rhino.DocObjects.TextOrientation] [byte]
2109  /// <summary>
2110  /// Method for getting rotation for drawing text
2111  /// </summary>
2112  enum class TextOrientation : unsigned char
2113  {
2114  /// <summary>
2115  /// Text has fixed rotation on a world coordinate plane
2116  /// </summary>
2117  InPlane = 0,
2118  /// <summary>
2119  /// Text is drawn on a plane perpendicular to view direction horizontal to the screen
2120  /// </summary>
2121  InView = 1,
2122  };
2123 
2124 #pragma endregion
2125 
2126  static ON::TextOrientation TextOrientationFromUnsigned(
2127  unsigned int orientation_as_unsigned
2128  );
2129 
2130 
2131 
2132 private:
2133  // ON::Begin() sets m_opennurbs_library_status
2134  // 0 = not initialized
2135  // 1 = in the body of ON::Begin()
2136  // 2 = ON:Begin() finished.
2137  static unsigned int m_opennurbs_library_status;
2138 
2139 private:
2140  // prohibit instantiaion
2141  //ON(); // no implementation
2142  //ON( const ON& ); // no implementation
2143  //~ON(); // no implementation
2144 };
2145 
2146 /*
2147 Description:
2148  Component indices are used to provide a persistent way
2149  to identify portions of complex objects.
2150 
2151 */
2152 class ON_CLASS ON_COMPONENT_INDEX
2153 {
2154 public:
2155 
2156  // Do not change these values; they are stored in 3dm archives
2157  // and provide a persistent way to indentify components of
2158  // complex objects.
2159  enum TYPE
2160  {
2161  invalid_type = 0,
2162 
2163  brep_vertex = 1,
2164  brep_edge = 2,
2165  brep_face = 3,
2166  brep_trim = 4,
2167  brep_loop = 5,
2168 
2169  mesh_vertex = 11,
2170  meshtop_vertex = 12,
2171  meshtop_edge = 13,
2172  mesh_face = 14,
2173  mesh_ngon = 15,
2174 
2175  idef_part = 21,
2176 
2177  polycurve_segment = 31,
2178 
2179  pointcloud_point = 41,
2180 
2181  group_member = 51,
2182 
2183 
2184  extrusion_bottom_profile = 61, // 3d bottom profile curves
2185  // index identifies profile component
2186  extrusion_top_profile = 62, // 3d top profile curves
2187  // index identifies profile component
2188  extrusion_wall_edge = 63, // 3d wall edge curve
2189  // index/2: identifies profile component
2190  // index%2: 0 = start, 1 = end
2191  extrusion_wall_surface = 64, // side wall surfaces
2192  // index: identifies profile component
2193  extrusion_cap_surface = 65, // bottom and top cap surfaces
2194  // index: 0 = bottom, 1 = top
2195  extrusion_path = 66, // extrusion path (axis line)
2196  // index -1 = entire path, 0 = start point, 1 = endpoint
2197 
2198  //////////////////////////////////////////////////////
2199  //
2200  // ON_SubD component index
2201  //
2202  // Use ON_SubD.ComponentPtrFromComponentIndex() to convert an ON_COMPONENT_INDEX
2203  // into a component pointer.
2204  // See also
2205  // ON_SubD.VertexFromId()
2206  // ON_SubD.EdgeFromId()
2207  // ON_SubD.FaceFromId()
2208  //
2209  subd_vertex = 71, // m_index = ON_SubDVertex.m_id, use ON_SubD.ComponentPtrFromComponentIndex()
2210  subd_edge = 72, // m_index = ON_SubDEdge.m_id
2211  subd_face = 73, // m_index = ON_SubDFace.m_id
2212 
2213  dim_linear_point = 100,
2214  dim_radial_point = 101,
2215  dim_angular_point = 102,
2216  dim_ordinate_point = 103,
2217  dim_text_point = 104,
2218  dim_centermark_point = 105,
2219  dim_leader_point = 106,
2220 
2221  no_type = 0xFFFFFFFF
2222  };
2223 
2224  /*
2225  Description:
2226  Safe conversion of integer value to TYPE enum.
2227  Parameters:
2228  i - [in] integer with value equal to one of the TYPE enums.
2229  Returns:
2230  The TYPE enum with the same numeric value
2231  or ON_COMPONENT_INDEX::invalid_type if no corresponding enum
2232  exists.
2233  */
2234  static
2235  ON_COMPONENT_INDEX::TYPE Type(int i);
2236 
2237  /*
2238  Description:
2239  Dictionary compare on m_type, m_index as ints.
2240  Returns:
2241  < 0: a < b
2242  = 0: a = b
2243  > 0: a > b
2244  */
2245  static
2246  int Compare( const ON_COMPONENT_INDEX* a, const ON_COMPONENT_INDEX* b);
2247 
2248  /*
2249  Description:
2250  UnsetComponentIndex.m_type = invalid_type
2251  UnsetComponentIndex.m_index = -1 as int
2252  = ON_UNSET_UINT_INDEX as unsigned int
2253  */
2254  static const ON_COMPONENT_INDEX UnsetComponentIndex;
2255 
2256  /*
2257  Description:
2258  Default constructor has value ON_COMPONENT_INDEX UnsetComponentIndex.
2259  */
2260  ON_COMPONENT_INDEX();
2261 
2262  /*
2263  Description:
2264  Sets m_type = type and m_index = index.
2265  */
2266  ON_COMPONENT_INDEX(ON_COMPONENT_INDEX::TYPE type,int index);
2267 
2268  bool operator==(const ON_COMPONENT_INDEX& other) const;
2269  bool operator!=(const ON_COMPONENT_INDEX& other) const;
2270  bool operator<(const ON_COMPONENT_INDEX& other) const;
2271  bool operator<=(const ON_COMPONENT_INDEX& other) const;
2272  bool operator>(const ON_COMPONENT_INDEX& other) const;
2273  bool operator>=(const ON_COMPONENT_INDEX& other) const;
2274 
2275  void Set(ON_COMPONENT_INDEX::TYPE type,int index);
2276  void Set(ON_COMPONENT_INDEX::TYPE type,unsigned int index);
2277 
2278  /*
2279  Description:
2280  Sets m_type = invalid_type and m_index = -1.
2281  */
2282  void UnSet();
2283 
2284  /*
2285  Returns:
2286  True if m_type is set to a TYPE enum value between
2287  brep_vertex and polycurve_segment.
2288  */
2289  bool IsSet() const;
2290 
2291  bool IsNotSet() const;
2292 
2293  /*
2294  Returns:
2295  True if m_type is set to one of the mesh or meshtop
2296  TYPE enum values and m_index >= 0.
2297  */
2298  bool IsMeshComponentIndex() const;
2299 
2300  /*
2301  Returns:
2302  True if m_type is set to one of the subd
2303  TYPE enum values and m_index >= 0.
2304  */
2305  bool IsSubDComponentIndex() const;
2306 
2307  /*
2308  Returns:
2309  True if m_type is set to one of the
2310  brep TYPE enum values and m_index >= 0.
2311  */
2312  bool IsBrepComponentIndex() const;
2313 
2314  /*
2315  Returns:
2316  True if m_type = idef_part and m_index >= 0.
2317  */
2318  bool IsIDefComponentIndex() const;
2319 
2320  /*
2321  Returns:
2322  True if m_type = polycurve_segment and m_index >= 0.
2323  */
2324  bool IsPolyCurveComponentIndex() const;
2325 
2326  /*
2327  Returns:
2328  True if m_type = group_member and m_index >= 0.
2329  */
2330  bool IsGroupMemberComponentIndex() const;
2331 
2332  /*
2333  Returns:
2334  True if m_type = extrusion_bottom_profile or extrusion_top_profile
2335  and m_index >= 0.
2336  */
2337  bool IsExtrusionProfileComponentIndex() const;
2338 
2339  /*
2340  Returns:
2341  True if m_type = extrusion_path and -1 <= m_index <= 1.
2342  */
2343  bool IsExtrusionPathComponentIndex() const;
2344 
2345  /*
2346  Returns:
2347  True if m_type = extrusion_wall_edge and m_index >= 0.
2348  */
2349  bool IsExtrusionWallEdgeComponentIndex() const;
2350 
2351  /*
2352  Returns:
2353  True if m_type = extrusion_wall_surface and m_index >= 0.
2354  */
2355  bool IsExtrusionWallSurfaceComponentIndex() const;
2356 
2357  /*
2358  Returns:
2359  True if m_type = extrusion_wall_surface or extrusion_wall_edge
2360  and m_index >= 0.
2361  */
2362  bool IsExtrusionWallComponentIndex() const;
2363 
2364  /*
2365  Returns:
2366  True if m_type = extrusion_bottom_profile, extrusion_top_profile,
2367  extrusion_wall_edge, extrusion_wall_surface, extrusion_cap_surface
2368  or extrusion_path and m_index is reasonable.
2369  */
2370  bool IsExtrusionComponentIndex() const;
2371 
2372  /*
2373  Returns:
2374  True if m_type = pointcloud_point and m_index >= 0.
2375  */
2376  bool IsPointCloudComponentIndex() const;
2377 
2378  /*
2379  Returns:
2380  True if m_type = dim_... and m_index >= 0.
2381  */
2382  bool IsAnnotationComponentIndex() const;
2383 
2384  void Dump(
2385  class ON_TextLog& text_log
2386  )const;
2387 
2388  void AppendToString(
2389  class ON_String& s
2390  )const;
2391 
2392  void AppendToString(
2393  class ON_wString& s
2394  )const;
2395 
2396 
2397  TYPE m_type;
2398 
2399  /*
2400  The interpretation of m_index depends on the m_type value.
2401 
2402  m_type m_index interpretation (0 based indices)
2403 
2404  no_type used when context makes it clear what array is being index
2405  brep_vertex ON_Brep.m_V[] array index
2406  brep_edge ON_Brep.m_E[] array index
2407  brep_face ON_Brep.m_F[] array index
2408  brep_trim ON_Brep.m_T[] array index
2409  brep_loop ON_Brep.m_L[] array index
2410  mesh_vertex ON_Mesh.m_V[] array index
2411  meshtop_vertex ON_MeshTopology.m_topv[] array index
2412  meshtop_edge ON_MeshTopology.m_tope[] array index
2413  mesh_face ON_Mesh.m_F[] array index
2414  mesh_ngon ON_Mesh.Ngon() array index
2415  idef_part ON_InstanceDefinition.m_object_uuid[] array index
2416  polycurve_segment ON_PolyCurve::m_segment[] array index
2417 
2418  extrusion_bottom_profile Use ON_Extrusion::Profile3d() to get 3d profile curve
2419  extrusion_top_profile Use ON_Extrusion::Profile3d() to get 3d profile curve
2420  extrusion_wall_edge Use ON_Extrusion::WallEdge() to get 3d line curve
2421  extrusion_wall_surface Use ON_Extrusion::WallSurface() to get 3d wall surface
2422  extrusion_cap_surface 0 = bottom cap, 1 = top cap
2423  extrusion_path -1 = entire path, 0 = start of path, 1 = end of path
2424 
2425  dim_linear_point linear dimension point index
2426  dim_radial_point radial dimension point index
2427  dim_angular_point angular dimension point index
2428  dim_ordinate_point ordinate dimension point index
2429  dim_text_point annotation text object point
2430  */
2431 
2432  unsigned int UnsignedIndex() const
2433  {
2434  return (unsigned int)m_index;
2435  }
2436 
2437  int m_index;
2438 };
2439 
2440 #endif
2441 
2442 ON_BEGIN_EXTERNC
2443 
2444 // on_wcsicmp() is a wrapper for case insensitive wide string compare
2445 // and calls one of _wcsicmp() or wcscasecmp() depending on OS.
2446 ON_DECL
2447 int on_wcsicmp( const wchar_t*, const wchar_t* );
2448 
2449 // on_wcsupr() calls _wcsupr() or wcsupr() depending on OS
2450 ON_DECL
2451 wchar_t* on_wcsupr(wchar_t*);
2452 
2453 // on_wcslwr() calls _wcslwr() or wcslwr() depending on OS
2454 ON_DECL
2455 wchar_t* on_wcslwr(wchar_t*);
2456 
2457 // on_wcsrev() calls _wcsrev() or wcsrev() depending on OS
2458 ON_DECL
2459 wchar_t* on_wcsrev(wchar_t*);
2460 
2461 // on_stricmp() is a wrapper for case insensitive string compare
2462 // and calls one of _stricmp(), stricmp(), or strcasecmp()
2463 // depending on OS.
2464 ON_DECL
2465 int on_stricmp(const char*, const char*);
2466 
2467 // on_stricmp() is a wrapper for case insensitive string compare
2468 // and calls one of _strnicmp() or strncasecmp()
2469 // depending on OS.
2470 ON_DECL
2471 int on_strnicmp(const char * s1, const char * s2, int n);
2472 
2473 // on_strupr() calls _strupr() or strupr() depending on OS
2474 ON_DECL
2475 char* on_strupr(char*);
2476 
2477 // on_strlwr() calls _strlwr() or strlwr() depending on OS
2478 ON_DECL
2479 char* on_strlwr(char*);
2480 
2481 // on_strrev() calls _strrev() or strrev() depending on OS
2482 ON_DECL
2483 char* on_strrev(char*);
2484 
2485 /*
2486 Description:
2487  Calls ON_ConvertWideCharToUTF8()
2488 */
2489 ON_DECL
2490 int on_WideCharToMultiByte(
2491  const wchar_t*, // lpWideCharStr,
2492  int, // cchWideChar,
2493  char*, // lpMultiByteStr,
2494  int // cchMultiByte,
2495  );
2496 
2497 /*
2498 Description:
2499  Calls ON_ConvertUTF8ToWideChar()
2500 */
2501 ON_DECL
2502 int on_MultiByteToWideChar(
2503  const char*, // lpMultiByteStr,
2504  int, // cchMultiByte,
2505  wchar_t*, // lpWideCharStr,
2506  int // cchWideChar
2507  );
2508 
2509 /*
2510 Description:
2511  Find the locations in a path the specify the drive, directory,
2512  file name and file extension.
2513 Parameters:
2514  path - [in]
2515  UTF-8 encoded string that is a legitimate path to a file.
2516  volume - [out] (pass null if you don't need the volume)
2517  If volume is not null and the path parameter begins with
2518  a Windows volum specification, the value of *volume will
2519  equal the input value of path. Otherwise *volume will be nullptr.
2520  A Windows volume specification can be either a single A-Z or a-z
2521  letter followed by a colon ( C: ) or a Windows UNC host name
2522  (\\MY_SERVER).
2523  dir - [out] (pass null if you don't need the directory)
2524  If dir is not null and the path parameter contains a
2525  directory specification, then the returned value of *dir
2526  will point to the character in path where the directory
2527  specification begins.
2528  fname - [out] (pass null if you don't need the file name)
2529  If fname is not null and the path parameter contains a
2530  file name specification, then the returned value of *fname
2531  will point to the character in path where the file name
2532  specification begins.
2533  ext - [out] (pass null if you don't need the extension)
2534  If ext is not null and the path parameter contains a
2535  file extension specification, then the returned value of
2536  *ext will point to the '.' character in path where the file
2537  extension specification begins.
2538 Remarks:
2539  This function will treat a front slash ( / ) and a back slash
2540  ( \ ) as directory separators. Because this function parses
2541  file names store in .3dm files and the .3dm file may have been
2542  written on a Windows computer and then read on a another
2543  computer, it looks for a volume specification even when the
2544  operating system is not Windows.
2545  This function will not return an directory that does not
2546  end with a trailing slash.
2547  This function will not return an empty filename and a non-empty
2548  extension.
2549  This function parses the path string according to these rules.
2550  It does not check the actual file system to see if the answer
2551  is correct.
2552 See Also:
2553  ON_String::SplitPath
2554 */
2555 ON_DECL void on_splitpath(
2556  const char* path,
2557  const char** volume,
2558  const char** dir,
2559  const char** fname,
2560  const char** ext
2561  );
2562 
2563 /*
2564 Description:
2565  Find the locations in a path the specify the drive, directory,
2566  file name and file extension.
2567 Parameters:
2568  path - [in]
2569  A legitimate file system path to a file.
2570  volume - [out] (pass null if you don't need the volume)
2571  If volume is not null and the path parameter begins with
2572  a Windows volum specification, the value of *volume will
2573  equal the input value of path. Otherwise *volume will be nullptr.
2574  A Windows volume specification can be either a single A-Z or a-z
2575  letter followed by a colon ( C: ) or a Windows UNC host name
2576  (\\MY_SERVER).
2577  dir - [out] (pass null if you don't need the directory)
2578  If dir is not null and the path parameter contains a
2579  directory specification, then the returned value of *dir
2580  will point to the character in path where the directory
2581  specification begins.
2582  fname - [out] (pass null if you don't need the file name)
2583  If fname is not null and the path parameter contains a
2584  file name specification, then the returned value of *fname
2585  will point to the character in path where the file name
2586  specification begins.
2587  ext - [out] (pass null if you don't need the extension)
2588  If ext is not null and the path parameter contains a
2589  file extension specification, then the returned value of
2590  *ext will point to the '.' character in path where the file
2591  extension specification begins.
2592 Remarks:
2593  This function will treat a front slash ( / ) and a back slash
2594  ( \ ) as directory separators. Because this function parses
2595  file names store in .3dm files and the .3dm file may have been
2596  written on a Windows computer and then read on a another
2597  computer, it looks for a volume specification even when the
2598  operating system is not Windows.
2599  This function will not return an directory that does not
2600  end with a trailing slash.
2601  This function will not return an empty filename and a non-empty
2602  extension.
2603  This function parses the path string according to these rules.
2604  It does not check the actual file system to see if the answer
2605  is correct.
2606 See Also:
2607  ON_wString::SplitPath
2608 */
2609 ON_DECL void on_wsplitpath(
2610  const wchar_t* path,
2611  const wchar_t** volume,
2612  const wchar_t** dir,
2613  const wchar_t** fname,
2614  const wchar_t** ext
2615  );
2616 
2617 ON_END_EXTERNC
2618 
2619 
2620 #endif
double d
Definition: opennurbs_defines.h:401
Definition: opennurbs_string.h:2020
Definition: opennurbs_string.h:852
void * p
Definition: opennurbs_defines.h:400
Definition: opennurbs_3dm_settings.h:26
char b[8]
Definition: opennurbs_defines.h:396
ON__INT32 i
Definition: opennurbs_defines.h:398
Definition: opennurbs_string.h:3739
Definition: opennurbs_textlog.h:20
Definition: opennurbs_defines.h:394
int j[2]
Definition: opennurbs_defines.h:399
ON__INT64 h
Definition: opennurbs_defines.h:397