Point Cloud Library (PCL)
1.7.0
|
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 // 00014 //////////////////////////////////////////////////////////////// 00015 */ 00016 00017 #if !defined(OPENNURBS_DIMSTYLE_INC_) 00018 #define OPENNURBS_DIMSTYLE_INC_ 00019 00020 class ON_CLASS ON_DimStyle : public ON_Object 00021 { 00022 ON_OBJECT_DECLARE(ON_DimStyle); 00023 00024 public: 00025 enum eArrowType 00026 { 00027 solidtriangle = 0, // 2:1 00028 dot = 1, 00029 tick = 2, 00030 shorttriangle = 3, // 1:1 00031 arrow = 4, 00032 rectangle = 5, 00033 longtriangle = 6, // 4:1 00034 longertriangle = 7, // 6:1 00035 }; 00036 00037 ON_DimStyle(); 00038 ~ON_DimStyle(); 00039 // C++ default copy construction and operator= work fine.- 00040 00041 ON_DimStyle& operator=( const ON_3dmAnnotationSettings& src); 00042 00043 ////////////////////////////////////////////////////////////////////// 00044 // 00045 // ON_Object overrides 00046 00047 /* 00048 Description: 00049 Tests an object to see if its data members are correctly 00050 initialized. 00051 Parameters: 00052 text_log - [in] if the object is not valid and text_log 00053 is not NULL, then a brief englis description of the 00054 reason the object is not valid is appened to the log. 00055 The information appended to text_log is suitable for 00056 low-level debugging purposes by programmers and is 00057 not intended to be useful as a high level user 00058 interface tool. 00059 Returns: 00060 @untitled table 00061 true object is valid 00062 false object is invalid, uninitialized, etc. 00063 Remarks: 00064 Overrides virtual ON_Object::IsValid 00065 */ 00066 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const; 00067 00068 // virtual 00069 void Dump( ON_TextLog& ) const; // for debugging 00070 00071 // virtual 00072 ON_BOOL32 Write( 00073 ON_BinaryArchive& // serialize definition to binary archive 00074 ) const; 00075 00076 // virtual 00077 ON_BOOL32 Read( 00078 ON_BinaryArchive& // restore definition from binary archive 00079 ); 00080 00081 void EmergencyDestroy(); 00082 00083 // virtual 00084 ON_UUID ModelObjectId() const; 00085 00086 00087 ////////////////////////////////////////////////////////////////////// 00088 // 00089 // Interface 00090 00091 void SetName( const wchar_t* ); 00092 void SetName( const char* ); 00093 00094 void GetName( ON_wString& ) const; 00095 const wchar_t* Name() const; 00096 00097 void SetIndex(int); 00098 int Index() const; 00099 00100 void SetDefaults(); 00101 void SetDefaultsNoExtension(); 00102 00103 00104 double ExtExtension() const; 00105 void SetExtExtension( const double); 00106 00107 double ExtOffset() const; 00108 void SetExtOffset( const double); 00109 00110 double ArrowSize() const; 00111 void SetArrowSize( const double); 00112 00113 double LeaderArrowSize() const; 00114 void SetLeaderArrowSize( const double); 00115 00116 double CenterMark() const; 00117 void SetCenterMark( const double); 00118 00119 int TextAlignment() const; 00120 void SetTextAlignment( ON::eTextDisplayMode); 00121 00122 int ArrowType() const; 00123 void SetArrowType( eArrowType); 00124 00125 int LeaderArrowType() const; 00126 void SetLeaderArrowType( eArrowType); 00127 00128 int AngularUnits() const; 00129 void SetAngularUnits( int); 00130 00131 int LengthFormat() const; 00132 void SetLengthFormat( int); 00133 00134 int AngleFormat() const; 00135 void SetAngleFormat( int); 00136 00137 int LengthResolution() const; 00138 void SetLengthResolution( int); 00139 00140 int AngleResolution() const; 00141 void SetAngleResolution( int); 00142 00143 int FontIndex() const; 00144 virtual void SetFontIndex( int index); 00145 00146 double TextGap() const; 00147 void SetTextGap( double gap); 00148 00149 double TextHeight() const; 00150 void SetTextHeight( double height); 00151 00152 // added at ver 1.3 00153 double LengthFactor() const; 00154 ON_DEPRECATED void SetLengthactor( double); 00155 void SetLengthFactor( double); // added 6/24/07 because of typo 00156 00157 bool Alternate() const; 00158 void SetAlternate( bool); 00159 00160 double AlternateLengthFactor() const; 00161 ON_DEPRECATED void SetAlternateLengthactor( double); 00162 void SetAlternateLengthFactor( double); // added 6/24/07 because of typo 00163 00164 int AlternateLengthFormat() const; 00165 void SetAlternateLengthFormat( int); 00166 00167 int AlternateLengthResolution() const; 00168 void SetAlternateLengthResolution( int); 00169 00170 int AlternateAngleFormat() const; 00171 void SetAlternateAngleFormat( int); 00172 00173 int AlternateAngleResolution() const; 00174 void SetAlternateAngleResolution( int); 00175 00176 void GetPrefix( ON_wString& ) const; 00177 const wchar_t* Prefix() const; 00178 void SetPrefix( const wchar_t*); 00179 void SetPrefix( wchar_t*); 00180 00181 void GetSuffix( ON_wString& ) const; 00182 const wchar_t* Suffix() const; 00183 void SetSuffix( const wchar_t*); 00184 void SetSuffix( wchar_t*); 00185 00186 void GetAlternatePrefix( ON_wString& ) const; 00187 const wchar_t* AlternatePrefix() const; 00188 void SetAlternatePrefix( const wchar_t*); 00189 void SetAlternatePrefix( wchar_t*); 00190 00191 void GetAlternateSuffix( ON_wString& ) const; 00192 const wchar_t* AlternateSuffix() const; 00193 void SetAlternateSuffix( const wchar_t*); 00194 void SetAlternateSuffix( wchar_t*); 00195 00196 bool SuppressExtension1() const; 00197 void SetSuppressExtension1( bool); 00198 00199 bool SuppressExtension2() const; 00200 void SetSuppressExtension2( bool); 00201 00202 // obsolete 00203 ON_DEPRECATED void Composite( const ON_DimStyle& override); 00204 00205 // Don't change these enum values 00206 // They are used in file reading & writing 00207 enum eField 00208 { 00209 fn_name = 0, 00210 fn_index = 1, 00211 fn_extextension = 2, 00212 fn_extoffset = 3, 00213 fn_arrowsize = 4, 00214 fn_centermark = 5, 00215 fn_textgap = 6, 00216 fn_textheight = 7, 00217 fn_textalign = 8, 00218 fn_arrowtype = 9, 00219 fn_angularunits = 10, 00220 fn_lengthformat = 11, 00221 fn_angleformat = 12, 00222 fn_angleresolution = 13, 00223 fn_lengthresolution = 14, 00224 fn_fontindex = 15, 00225 fn_lengthfactor = 16, 00226 fn_bAlternate = 17, 00227 fn_alternate_lengthfactor = 18, 00228 fn_alternate_lengthformat = 19, 00229 fn_alternate_lengthresolution = 20, 00230 fn_alternate_angleformat = 21, 00231 fn_alternate_angleresolution = 22, 00232 fn_prefix = 23, 00233 fn_suffix = 24, 00234 fn_alternate_prefix = 25, 00235 fn_alternate_suffix = 26, 00236 fn_dimextension = 27, 00237 fn_leaderarrowsize = 28, 00238 fn_leaderarrowtype = 29, 00239 fn_suppressextension1 = 30, 00240 fn_suppressextension2 = 31, 00241 fn_last = 32, // not used - left here for sdk 00242 00243 // Added for v5 - 5/01/07 LW 00244 // version 1.6 00245 fn_overall_scale = 33, 00246 fn_ext_line_color_source = 34, 00247 fn_dim_line_color_source = 35, 00248 fn_arrow_color_source = 36, 00249 fn_text_color_source = 37, 00250 fn_ext_line_color = 38, 00251 fn_dim_line_color = 39, 00252 fn_arrow_color = 40, 00253 fn_text_color = 41, 00254 fn_ext_line_plot_color_source = 42, 00255 fn_dim_line_plot_color_source = 43, 00256 fn_arrow_plot_color_source = 44, 00257 fn_text_plot_color_source = 45, 00258 fn_ext_line_plot_color = 46, 00259 fn_dim_line_plot_color = 47, 00260 fn_arrow_plot_color = 48, 00261 fn_text_plot_color = 49, 00262 fn_ext_line_plot_weight_source = 50, 00263 fn_dim_line_plot_weight_source = 51, 00264 fn_ext_line_plot_weight_mm = 52, 00265 fn_dim_line_plot_weight_mm = 53, 00266 fn_tolerance_style = 54, 00267 fn_tolerance_resolution = 55, 00268 fn_tolerance_upper_value = 56, 00269 fn_tolerance_lower_value = 57, 00270 fn_tolerance_height_scale = 58, 00271 fn_baseline_spacing = 59, 00272 00273 // Added for v5 - 12/15/09 LW 00274 // version 1.7 00275 fn_draw_mask = 60, 00276 fn_mask_color_source = 61, 00277 fn_mask_color = 62, 00278 fn_mask_border = 63, 00279 00280 // Added for v5 - 12/17/09 LW 00281 // version 1.8 00282 fn_dimscale = 64, 00283 fn_dimscale_source = 65, 00284 00285 //When fields are added to ON_DimStyleExtra, 00286 // enum { eFieldCount = 64 }; in opennurbs_dimstyle.cpp 00287 // needs to be changed. 00288 fn_really_last = 0xFFFF 00289 }; 00290 00291 // These are obsolete - don't use 00292 // 5/01/07 - LW 00293 ON_DEPRECATED void InvalidateField( eField field); 00294 ON_DEPRECATED void InvalidateAllFields(); 00295 ON_DEPRECATED void ValidateField( eField field); 00296 ON_DEPRECATED bool IsFieldValid( eField) const; 00297 00298 // added version 1.3 00299 double DimExtension() const; 00300 void SetDimExtension( const double); 00301 00302 // This section Added for v5 - 4-24-07 LW 00303 // version 1.6 00304 00305 // Test if a specific field has been set in this dimstyle 00306 // and not inherited from its parent. 00307 bool IsFieldOverride( eField field_id) const; 00308 // Set a field to be overridden or not 00309 // Fields that aren't overrides inherit from their parent dimstyle 00310 void SetFieldOverride( ON_DimStyle::eField field_id, bool bOverride); 00311 00312 // Test if the dimstyle has any field override flags set 00313 bool HasOverrides() const; 00314 00315 // Change the fields in this dimstyle to match the fields of the 00316 // source dimstyle for all of the fields that are marked overridden in the source 00317 // and to match the parent for all of the fields not marked overriden. 00318 // Returns true if any overrides were set. 00319 bool OverrideFields( const ON_DimStyle& source, const ON_DimStyle& parent); 00320 00321 // 00322 // Change the fields in this dimstyle to match the fields of the 00323 // parent dimstyle for all of the fields that are not marked overridden in the 00324 // target dimstyle. 00325 // This is the complement of OverrideFields() 00326 bool InheritFields( const ON_DimStyle& parent); 00327 00328 // Test if this dimstyle is the child of any other dimstyle 00329 bool IsChildDimstyle() const; 00330 00331 // Test if this dimstyle is the child of a given dimstyle 00332 // A dimstyle may have several child dimstyles, but only one parent 00333 bool IsChildOf( const ON_UUID& parent_uuid) const; 00334 bool IsChildOf( ON_UUID& parent_uuid) const; // decl error - const forgotten 00335 00336 ON_UUID ParentId() const; 00337 00338 // Set the parent of this dimstyle 00339 void SetParentId( ON_UUID parent_uuid); 00340 ON_DEPRECATED void SetParent( ON_UUID& parent_uuid); // use set parent id 00341 00342 // Tolerances 00343 // Tolerance style 00344 // 0: None 00345 // 1: Symmetrical 00346 // 2: Deviation 00347 // 3: Limits 00348 // 4: Basic 00349 int ToleranceStyle() const; 00350 int ToleranceResolution() const; 00351 double ToleranceUpperValue() const; 00352 double ToleranceLowerValue() const; 00353 double ToleranceHeightScale() const; 00354 00355 double BaselineSpacing() const; 00356 00357 void SetToleranceStyle( int style); 00358 void SetToleranceResolution( int resolution); 00359 void SetToleranceUpperValue( double upper_value); 00360 void SetToleranceLowerValue( double lower_value); 00361 void SetToleranceHeightScale( double scale); 00362 00363 void SetBaselineSpacing( double spacing = false); 00364 00365 // Determines whether or not to draw a Text Mask 00366 bool DrawTextMask() const; 00367 void SetDrawTextMask(bool bDraw); 00368 00369 // Determines where to get the color to draw a Text Mask 00370 // 0: Use background color of the viewport. Initially, gradient backgrounds will not be supported 00371 // 1: Use the ON_Color returned by MaskColor() 00372 int MaskColorSource() const; 00373 void SetMaskColorSource(int source); 00374 00375 ON_Color MaskColor() const; // Only works right if MaskColorSource returns 1. 00376 // Does not return viewport background color 00377 void SetMaskColor(ON_Color color); 00378 00379 // Per DimStyle DimScale 00380 void SetDimScaleSource(int source); 00381 int DimScaleSource() const; // 0: Global DimScale, 1: DimStyle DimScale 00382 void SetDimScale(double scale); 00383 double DimScale() const; 00384 00385 // Offset for the border around text to the rectangle used to draw the mask 00386 // This number * CRhinoAnnotation::TextHeight() for the text is the offset 00387 // on each side of the tight rectangle around the text characters to the mask rectangle. 00388 double MaskOffsetFactor() const; 00389 00390 void Scale( double scale); 00391 00392 // UUID of the dimstyle this was originally copied from 00393 // so Restore Defaults has some place to look 00394 void SetSourceDimstyle(ON_UUID source_uuid); 00395 ON_UUID SourceDimstyle() const; 00396 00397 // Defaults for values stored in Userdata extension 00398 static int DefaultToleranceStyle(); 00399 static int DefaultToleranceResolution(); 00400 static double DefaultToleranceUpperValue(); 00401 static double DefaultToleranceLowerValue(); 00402 static double DefaultToleranceHeightScale(); 00403 static double DefaultBaselineSpacing(); 00404 static bool DefaultDrawTextMask(); // false 00405 static int DefaultMaskColorSource(); // 0; 00406 static ON_Color DefaultMaskColor(); // .SetRGB(255,255,255); 00407 static double DefaultDimScale(); // 1.0; 00408 static int DefaultDimScaleSource(); // 0; 00409 00410 bool CompareFields(const ON_DimStyle& other) const; 00411 00412 public: 00413 ON_wString m_dimstyle_name; // String name of the style 00414 int m_dimstyle_index; // Index in the dimstyle table 00415 ON_UUID m_dimstyle_id; 00416 00417 double m_extextension; // extension line extension 00418 double m_extoffset; // extension line offset 00419 double m_arrowsize; // length of an arrow - may mean different things to different arrows 00420 double m_centermark; // size of the + at circle centers 00421 double m_textgap; // gap around the text for clipping dim line 00422 double m_textheight; // model unit height of dimension text before applying dimscale 00423 int m_textalign; // text alignment relative to the dimension line 00424 int m_arrowtype; // 0: filled narrow triangular arrow 00425 int m_angularunits; // 0: degrees, 1: radians 00426 int m_lengthformat; // 0: decimal, 1: feet, 2: feet & inches 00427 int m_angleformat; // 0: decimal degrees, ... 00428 int m_angleresolution; // for decimal degrees, digits past decimal 00429 int m_lengthresolution; // depends on m_lengthformat 00430 // for decimal, digits past the decimal point 00431 int m_fontindex; // index of the ON_Font used by this dimstyle 00432 00433 // added fields version 1.2, Jan 13, 05 00434 double m_lengthfactor; // (dimlfac) model units multiplier for length display 00435 bool m_bAlternate; // (dimalt) display alternate dimension string (or not) 00436 // using m_alternate_xxx values 00437 double m_alternate_lengthfactor; // (dimaltf) model units multiplier for alternate length display 00438 int m_alternate_lengthformat; // 0: decimal, 1: feet, 2: feet & inches 00439 int m_alternate_lengthresolution; // depends on m_lengthformat 00440 // for decimal, digits past the decimal point 00441 int m_alternate_angleformat; // 0: decimal degrees, ... 00442 int m_alternate_angleresolution; // for decimal degrees, digits past decimal 00443 ON_wString m_prefix; // string preceding dimension value string 00444 ON_wString m_suffix; // string following dimension value string 00445 ON_wString m_alternate_prefix; // string preceding alternate value string 00446 ON_wString m_alternate_suffix; // string following alternate value string 00447 00448 private: 00449 unsigned int m_valid; // Obsolete deprecated field to be removed - Do not use 00450 public: 00451 00452 // field added version 1.4, Dec 28, 05 00453 double m_dimextension; // (dimdle) dimension line extension past the "tip" location 00454 00455 // fields added version 1.5 Mar 23 06 00456 double m_leaderarrowsize; // Like dimension arrow size but applies to leaders 00457 int m_leaderarrowtype; // Like dimension arrow type but applies to leaders 00458 bool m_bSuppressExtension1; // flag to not draw extension lines 00459 bool m_bSuppressExtension2; // flag to not draw extension lines 00460 00461 00462 // Added March 23, 2008 -LW 00463 // This function is temporary and will be removed next time the SDK can be modified. 00464 class ON_DimStyleExtra* DimStyleExtension(); // can return null 00465 const class ON_DimStyleExtra* DimStyleExtension() const; // can return null 00466 }; 00467 00468 #endif 00469