QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_object_history.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(ON_OBJECT_HISTORY_INC_)
17#define ON_OBJECT_HISTORY_INC_
18
19#if defined(ON_DLL_TEMPLATE)
20// This stuff is here because of a limitation in the way Microsoft
21// handles templates and DLLs. See Microsoft's knowledge base
22// article ID Q168958 for details.
23#pragma warning( push )
24#pragma warning( disable : 4231 )
25ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray< class ON_Value* >;
26#pragma warning( pop )
27#endif
28
30{
32public:
35
36 // The copy constructor and operator= create duplicates
37 // of the linked list of ON_Value classes.
39 ON_HistoryRecord& operator=(const ON_HistoryRecord& src);
40
41 // virtual ON_Object::IsValid override
42 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
43 // virtual ON_Object::Dump override
44 void Dump( ON_TextLog& ) const;
45 // virtual ON_Object::Write override
46 ON_BOOL32 Write(ON_BinaryArchive& binary_archive) const;
47 // virtual ON_Object::Read override
48 ON_BOOL32 Read(ON_BinaryArchive& binary_archive);
49 // virtual
50 ON_UUID ModelObjectId() const;
51
53 // If history becomes invalid, call Destroy()
54 void Destroy();
55
56 void DestroyValue( int value_id );
57
58 /*
59 Description:
60 For setting values.
61 Parameters:
62 value_id - [in]
63 If there a value with the same input
64 id exists, the old value is replaced.
65 count - [in]
66 Number of values
67 b - [in]
68 array of count bools
69 i - [in]
70 array of count ints
71 x - [in]
72 array of count doubles
73 p - [in]
74 array of count 3d points
75 v - [in]
76 array of count 3d vectors
77 xform - [in]
78 array of count xforms
79 c - [in]
80 array of count colors
81 or - [in]
82 array of count object references
83 g - [in]
84 array of count geometry pointers
85 u - [in]
86 array of uuids
87 s - [in]
88 string
89 */
90 bool SetBoolValue( int value_id, bool b);
91 bool SetIntValue( int value_id, int i);
92 bool SetDoubleValue( int value_id, double x);
93 bool SetPointValue( int value_id, ON_3dPoint p);
94 bool SetVectorValue( int value_id, ON_3dVector v);
95 bool SetXformValue( int value_id, ON_Xform xform);
96 bool SetColorValue( int value_id, ON_Color c);
97 bool SetObjRefValue( int value_id, const ON_ObjRef& oref);
98 bool SetPointOnObjectValue( int value_id, const ON_ObjRef& oref, ON_3dPoint point );
99 bool SetUuidValue( int value_id, ON_UUID uuid );
100 bool SetStringValue( int value_id, const wchar_t* s );
101 bool SetGeometryValue( int value_id, ON_Geometry* g);
102
103 /*
104 Description:
105 For setting values.
106 Parameters:
107 value_id - [in]
108 If there a value with the same input
109 id exists, the old value is replaced.
110 count - [in]
111 Number of values
112 b - [in]
113 array of count bools
114 i - [in]
115 array of count ints
116 x - [in]
117 array of count doubles
118 P - [in]
119 array of count 3d points
120 V - [in]
121 array of count 3d vectors
122 xform - [in]
123 array of count xforms
124 c - [in]
125 array of count colors
126 or - [in]
127 array of count object references
128 g - [in]
129 array of count geometry pointers
130 u - [in]
131 array of uuids
132 s - [in]
133 array of strings
134 */
135 bool SetBoolValues( int value_id, int count, const bool* b);
136 bool SetIntValues( int value_id, int count, const int* i);
137 bool SetDoubleValues( int value_id, int count, const double* x);
138 bool SetPointValues( int value_id, int count, const ON_3dPoint* P);
139 bool SetVectorValues( int value_id, int count, const ON_3dVector* V);
140 bool SetXformValues( int value_id, int count, const ON_Xform* xform);
141 bool SetColorValues( int value_id, int count, const ON_Color* c);
142 bool SetObjRefValues( int value_id, int count, const ON_ObjRef* oref);
143 bool SetUuidValues( int value_id, int count, const ON_UUID* u );
144 bool SetStringValues( int value_id, int count, const wchar_t* const* s );
145 bool SetStringValues( int value_id, const ON_ClassArray<ON_wString>& s );
146 bool SetGeometryValues( int value_id, const ON_SimpleArray<ON_Geometry*> a);
147
148 /*
149 Description:
150 For retrieving values.
151 */
152 bool GetStringValue( int value_id, ON_wString& str ) const;
153 bool GetBoolValue( int value_id, bool* b ) const;
154 bool GetIntValue( int value_id, int* i ) const;
155 bool GetDoubleValue( int value_id, double* number ) const;
156 bool GetPointValue( int value_id, ON_3dPoint& point ) const;
157 bool GetVectorValue( int value_id, ON_3dVector& point ) const;
158 bool GetXformValue( int value_id, ON_Xform& point ) const;
159 bool GetColorValue( int value_id, ON_Color* color ) const;
160 bool GetObjRefValue( int value_id, ON_ObjRef& oref ) const;
161 bool GetPointOnObjectValue( int value_id, ON_ObjRef& oref ) const;
162 bool GetCurveValue( int value_id, const ON_Curve*& ) const;
163 bool GetSurfaceValue( int value_id, const ON_Surface*& ) const;
164 bool GetBrepValue( int value_id, const ON_Brep*& ) const;
165 bool GetMeshValue( int value_id, const ON_Mesh*& ) const;
166 bool GetGeometryValue( int value_id, const ON_Geometry*& ) const;
167 bool GetUuidValue( int value_id, ON_UUID* uuid ) const;
168
169 int GetStringValues( int value_id, ON_ClassArray<ON_wString>& string ) const;
170 int GetBoolValues( int value_id, ON_SimpleArray<bool>& ) const;
171 int GetIntValues( int value_id, ON_SimpleArray<int>& ) const;
172 int GetDoubleValues( int value_id, ON_SimpleArray<double>& ) const;
173 int GetPointValues( int value_id, ON_SimpleArray<ON_3dPoint>& ) const;
174 int GetVectorValues( int value_id, ON_SimpleArray<ON_3dVector>& ) const;
175 int GetXformValues( int value_id, ON_SimpleArray<ON_Xform>& ) const;
176 int GetColorValues( int value_id, ON_SimpleArray<ON_Color>& ) const;
177 int GetObjRefValues( int value_id, ON_ClassArray<ON_ObjRef>& objects ) const;
178 int GetGeometryValues( int value_id, ON_SimpleArray<const ON_Geometry*>& ) const;
179 int GetUuidValues( int value_id, ON_SimpleArray<ON_UUID>& ) const;
180
181 /*
182 Desccription:
183 Determine if object is an antecedent (input) in this
184 history record.
185 Parameters:
186 object_uuid - [in]
187 Returns:
188 Returns true if object_uuid is the id of an input
189 object.
190 */
191 bool IsAntecedent( ON_UUID object_uuid ) const;
192
193
194 /*
195 Description:
196 Print a list of the values in text_log.
197 Parameters:
198 text_log - [in]
199 Returns:
200 Number of values listed.
201 */
202 int ValueReport( ON_TextLog& text_log ) const;
203
204 // CRhinoCommand::CommandId() value of the command that
205 // created this history record. Each time the command
206 // is run, it can create a history record.
208
209 // A YYYYMMDDn version number that gets updated when
210 // a command changes. This version is checked so that
211 // new versions of a command's ReplayHistory don't
212 // attempt to use information saved in old files.
214
216 {
217 history_parameters = 0, // parameters for UpdateHistory
218 feature_parameters = 1, // parameters for a feature
219 force_32bit_record_type = 0xFFFFFFFF
220 };
221
223
224 /*
225 Description:
226 Convert integer into an ON_HistoryRecord::RECORD_TYPE.
227 Parameters:
228 i - [in]
229 Returns:
230 ON_HistoryRecord::RECORD_TYPE enum with same value as i.
231 */
232 static
233 RECORD_TYPE RecordType(int i);
234
235 // Each history record has a unique id that is assigned
236 // when the record is added to Rhino's history record table.
238
239 // List of object id values of antecedent objects that
240 // are referenced in the list of input events in m_value[].
241 // These were the command's "input" objects.
243
244 // List of object id values of descendant objects that
245 // were created. These were the command's "output" objects
247
248 // Information needed to update the descendant objects
249 // when an antecedent object is modified.
251
252 /*
253 Description:
254 This tool is used in rare situations when the object ids
255 stored in the uuid list need to be remapped.
256 Parameters:
257 uuid_remap - [in]
258 Is it critical that uuid_remap[] be sorted with respect
259 to ON_UuidPair::CompareFirstUuid.
260 */
261 void RemapObjectIds( const ON_SimpleArray<ON_UuidPair>& uuid_remap );
262
263private:
265 ON_Value* FindValueHelper( int, int, bool ) const;
266 void CopyHelper( const ON_HistoryRecord&);
267};
268
269
270#endif
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition autostart.js:32
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_archive.h:152
Definition opennurbs_brep.h:1585
Definition opennurbs_array.h:760
Definition opennurbs_color.h:24
Definition opennurbs_curve.h:88
Definition opennurbs_geometry.h:36
Definition opennurbs_object_history.h:30
ON_OBJECT_DECLARE(ON_HistoryRecord)
bool m_bValuesSorted
Definition opennurbs_object_history.h:264
int m_version
Definition opennurbs_object_history.h:213
ON_UuidList m_descendants
Definition opennurbs_object_history.h:246
RECORD_TYPE
Definition opennurbs_object_history.h:216
ON_UUID m_record_id
Definition opennurbs_object_history.h:237
ON_SimpleArray< class ON_Value * > m_value
Definition opennurbs_object_history.h:250
RECORD_TYPE m_record_type
Definition opennurbs_object_history.h:222
ON_UuidList m_antecedents
Definition opennurbs_object_history.h:242
ON_UUID m_command_id
Definition opennurbs_object_history.h:207
Definition opennurbs_mesh.h:795
Definition opennurbs_objref.h:167
Definition opennurbs_object.h:393
Definition opennurbs_array.h:46
Definition opennurbs_surface.h:58
Definition opennurbs_textlog.h:20
Definition opennurbs_uuid.h:31
Definition opennurbs_array.h:1079
Definition opennurbs_object_history.cpp:19
Definition opennurbs_xform.h:28
Definition opennurbs_string.h:392
#define ON_CLASS
Definition opennurbs_defines.h:91
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362