QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_dimstyle.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_DIMSTYLE_INC_)
17#define OPENNURBS_DIMSTYLE_INC_
18
20{
22
23public:
25 {
26 solidtriangle = 0, // 2:1
27 dot = 1,
28 tick = 2,
29 shorttriangle = 3, // 1:1
30 arrow = 4,
31 rectangle = 5,
32 longtriangle = 6, // 4:1
33 longertriangle = 7, // 6:1
34 };
35
38 // C++ default copy construction and operator= work fine.-
39
41
43 //
44 // ON_Object overrides
45
46 /*
47 Description:
48 Tests an object to see if its data members are correctly
49 initialized.
50 Parameters:
51 text_log - [in] if the object is not valid and text_log
52 is not NULL, then a brief englis description of the
53 reason the object is not valid is appened to the log.
54 The information appended to text_log is suitable for
55 low-level debugging purposes by programmers and is
56 not intended to be useful as a high level user
57 interface tool.
58 Returns:
59 @untitled table
60 true object is valid
61 false object is invalid, uninitialized, etc.
62 Remarks:
63 Overrides virtual ON_Object::IsValid
64 */
65 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
66
67 // virtual
68 void Dump( ON_TextLog& ) const; // for debugging
69
70 // virtual
72 ON_BinaryArchive& // serialize definition to binary archive
73 ) const;
74
75 // virtual
77 ON_BinaryArchive& // restore definition from binary archive
78 );
79
80 void EmergencyDestroy();
81
82 // virtual
83 ON_UUID ModelObjectId() const;
84
85
87 //
88 // Interface
89
90 void SetName( const wchar_t* );
91 void SetName( const char* );
92
93 void GetName( ON_wString& ) const;
94 const wchar_t* Name() const;
95
96 void SetIndex(int);
97 int Index() const;
98
99 void SetDefaults();
100
101 double ExtExtension() const;
102 void SetExtExtension( const double);
103
104 double ExtOffset() const;
105 void SetExtOffset( const double);
106
107 double ArrowSize() const;
108 void SetArrowSize( const double);
109
110 double LeaderArrowSize() const;
111 void SetLeaderArrowSize( const double);
112
113 double CenterMark() const;
114 void SetCenterMark( const double);
115
116 int TextAlignment() const;
117 void SetTextAlignment( ON::eTextDisplayMode);
118
119 int ArrowType() const;
120 void SetArrowType( eArrowType);
121
122 int LeaderArrowType() const;
123 void SetLeaderArrowType( eArrowType);
124
125 int AngularUnits() const;
126 void SetAngularUnits( int);
127
128 int LengthFormat() const;
129 void SetLengthFormat( int);
130
131 int AngleFormat() const;
132 void SetAngleFormat( int);
133
134 int LengthResolution() const;
135 void SetLengthResolution( int);
136
137 int AngleResolution() const;
138 void SetAngleResolution( int);
139
140 int FontIndex() const;
141 virtual void SetFontIndex( int index);
142
143 double TextGap() const;
144 void SetTextGap( double gap);
145
146 double TextHeight() const;
147 void SetTextHeight( double height);
148
149 // added at ver 1.3
150 double LengthFactor() const;
151 void SetLengthactor( double);
152 void SetLengthFactor( double); // added 6/24/07 because of typo
153
154 bool Alternate() const;
155 void SetAlternate( bool);
156
157 double AlternateLengthFactor() const;
158 void SetAlternateLengthactor( double);
159 void SetAlternateLengthFactor( double); // added 6/24/07 because of typo
160
161 int AlternateLengthFormat() const;
162 void SetAlternateLengthFormat( int);
163
164 int AlternateLengthResolution() const;
165 void SetAlternateLengthResolution( int);
166
167 int AlternateAngleFormat() const;
168 void SetAlternateAngleFormat( int);
169
170 int AlternateAngleResolution() const;
171 void SetAlternateAngleResolution( int);
172
173 void GetPrefix( ON_wString& ) const;
174 const wchar_t* Prefix() const;
175 void SetPrefix( const wchar_t*);
176 void SetPrefix( wchar_t*);
177
178 void GetSuffix( ON_wString& ) const;
179 const wchar_t* Suffix() const;
180 void SetSuffix( const wchar_t*);
181 void SetSuffix( wchar_t*);
182
183 void GetAlternatePrefix( ON_wString& ) const;
184 const wchar_t* AlternatePrefix() const;
185 void SetAlternatePrefix( const wchar_t*);
186 void SetAlternatePrefix( wchar_t*);
187
188 void GetAlternateSuffix( ON_wString& ) const;
189 const wchar_t* AlternateSuffix() const;
190 void SetAlternateSuffix( const wchar_t*);
191 void SetAlternateSuffix( wchar_t*);
192
193 bool SuppressExtension1() const;
194 void SetSuppressExtension1( bool);
195
196 bool SuppressExtension2() const;
197 void SetSuppressExtension2( bool);
198
199 // obsolete
200 void Composite( const ON_DimStyle& override);
201
202 // Don't change these enum values
203 // They are used in file reading & writing
205 {
206 fn_name = 0,
207 fn_index = 1,
208 fn_extextension = 2,
209 fn_extoffset = 3,
210 fn_arrowsize = 4,
211 fn_centermark = 5,
212 fn_textgap = 6,
213 fn_textheight = 7,
214 fn_textalign = 8,
215 fn_arrowtype = 9,
216 fn_angularunits = 10,
217 fn_lengthformat = 11,
218 fn_angleformat = 12,
219 fn_angleresolution = 13,
220 fn_lengthresolution = 14,
221 fn_fontindex = 15,
222 fn_lengthfactor = 16,
223 fn_bAlternate = 17,
224 fn_alternate_lengthfactor = 18,
225 fn_alternate_lengthformat = 19,
226 fn_alternate_lengthresolution = 20,
227 fn_alternate_angleformat = 21,
228 fn_alternate_angleresolution = 22,
229 fn_prefix = 23,
230 fn_suffix = 24,
231 fn_alternate_prefix = 25,
232 fn_alternate_suffix = 26,
233 fn_dimextension = 27,
234 fn_leaderarrowsize = 28,
235 fn_leaderarrowtype = 29,
236 fn_suppressextension1 = 30,
237 fn_suppressextension2 = 31,
238 fn_last = 32, // not used - left here for sdk
239
240 // Added for v5 - 5/01/07 LW
241 // version 1.6
242 fn_overall_scale = 33,
243 fn_ext_line_color_source = 34,
244 fn_dim_line_color_source = 35,
245 fn_arrow_color_source = 36,
246 fn_text_color_source = 37,
247 fn_ext_line_color = 38,
248 fn_dim_line_color = 39,
249 fn_arrow_color = 40,
250 fn_text_color = 41,
251 fn_ext_line_plot_color_source = 42,
252 fn_dim_line_plot_color_source = 43,
253 fn_arrow_plot_color_source = 44,
254 fn_text_plot_color_source = 45,
255 fn_ext_line_plot_color = 46,
256 fn_dim_line_plot_color = 47,
257 fn_arrow_plot_color = 48,
258 fn_text_plot_color = 49,
259 fn_ext_line_plot_weight_source = 50,
260 fn_dim_line_plot_weight_source = 51,
261 fn_ext_line_plot_weight_mm = 52,
262 fn_dim_line_plot_weight_mm = 53,
263 fn_tolerance_style = 54,
264 fn_tolerance_resolution = 55,
265 fn_tolerance_upper_value = 56,
266 fn_tolerance_lower_value = 57,
267 fn_tolerance_height_scale = 58,
268 fn_baseline_spacing = 59,
269
270 // Added for v5 - 12/15/09 LW
271 // version 1.7
272 fn_draw_mask = 60,
273 fn_mask_color_source = 61,
274 fn_mask_color = 62,
275 fn_mask_border = 63,
276
277 // Added for v5 - 12/17/09 LW
278 // version 1.8
279 fn_dimscale = 64,
280 fn_dimscale_source = 65,
281
282 //When fields are added to ON_DimStyleExtra,
283 // enum { eFieldCount = 64 }; in opennurbs_dimstyle.cpp
284 // needs to be changed.
285 fn_really_last = 0xFFFF
286 };
287
288 // These are obsolete - don't use
289 // 5/01/07 - LW
290 void InvalidateField( eField field);
291 void InvalidateAllFields();
292 void ValidateField( eField field);
293 bool IsFieldValid( eField) const;
294//#pragma deprecated( InvalidateField, InvalidateAllFields, ValidateField, IsFieldValid, Composite)
295
296 // added version 1.3
297 double DimExtension() const;
298 void SetDimExtension( const double);
299
300 // This section Added for v5 - 4-24-07 LW
301 // version 1.6
302
303 // Test if a specific field has been set in this dimstyle
304 // and not inherited from its parent.
305 bool IsFieldOverride( eField field_id) const;
306 // Set a field to be overridden or not
307 // Fields that aren't overrides inherit from their parent dimstyle
308 void SetFieldOverride( ON_DimStyle::eField field_id, bool bOverride);
309
310 // Test if the dimstyle has any field override flags set
311 bool HasOverrides() const;
312
313 // Change the fields in this dimstyle to match the fields of the
314 // source dimstyle for all of the fields that are marked overridden in the source
315 // and to match the parent for all of the fields not marked overriden.
316 // Returns true if any overrides were set.
317 bool OverrideFields( const ON_DimStyle& source, const ON_DimStyle& parent);
318
319 //
320 // Change the fields in this dimstyle to match the fields of the
321 // parent dimstyle for all of the fields that are not marked overridden in the
322 // target dimstyle.
323 // This is the complement of OverrideFields()
324 bool InheritFields( const ON_DimStyle& parent);
325
326 // Test if this dimstyle is the child of any other dimstyle
327 bool IsChildDimstyle() const;
328
329 // Test if this dimstyle is the child of a given dimstyle
330 // A dimstyle may have several child dimstyles, but only one parent
331 bool IsChildOf( ON_UUID& parent_uuid) const;
332
333 // Set the parent of this dimstyle
334 void SetParent( ON_UUID& parent_uuid);
335
336 // Tolerances
337 // Tolerance style
338 // 0: None
339 // 1: Symmetrical
340 // 2: Deviation
341 // 3: Limits
342 // 4: Basic
343 int ToleranceStyle() const;
344 int ToleranceResolution() const;
345 double ToleranceUpperValue() const;
346 double ToleranceLowerValue() const;
347 double ToleranceHeightScale() const;
348
349 double BaselineSpacing() const;
350
351 void SetToleranceStyle( int style);
352 void SetToleranceResolution( int resolution);
353 void SetToleranceUpperValue( double upper_value);
354 void SetToleranceLowerValue( double lower_value);
355 void SetToleranceHeightScale( double scale);
356
357 void SetBaselineSpacing( double spacing = false);
358
359 // Determines whether or not to draw a Text Mask
360 bool DrawTextMask() const;
361 void SetDrawTextMask(bool bDraw);
362
363 // Determines where to get the color to draw a Text Mask
364 // 0: Use background color of the viewport. Initially, gradient backgrounds will not be supported
365 // 1: Use the ON_Color returned by MaskColor()
366 int MaskColorSource() const;
367 void SetMaskColorSource(int source);
368
369 ON_Color MaskColor() const; // Only works right if MaskColorSource returns 1.
370 // Does not return viewport background color
371 void SetMaskColor(ON_Color color);
372
373 // Per DimStyle DimScale
374 void SetDimScaleSource(int source);
375 int DimScaleSource() const; // 0: Global DimScale, 1: DimStyle DimScale
376 void SetDimScale(double scale);
377 double DimScale() const;
378
379 // Offset for the border around text to the rectangle used to draw the mask
380 // This number * CRhinoAnnotation::TextHeight() for the text is the offset
381 // on each side of the tight rectangle around the text characters to the mask rectangle.
382 double MaskOffsetFactor() const;
383
384 void Scale( double scale);
385
386 // Defaults for values stored in Userdata extension
387 static int DefaultToleranceStyle();
388 static int DefaultToleranceResolution();
389 static double DefaultToleranceUpperValue();
390 static double DefaultToleranceLowerValue();
391 static double DefaultToleranceHeightScale();
392 static double DefaultBaselineSpacing();
393
394 bool CompareFields(const ON_DimStyle& other) const;
395
396public:
397 ON_wString m_dimstyle_name; // String name of the style
398 int m_dimstyle_index; // Index in the dimstyle table
400
401 double m_extextension; // extension line extension
402 double m_extoffset; // extension line offset
403 double m_arrowsize; // length of an arrow - may mean different things to different arrows
404 double m_centermark; // size of the + at circle centers
405 double m_textgap; // gap around the text for clipping dim line
406 double m_textheight; // model unit height of dimension text before applying dimscale
407 int m_textalign; // text alignment relative to the dimension line
408 int m_arrowtype; // 0: filled narrow triangular arrow
409 int m_angularunits; // 0: degrees, 1: radians
410 int m_lengthformat; // 0: decimal, 1: feet, 2: feet & inches
411 int m_angleformat; // 0: decimal degrees, ...
412 int m_angleresolution; // for decimal degrees, digits past decimal
413 int m_lengthresolution; // depends on m_lengthformat
414 // for decimal, digits past the decimal point
415 int m_fontindex; // index of the ON_Font used by this dimstyle
416
417 // added fields version 1.2, Jan 13, 05
418 double m_lengthfactor; // (dimlfac) model units multiplier for length display
419 bool m_bAlternate; // (dimalt) display alternate dimension string (or not)
420 // using m_alternate_xxx values
421 double m_alternate_lengthfactor; // (dimaltf) model units multiplier for alternate length display
422 int m_alternate_lengthformat; // 0: decimal, 1: feet, 2: feet & inches
423 int m_alternate_lengthresolution; // depends on m_lengthformat
424 // for decimal, digits past the decimal point
425 int m_alternate_angleformat; // 0: decimal degrees, ...
426 int m_alternate_angleresolution; // for decimal degrees, digits past decimal
427 ON_wString m_prefix; // string preceding dimension value string
428 ON_wString m_suffix; // string following dimension value string
429 ON_wString m_alternate_prefix; // string preceding alternate value string
430 ON_wString m_alternate_suffix; // string following alternate value string
431
432 unsigned int m_valid; // Obsolete field to be removed - Do not use
433
434 // field added version 1.4, Dec 28, 05
435 double m_dimextension; // (dimdle) dimension line extension past the "tip" location
436
437 // fields added version 1.5 Mar 23 06
438 double m_leaderarrowsize; // Like dimension arrow size but applies to leaders
439 int m_leaderarrowtype; // Like dimension arrow type but applies to leaders
440 bool m_bSuppressExtension1; // flag to not draw extension lines
441 bool m_bSuppressExtension2; // flag to not draw extension lines
442
443
444 // Added March 23, 2008 -LW
445 // This function is temporary and will be removed next time the SDK can be modified.
446 class ON_DimStyleExtra* DimStyleExtension();
447};
448
449#endif
450
Definition Index.h:34
Definition opennurbs_3dm_settings.h:77
Definition opennurbs_archive.h:152
Definition opennurbs_color.h:24
Definition opennurbs_dimstyle.cpp:60
Definition opennurbs_dimstyle.h:20
int m_textalign
Definition opennurbs_dimstyle.h:407
int m_fontindex
Definition opennurbs_dimstyle.h:415
double m_textgap
Definition opennurbs_dimstyle.h:405
ON_wString m_dimstyle_name
Definition opennurbs_dimstyle.h:397
int m_lengthresolution
Definition opennurbs_dimstyle.h:413
double m_alternate_lengthfactor
Definition opennurbs_dimstyle.h:421
double m_lengthfactor
Definition opennurbs_dimstyle.h:418
double m_leaderarrowsize
Definition opennurbs_dimstyle.h:438
eArrowType
Definition opennurbs_dimstyle.h:25
double m_textheight
Definition opennurbs_dimstyle.h:406
int m_alternate_lengthformat
Definition opennurbs_dimstyle.h:422
int m_alternate_angleformat
Definition opennurbs_dimstyle.h:425
ON_wString m_alternate_suffix
Definition opennurbs_dimstyle.h:430
ON_UUID m_dimstyle_id
Definition opennurbs_dimstyle.h:399
double m_centermark
Definition opennurbs_dimstyle.h:404
double m_dimextension
Definition opennurbs_dimstyle.h:435
int m_dimstyle_index
Definition opennurbs_dimstyle.h:398
ON_wString m_prefix
Definition opennurbs_dimstyle.h:427
int m_lengthformat
Definition opennurbs_dimstyle.h:410
int m_angleresolution
Definition opennurbs_dimstyle.h:412
ON_wString m_suffix
Definition opennurbs_dimstyle.h:428
double m_extextension
Definition opennurbs_dimstyle.h:401
int m_alternate_lengthresolution
Definition opennurbs_dimstyle.h:423
bool m_bSuppressExtension2
Definition opennurbs_dimstyle.h:441
int m_leaderarrowtype
Definition opennurbs_dimstyle.h:439
int m_arrowtype
Definition opennurbs_dimstyle.h:408
ON_OBJECT_DECLARE(ON_DimStyle)
unsigned int m_valid
Definition opennurbs_dimstyle.h:432
int m_angleformat
Definition opennurbs_dimstyle.h:411
bool m_bAlternate
Definition opennurbs_dimstyle.h:419
bool m_bSuppressExtension1
Definition opennurbs_dimstyle.h:440
double m_arrowsize
Definition opennurbs_dimstyle.h:403
eField
Definition opennurbs_dimstyle.h:205
int m_angularunits
Definition opennurbs_dimstyle.h:409
int m_alternate_angleresolution
Definition opennurbs_dimstyle.h:426
double m_extoffset
Definition opennurbs_dimstyle.h:402
ON_wString m_alternate_prefix
Definition opennurbs_dimstyle.h:429
Definition opennurbs_object.h:393
virtual void Dump(ON_TextLog &) const
Definition opennurbs_object.cpp:1695
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
Definition opennurbs_object.cpp:1734
virtual ON_UUID ModelObjectId() const
Definition opennurbs_object.cpp:1622
ON_Object & operator=(const ON_Object &)
Definition opennurbs_object.cpp:1362
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
Definition opennurbs_object.cpp:1714
Definition opennurbs_textlog.h:20
Definition opennurbs_uuid.h:31
Definition opennurbs_string.h:392
Scales selected entities.
Definition Scale.js:11
void scale(void e, void factor, void focusPoint)
Scales the given entity or shape by the given factor with the given focus point.
Definition simple_modify.js:15
#define ON_CLASS
Definition opennurbs_defines.h:91
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362