- Main Page
- Related Pages
- Modules
- Classes
- Files

# GeometricPropertyDefinition.h

Go to the documentation of this file.

    00001 #ifndef _GEOMETRICPROPERTYDEFINITION_H_
    00002 #define _GEOMETRICPROPERTYDEFINITION_H_
    00003
    00004 //
    00005 // Copyright (C) 2004-2006  Autodesk, Inc.
    00006 //
    00007 // This library is free software; you can redistribute it and/or
    00008 // modify it under the terms of version 2.1 of the GNU Lesser
    00009 // General Public License as published by the Free Software Foundation.
    00010 //
    00011 // This library is distributed in the hope that it will be useful,
    00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014 // Lesser General Public License for more details.
    00015 //
    00016 // You should have received a copy of the GNU Lesser General Public
    00017 // License along with this library; if not, write to the Free Software
    00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00019 //
    00020
    00021 #ifdef _WIN32
    00022 #pragma once
    00023 #endif
    00024
    00025 #include <FdoStd.h>
    00026 #include <Fdo/Schema/PropertyDefinition.h>
    00027 #include <Common/GeometryType.h>
    00028 #include <Fdo/Schema/PropertyType.h>
    00029
    00030 #define MAX_GEOMETRY_TYPE_SIZE    12
    00031 #define MAX_GEOMETRIC_TYPE_SIZE    4
    00032
    00033 /// \brief
    00034 /// FdoGeometricPropertyDefinition derives from FdoPropertyDefinition and represents a
    00035 /// geometric value. Geometric properties can take on any of the geometric types
    00036 /// listed in the FdoGeometricType enumeration.
    00037 /// \note
    00038 /// Geometric properties do
    00039 /// not actually store the coordinate system or measure units, this is to enable
    00040 /// the use of the same schema in different geometric locals. FdoGeometricType
    00041 /// informs the client application what types of geometric primitives it can
    00042 /// expect when reading a particular geometric property (and what types they can
    00043 /// store in the property on insert/update). The client application can
    00044 /// interpret the actual geometry values as it wants, e.g., displaying and
    00045 /// manipulating the vertices of a Polyline as a group of independent points.
    00046 class FdoGeometricPropertyDefinition : public FdoPropertyDefinition
    00047 {
    00048     friend class FdoFeatureClass;
    00049
    00050 /// \cond DOXYGEN-IGNORE
    00051 protected:
    00052     /// Constructs a default instance of an FdoGeometricPropertyDefinition.
    00053     FdoGeometricPropertyDefinition();
    00054
    00055     /// Constructs an instance of an FdoGeometricPropertyDefinition using the
    00056     /// specified arguments.
    00057     FdoGeometricPropertyDefinition(FdoString* name, FdoString* description, bool system = false);
    00058
    00059     virtual ~FdoGeometricPropertyDefinition();
    00060
    00061     virtual void Dispose();
    00062 /// \endcond
    00063
    00064 public:
    00065     /// \brief
    00066     /// Constructs a default instance of an FdoGeometricPropertyDefinition.
    00067     ///
    00068     /// \return
    00069     /// Returns FdoGeometricPropertyDefinition
    00070     ///
    00071     FDO_API static FdoGeometricPropertyDefinition *Create();
    00072
    00073     /// \brief
    00074     /// Constructs an instance of an FdoGeometricPropertyDefinition using the
    00075     /// specified arguments.
    00076     ///
    00077     /// \param name
    00078     /// Input name
    00079     /// \param description
    00080     /// Input description
    00081     /// \param system
    00082     /// Input true if this is a system generated property, false otherwise.
    00083     /// \note
    00084     /// A client would never set system to true, only a provider.
    00085     ///
    00086     /// \return
    00087     /// Returns FdoGeometricPropertyDefinition
    00088     ///
    00089     FDO_API static FdoGeometricPropertyDefinition *Create(FdoString *name, FdoString *description, bool system = false);
    00090
    00091     /// \brief
    00092     /// Gets the concrete property type.
    00093     ///
    00094     /// \return
    00095     /// Returns the concrete property type
    00096     ///
    00097     FDO_API virtual FdoPropertyType GetPropertyType();
    00098
    00099     /// \brief
    00100     /// Gets the FdoGeometricTypes that can be stored in this geometric property.
    00101     /// The returned value may be any combination of the values from the
    00102     /// FdoGeometricType enumeration combined via a bit-wise or operation.
    00103     ///
    00104     /// \return
    00105     /// Returns the FdoGeometricTypes that can be stored in this geometric property
    00106     ///
    00107     FDO_API FdoInt32 GetGeometryTypes();
    00108
    00109     /// \brief
    00110     /// Sets the FdoGeometricTypes that can be stored in this geometric property.
    00111     /// The value may be any combination of the values from the FdoGeometricType
    00112     /// enumeration combined via a bit-wise or operation.
    00113     ///
    00114     /// \param value
    00115     /// Input the FdoGeometricTypes that can be stored in this geometric property
    00116     ///
    00117     /// \return
    00118     /// Returns nothing
    00119     ///
    00120     FDO_API void SetGeometryTypes(FdoInt32 value);
    00121
    00122     /// \brief
    00123     /// Returns a Boolean value that indicates if this geometric property is
    00124     /// read-only.
    00125     ///
    00126     /// \return
    00127     /// Returns a Boolean value that specifies whether this geometric property is
    00128     /// read-only
    00129     ///
    00130     FDO_API bool GetReadOnly();
    00131
    00132     /// \brief
    00133     /// Sets a Boolean value that specifies whether this geometric property is
    00134     /// read-only.
    00135     ///
    00136     /// \param value
    00137     /// Input a Boolean value that specifies whether this geometric property is
    00138     /// read-only
    00139     ///
    00140     /// \return
    00141     /// Returns nothing
    00142     ///
    00143     FDO_API void SetReadOnly(bool value);
    00144
    00145     /// \brief
    00146     /// Gets a Boolean value that indicates if the geometry of this property
    00147     /// include elevation values.
    00148     ///
    00149     /// \return
    00150     /// Returns a Boolean value that determines if the geometry of this property
    00151     /// includes elevation values
    00152     ///
    00153     FDO_API bool GetHasElevation();
    00154
    00155     /// \brief
    00156     /// Sets a Boolean value that determines if the geometry of this property
    00157     /// includes elevation values.
    00158     ///
    00159     /// \param value
    00160     /// Input a Boolean value that determines if the geometry of this property
    00161     /// includes elevation values
    00162     ///
    00163     /// \return
    00164     /// Returns nothing
    00165     ///
    00166     FDO_API void SetHasElevation(bool value);
    00167
    00168     /// \brief
    00169     /// Gets a Boolean value that indicates if the geometry of this property
    00170     /// includes measurement values that can be used for dynamic segmentation.
    00171     ///
    00172     /// \return
    00173     /// Returns a Boolean value that indicates if the geometry of this property
    00174     /// includes measurement values
    00175     ///
    00176     FDO_API bool GetHasMeasure();
    00177
    00178     /// \brief
    00179     /// Sets a Boolean value that determines if the geometry of this property
    00180     /// includes measurement values that can be used for dynamic segmentation.
    00181     ///
    00182     /// \param value
    00183     /// Input a Boolean value that determines if the geometry of this property
    00184     /// includes measurement values
    00185     ///
    00186     /// \return
    00187     /// Returns nothing
    00188     ///
    00189     FDO_API void SetHasMeasure(bool value);
    00190
    00191     /// \brief
    00192     /// Sets/add a Spatial Context association to this geometric property.
    00193     ///
    00194     /// \param value
    00195     /// Input the Spatial Context name to be added/set.
    00196     /// Defaults to the active Spatial Context.
    00197     ///
    00198     /// \return
    00199     /// Returns nothing
    00200     ///
    00201     FDO_API void SetSpatialContextAssociation(FdoString *value);
    00202
    00203     /// \brief
    00204     /// Gets the Spatial Context name associated to this geometric property.
    00205     ///
    00206     /// \return
    00207     /// Returns a String value representing the Spatial Context name.
    00208     /// If NULL then the geometric property is associated with all the Spatial Contexts
    00209     /// in the datastore (supports multiple geometric representations via this property).
    00210     ///
    00211     FDO_API FdoString *GetSpatialContextAssociation();
    00212
    00213     /// \brief
    00214     /// Gets the specific geometry types that can be stored in this geometric
    00215     /// property. The returned value is a list of geometry types that are
    00216     /// supported, with length being the number of types returned.
    00217     ///
    00218     /// \param length
    00219     /// The parameter is used to return the number of geometry types being
    00220     /// returned by the function.
    00221     ///
    00222     /// \return
    00223     /// Returns a list of geometry types that are supported.
    00224     ///
    00225     FDO_API FdoGeometryType *GetSpecificGeometryTypes(FdoInt32 &length);
    00226
    00227     /// \brief
    00228     /// Sets the specific set of geometry types that can be stored in this
    00229     /// geometric property. The provided value is a list of geometry types
    00230     /// that are supported. Usually, one specific type is supported, but
    00231     /// there can be more than one.
    00232     ///
    00233     /// \param types
    00234     /// The specific set of geometry types that can be stored in this
    00235     /// geometric property.
    00236     ///
    00237     /// \param length
    00238     /// Indicates the number of geometry types being stored in the provided
    00239     /// set of geometry types.
    00240     ///
    00241     /// \return
    00242     /// Returns nothing.
    00243     ///
    00244     FDO_API void SetSpecificGeometryTypes(FdoGeometryType *types, FdoInt32 length);
    00245
    00246 /// \cond DOXYGEN-IGNORE
    00247     // Public non-API function for geometry type support (this is to pass along the
    00248     // hex-code (bitfield) value of the supported geometry types rather than the
    00249     // complete array.
    00250     FDO_API FdoInt32 GetSpecificGeometryTypes();
    00251
    00252     // Public non-API functions for XML and Schema Mergesupport
    00253
    00254     // Update this property from the given property.
    00255     virtual void Set( FdoPropertyDefinition* pProperty, FdoSchemaMergeContext* pContext );
    00256
    00257     /// Initialize this property from its XML attributes
    00258     virtual void InitFromXml(FdoString* propertyTypeName, FdoSchemaXmlContext* pContext, FdoXmlAttributeCollection* attrs);
    00259
    00260     /// read the geometric types from XML sub-elements.
    00261     /// Element start
    00262     virtual FdoXmlSaxHandler* XmlStartElement(FdoXmlSaxContext* context,
    00263                                               FdoString* uri,
    00264                                               FdoString* name,
    00265                                               FdoString* qname,
    00266                                               FdoXmlAttributeCollection* atts);
    00267     /// Element end
    00268     virtual FdoBoolean XmlEndElement(FdoXmlSaxContext* context, FdoString* uri, FdoString* name, FdoString* qname);
    00269
    00270     /// Serialize this property to XML.
    00271     virtual void _writeXml(FdoSchemaXmlContext* pContext);
    00272
    00273     /// Returns true if none of this property's setters have been called.
    00274     bool GetAllDefaults();
    00275
    00276 private:
    00277     FdoInt32        m_geometryTypes;
    00278     FdoInt32        m_geometricTypes;
    00279     bool            m_readOnly;
    00280     bool            m_hasElevation;
    00281     bool            m_hasMeasure;
    00282     FdoStringP      m_associatedSCName;
    00283     bool            m_allDefaults;
    00284     FdoGeometryType m_types[MAX_GEOMETRY_TYPE_SIZE];
    00285     FdoInt32        m_typesSize;
    00286     bool            m_cacheGeometryTypes;
    00287
    00288     /// Temporary holding place for geometric types while being
    00289     /// deserialized from XML.
    00290     FdoInt32        m_XmlGeometricTypes;
    00291     FdoInt32        m_XmlGeometryTypesCount;
    00292     FdoGeometryType m_XmlGeometryTypes[MAX_GEOMETRY_TYPE_SIZE];
    00293
    00294     /// Function to initialize the internal geometry type collection.
    00295     void InitGeometryTypes();
    00296
    00297     /// Function to retrieve the current geometric type.
    00298     FdoInt32 GetGeometricType(int pos);
    00299
    00300     /// Function to map a geometry type to a unique number that can be used
    00301     /// in a bit-wise operation.
    00302     FdoInt32 MapGeometryTypeToHexCode (FdoGeometryType gType);
    00303     FdoInt32 MapGeometryTypeToHexCode (int             pos);
    00304
    00305     /// Function to map a geometry type hex code to the corresponding FDO geometry type.
    00306     FdoGeometryType MapHexCodeToGeometryType (FdoInt32 gTypeHexCode);
    00307
    00308     /// Function to cache the geometry types currently available.
    00309     void CacheGeometryTypes();
    00310
    00311     /// Function to initialize all member variables.
    00312     void SetToZero();
    00313
    00314 protected:
    00315     /// FdoFeatureSchema::RejectChanges() support
    00316     virtual void    _StartChanges();
    00317     virtual void    _RejectChanges();
    00318     virtual void    _AcceptChanges();
    00319     FdoInt32        m_geometryTypesCHANGED;
    00320     FdoInt32        m_geometricTypesCHANGED;
    00321     bool            m_readOnlyCHANGED;
    00322     bool            m_hasElevationCHANGED;
    00323     bool            m_hasMeasureCHANGED;
    00324     FdoStringP      m_associatedSCNameCHANGED;
    00325 /// \endcond
    00326 };
    00327
    00328 /// \ingroup (typedefs)
    00329 /// \brief
    00330 /// FdoGeometricPropertyP is a FdoPtr on FdoGeometricPropertyDefinition, provided for convenience.
    00331 typedef FdoPtr<FdoGeometricPropertyDefinition> FdoGeometricPropertyP;
    00332
    00333 #endif
    00334
    00335

Please send us your comment about this page