00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _OSGGEOPROPERTYBASE_H_
00039 #define _OSGGEOPROPERTYBASE_H_
00040 #ifdef __sgi
00041 #pragma once
00042 #endif
00043
00044 #include <OSGGL.h>
00045
00046 #include <OSGSystemDef.h>
00047 #include <OSGMFVecTypes.h>
00048 #include <OSGMFSysTypes.h>
00049 #include <OSGMFBaseTypes.h>
00050 #include <OSGAttachment.h>
00051 #include <OSGGeoPropertyInterface.h>
00052
00053 OSG_BEGIN_NAMESPACE
00054
00065 template <class GeoPropertyDesc>
00066 class AbstractGeoProperty :
00067 public GeoPropertyDesc::Inherited
00068 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00069 , public GeoPropertyDesc::Interface
00070 #endif
00071 {
00072
00073 public:
00074
00075 typedef AbstractGeoProperty<GeoPropertyDesc> PropertyType;
00076
00077 typedef FCPtr<typename GeoPropertyDesc::InheritedPtr,
00078 PropertyType > PtrType;
00079
00080 OSG_ABSTR_FIELD_CONTAINER_TMPL_DECL(PtrType)
00081
00082
00086 virtual PtrType clone(void) = 0;
00087
00089 #ifdef OSG_SUPPORT_NO_GEO_INTERFACE
00090
00094 typedef typename GeoPropertyDesc::GenericType GenericType;
00095
00096 virtual UInt32 getFormat (void) const = 0;
00097 virtual UInt32 getFormatSize(void) const = 0;
00098 virtual UInt32 getStride (void) const = 0;
00099 virtual UInt32 getDimension (void) const = 0;
00100 virtual UInt32 getSize (void) const = 0;
00101 virtual UInt32 size (void) const = 0;
00102 virtual UInt8 *getData (void) const = 0;
00103
00104 virtual GenericType getValue (const UInt32 index ) = 0;
00105
00106 virtual GenericType getValue (const UInt32 index ) const = 0;
00107
00108 virtual void getValue ( GenericType &val,
00109 const UInt32 index ) = 0;
00110
00111 virtual void getValue ( GenericType &val,
00112 const UInt32 index ) const = 0;
00113
00114
00115 virtual void setValue (const GenericType &val,
00116 const UInt32 index ) = 0;
00117
00118 virtual void addValue (const GenericType &val ) = 0;
00119
00120 virtual bool insertValue(const GenericType &val,
00121 const UInt32 index) = 0;
00122
00123 virtual void clear ( void ) = 0;
00124 virtual void resize ( size_t newsize) = 0;
00125 virtual void push_back(const GenericType &val ) = 0;
00126
00127 virtual void shrink (void ) = 0;
00128
00130 #endif
00131
00135 virtual void dump( UInt32 uiIndent = 0,
00136 const BitVector bvFlags = 0) const;
00137
00139
00140 protected:
00141
00142 friend class OSG_SYSTEMLIB_DLLMAPPING FieldContainer;
00143
00144
00148 AbstractGeoProperty(void);
00149 AbstractGeoProperty(const AbstractGeoProperty &source);
00150
00152
00156 virtual ~AbstractGeoProperty(void);
00157
00159
00160 private:
00161
00162
00163
00164 typedef typename GeoPropertyDesc::Inherited LocalInherited;
00165 typedef typename GeoPropertyDesc::InheritedDesc LocalInheritedDesc;
00166
00167 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00168 typedef GeoPropertyInterface<GeoPropertyDesc> LocalInterface;
00169 #endif
00170
00171 static FieldContainerType _type;
00172 };
00173
00174
00181 template <class GeoPropertyDesc>
00182 class GeoProperty :
00183 public GeoPropertyDesc::Inherited
00184 {
00185
00186 private:
00187
00188
00189
00190 typedef typename GeoPropertyDesc::Inherited LocalInherited;
00191 typedef typename GeoPropertyDesc::InheritedDesc LocalInheritedDesc;
00192 typedef typename GeoPropertyDesc::InheritedPtr LocalInheritedPtr;
00193
00194
00195 public:
00196
00197 enum
00198 {
00199 GeoPropDataFieldId = LocalInherited::NextFieldId,
00200
00201 NextFieldId = GeoPropDataFieldId + 1
00202 };
00203
00204 static const BitVector GeoPropDataFieldMask =
00205 1 << static_cast<Int32>(GeoPropDataFieldId);
00206
00207 typedef GeoProperty<GeoPropertyDesc> PropertyType;
00208 typedef GeoProperty<GeoPropertyDesc> Self;
00209
00210 typedef FCPtr<LocalInheritedPtr,
00211 PropertyType > PtrType;
00212
00213
00214 typedef typename GeoPropertyDesc::StoredFieldType StoredFieldType;
00215 typedef typename GeoPropertyDesc::GenericType StoredGenericType;
00216 typedef typename StoredFieldType::StoredType StoredType;
00217
00218 OSG_FIELD_CONTAINER_TMPL_DECL(PtrType)
00219
00220 #ifdef OSG_MICROSOFT_COMPILER_HACKS
00221 static FieldAccessMethod getFPtrAccessMethod(void);
00222 #endif
00223
00224
00228 StoredFieldType *getFieldPtr(void);
00229
00230 StoredFieldType &getField(void);
00231 const StoredFieldType &getField(void) const;
00232
00233 virtual LocalInheritedPtr clone(void);
00234
00235 virtual UInt32 getFormat (void) const;
00236 virtual UInt32 getFormatSize(void) const;
00237 virtual UInt32 getStride (void) const;
00238 virtual UInt32 getDimension (void) const;
00239 virtual UInt32 getSize (void) const;
00240 virtual UInt32 size (void) const;
00241 virtual UInt8 *getData (void) const;
00242
00243 StoredFieldType &operator->() { return _field; }
00244
00245 virtual StoredGenericType getValue(const UInt32 index);
00246
00247 virtual StoredGenericType getValue(const UInt32 index) const;
00248
00249 virtual void getValue( StoredGenericType &val,
00250 const UInt32 index);
00251
00252 virtual void getValue( StoredGenericType &val,
00253 const UInt32 index) const;
00254
00255 virtual void setValue(const StoredGenericType &val,
00256 const UInt32 index);
00257
00258 virtual void addValue(const StoredGenericType &val);
00259
00260 virtual bool insertValue(const StoredGenericType &val,
00261 const UInt32 index);
00262 virtual void clear();
00263
00264 virtual void resize(size_t newsize);
00265
00266 virtual void push_back(const StoredGenericType &val);
00267
00268 virtual void shrink(void);
00269
00271
00275 GeoProperty &operator =(const GeoProperty &source);
00276
00278
00282 virtual void dump( UInt32 uiIndent = 0,
00283 const BitVector bvFlags = 0) const;
00284
00286
00287 protected:
00288
00289 friend class OSG_SYSTEMLIB_DLLMAPPING FieldContainer;
00290
00291 StoredFieldType _field;
00292
00293
00297 GeoProperty(void);
00298 GeoProperty(const GeoProperty &source);
00299
00301
00305 virtual ~GeoProperty(void);
00306
00308
00312 #if !defined(OSG_FIXED_MFIELDSYNC)
00313 virtual void executeSync ( FieldContainer &other,
00314 const BitVector &whichField);
00315
00316 void executeSyncImpl( GeoProperty *pOther,
00317 const BitVector &whichField);
00318 #else
00319 virtual void executeSync ( FieldContainer &other,
00320 const BitVector &whichField,
00321 const SyncInfo &sInfo );
00322
00323 void executeSyncImpl ( GeoProperty *pOther,
00324 const BitVector &whichField,
00325 const SyncInfo &sInfo );
00326
00327 virtual void execBeginEdit (const BitVector &whichField,
00328 UInt32 uiAspect,
00329 UInt32 uiContainerSize);
00330
00331 void execBeginEditImpl (const BitVector &whichField,
00332 UInt32 uiAspect,
00333 UInt32 uiContainerSize);
00334
00335 virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00336 #endif
00337
00339
00343 virtual void changed (BitVector whichField,
00344 UInt32 origin );
00345
00347
00351 virtual UInt32 getBinSize (const BitVector &whichField);
00352 virtual void copyToBin ( BinaryDataHandler &pMem,
00353 const BitVector &whichField);
00354 virtual void copyFromBin( BinaryDataHandler &pMem,
00355 const BitVector &whichField);
00356
00358
00359 private:
00360
00361 static const PtrType NullPtr;
00362
00363 #if defined(OSG_MICROSOFT_COMPILER_ALERT)
00364 static FieldDescription *_desc[];
00365 #endif
00366 static FieldContainerType _type;
00367 };
00368
00369 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00370 typedef AbstractGeoProperty<GeoPositionsPropertyDesc> GeoPositions;
00371 #endif
00372
00373 #ifndef OSG_COMPILEGEOPROPINST
00374 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00375 GeoPositionsPropertyDesc,
00376 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00377 #endif
00378
00379 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00380 typedef AbstractGeoProperty<GeoNormalsPropertyDesc> GeoNormals;
00381 #endif
00382
00383 #ifndef OSG_COMPILEGEOPROPINST
00384 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00385 GeoNormalsPropertyDesc,
00386 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00387 #endif
00388
00389 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00390 typedef AbstractGeoProperty<GeoColorsPropertyDesc> GeoColors;
00391 #endif
00392
00393 #ifndef OSG_COMPILEGEOPROPINST
00394 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00395 GeoColorsPropertyDesc,
00396 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00397 #endif
00398
00399 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00400 typedef AbstractGeoProperty<GeoTexCoordsPropertyDesc> GeoTexCoords;
00401 #endif
00402
00403 #ifndef OSG_COMPILEGEOPROPINST
00404 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00405 GeoTexCoordsPropertyDesc,
00406 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00407 #endif
00408
00409 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00410 typedef AbstractGeoProperty<GeoIndicesPropertyDesc> GeoIndices;
00411 #endif
00412
00413 #ifndef OSG_COMPILEGEOPROPINST
00414 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00415 GeoIndicesPropertyDesc,
00416 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00417 #endif
00418
00419 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00420 typedef AbstractGeoProperty<GeoPTypesPropertyDesc> GeoPTypes;
00421 #endif
00422
00423 #ifndef OSG_COMPILEGEOPROPINST
00424 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00425 GeoPTypesPropertyDesc,
00426 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00427 #endif
00428
00429 #if !defined(OSG_DO_DOC) // created as a dummy class, remove to prevent doubles
00430 typedef AbstractGeoProperty<GeoPLengthsPropertyDesc> GeoPLengths;
00431 #endif
00432
00433 #ifndef OSG_COMPILEGEOPROPINST
00434 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00435 GeoPLengthsPropertyDesc,
00436 OSG_SYSTEMLIB_DLLTMPLMAPPING)
00437 #endif
00438
00439 OSG_END_NAMESPACE
00440
00441 #include <OSGGeoPropertyBase.inl>
00442
00443
00444 #endif
00445