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(ON_OBJECT_HISTORY_INC_) 00018 #define ON_OBJECT_HISTORY_INC_ 00019 00020 #if defined(ON_DLL_TEMPLATE) 00021 // This stuff is here because of a limitation in the way Microsoft 00022 // handles templates and DLLs. See Microsoft's knowledge base 00023 // article ID Q168958 for details. 00024 #pragma warning( push ) 00025 #pragma warning( disable : 4231 ) 00026 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray< class ON_Value* >; 00027 #pragma warning( pop ) 00028 #endif 00029 00030 class ON_CLASS ON_CurveProxyHistory 00031 { 00032 public: 00033 // Used to save information needed to create an ON_CurveProxy 00034 // reference in history records. 00035 ON_CurveProxyHistory(); 00036 ~ON_CurveProxyHistory(); 00037 00038 ON_ObjRef m_curve_ref; // from ON_CurveProxy.m_real_curve 00039 bool m_bReversed; // from ON_CurveProxy.m_bReversed 00040 ON_Interval m_full_real_curve_domain; // from ON_CurveProxy.m_real_curve.Domain() 00041 ON_Interval m_sub_real_curve_domain; // from ON_CurveProxy.m_real_curve_domain 00042 ON_Interval m_proxy_curve_domain; // from ON_CurveProxy.m_this_domain 00043 00044 void Destroy(); 00045 bool Write( ON_BinaryArchive& ) const; 00046 bool Read( ON_BinaryArchive& ); 00047 void Dump( ON_TextLog& ) const; 00048 00049 private: 00050 ON__UINT8 m_reserved[64]; 00051 }; 00052 00053 #if defined(ON_DLL_TEMPLATE) 00054 // This stuff is here because of a limitation in the way Microsoft 00055 // handles templates and DLLs. See Microsoft's knowledge base 00056 // article ID Q168958 for details. 00057 #pragma warning( push ) 00058 #pragma warning( disable : 4231 ) 00059 ON_DLL_TEMPLATE template class ON_CLASS ON_ClassArray<ON_CurveProxyHistory>; 00060 #pragma warning( pop ) 00061 #endif 00062 00063 class ON_CLASS ON_PolyEdgeHistory 00064 { 00065 public: 00066 // Used to save information needed to create an CRhinoPolyEdge 00067 // reference in history records. 00068 ON_PolyEdgeHistory(); 00069 ~ON_PolyEdgeHistory(); 00070 00071 void Destroy(); 00072 bool Write( ON_BinaryArchive& ) const; 00073 bool Read( ON_BinaryArchive& ); 00074 void Dump( ON_TextLog& ) const; 00075 00076 ON_ClassArray< ON_CurveProxyHistory > m_segment; 00077 ON_SimpleArray<double> m_t; 00078 int m_evaluation_mode; 00079 private: 00080 ON__UINT8 m_reserved[64]; 00081 }; 00082 00083 class ON_CLASS ON_HistoryRecord : public ON_Object 00084 { 00085 ON_OBJECT_DECLARE(ON_HistoryRecord); 00086 public: 00087 ON_HistoryRecord(); 00088 ~ON_HistoryRecord(); 00089 00090 // The copy constructor and operator= create duplicates 00091 // of the linked list of ON_Value classes. 00092 ON_HistoryRecord(const ON_HistoryRecord& src); 00093 ON_HistoryRecord& operator=(const ON_HistoryRecord& src); 00094 00095 // virtual ON_Object::IsValid override 00096 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const; 00097 // virtual ON_Object::Dump override 00098 void Dump( ON_TextLog& ) const; 00099 // virtual ON_Object::Write override 00100 ON_BOOL32 Write(ON_BinaryArchive& binary_archive) const; 00101 // virtual ON_Object::Read override 00102 ON_BOOL32 Read(ON_BinaryArchive& binary_archive); 00103 // virtual 00104 ON_UUID ModelObjectId() const; 00105 00106 ////////// 00107 // If history becomes invalid, call Destroy() 00108 void Destroy(); 00109 00110 void DestroyValue( int value_id ); 00111 00112 /* 00113 Description: 00114 For setting values. 00115 Parameters: 00116 value_id - [in] 00117 If there a value with the same input 00118 id exists, the old value is replaced. 00119 count - [in] 00120 Number of values 00121 b - [in] 00122 array of count bools 00123 i - [in] 00124 array of count ints 00125 x - [in] 00126 array of count doubles 00127 p - [in] 00128 array of count 3d points 00129 v - [in] 00130 array of count 3d vectors 00131 xform - [in] 00132 array of count xforms 00133 c - [in] 00134 array of count colors 00135 or - [in] 00136 array of count object references 00137 g - [in] 00138 array of count geometry pointers 00139 u - [in] 00140 array of uuids 00141 s - [in] 00142 string 00143 */ 00144 bool SetBoolValue( int value_id, bool b); 00145 bool SetIntValue( int value_id, int i); 00146 bool SetDoubleValue( int value_id, double x); 00147 bool SetPointValue( int value_id, ON_3dPoint p); 00148 bool SetVectorValue( int value_id, ON_3dVector v); 00149 bool SetXformValue( int value_id, ON_Xform xform); 00150 bool SetColorValue( int value_id, ON_Color c); 00151 bool SetObjRefValue( int value_id, const ON_ObjRef& oref); 00152 bool SetPointOnObjectValue( int value_id, const ON_ObjRef& oref, ON_3dPoint point ); 00153 bool SetUuidValue( int value_id, ON_UUID uuid ); 00154 bool SetStringValue( int value_id, const wchar_t* s ); 00155 bool SetGeometryValue( int value_id, ON_Geometry* g); 00156 bool SetPolyEdgeValue( int value_id, const ON_PolyEdgeHistory& polyedge ); 00157 00158 /* 00159 Description: 00160 For setting values. 00161 Parameters: 00162 value_id - [in] 00163 If there a value with the same input 00164 id exists, the old value is replaced. 00165 count - [in] 00166 Number of values 00167 b - [in] 00168 array of count bools 00169 i - [in] 00170 array of count ints 00171 x - [in] 00172 array of count doubles 00173 P - [in] 00174 array of count 3d points 00175 V - [in] 00176 array of count 3d vectors 00177 xform - [in] 00178 array of count xforms 00179 c - [in] 00180 array of count colors 00181 or - [in] 00182 array of count object references 00183 g - [in] 00184 array of count geometry pointers 00185 u - [in] 00186 array of uuids 00187 s - [in] 00188 array of strings 00189 */ 00190 bool SetBoolValues( int value_id, int count, const bool* b); 00191 bool SetIntValues( int value_id, int count, const int* i); 00192 bool SetDoubleValues( int value_id, int count, const double* x); 00193 bool SetPointValues( int value_id, int count, const ON_3dPoint* P); 00194 bool SetVectorValues( int value_id, int count, const ON_3dVector* V); 00195 bool SetXformValues( int value_id, int count, const ON_Xform* xform); 00196 bool SetColorValues( int value_id, int count, const ON_Color* c); 00197 bool SetObjRefValues( int value_id, int count, const ON_ObjRef* oref); 00198 bool SetUuidValues( int value_id, int count, const ON_UUID* u ); 00199 bool SetStringValues( int value_id, int count, const wchar_t* const* s ); 00200 bool SetStringValues( int value_id, const ON_ClassArray<ON_wString>& s ); 00201 bool SetGeometryValues( int value_id, const ON_SimpleArray<ON_Geometry*> a); 00202 bool SetPolyEdgeValues( int value_id, int count, const ON_PolyEdgeHistory* a ); 00203 00204 /* 00205 Description: 00206 For retrieving values. 00207 */ 00208 bool GetStringValue( int value_id, ON_wString& str ) const; 00209 bool GetBoolValue( int value_id, bool* b ) const; 00210 bool GetIntValue( int value_id, int* i ) const; 00211 bool GetDoubleValue( int value_id, double* number ) const; 00212 bool GetPointValue( int value_id, ON_3dPoint& point ) const; 00213 bool GetVectorValue( int value_id, ON_3dVector& point ) const; 00214 bool GetXformValue( int value_id, ON_Xform& point ) const; 00215 bool GetColorValue( int value_id, ON_Color* color ) const; 00216 bool GetObjRefValue( int value_id, ON_ObjRef& oref ) const; 00217 bool GetPointOnObjectValue( int value_id, ON_ObjRef& oref ) const; 00218 bool GetCurveValue( int value_id, const ON_Curve*& ) const; 00219 bool GetSurfaceValue( int value_id, const ON_Surface*& ) const; 00220 bool GetBrepValue( int value_id, const ON_Brep*& ) const; 00221 bool GetMeshValue( int value_id, const ON_Mesh*& ) const; 00222 bool GetGeometryValue( int value_id, const ON_Geometry*& ) const; 00223 bool GetUuidValue( int value_id, ON_UUID* uuid ) const; 00224 bool GetPolyEdgeValue( int value_id, const ON_PolyEdgeHistory*& polyedge ) const; 00225 00226 int GetStringValues( int value_id, ON_ClassArray<ON_wString>& string ) const; 00227 int GetBoolValues( int value_id, ON_SimpleArray<bool>& ) const; 00228 int GetIntValues( int value_id, ON_SimpleArray<int>& ) const; 00229 int GetDoubleValues( int value_id, ON_SimpleArray<double>& ) const; 00230 int GetPointValues( int value_id, ON_SimpleArray<ON_3dPoint>& ) const; 00231 int GetVectorValues( int value_id, ON_SimpleArray<ON_3dVector>& ) const; 00232 int GetXformValues( int value_id, ON_SimpleArray<ON_Xform>& ) const; 00233 int GetColorValues( int value_id, ON_SimpleArray<ON_Color>& ) const; 00234 int GetObjRefValues( int value_id, ON_ClassArray<ON_ObjRef>& objects ) const; 00235 int GetGeometryValues( int value_id, ON_SimpleArray<const ON_Geometry*>& ) const; 00236 int GetUuidValues( int value_id, ON_SimpleArray<ON_UUID>& ) const; 00237 int GetPolyEdgeValues( int value_id, ON_SimpleArray<const ON_PolyEdgeHistory*>& ) const; 00238 00239 /* 00240 Desccription: 00241 Determine if object is an antecedent (input) in this 00242 history record. 00243 Parameters: 00244 object_uuid - [in] 00245 Returns: 00246 Returns true if object_uuid is the id of an input 00247 object. 00248 */ 00249 bool IsAntecedent( ON_UUID object_uuid ) const; 00250 00251 00252 /* 00253 Description: 00254 Print a list of the values in text_log. 00255 Parameters: 00256 text_log - [in] 00257 Returns: 00258 Number of values listed. 00259 */ 00260 int ValueReport( ON_TextLog& text_log ) const; 00261 00262 // CRhinoCommand::CommandId() value of the command that 00263 // created this history record. Each time the command 00264 // is run, it can create a history record. 00265 ON_UUID m_command_id; 00266 00267 // A YYYYMMDDn version number that gets updated when 00268 // a command changes. This version is checked so that 00269 // new versions of a command's ReplayHistory don't 00270 // attempt to use information saved in old files. 00271 int m_version; 00272 00273 enum RECORD_TYPE 00274 { 00275 history_parameters = 0, // parameters for UpdateHistory 00276 feature_parameters = 1, // parameters for a feature 00277 force_32bit_record_type = 0xFFFFFFFF 00278 }; 00279 00280 RECORD_TYPE m_record_type; 00281 00282 /* 00283 Description: 00284 Convert integer into an ON_HistoryRecord::RECORD_TYPE. 00285 Parameters: 00286 i - [in] 00287 Returns: 00288 ON_HistoryRecord::RECORD_TYPE enum with same value as i. 00289 */ 00290 static 00291 RECORD_TYPE RecordType(int i); 00292 00293 // Each history record has a unique id that is assigned 00294 // when the record is added to Rhino's history record table. 00295 ON_UUID m_record_id; 00296 00297 // List of object id values of antecedent objects that 00298 // are referenced in the list of input events in m_value[]. 00299 // These were the command's "input" objects. 00300 ON_UuidList m_antecedents; 00301 00302 // List of object id values of descendant objects that 00303 // were created. These were the command's "output" objects 00304 ON_UuidList m_descendants; 00305 00306 // Information needed to update the descendant objects 00307 // when an antecedent object is modified. 00308 ON_SimpleArray< class ON_Value* > m_value; 00309 00310 /* 00311 Description: 00312 This tool is used in rare situations when the object ids 00313 stored in the uuid list need to be remapped. 00314 Parameters: 00315 uuid_remap - [in] 00316 Is it critical that uuid_remap[] be sorted with respect 00317 to ON_UuidPair::CompareFirstUuid. 00318 */ 00319 void RemapObjectIds( const ON_SimpleArray<ON_UuidPair>& uuid_remap ); 00320 00321 private: 00322 bool m_bValuesSorted; 00323 ON_Value* FindValueHelper( int, int, bool ) const; 00324 void CopyHelper( const ON_HistoryRecord&); 00325 }; 00326 00327 00328 #endif