QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_annotation.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_ANNOTATION_INC_)
17#define OPENNURBS_ANNOTATION_INC_
18
19
21{
22 // 3d annotation dot with text
24public:
29
31 //
32 // ON_Object overrides
33 //
34
35 /*
36 Description:
37 Tests an object to see if its data members are correctly
38 initialized.
39 Parameters:
40 text_log - [in] if the object is not valid and text_log
41 is not NULL, then a brief englis description of the
42 reason the object is not valid is appened to the log.
43 The information appended to text_log is suitable for
44 low-level debugging purposes by programmers and is
45 not intended to be useful as a high level user
46 interface tool.
47 Returns:
48 @untitled table
49 true object is valid
50 false object is invalid, uninitialized, etc.
51 Remarks:
52 Overrides virtual ON_Object::IsValid
53 */
54 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
55
56 void Dump( ON_TextLog& ) const; // for debugging
57
59 ON_BinaryArchive& // serialize definition to binary archive
60 ) const;
61
63 ON_BinaryArchive& // restore definition from binary archive
64 );
65
67};
68
70{
71 // 3d annotation arrow
73public:
78
80 //
81 // ON_Object overrides
82 //
83
84 /*
85 Description:
86 Tests an object to see if its data members are correctly
87 initialized.
88 Parameters:
89 text_log - [in] if the object is not valid and text_log
90 is not NULL, then a brief englis description of the
91 reason the object is not valid is appened to the log.
92 The information appended to text_log is suitable for
93 low-level debugging purposes by programmers and is
94 not intended to be useful as a high level user
95 interface tool.
96 Returns:
97 @untitled table
98 true object is valid
99 false object is invalid, uninitialized, etc.
100 Remarks:
101 Overrides virtual ON_Object::IsValid
102 */
103 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
104
105 void Dump( ON_TextLog& ) const; // for debugging
106
108 ON_BinaryArchive& // serialize definition to binary archive
109 ) const;
110
112 ON_BinaryArchive& // restore definition from binary archive
113 );
114
115 ON::object_type ObjectType() const;
116
118 //
119 // ON_Geometry overrides
120 //
121
122 int Dimension() const;
123
124 // work horse bounding box getter
125 ON_BOOL32 GetBBox( // returns true if successful
126 double*, // boxmin[dim]
127 double*, // boxmax[dim]
128 ON_BOOL32 = false // true means grow box
129 ) const;
130
132 const ON_Xform&
133 );
134
136 //
137 // Interface
138 //
139 ON_3dVector Vector() const;
140 ON_3dPoint Head() const;
141 ON_3dPoint Tail() const;
142
145};
146
148//
149// ON_Annotation - used to serialize definitions of annotation
150// objects (dimensions, text blocks, etc.).
151//
152
154{
156
158 {
159 degreesym = 176,
160 radiussym = 'R',
161 diametersym = 216,
162 plusminussym = 177,
163 };
164
165
166
167public:
168
169 virtual ON_BOOL32 IsRealObject() const = 0;
170
175
176 void Create(); // initialize class's fields assuming
177 // memory is uninitialized
178 void Destroy();
179 void EmergencyDestroy();
180
182 //
183 // ON_Object overrides
184 //
185
186 /*
187 Description:
188 Tests an object to see if its data members are correctly
189 initialized.
190 Parameters:
191 text_log - [in] if the object is not valid and text_log
192 is not NULL, then a brief englis description of the
193 reason the object is not valid is appened to the log.
194 The information appended to text_log is suitable for
195 low-level debugging purposes by programmers and is
196 not intended to be useful as a high level user
197 interface tool.
198 Returns:
199 @untitled table
200 true object is valid
201 false object is invalid, uninitialized, etc.
202 Remarks:
203 Overrides virtual ON_Object::IsValid
204 */
205 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
206
207 void Dump( ON_TextLog& ) const; // for debugging
208
210 ON_BinaryArchive& // serialize definition to binary archive
211 ) const;
212
214 ON_BinaryArchive& // restore definition from binary archive
215 );
216
217 ON::object_type ObjectType() const;
218
220 //
221 // ON_Geometry overrides
222 //
223
224 int Dimension() const;
225
226 ON_BOOL32 GetBBox( // returns true if successful
227 double*, // boxmin[dim]
228 double*, // boxmax[dim]
229 ON_BOOL32 = false // true means grow box
230 ) const;
231
233 const ON_Xform&
234 );
235
237 //
238 // ON_Annotation interface
239 //
240
241 // use these to get/set the current annotation settings
242 static const ON_3dmAnnotationSettings& AnnotationSettings();
243 static void SetAnnotationSettings( const ON_3dmAnnotationSettings* );
244
245 bool IsText() const;
246 bool IsLeader() const;
247 bool IsDimension() const;
248
249 virtual double NumericValue() const;
250 virtual void SetTextToDefault();
251
252 void SetType( ON::eAnnotationType type );
253 ON::eAnnotationType Type() const;
254 void SetTextDisplayMode( ON::eTextDisplayMode mode);
255 ON::eTextDisplayMode TextDisplayMode() const;
256
257 void SetPlane( const ON_Plane& plane );
258 ON_Plane Plane() const;
259 int PointCount() const;
260 void SetPoints( const ON_SimpleArray<ON_2dPoint>& points );
261 const ON_SimpleArray<ON_2dPoint>& Points() const;
262 void SetPoint( int idx, ON_3dPoint point );
263 ON_2dPoint Point( int idx ) const;
264 void SetUserText( const wchar_t* string );
265 const ON_wString& UserText() const;
266 void SetDefaultText( const wchar_t* string );
267 const ON_wString& DefaultText() const;
268 void SetUserPositionedText( int bUserPositionedText );
269 bool UserPositionedText() const;
270
271 // to convert world 3d points to and from annotation 2d points
272 bool GetECStoWCSXform( ON_Xform& xform ) const;
273 bool GeWCStoECSXform( ON_Xform& xform ) const;
274
275 ON::eAnnotationType m_type; // enum for type of annotation
276 // DimLinear, DimRadius, etc.
277
278 ON::eTextDisplayMode m_textdisplaymode; // how the text is displayed
279 // Horizontal, InLine, AboveLine
280
281 ON_Plane m_plane; // ECS reference plane in WCS coordinates
282 ON_SimpleArray<ON_2dPoint> m_points; // Definition points for the dimension
283
284 ON_wString m_usertext; // "<>", or user override
285 ON_wString m_defaulttext; // The displayed text string
286
287 bool m_userpositionedtext; // true: User has positioned text
288 // false: use default location
289};
290
291
293{
295
296public:
297 ON_BOOL32 IsRealObject() const;
302
303 double NumericValue();
304 void SetTextToDefault();
305 void EmergencyDestroy();
306};
307
309{
311
312public:
313 ON_BOOL32 IsRealObject() const;
318
319 double NumericValue();
320 void SetTextToDefault();
321
322 void EmergencyDestroy();
323};
324
326{
328
329public:
330 ON_BOOL32 IsRealObject() const;
331
336
337 void EmergencyDestroy();
338
339 ON_BOOL32 Write( ON_BinaryArchive& file ) const;
341
342 void SetAngle( double angle ) { m_angle = angle; }
343 double Angle() const { return m_angle; }
344 void SetRadius( double radius ) { m_radius = radius; }
345 double Radius() const { return m_radius; }
346
347 double NumericValue();
348 void SetTextToDefault();
349
350
351private:
352 double m_angle; // angle being dimensioned
353 double m_radius; // radius for dimension arc
354};
355
357{
359
360public:
361 ON_BOOL32 IsRealObject() const;
366
367 void EmergencyDestroy();
368
369 ON_BOOL32 Write( ON_BinaryArchive& file ) const;
371
372 void SetFaceName( ON_wString string ) { m_facename = string; }
373 ON_wString FaceName() const { return m_facename; }
374 void SetFontWeight( int weight ) { m_fontweight = weight; }
375 int FontWeight() const { return m_fontweight; }
376 void SetHeight( double height ) { m_height = height; }
377 double Height() const { return m_height; }
378
379private:
381 int m_fontweight; // windows - 400 = NORMAL )
382 double m_height; // gets multiplied by dimscale
383};
384
386{
388
389public:
390 ON_BOOL32 IsRealObject() const;
391 ON_Leader();
392 ON_Leader(const ON_Leader&);
393 ~ON_Leader();
395
396 void EmergencyDestroy();
397};
398
399
400
401
402#endif
403
@ Point
Definition RSMetaType.h:50
@ Transform
Definition RSMetaType.h:67
Definition opennurbs_point.h:253
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_3dm_settings.h:77
Definition opennurbs_annotation.h:326
void SetAngle(double angle)
Definition opennurbs_annotation.h:342
void SetRadius(double radius)
Definition opennurbs_annotation.h:344
double m_angle
Definition opennurbs_annotation.h:352
double Angle() const
Definition opennurbs_annotation.h:343
double m_radius
Definition opennurbs_annotation.h:353
ON_OBJECT_DECLARE(ON_AngularDimension)
double Radius() const
Definition opennurbs_annotation.h:345
Definition opennurbs_annotation.h:70
ON_3dPoint m_tail
Definition opennurbs_annotation.h:143
ON_OBJECT_DECLARE(ON_AnnotationArrow)
ON_3dPoint m_head
Definition opennurbs_annotation.h:144
Definition opennurbs_annotation.h:154
virtual ON_BOOL32 IsRealObject() const =0
ON_wString m_usertext
Definition opennurbs_annotation.h:284
bool m_userpositionedtext
Definition opennurbs_annotation.h:287
ON::eAnnotationType m_type
Definition opennurbs_annotation.h:275
ON_OBJECT_DECLARE(ON_Annotation)
SYMBOLS
Definition opennurbs_annotation.h:158
ON::eTextDisplayMode m_textdisplaymode
Definition opennurbs_annotation.h:278
ON_Plane m_plane
Definition opennurbs_annotation.h:281
ON_wString m_defaulttext
Definition opennurbs_annotation.h:285
ON_SimpleArray< ON_2dPoint > m_points
Definition opennurbs_annotation.h:282
Definition opennurbs_annotation.h:21
ON_OBJECT_DECLARE(ON_AnnotationTextDot)
ON_wString m_text
Definition opennurbs_annotation.h:66
Definition opennurbs_archive.h:152
Definition opennurbs_geometry.h:36
Definition opennurbs_annotation.h:386
ON_OBJECT_DECLARE(ON_Leader)
Definition opennurbs_annotation.h:293
ON_OBJECT_DECLARE(ON_LinearDimension)
Definition opennurbs_plane.h:20
Definition opennurbs_pointgeometry.h:24
void Dump(ON_TextLog &) const
Definition opennurbs_pointgeometry.cpp:30
ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const
Definition opennurbs_pointgeometry.cpp:20
ON_BOOL32 Read(ON_BinaryArchive &)
Definition opennurbs_pointgeometry.cpp:44
ON_Point & operator=(const ON_Point &)
Definition opennurbs_pointgeometry.cpp:107
ON_BOOL32 GetBBox(double *, double *, ON_BOOL32=false) const
Definition opennurbs_pointgeometry.cpp:66
ON::object_type ObjectType() const
Definition opennurbs_pointgeometry.cpp:56
int Dimension() const
Definition opennurbs_pointgeometry.cpp:61
ON_BOOL32 Write(ON_BinaryArchive &) const
Definition opennurbs_pointgeometry.cpp:37
Definition opennurbs_annotation.h:309
ON_OBJECT_DECLARE(ON_RadialDimension)
Definition opennurbs_array.h:46
Definition opennurbs_annotation.h:357
int FontWeight() const
Definition opennurbs_annotation.h:375
ON_wString FaceName() const
Definition opennurbs_annotation.h:373
ON_OBJECT_DECLARE(ON_TextEntity)
ON_wString m_facename
Definition opennurbs_annotation.h:380
void SetHeight(double height)
Definition opennurbs_annotation.h:376
void SetFontWeight(int weight)
Definition opennurbs_annotation.h:374
int m_fontweight
Definition opennurbs_annotation.h:381
void SetFaceName(ON_wString string)
Definition opennurbs_annotation.h:372
double m_height
Definition opennurbs_annotation.h:382
double Height() const
Definition opennurbs_annotation.h:377
Definition opennurbs_textlog.h:20
Definition opennurbs_xform.h:28
Definition opennurbs_string.h:392
#define ON_CLASS
Definition opennurbs_defines.h:91
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362