opennurbs_defines.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00018 //
00019 //   Includes all openNURBS toolkit defines and enums.
00020 //
00022 
00023 #if !defined(OPENNURBS_DEFINES_INC_)
00024 #define OPENNURBS_DEFINES_INC_
00025 
00026 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus) || defined(ON_CPLUSPLUS)
00027 // C++ extern "C" declaration for C linkage
00028 
00029 #if !defined(ON_CPLUSPLUS)
00030 #define ON_CPLUSPLUS
00031 #endif
00032 #define ON_EXTERNC extern "C"
00033 #define ON_BEGIN_EXTERNC extern "C" {
00034 #define ON_END_EXTERNC   }
00035 
00036 #else
00037 
00038 /* C file - no extern declaration required or permitted */
00039 
00040 #define ON_EXTERNC
00041 #define ON_BEGIN_EXTERNC
00042 #define ON_END_EXTERNC  
00043 
00044 #endif
00045 
00046 
00047 #if defined(_DEBUG)
00048 /* enable OpenNurbs debugging code */
00049 #if !defined(ON_DEBUG)
00050 #define ON_DEBUG
00051 #endif
00052 #endif
00053 
00054 /*
00055 // Declarations in header (.H) files look like
00056 //
00057 //   ON_DECL type function():
00058 //   extern ON_EXTERN_DECL type global_variable;
00059 //   class ON_CLASS classname {};
00060 //   ON_TEMPLATE template class ON_CLASS template<T>;
00061 //
00062 */
00063 
00064 #if defined(OPENNURBS_EXPORTS)
00065 // OPENNURBS_EXPORTS is Microsoft's prefered defined for building an opennurbs DLL.
00066 #if !defined(ON_DLL_EXPORTS)
00067 #define ON_DLL_EXPORTS
00068 #endif
00069 #if !defined(ON_COMPILING_OPENNURBS)
00070 #define ON_COMPILING_OPENNURBS
00071 #endif
00072 #endif
00073 
00074 #if defined(OPENNURBS_IMPORTS)
00075 // OPENNURBS_EXPORTS is Microsoft's prefered defined for linking with an opennurbs DLL.
00076 #if !defined(ON_DLL_IMPORTS)
00077 #define ON_DLL_IMPORTS
00078 #endif
00079 #endif
00080 
00081 #if defined(ON_DLL_EXPORTS) && defined(ON_DLL_IMPORTS)
00082 #error At most one of ON_DLL_EXPORTS and ON_DLL_IMPORTS can be defined.
00083 #endif
00084 
00085 /* export/import */
00086 #if defined(ON_DLL_EXPORTS)
00087 
00088 #if !defined(ON_COMPILING_OPENNURBS)
00089 #error When compiling an OpenNURBS DLL, ON_DLL_EXPORTS must be defined
00090 #endif
00091 
00092 /* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
00093 #define ON_CLASS __declspec(dllexport)
00094 #define ON_DECL __declspec(dllexport)
00095 #define ON_EXTERN_DECL __declspec(dllexport)
00096 #define ON_DLL_TEMPLATE
00097 
00098 #elif defined(ON_DLL_IMPORTS)
00099 
00100 #if defined(ON_COMPILING_OPENNURBS)
00101 #error When compiling an OpenNURBS DLL, ON_DLL_IMPORTS must NOT be defined
00102 #endif
00103 
00104 /* using OpenNurbs as a Windows DLL - import classes, functions, templates, and globals */
00105 #define ON_CLASS __declspec(dllimport)
00106 #define ON_DECL __declspec(dllimport)
00107 #define ON_EXTERN_DECL __declspec(dllimport)
00108 #define ON_DLL_TEMPLATE extern
00109 
00110 #else
00111 
00112 /* compiling or using OpenNurbs as a static library */
00113 #define ON_CLASS
00114 #define ON_DECL
00115 #define ON_EXTERN_DECL
00116 
00117 #if defined(ON_DLL_TEMPLATE)
00118 #undef ON_DLL_TEMPLATE
00119 #endif
00120 
00121 #endif
00122 
00123 
00124 // ON_DEPRECATED is used to mark deprecated functions.
00125 #if defined(ON_COMPILER_MSC)
00126 #define ON_DEPRECATED  __declspec(deprecated)
00127 #else
00128 #define ON_DEPRECATED
00129 #endif
00130 
00131 #if defined(PI)
00132 #define ON_PI           PI
00133 #else
00134 #define ON_PI           3.141592653589793238462643
00135 #endif
00136 
00137 #define ON_DEGREES_TO_RADIANS ON_PI/180.0
00138 #define ON_RADIANS_TO_DEGREES 180.0/ON_PI
00139 
00140 #define ON_SQRT2          1.414213562373095048801689
00141 #define ON_SQRT3          1.732050807568877293527446
00142 #define ON_SQRT3_OVER_2   0.8660254037844386467637230
00143 #define ON_1_OVER_SQRT2   0.7071067811865475244008445
00144 #define ON_SIN_PI_OVER_12 0.2588190451025207623488990
00145 #define ON_COS_PI_OVER_12 0.9659258262890682867497433
00146 
00147 #define ON_LOG2         0.6931471805599453094172321
00148 #define ON_LOG10        2.302585092994045684017991
00149 
00150 #define ON_ArrayCount(a) (sizeof(a)/sizeof((a)[0]))
00151 
00152 #if defined(DBL_MAX)
00153 #define ON_DBL_MAX DBL_MAX
00154 #else
00155 #define ON_DBL_MAX 1.7976931348623158e+308
00156 #endif
00157 
00158 #if defined(DBL_MIN)
00159 #define ON_DBL_MIN DBL_MIN
00160 #else
00161 #define ON_DBL_MIN 2.22507385850720200e-308
00162 #endif
00163 
00164 // ON_EPSILON = 2^-52
00165 #if defined(DBL_EPSILON)
00166 #define ON_EPSILON DBL_EPSILON
00167 #else
00168 #define ON_EPSILON 2.2204460492503131e-16
00169 #endif
00170 #define ON_SQRT_EPSILON 1.490116119385000000e-8
00171 
00172 #if defined(FLT_EPSILON)
00173 #define ON_FLOAT_EPSILON FLT_EPSILON
00174 #else
00175 #define ON_FLOAT_EPSILON 1.192092896e-07
00176 #endif
00177 #define ON_SQRT_FLOAT_EPSILON 3.452669830725202719e-4
00178 
00179 /*
00180 // In cases where lazy evaluation of a double value is
00181 // performed, b-rep tolerances being a notable example,
00182 // this value is used to indicate the value has not been
00183 // computed.  This value must be < -1.0e308. and > -ON_DBL_MAX
00184 //
00185 // The reasons ON_UNSET_VALUE is a valid finite number are:
00186 //
00187 //   1) It needs to round trip through fprintf/sscanf.
00188 //   2) It needs to persist unchanged through assigment
00189 /       and not generate exceptions when assigned.
00190 //   3) ON_UNSET_VALUE == ON_UNSET_VALUE needs to be true.
00191 //   4) ON_UNSET_VALUE != ON_UNSET_VALUE needs to be false.
00192 //
00193 // Ideally, it would also have these SNaN attributes
00194 //   * When used in a calculation, a floating point exception
00195 //     occures.
00196 //   * No possibility of a valid calculation would generate
00197 //     ON_UNSET_VALUE.
00198 //   * float f = (float)ON_UNSET_VALUE would create an invalid
00199 //     float and generate an exception.
00200 */
00201 #define ON_UNSET_VALUE -1.23432101234321e+308
00202 
00203 /*
00204 // ON_UNSET_FLOAT is used to indicate a texture coordinate
00205 // value cannot be calculated or is not well defined.  
00206 // In hindsight, this value should have been ON_FLT_QNAN
00207 // because many calculation convert float texture coordinates
00208 // to doubles and the "unset"ness attribute is lost.
00209 */
00210 #define ON_UNSET_FLOAT -1.234321e+38f
00211 
00212 
00213 ON_BEGIN_EXTERNC
00214 
00215 // IEEE 754 special values
00216 extern ON_EXTERN_DECL const double ON_DBL_QNAN;
00217 extern ON_EXTERN_DECL const double ON_DBL_PINF;
00218 extern ON_EXTERN_DECL const double ON_DBL_NINF;
00219 
00220 extern ON_EXTERN_DECL const float  ON_FLT_QNAN;
00221 extern ON_EXTERN_DECL const float  ON_FLT_PINF;
00222 extern ON_EXTERN_DECL const float  ON_FLT_NINF;
00223 
00224 /*
00225 Description:
00226 Paramters:
00227   x - [out] returned value of x is an SNan
00228             (signalling not a number).
00229 Remarks:
00230   Any time an SNaN passes through an Intel FPU, the result
00231   is a QNaN (quiet nan) and the invalid operation excpetion
00232   flag is set.  If this exception is not masked, then the
00233   exception handler is invoked.
00234  
00235     double x, y;
00236     ON_DBL_SNAN(&x);
00237     y = x;     // y = QNAN and invalid op exception occurs
00238     z = sin(x) // z = QNAN and invalid op exception occurs
00239 
00240   So, if you want to reliably initialize doubles to SNaNs, 
00241   you must use memcpy() or some other method that does not
00242   use the Intel FPU.
00243 */
00244 ON_DECL
00245 void ON_DBL_SNAN( double* x );
00246 
00247 ON_DECL
00248 void ON_FLT_SNAN( float* x );
00249 
00250 ON_END_EXTERNC
00251 
00252 /*
00253 // In cases where lazy evaluation of a color value is
00254 // performed, this value is used to indicate the value 
00255 // has not been computed.
00256 */
00257 #define ON_UNSET_COLOR 0xFFFFFFFF
00258 
00259 /*
00260 // In cases when an absolute "zero" tolerance 
00261 // is required to compare model space coordinates,
00262 // ON_ZERO_TOLERANCE is used.  The value of
00263 // ON_ZERO_TOLERANCE should be no smaller than
00264 // ON_EPSILON and should be several orders of 
00265 // magnitude smaller than ON_SQRT_EPSILON
00266 // 
00267 */
00268 //#define ON_ZERO_TOLERANCE 1.0e-12
00269 // ON_ZERO_TOLERANCE = 2^-32
00270 #define ON_ZERO_TOLERANCE 2.3283064365386962890625e-10
00271 
00272 /*
00273 // In cases when an relative "zero" tolerance is
00274 // required for comparing model space coordinates, 
00275 // (fabs(a)+fabs(b))*ON_RELATIVE_TOLERANCE is used.
00276 // ON_RELATIVE_TOLERANCE should be larger than
00277 // ON_EPSILON and smaller than no larger than 
00278 // ON_ZERO_TOLERANCE*2^-10.
00279 // 
00280 */
00281 // ON_RELATIVE_TOLERANCE = 2^-42
00282 #define ON_RELATIVE_TOLERANCE 2.27373675443232059478759765625e-13
00283 
00284 /*
00285 // Bugs in geometry calculations involving world coordinates 
00286 // values > ON_MAXIMUM_WORLD_COORDINATE_VALUE
00287 // will be a low priority.
00288 */
00289 // ON_MAXIMUM_VALUE = 2^27
00290 #define ON_MAXIMUM_WORLD_COORDINATE_VALUE 1.34217728e8
00291 
00292 /*
00293 // The default test for deciding if a curvature value should be
00294 // treated as zero is 
00295 // length(curvature) <= ON_ZERO_CURVATURE_TOLERANCE.
00296 // ON_ZERO_CURVATURE_TOLERANCE must be set so that
00297 // ON_ZERO_CURVATURE_TOLERANCE >= sqrt(3)*ON_ZERO_TOLERANCE
00298 // so that K.IsTiny() = true implies |K| <= ON_ZERO_CURVATURE_TOLERANCE
00299 */
00300 #define ON_ZERO_CURVATURE_TOLERANCE 1.0e-8
00301 
00302 /* default value for angle tolerances = 1 degree */
00303 #define ON_DEFAULT_ANGLE_TOLERANCE (ON_PI/180.0)
00304 #define ON_DEFAULT_ANGLE_TOLERANCE_COSINE 0.99984769515639123915701155881391
00305 #define ON_MINIMUM_ANGLE_TOLERANCE (ON_DEFAULT_ANGLE_TOLERANCE/10.0)
00306 
00307 // pair of integer indices.  This
00308 // is intentionally a struct/typedef
00309 // rather than a class so that it
00310 // can be used in other structs.
00311 struct tagON_2dex
00312 {
00313   int i;
00314   int j;
00315 };
00316 
00317 typedef struct tagON_2dex ON_2dex;
00318 
00319 // triplet of integer indices.  This
00320 // is intentionally a struct/typedef
00321 // rather than a class so that it
00322 // can be used in other structs.
00323 struct tagON_3dex
00324 {
00325   int i;
00326   int j;
00327   int k;
00328 };
00329 
00330 typedef struct tagON_3dex ON_3dex;
00331 
00332 
00333 // quadruplet of integer indices.  This
00334 // is intentionally a struct/typedef
00335 // rather than a class so that it
00336 // can be used in other structs.
00337 struct tagON_4dex
00338 {
00339   int i;
00340   int j;
00341   int k;
00342   int l;
00343 };
00344 
00345 typedef struct tagON_4dex ON_4dex;
00346 
00347 union ON_U
00348 {
00349   char      b[8]; // 8 bytes
00350   ON__INT64 h;    // 64 bit integer
00351   ON__INT32 i;    // 32 bit integer
00352   int       j[2]; // two 32 bit integers
00353   void*     p;
00354   double    d;
00355 };
00356 
00357 #if defined(ON_CPLUSPLUS)
00358 
00359 // OpenNurbs enums
00360 class ON_CLASS ON
00361 {
00362 public:
00363   /*
00364   Description:
00365     Call before using openNURBS to ensure all class definitions
00366     are linked.
00367   */
00368   static void Begin();
00369 
00370 
00371   /*
00372   Description:
00373     Call when finished with openNURBS.
00374   Remarks:
00375     Currently does nothing.
00376   */
00377   static void End();
00378 
00380   // Version of opennurbs (YYYYMMDDn)
00381   static
00382   int Version();
00383 
00385   // McNeel subversion revsion used to build opennurbs
00386   static
00387   const char* SourceRevision();
00388 
00389   static
00390   const char* DocumentationRevision();
00391 
00392   static
00393   const char* SourceBranch();
00394 
00395   static
00396   const char* DocumentationBranch();
00397 
00398 
00400 
00401   static
00402   FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
00403           const char* filename,
00404           const char* filemode
00405           );
00406 
00407   static
00408   FILE* OpenFile( // like fopen() - needed when OpenNURBS is used as a DLL
00409           const wchar_t* filename,
00410           const wchar_t* filemode
00411           );
00412 
00413   static
00414   int CloseFile( // like fclose() - needed when OpenNURBS is used as a DLL
00415           FILE* // pointer returned by OpenFile()
00416           );
00417 
00418   static
00419   int CloseAllFiles(); // like _fcloseall() - needed when OpenNURBS is used as a DLL
00420 
00421   /*
00422   Description:
00423     Uses the flavor of fstat that is appropriate for the platform.
00424   Parameters:
00425     filename - [in]
00426     fp - [in]
00427     filesize - [out] (can be NULL if you do not want filesize)
00428     create_time - [out] (can be NULL if you do not want last create time)
00429     lastmodify_time - [out] (can be NULL if you do not want last modification time)
00430   Returns:
00431     True if file exists, can be opened for read, and fstat worked.
00432   */
00433   static
00434   bool GetFileStats( const wchar_t* filename,
00435                      size_t* filesize,
00436                      time_t* create_time,
00437                      time_t* lastmodify_time
00438                     );
00439 
00440   static
00441   bool GetFileStats( FILE* fp,
00442                      size_t* filesize,
00443                      time_t* create_time,
00444                      time_t* lastmodify_time
00445                     );
00446 
00447   /*
00448   Returns true if pathname is a directory.
00449   */
00450   static bool IsDirectory( const wchar_t* pathname );
00451   static bool IsDirectory( const char* utf8pathname );
00452 
00453   /*
00454   Returns
00455     If the file is an opennurbs file, the version of the file
00456     is returned (2,3,4,50,...).
00457     If the file is not an opennurbs file, 0 is returned.
00458   */
00459   static int IsOpenNURBSFile( const wchar_t* pathname );
00460   static int IsOpenNURBSFile( const char* utf8pathname );
00461   static int IsOpenNURBSFile( FILE* fp );
00462 
00464   enum eAnnotationType
00465   {
00466     dtNothing,
00467     dtDimLinear,
00468     dtDimAligned,
00469     dtDimAngular,
00470     dtDimDiameter,
00471     dtDimRadius,
00472     dtLeader,
00473     dtTextBlock,
00474     dtDimOrdinate,
00475   };
00476 
00477   static eAnnotationType AnnotationType(int); // convert integer to eAnnotationType enum
00478 
00479 
00481   enum eTextDisplayMode
00482   {
00483     dtNormal = 0,
00484     dtHorizontal = 1,
00485     dtAboveLine = 2,
00486     dtInLine = 3,
00487   };
00488 
00489   static eTextDisplayMode TextDisplayMode( int);
00490 
00491   // Defines the current working space.
00492   enum active_space
00493   {
00494     no_space    = 0,
00495     model_space = 1, // 3d modeling or "world" space
00496     page_space  = 2  // page/layout/paper/printing space
00497   };
00498 
00499   static active_space ActiveSpace(int); // convert integer to active_space enum
00500 
00501 
00502 
00504   enum unit_system
00505   {
00506     // The constant enum values are saved in 3dm files 
00507     // and must never be changed.  The values > 11 were
00508     // added 5 April 2006.
00509     no_unit_system =  0, 
00510 
00511     // atomic distances
00512     angstroms      = 12,  // 1.0e-10 meters
00513 
00514     // SI units
00515     nanometers     = 13,  // 1.0e-9 meters
00516     microns        =  1,  // 1.0e-6 meters
00517     millimeters    =  2,  // 1.0e-3 meters
00518     centimeters    =  3,  // 1.0e-2 meters
00519     decimeters     = 14,  // 1.0e-1 meters
00520     meters         =  4,
00521     dekameters     = 15,  // 1.0e+1 meters
00522     hectometers    = 16,  // 1.0e+2 meters
00523     kilometers     =  5,  // 1.0e+3 meters
00524     megameters     = 17,  // 1.0e+6 meters
00525     gigameters     = 18,  // 1.0e+9 meters
00526 
00527     // english distances
00528     microinches    =  6,  //    2.54e-8 meters (1.0e-6 inches)
00529     mils           =  7,  //    2.54e-5 meters (0.001 inches)
00530     inches         =  8,  //    0.0254  meters
00531     feet           =  9,  //    0.3408  meters (12 inches)
00532     yards          = 19,  //    0.9144  meters (36 inches)
00533     miles          = 10,  // 1609.344   meters (5280 feet)
00534 
00535     // printer distances
00536     printer_point  = 20,  // 1/72 inches (computer points)
00537     printer_pica   = 21,  // 1/6 inches  (computer picas)
00538 
00539     // terrestrial distances
00540     nautical_mile  = 22, // 1852 meters 
00541                          //    Approximately 1 minute of arc on a terrestrial great circle.
00542                          //    See http://en.wikipedia.org/wiki/Nautical_mile.
00543 
00544     // astronomical distances
00545     astronomical   = 23, // 1.4959787e+11 // http://en.wikipedia.org/wiki/Astronomical_unit
00546                          // 1.495979e+11  // http://units.nist.gov/Pubs/SP811/appenB9.htm  
00547                          //    An astronomical unit (au) is the mean distance from the 
00548                          //    center of the earth to the center of the sun.
00549     lightyears     = 24, // 9.4607304725808e+15 // http://en.wikipedia.org/wiki/Light_year
00550                          // 9.46073e+15 meters  // http://units.nist.gov/Pubs/SP811/appenB9.htm
00551                          //    A light year is the distance light travels in one Julian year.
00552                          //    The speed of light is exactly 299792458 meters/second.
00553                          //    A Julian year is exactly 365.25 * 86400 seconds and is 
00554                          //    approximately the time it takes for one earth orbit.
00555     parsecs        = 25, // 3.08567758e+16  // http://en.wikipedia.org/wiki/Parsec
00556                          // 3.085678e+16    // http://units.nist.gov/Pubs/SP811/appenB9.htm  
00557 
00558     // Custom unit systems
00559     custom_unit_system = 11 // x meters with x defined in ON_3dmUnitsAndTolerances.m_custom_unit_scale
00560   };
00561 
00562   static unit_system UnitSystem(int); // convert integer to unit_system enum
00563 
00564   /*
00565   Description:
00566     Scale factor for changing unit "standard" systems.
00567   Parameters:
00568     us_from - [in]
00569     us_to - [in] 
00570   For example:
00571 
00572           100.0 = ON::UnitScale( ON::meters, ON::centimeters ) 
00573           2.54  = ON::UnitScale( ON::inches, ON::centimeters ) 
00574           12.0  = ON::UnitScale( ON::feet,   ON::inches ) 
00575 
00576   Remarks:
00577     If you are using custom unit systems, use the version
00578     that takes ON_UnitSystem or ON_3dmUnitsAndTolerances 
00579     parameters.
00580   */
00581   static double UnitScale(
00582       ON::unit_system us_from,
00583       ON::unit_system us_to
00584       );
00585   static double UnitScale(
00586       const class ON_UnitSystem& us_from, 
00587       const class ON_UnitSystem& us_to
00588       );
00589   static double UnitScale(
00590       ON::unit_system us_from,
00591       const class ON_UnitSystem& us_to
00592       );
00593   static double UnitScale(
00594       const class ON_UnitSystem& us_from, 
00595       ON::unit_system us_to
00596       );
00597   static double UnitScale(
00598       const class ON_3dmUnitsAndTolerances& us_from, 
00599       const class ON_3dmUnitsAndTolerances& us_to
00600       );
00601 
00602 
00603   /*
00604   Description:
00605     Returns the string " : ".  This is the string Rhino uses
00606     to separate reference model names from the root name for 
00607     things like layer, block definition, material, linetype,
00608     dimstyle and font names.  
00609   See Also:
00610     ON::NameReferenceDelimiterLength()
00611     ON::IsNameReferenceDelimiter()
00612   */
00613   static const wchar_t* NameReferenceDelimiter();
00614 
00615   /*
00616   Description:
00617     Returns the number of characters in the string returned
00618     by ON::NameReferenceDelimiter().
00619   See Also:
00620     ON::NameReferenceDelimiterLength()
00621     ON::IsNameReferenceDelimiter()
00622   */
00623   static unsigned int NameReferenceDelimiterLength();
00624 
00625   /*
00626   Description:
00627     Test a string to see if its beginning matches the 
00628     string returned by ON::NameReferenceDelimiter().
00629   Parameters:
00630     s - [in];
00631       string to test.
00632   Returns:
00633     null:
00634       The beginning of the string does not match ON::NameReferenceDelimiter().
00635     non-null:
00636       The beginning of the string matches ON::NameReferenceDelimiter(). The
00637       returned pointer is the first character in s after the last character
00638       of the delimiter.  Put another way, if the beginning of s matches
00639       the string  ON::NameReferenceDelimiter(), then the returned pointer is
00640       s + ON::NameReferenceDelimiterLength().
00641   See Also:
00642     ON::NameReferenceDelimiter()
00643     ON::NameReferenceDelimiterLength()
00644   */
00645   static const wchar_t* IsNameReferenceDelimiter(const wchar_t* s);
00646 
00648   enum distance_display_mode
00649   {
00650     decimal     = 0, 
00651     fractional  = 1,
00652     feet_inches = 2
00653   };
00654 
00655   static distance_display_mode DistanceDisplayMode(int); // convert integer to distance_display_mode enum
00656 
00657 
00659   enum point_style 
00660   {
00661     unknown_point_style   = 0,
00662     not_rational          = 1,
00663     homogeneous_rational  = 2,
00664     euclidean_rational    = 3,
00665     intrinsic_point_style = 4, // point format used in definition
00666     point_style_count     = 5
00667   };
00668 
00669   static point_style PointStyle(int); // convert integer to point_style enum
00670 
00672   enum knot_style // if a knot vector meets the conditions of two styles,
00673   {               // then the style with the lowest value is used
00674     unknown_knot_style     = 0, // unknown knot style
00675     uniform_knots          = 1, // uniform knots (ends not clamped)
00676     quasi_uniform_knots    = 2, // uniform knots (clamped ends, degree >= 2)
00677     piecewise_bezier_knots = 3, // all internal knots have full multiplicity
00678     clamped_end_knots      = 4, // clamped end knots (with at least 1 interior non-uniform knot)
00679     non_uniform_knots      = 5, // known to be none of the above
00680     knot_style_count       = 6
00681   };
00682 
00683   static knot_style KnotStyle(int); // convert integer to knot_style enum
00684 
00686   enum continuity
00687   {
00688     unknown_continuity = 0,
00689 
00690     // These test for parametric continuity.  In particular,
00691     // all types of ON_Curves are considered infinitely 
00692     // continuous at the start/end of the evaluation domain.
00693     C0_continuous =  1, // continuous function
00694     C1_continuous =  2, // continuous first derivative
00695     C2_continuous =  3, // continuous first and second derivative
00696     G1_continuous =  4, // continuous unit tangent
00697     G2_continuous =  5, // continuous unit tangent and curvature
00698 
00699     // 20 March 2003 Dale Lear added these.
00700     //
00701     // Continuity tests using the following enum values
00702     // are identical to tests using the preceding enum values
00703     // on the INTERIOR of a curve's domain.  At the END of
00704     // a curve a "locus" test is performed in place of a 
00705     // parametric test. In particular, at the END of a domain,
00706     // all open curves are locus discontinuous.  At the END of
00707     // a domain, all closed curves are at least C0_locus_continuous.
00708     // By convention all ON_Curves are considered 
00709     // locus continuous at the START of the evaluation domain.
00710     // This convention is not strictly correct, but is was
00711     // adopted to make iterative kink finding tools easier to
00712     // use and so that locus discontinuities are reported once
00713     // at the end parameter of a curve rather than twice.
00714     C0_locus_continuous =  6, // locus continuous function
00715     C1_locus_continuous =  7, // locus continuous first derivative
00716     C2_locus_continuous =  8, // locus continuous first and second derivative
00717     G1_locus_continuous =  9, // locus continuous unit tangent
00718     G2_locus_continuous = 10, // locus continuous unit tangent and curvature
00719 
00720     Cinfinity_continuous = 11, // analytic discontinuity
00721     Gsmooth_continuous = 12    // aesthetic discontinuity
00722   };
00723 
00724   /*
00725   Description:
00726     Convert int to ON::continuity enum value
00727   */
00728   static continuity Continuity(int);
00729 
00730   /*
00731   Description:
00732     Convert int to ON::continuity enum value and
00733     convert the locus flavored values to the parametric
00734     flavored values.
00735   */
00736   static continuity ParametricContinuity(int);
00737 
00738   /*
00739   Description:
00740     Convert int to ON::continuity enum value and
00741     convert the higher order flavored values to 
00742     the corresponding C1 or G1 values needed to
00743     test piecewise linear curves.
00744   */
00745   static continuity PolylineContinuity(int);
00746 
00748   enum curve_style 
00749   {
00750     unknown_curve_style   =  0,
00751     line                  =  1,
00752     circle                =  2,
00753     ellipse               =  3, // with distinct foci (not a circle)
00754     parabola              =  4,
00755     hyperbola             =  5,
00756     planar_polyline       =  6, // not a line segment
00757     polyline              =  7, // non-planar polyline
00758     planar_freeform_curve =  8, // planar but none of the above
00759     freeform_curve        =  9, // known to be none of the above
00760     curve_style_count     = 10
00761   };
00762 
00763   static curve_style CurveStyle(int); // convert integer to curve_style enum
00764 
00766   enum surface_style 
00767   {
00768     unknown_surface_style =  0,
00769     plane                 =  1,
00770     circular_cylinder     =  2, // portion of right circular cylinder
00771     elliptical_cylinder   =  3, // portion of right elliptical cylinder
00772     circular_cone         =  4, // portion of right circular cone
00773     elliptical_cone       =  5, // portion of right elliptical cone
00774     sphere                =  6, // portion of sphere
00775     torus                 =  7, // portion of torus
00776     surface_of_revolution =  8, // portion of surface of revolution that is none of the above
00777     ruled_surface         =  9, // portion of a ruled surface this is none of the above
00778     freeform_surface      = 10, // known to be none of the above
00779     surface_style_count   = 11
00780   };
00781 
00782   static surface_style SurfaceStyle(int); // convert integer to surface_style enum
00783 
00785   enum sort_algorithm
00786   {
00787     heap_sort  = 0,
00788     quick_sort = 1
00789   };
00790 
00791   static sort_algorithm SortAlgorithm(int); // convert integer to sort_method enum
00792 
00794   enum endian {
00795     little_endian = 0, // least significant byte first or reverse byte order - Intel x86, ...
00796     big_endian    = 1  // most significant byte first - Motorola, Sparc, MIPS, ...
00797   };
00798 
00799   static endian Endian(int); // convert integer to endian enum
00800   static endian Endian();    // returns endian-ness of current CPU
00801 
00803   enum archive_mode
00804   {
00805     unknown_archive_mode = 0,
00806     read      = 1, // all read modes have bit 0x0001 set
00807     write     = 2, // all write modes have bit 0x0002 set
00808     readwrite = 3,
00809     read3dm   = 5,
00810     write3dm  = 6
00811   };
00812   static archive_mode ArchiveMode(int); // convert integer to endian enum
00813 
00814 
00816 
00817   // The x/y/z_2pt_perspective_view projections are ordinary perspective
00818   // projection. Using these values insures the ON_Viewport member 
00819   // fuctions properly constrain the camera up and camera direction vectors
00820   // to preserve the specified perspective vantage.
00821   enum view_projection
00822   { 
00823     unknown_view       = 0,
00824     parallel_view      = 1,
00825     perspective_view   = 2
00826   };
00827 
00828   /*
00829   Description:
00830     Converts integer into ON::view_projection enum value.
00831   Parameters:
00832     i - [in]
00833   Returns:
00834     ON::view_projection enum with same value as i.
00835     If i is not an ON::view_projection enum value,
00836     then ON::unknow_view is returned.
00837   */
00838   static view_projection ViewProjection(int i);
00839 
00840   /*
00841   Parameters:
00842     projection - [in]
00843   Returns:
00844     True if projection is ON::perspective_view.
00845   */
00846   static bool IsPerspectiveProjection( ON::view_projection projection );
00847 
00848 
00849   /*
00850   Parameters:
00851     projection - [in]
00852   Returns:
00853     True if projection is ON::parallel_view.
00854   */
00855   static bool IsParallelProjection( ON::view_projection projection );
00856 
00858 
00859   enum coordinate_system 
00860   {
00861     world_cs  = 0, 
00862     camera_cs = 1, 
00863     clip_cs   = 2, 
00864     screen_cs = 3 
00865   };
00866 
00867   static coordinate_system CoordinateSystem(int); // convert integer to coordinate_system enum
00868 
00870         enum exception_type 
00871   {
00872     unknown_exception = 0,
00873                 out_of_memory,  
00874     corrupt_object,               // invalid object encountered - continuing would crash or
00875                                   // result in corrupt object being saved in archive.
00876                 unable_to_write_archive,      // write operation failed - out of file space/read only mode/...?
00877                 unable_to_read_archive,       // read operation failed - truncated archive/locked file/... ?
00878                 unable_to_seek_archive,       // seek operation failed - locked file/size out of bounds/... ?
00879                 unexpected_end_of_archive,    // truncated archive
00880                 unexpected_value_in_archive   // corrupt archive?
00881   };
00882   static exception_type ExceptionType(int); // convert integer to exception_type enum
00883 
00885   // OBSOLETE 
00886         enum layer_mode 
00887   {
00888     normal_layer       = 0, // visible, objects on layer can be selected and changed
00889     hidden_layer       = 1, // not visible, objects on layer cannot be selected or changed
00890     locked_layer       = 2, // visible, objects on layer cannot be selected or changed
00891     layer_mode_count   = 3
00892   };
00893   static layer_mode LayerMode(int); // convert integer to layer_mode enum
00894 
00896         enum object_mode 
00897   {
00898     normal_object    = 0, // object mode comes from layer
00899     hidden_object    = 1, // not visible, object cannot be selected or changed
00900     locked_object    = 2, // visible, object cannot be selected or changed
00901     idef_object      = 3, // object is part of an ON_InstanceDefinition.  The
00902                           // ON_InstanceDefinition m_object_uuid[] array will
00903                           // contain this object attribute's uuid.
00904     object_mode_count = 4
00905   };
00906   static object_mode ObjectMode(int); // convert integer to object_mode enum
00907 
00909         enum object_color_source
00910   {
00911     color_from_layer    = 0, // use color assigned to layer
00912     color_from_object   = 1, // use color assigned to object
00913     color_from_material = 2, // use diffuse render material color
00914     color_from_parent   = 3  // for objects with parents (like objects in instance references, use parent linetype)
00915                              // if no parent, treat as color_from_layer
00916   };
00917   static object_color_source ObjectColorSource(int); // convert integer to object_color_source enum
00918 
00920         enum plot_color_source
00921   {
00922     plot_color_from_layer   = 0, // use plot color assigned to layer
00923     plot_color_from_object  = 1, // use plot color assigned to object
00924     plot_color_from_display = 2, // use display color
00925     plot_color_from_parent  = 3  // for objects with parents (like objects in instance references, use parent plot color)
00926                                  // if no parent, treat as plot_color_from_layer
00927   };
00928   static plot_color_source PlotColorSource(int); // convert integer to plot_color_source enum
00929 
00931         enum plot_weight_source
00932   {
00933     plot_weight_from_layer   = 0, // use plot color assigned to layer
00934     plot_weight_from_object  = 1, // use plot color assigned to object
00935     plot_weight_from_parent  = 3  // for objects with parents (like objects in instance references, use parent plot color)
00936                                   // if no parent, treat as plot_color_from_layer
00937   };
00938   static plot_weight_source PlotWeightSource(int); // convert integer to plot_color_source enum
00939 
00941         enum object_linetype_source
00942   {
00943     linetype_from_layer  = 0, // use line style assigned to layer
00944     linetype_from_object = 1, // use line style assigned to object
00945     linetype_from_parent = 3  // for objects with parents (like objects in instance references, use parent linetype)
00946                               // if not parent, treat as linetype_from_layer.
00947   };
00948   static object_linetype_source ObjectLinetypeSource(int); // convert integer to object_linetype_source enum
00949 
00951         enum object_material_source
00952   {
00953     material_from_layer  = 0, // use material assigned to layer
00954     material_from_object = 1, // use material assigned to object
00955     material_from_parent = 3  // for objects with parents, like 
00956                               // definition geometry in instance
00957                               // references and faces in polysurfaces,
00958                               // this value indicates the material
00959                               // definition should come from the parent.
00960                               // If the object does not have an 
00961                               // obvious "parent", then treat
00962                               // it the same as material_from_layer.
00963   };
00964   static object_material_source ObjectMaterialSource(int); // convert integer to object_color_source enum
00965 
00967   enum light_style
00968   {
00969     unknown_light_style      = 0,
00970     //view_directional_light   = 1, // light location and direction in clip coordinates
00971     //view_point_light         = 2,
00972     //view_spot_light          = 3,
00973     camera_directional_light = 4, // light location and direction in camera coordinates
00974     camera_point_light       = 5, //   +x points to right, +y points up, +z points towards camera
00975     camera_spot_light        = 6,
00976     world_directional_light  = 7, // light location and direction in world coordinates
00977     world_point_light        = 8, 
00978     world_spot_light         = 9,
00979     ambient_light            = 10, // pure ambient light
00980     world_linear_light       = 11,
00981     world_rectangular_light  = 12,
00982     light_style_count        = 13
00983   };
00984   static light_style LightStyle(int); // convert integer to light_style enum
00985 
00987   enum curvature_style
00988   {
00989     unknown_curvature_style = 0,
00990     gaussian_curvature = 1,
00991     mean_curvature = 2, // unsigned mean curvature
00992     min_curvature  = 3, // minimum unsigned radius of curvature
00993     max_curvature  = 4, // maximum unsigned radius of curvature
00994     curvature_style_count = 5
00995   };
00996   static curvature_style CurvatureStyle(int); // convert integer to curvature_style enum
00997 
00999   enum display_mode
01000   {
01001     default_display       = 0, // default display
01002     wireframe_display     = 1, // wireframe display
01003     shaded_display        = 2, // shaded display
01004     renderpreview_display = 3  // render preview display
01005   };
01006   static display_mode DisplayMode(int); // convert integer to display_mode enum
01007 
01008 
01009   enum view_type
01010   {
01011     model_view_type  = 0,       // standard model space 3d view
01012     page_view_type   = 1,       // a.k.a "paper space", "plot view", etc.
01013                                 // A page view must be orthographic,
01014                                 // the camera frame x,y,z direction must be
01015                                 // world x,y,z (which means the camera direction
01016                                 // is always (0,0,-1)).  
01017     nested_view_type = 2,       // This view is a "model" view that is nested
01018                                 // in another view.  The nesting and parent
01019                                 // information is saved in ON_3dmView.
01020   };
01021   static view_type ViewType(int); // convert integer to display_mode enum
01022 
01023 
01025   //
01026   // OBSOLETE 
01027   enum texture_mode
01028   {
01029     no_texture = 0,        // texture disabled
01030     modulate_texture = 1,  // modulate with material diffuse color
01031     decal_texture = 2      // decal
01032   };
01033   // OBSOLETE 
01034   static texture_mode TextureMode(int); // convert integer to texture_mode enum
01035   // OBSOLETE 
01036   //
01038 
01040   enum object_type
01041   {
01042     // Use with ON_Object::ObjectType() in situations where
01043     // using a switch() is better than a long string of if else if ...
01044     // if ( ON_Curve::Cast() ) ... else if ( ON_Surface::Cast() ) ...
01045     // ...
01046     unknown_object_type  =          0,
01047 
01048     point_object         =          1, // some type of ON_Point
01049     pointset_object      =          2, // some type of ON_PointCloud, ON_PointGrid, ...
01050     curve_object         =          4, // some type of ON_Curve like ON_LineCurve, ON_NurbsCurve, etc.
01051     surface_object       =          8, // some type of ON_Surface like ON_PlaneSurface, ON_NurbsSurface, etc.
01052     brep_object          =       0x10, // some type of ON_Brep
01053     mesh_object          =       0x20, // some type of ON_Mesh
01054     layer_object         =       0x40, // some type of ON_Layer
01055     material_object      =       0x80, // some type of ON_Material
01056     light_object         =      0x100, // some type of ON_Light
01057     annotation_object    =      0x200, // some type of ON_Annotation
01058     userdata_object      =      0x400, // some type of ON_UserData
01059     instance_definition  =      0x800, // some type of ON_InstanceDefinition
01060     instance_reference   =     0x1000, // some type of ON_InstanceRef
01061     text_dot             =     0x2000, // some type of ON_TextDot
01062     grip_object          =     0x4000, // selection filter value - not a real object type
01063     detail_object        =     0x8000, // some type of ON_DetailView
01064     hatch_object         =    0x10000, // some type of ON_Hatch
01065     morph_control_object =    0x20000, // some type of ON_MorphControl
01066     loop_object          =    0x80000, // some type of ON_BrepLoop
01067     polysrf_filter       =   0x200000, // selection filter value - not a real object type
01068     edge_filter          =   0x400000, // selection filter value - not a real object type
01069     polyedge_filter      =   0x800000, // selection filter value - not a real object type
01070     meshvertex_object    = 0x01000000, // some type of ON_MeshVertexRef
01071     meshedge_object      = 0x02000000, // some type of ON_MeshEdgeRef
01072     meshface_object      = 0x04000000, // some type of ON_MeshFaceRef
01073     cage_object          = 0x08000000, // some type of ON_NurbsCage
01074     phantom_object       = 0x10000000,
01075     clipplane_object     = 0x20000000,
01076     beam_object          = 0x40000000, // obsolete - use extrusion_object
01077     extrusion_object     = 0x40000000, // some type of ON_Extrusion
01078     
01079     any_object           = 0xFFFFFFFF
01080 
01081     // Please discuss any changes with Dale Lear
01082   };
01083 
01084   static object_type ObjectType(int); // convert integer to object_type enum
01085 
01087   enum bitmap_type
01088   {
01089     unknown_bitmap_type = 0,
01090     windows_bitmap = 1,     // BITMAPINFO style
01091     opengl_bitmap = 2,      // unpacked OpenGL RGB or RGBA
01092     png_bitmap = 3
01093   };
01094   static bitmap_type BitmapType(int); // convert integer to bitmap_type enum
01095 
01096   enum object_decoration
01097   {
01098     no_object_decoration = 0,
01099     start_arrowhead      = 0x08, // arrow head at start
01100     end_arrowhead        = 0x10, // arrow head at end
01101     both_arrowhead       = 0x18  // arrow heads at start and end
01102   };
01103   static object_decoration ObjectDecoration(int); // convert integer to line_pattern enum
01104 
01105   enum mesh_type
01106   {
01107     default_mesh  = 0,
01108     render_mesh   = 1,
01109     analysis_mesh = 2,
01110     preview_mesh  = 3,
01111     any_mesh      = 4
01112   };
01113   static mesh_type MeshType(int); // convert integer to mesh_type enum
01114 
01115 
01116   // Types of object snapping.  
01117   // In situations where more than one type of snap applies, 
01118   // snaps with higher value take precedence.
01119   // enum values must be a power of 2.
01120   // ON_ObjRef saves these values in files.  Do not change
01121   // the values.  The reason for the gaps between the enum
01122   // values is to leave room for future snaps with prededence
01123   // falling between existing snaps
01124   enum osnap_mode
01125   {
01126     os_none          =          0,
01127     os_near          =          2,
01128     os_focus         =          8,
01129     os_center        =       0x20,
01130     os_vertex        =       0x40,
01131     os_knot          =       0x80,
01132     os_quadrant      =      0x200,
01133     os_midpoint      =      0x800,
01134     os_intersection  =     0x2000,
01135     os_end           =    0x20000,
01136     os_perpendicular =    0x80000,
01137     os_tangent       =   0x200000,
01138     os_point         = 0x08000000,
01139     os_all_snaps     = 0xFFFFFFFF
01140   };
01141   static osnap_mode OSnapMode(int); // convert integer to osnap_mode enum
01142 
01143 
01145   enum eCurveType
01146   {
01147     ctCurve, // nothing
01148     ctArc,
01149     ctCircle,
01150     ctLine,
01151     ctNurbs,
01152     ctOnsurface,
01153     ctProxy,
01154     ctPolycurve,
01155     ctPolyline,
01156   };
01157 
01158 
01160   //
01161   // End condition paramter values for  ON_Curve::CreateCubicLoft() and
01162   // ON_Surface::CreateCubicLoft().
01163   enum cubic_loft_end_condition
01164   {
01165     cubic_loft_ec_quadratic      = 0,
01166     cubic_loft_ec_linear         = 1,
01167     cubic_loft_ec_cubic          = 2,
01168     cubic_loft_ec_natural        = 3,
01169     cubic_loft_ec_unit_tangent   = 4,
01170     cubic_loft_ec_1st_derivative = 5,
01171     cubic_loft_ec_2nd_derivative = 6,
01172     cubic_loft_ec_free_cv        = 7
01173   };
01174 
01175   /*
01176   Description:
01177     Convert an integer to cubic_loft_end_condition enum.
01178   Parameters:
01179     i - [in]
01180   Returns:
01181     corresponding cubic_loft_end_condition enum value.
01182   Remarks:
01183     If i does not correspond to a cubic_loft_end_condition
01184     enum value, then cubic_loft_ec_quadratic is returned.
01185   */
01186   static 
01187   cubic_loft_end_condition CubicLoftEndCondition(int i); 
01188 
01189 private:
01190   // prohibit instantiaion
01191   //ON();             // no implementation
01192   //ON( const ON& );  // no implementation
01193   //~ON();            // no implementation
01194 };
01195 
01196 
01197 /*
01198 Description:
01199   Component indices are used to provide a persistent way
01200   to identify portions of complex objects.
01201 
01202 */
01203 class ON_CLASS ON_COMPONENT_INDEX
01204 {
01205 public:
01206 
01207   // Do not change these values; they are stored in 3dm archives
01208   // and provide a persistent way to indentify components of
01209   // complex objects.
01210   enum TYPE
01211   {
01212     invalid_type       =   0,
01213 
01214     brep_vertex        =   1,
01215     brep_edge          =   2,
01216     brep_face          =   3,
01217     brep_trim          =   4,
01218     brep_loop          =   5,
01219 
01220     mesh_vertex        =  11,
01221     meshtop_vertex     =  12,
01222     meshtop_edge       =  13,
01223     mesh_face          =  14,
01224 
01225     idef_part          =  21,
01226 
01227     polycurve_segment  =  31,
01228 
01229     pointcloud_point   =  41,
01230 
01231     group_member       =  51,
01232 
01233 
01234     extrusion_bottom_profile = 61, // 3d bottom profile curves
01235                                    //   index identifies profile component
01236     extrusion_top_profile    = 62, // 3d top profile curves
01237                                    //   index identifies profile component
01238     extrusion_wall_edge      = 63, // 3d wall edge curve
01239                                    //   index/2: identifies profile component
01240                                    //   index%2: 0 = start, 1 = end
01241     extrusion_wall_surface   = 64, // side wall surfaces
01242                                    //   index: identifies profile component
01243     extrusion_cap_surface    = 65, // bottom and top cap surfaces
01244                                    //   index: 0 = bottom, 1 = top
01245     extrusion_path           = 66, // extrusion path (axis line)
01246                                    //   index -1 = entire path, 0 = start point, 1 = endpoint
01247 
01248     dim_linear_point   = 100,
01249     dim_radial_point   = 101,
01250     dim_angular_point  = 102,
01251     dim_ordinate_point = 103,
01252     dim_text_point     = 104,
01253 
01254     no_type           = 0xFFFFFFFF
01255   };
01256 
01257   /*
01258   Description:
01259     Safe conversion of integer value to TYPE enum.
01260   Parameters:
01261     i - [in] integer with value equal to one of the TYPE enums.
01262   Returns:
01263     The TYPE enum with the same numeric value 
01264     or ON_COMPONENT_INDEX::invalid_type if no corresponding enum
01265     exists.
01266   */
01267   static 
01268   TYPE Type(int i);
01269 
01270   /*
01271   Description:
01272     Dictionary compare on m_type, m_index as ints.
01273   Returns:
01274     < 0: a < b
01275     = 0: a = b
01276     > 0: a > b
01277   */
01278   static
01279   int Compare( const ON_COMPONENT_INDEX* a, const ON_COMPONENT_INDEX* b);
01280 
01281   /*
01282   Description:
01283     Sets m_type = invalid_type and m_index = -1.
01284   */
01285   ON_COMPONENT_INDEX();
01286 
01287   /*
01288   Description:
01289     Sets m_type = type and m_index = index.
01290   */
01291   ON_COMPONENT_INDEX(TYPE type,int index);
01292 
01293   bool operator==(const ON_COMPONENT_INDEX& other) const;
01294   bool operator!=(const ON_COMPONENT_INDEX& other) const;
01295   bool operator<(const ON_COMPONENT_INDEX& other) const;
01296   bool operator<=(const ON_COMPONENT_INDEX& other) const;
01297   bool operator>(const ON_COMPONENT_INDEX& other) const;
01298   bool operator>=(const ON_COMPONENT_INDEX& other) const;
01299 
01300   void Set(TYPE type,int index);
01301 
01302   /*
01303   Description:
01304     Sets m_type = invalid_type and m_index = -1.
01305   */
01306   void UnSet();
01307 
01308   /*
01309   Returns:
01310     True if m_type is set to a TYPE enum value between
01311     brep_vertex and polycurve_segment.
01312   */
01313   bool IsSet() const;
01314 
01315   /*
01316   Returns:
01317     True if m_type is set to one of the mesh or meshtop
01318     TYPE enum values and m_index >= 0.
01319   */
01320   bool IsMeshComponentIndex() const;
01321 
01322   /*
01323   Returns:
01324     True if m_type is set to one of the 
01325     brep TYPE enum values and m_index >= 0.
01326   */
01327   bool IsBrepComponentIndex() const;
01328 
01329   /*
01330   Returns:
01331     True if m_type = idef_part and m_index >= 0.
01332   */
01333   bool IsIDefComponentIndex() const;
01334 
01335   /*
01336   Returns:
01337     True if m_type = polycurve_segment and m_index >= 0.
01338   */
01339   bool IsPolyCurveComponentIndex() const;
01340 
01341   /*
01342   Returns:
01343     True if m_type = group_member and m_index >= 0.
01344   */
01345   bool IsGroupMemberComponentIndex() const;
01346 
01347   /*
01348   Returns:
01349     True if m_type = extrusion_bottom_profile or extrusion_top_profile
01350     and m_index >= 0.
01351   */
01352   bool IsExtrusionProfileComponentIndex() const;
01353 
01354   /*
01355   Returns:
01356     True if m_type = extrusion_path and -1 <= m_index <= 1.
01357   */
01358   bool IsExtrusionPathComponentIndex() const;
01359 
01360   /*
01361   Returns:
01362     True if m_type = extrusion_wall_edge and m_index >= 0.
01363   */
01364   bool IsExtrusionWallEdgeComponentIndex() const;
01365 
01366   /*
01367   Returns:
01368     True if m_type = extrusion_wall_surface and m_index >= 0.
01369   */
01370   bool IsExtrusionWallSurfaceComponentIndex() const;
01371 
01372   /*
01373   Returns:
01374     True if m_type = extrusion_wall_surface or extrusion_wall_edge
01375     and m_index >= 0.
01376   */
01377   bool IsExtrusionWallComponentIndex() const;
01378 
01379   /*
01380   Returns:
01381     True if m_type = extrusion_bottom_profile, extrusion_top_profile,
01382     extrusion_wall_edge, extrusion_wall_surface, extrusion_cap_surface
01383     or extrusion_path and m_index is reasonable.
01384   */
01385   bool IsExtrusionComponentIndex() const;
01386 
01387   /*
01388   Returns:
01389     True if m_type = pointcloud_point and m_index >= 0.
01390   */
01391   bool IsPointCloudComponentIndex() const;
01392 
01393   /*
01394   Returns:
01395     True if m_type = dim_... and m_index >= 0.
01396   */
01397   bool IsAnnotationComponentIndex() const;
01398 
01399   TYPE m_type;
01400 
01401   /*
01402   The interpretation of m_index depends on the m_type value.
01403 
01404     m_type             m_index interpretation (0 based indices)
01405 
01406     no_type            used when context makes it clear what array is being index
01407     brep_vertex        ON_Brep.m_V[] array index
01408     brep_edge          ON_Brep.m_E[] array index
01409     brep_face          ON_Brep.m_F[] array index
01410     brep_trim          ON_Brep.m_T[] array index
01411     brep_loop          ON_Brep.m_L[] array index
01412     mesh_vertex        ON_Mesh.m_V[] array index
01413     meshtop_vertex     ON_MeshTopology.m_topv[] array index
01414     meshtop_edge       ON_MeshTopology.m_tope[] array index
01415     mesh_face          ON_Mesh.m_F[] array index
01416     idef_part          ON_InstanceDefinition.m_object_uuid[] array index
01417     polycurve_segment  ON_PolyCurve::m_segment[] array index
01418 
01419     extrusion_bottom_profile  Use ON_Extrusion::Profile3d() to get 3d profile curve
01420     extrusion_top_profile     Use ON_Extrusion::Profile3d() to get 3d profile curve
01421     extrusion_wall_edge       Use ON_Extrusion::WallEdge() to get 3d line curve
01422     extrusion_wall_surface    Use ON_Extrusion::WallSurface() to get 3d wall surface
01423     extrusion_cap_surface      0 = bottom cap, 1 = top cap
01424     extrusion_path            -1 = entire path, 0 = start of path, 1 = end of path
01425 
01426     dim_linear_point   ON_LinearDimension2::POINT_INDEX
01427     dim_radial_point   ON_RadialDimension2::POINT_INDEX
01428     dim_angular_point  ON_AngularDimension2::POINT_INDEX
01429     dim_ordinate_point ON_OrdinateDimension2::POINT_INDEX
01430     dim_text_point     ON_TextEntity2 origin point
01431   */
01432   int m_index;
01433 };
01434 
01435 #endif
01436 
01437 ON_BEGIN_EXTERNC
01438 
01439 /*
01440 Description:
01441   Sets Windows code page used to convert UNICODE (wchar_t) strings
01442   to multibyte (char) strings and vice verse.
01443 Parameters:
01444   code_page - [in] code page to use when converting UNICODE strings
01445        to multibyte strings and vice verse.
01446 Returns:
01447   previous value of Windows code page.
01448 Remarks:
01449   For Windows NT/2000/XP, CP_THREAD_ACP will work for all
01450   locales if your app's thread is correctly configured.
01451   For Windows 95/98/ME you have to choose the locale.
01452 
01453   Conversions between UNICODE and multibyte strings happens when
01454   ON_wString converts a char* string to a wchar_t* string and
01455   when and ON_String converts a wchar_t* string to a char* string.
01456 
01457   All pertinant code is in opennurbs_defines.cpp.
01458 
01459 See Also:
01460   ON_GetStringConversionWindowsCodePage
01461   on_WideCharToMultiByte
01462   on_MultiByteToWideChar
01463   ON_wString::operator=(const char*)
01464   ON_String::operator=(const wchar_t*)  
01465 */
01466 ON_DECL
01467 unsigned int ON_SetStringConversionWindowsCodePage( 
01468                 unsigned int code_page 
01469                 );
01470 
01471 /*
01472 Description:
01473   Gets Windows code page used to convert UNICODE (wchar_t) strings
01474   to multibyte (char) strings and vice verse.
01475 Returns:
01476   Value of Windows code page used to convert strings.
01477 Remarks:
01478   For Windows NT/2000/XP, CP_THREAD_ACP will work for all
01479   locales if your app's thread is correctly configured.
01480   For Windows 95/98/ME you have to choose the locale.
01481 
01482   Conversions between UNICODE and multibyte strings happens when
01483   ON_wString converts a char* string to a wchar_t* string and
01484   when and ON_String converts a wchar_t* string to a char* string.
01485 
01486   All pertinant code is in opennurbs_defines.cpp.
01487 
01488 See Also:
01489   ON_GetStringConversionWindowsCodePage
01490   on_WideCharToMultiByte
01491   on_MultiByteToWideChar
01492   ON_wString::operator=(const char*)
01493   ON_String::operator=(const wchar_t*)  
01494 */
01495 ON_DECL
01496 unsigned int ON_GetStringConversionWindowsCodePage();
01497 
01498 
01499 /*
01500 Description:
01501   Sets Windows locale id used in case insensitive string
01502   compares.
01503 Parameters:
01504   locale_id - [in] Windows locale id to use in case insensitive
01505                  string compares.
01506   bWin9X - [in] True if OS is Windows 95/98/ME (which has
01507                 poor UNICODE support).
01508 Returns:
01509   Previous value of Windows locale id.
01510 Remarks:
01511   All pertinant code is in opennurbs_defines.cpp.
01512 See Also:
01513   ON_GetStringConversionWindowsLocaleID
01514   on_wcsicmp
01515 */
01516 ON_DECL
01517 unsigned int ON_SetStringConversionWindowsLocaleID( 
01518                 unsigned int locale_id, 
01519                 ON_BOOL32 bWin9X
01520                 );
01521 
01522 /*
01523 Description:
01524   Gets Windows locale id used in case insensitive string
01525   compares.
01526 Returns:
01527   Value of Windows locale id used in case insensitive string
01528   compares.
01529 Remarks:
01530   All pertinant code is in opennurbs_defines.cpp.
01531 See Also:
01532   ON_SetStringConversionWindowsLocaleID
01533   on_wcsicmp
01534 */
01535 ON_DECL
01536 unsigned int ON_GetStringConversionWindowsLocaleID();
01537 
01538 // on_wcsicmp() is a wrapper for case insensitive wide string compare
01539 // and calls one of _wcsicmp() or wcscasecmp() depending on OS.
01540 ON_DECL
01541 int on_wcsicmp( const wchar_t*, const wchar_t* );
01542 
01543 // on_wcsupr() calls _wcsupr() or wcsupr() depending on OS
01544 ON_DECL
01545 wchar_t* on_wcsupr(wchar_t*);
01546 
01547 // on_wcslwr() calls _wcslwr() or wcslwr() depending on OS
01548 ON_DECL
01549 wchar_t* on_wcslwr(wchar_t*);
01550 
01551 // on_wcsrev() calls _wcsrev() or wcsrev() depending on OS
01552 ON_DECL
01553 wchar_t* on_wcsrev(wchar_t*);
01554 
01555 // on_stricmp() is a wrapper for case insensitive string compare
01556 // and calls one of _stricmp(), stricmp(), or strcasecmp()
01557 // depending on OS.
01558 ON_DECL
01559 int on_stricmp(const char*, const char*); 
01560 
01561 // on_stricmp() is a wrapper for case insensitive string compare
01562 // and calls one of _strnicmp() or strncasecmp()
01563 // depending on OS.
01564 ON_DECL
01565 int on_strnicmp(const char * s1, const char * s2, int n);
01566 
01567 // on_strupr() calls _strupr() or strupr() depending on OS
01568 ON_DECL
01569 char* on_strupr(char*);
01570 
01571 // on_strlwr() calls _strlwr() or strlwr() depending on OS
01572 ON_DECL
01573 char* on_strlwr(char*);
01574 
01575 // on_strrev() calls _strrev() or strrev() depending on OS
01576 ON_DECL
01577 char* on_strrev(char*);
01578 
01579 /*
01580 Description:
01581   Calls ON_ConvertWideCharToUTF8()
01582 */
01583 ON_DECL
01584 int on_WideCharToMultiByte(
01585     const wchar_t*, // lpWideCharStr,
01586     int,            // cchWideChar,
01587     char*,          // lpMultiByteStr,
01588     int             // cchMultiByte,
01589     );
01590 
01591 /*
01592 Description:
01593   Calls ON_ConvertUTF8ToWideChar()
01594 */
01595 ON_DECL
01596 int on_MultiByteToWideChar(
01597     const char*, // lpMultiByteStr,
01598     int,         // cchMultiByte,
01599     wchar_t*,    // lpWideCharStr,
01600     int          // cchWideChar
01601     );
01602 
01603 /*
01604 Description:
01605   Find the locations in a path the specify the drive, directory,
01606   file name and file extension.
01607 Parameters:
01608   path - [in]
01609     UTF-8 encoded string that is a legitimate path to a file.
01610   drive - [out] (pass null if you don't need the drive)
01611     If drive is not null and the path parameter begins with 
01612     an A-Z or a-z followed by a colon ( : ) then the returned
01613     value of *drive will equal the input value of path.
01614   dir - [out] (pass null if you don't need the directory)
01615     If dir is not null and the path parameter contains a
01616     directory specification, then the returned value of *dir
01617     will point to the character in path where the directory
01618     specification begins.
01619   fname - [out] (pass null if you don't need the file name)
01620     If fname is not null and the path parameter contains a
01621     file name specification, then the returned value of *fname
01622     will point to the character in path where the file name
01623     specification begins.
01624   ext - [out] (pass null if you don't need the extension)
01625     If ext is not null and the path parameter contains a
01626     file extension specification, then the returned value of
01627     *ext will point to the '.' character in path where the file
01628     extension specification begins.
01629 Remarks:
01630   This function will treat a front slash ( / ) and a back slash
01631   ( \ ) as directory separators.  Because this function parses
01632   file names store in .3dm files and the .3dm file may have been
01633   written on a Windows computer and then read on a another
01634   computer, it looks for a drive dpecification even when the
01635   operating system is not Windows.
01636   This function will not return an directory that does not
01637   end with a trailing slash.
01638   This function will not return an empty filename and a non-empty
01639   extension.
01640   This function parses the path string according to these rules.
01641   It does not check the actual file system to see if the answer
01642   is correct.
01643 See Also:
01644   ON_String::SplitPath
01645 */
01646 ON_DECL void on_splitpath(
01647   const char* path,
01648   const char** drive,
01649   const char** dir,
01650   const char** fname,
01651   const char** ext
01652   );
01653 
01654 /*
01655 Description:
01656   Find the locations in a path the specify the drive, directory,
01657   file name and file extension.
01658 Parameters:
01659   path - [in]
01660     UTF-8, UTF-16 or UTF-32 encoded wchar_t string that is a
01661     legitimate path to a file.
01662   drive - [out] (pass null if you don't need the drive)
01663     If drive is not null and the path parameter begins with 
01664     an A-Z or a-z followed by a colon ( : ) then the returned
01665     value of *drive will equal the input value of path.
01666   dir - [out] (pass null if you don't need the directory)
01667     If dir is not null and the path parameter contains a
01668     directory specification, then the returned value of *dir
01669     will point to the character in path where the directory
01670     specification begins.
01671   fname - [out] (pass null if you don't need the file name)
01672     If fname is not null and the path parameter contains a
01673     file name specification, then the returned value of *fname
01674     will point to the character in path where the file name
01675     specification begins.
01676   ext - [out] (pass null if you don't need the extension)
01677     If ext is not null and the path parameter contains a
01678     file extension specification, then the returned value of
01679     *ext will point to the '.' character in path where the file
01680     extension specification begins.
01681 Remarks:
01682   This function will treat a front slash ( / ) and a back slash
01683   ( \ ) as directory separators.  Because this function parses
01684   file names store in .3dm files and the .3dm file may have been
01685   written on a Windows computer and then read on a another
01686   computer, it looks for a drive dpecification even when the
01687   operating system is not Windows.
01688   This function will not return an directory that does not
01689   end with a trailing slash.
01690   This function will not return an empty filename and a non-empty
01691   extension.
01692   This function parses the path string according to these rules.
01693   It does not check the actual file system to see if the answer
01694   is correct.
01695 See Also:
01696   ON_wString::SplitPath
01697 */
01698 ON_DECL void on_wsplitpath(
01699   const wchar_t* path,
01700   const wchar_t** drive,
01701   const wchar_t** dir,
01702   const wchar_t** fname,
01703   const wchar_t** ext
01704   );
01705 
01706 ON_END_EXTERNC
01707 
01708 
01709 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:00