00001 /*
00002 * (C) Copyright 2004 by Autodesk, Inc. All Rights Reserved.
00003 *
00004 * By using this code, you are agreeing to the terms and conditions of
00005 * the License Agreement included in the documentation for this code.
00006 *
00007 * AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE
00008 * CORRECTNESS OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE
00009 * IT. AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY
00010 * DISCLAIMS ANY LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL
00011 * DAMAGES FOR ERRORS, OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 *
00013 * Use, duplication, or disclosure by the U.S. Government is subject
00014 * to restrictions set forth in FAR 52.227-19 (Commercial Computer
00015 * Software Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
00016 * (Rights in Technical Data and Computer Software), as applicable.
00017 *
00018 */
00019 #ifndef FDORFPRASTERFEATUREDEFINITION_H
00020 #define FDORFPRASTERFEATUREDEFINITION_H
00021
00022 #ifdef _WIN32
00023 #pragma once
00024 #endif //_WIN32
00025
00026 class FdoRfpRasterExtents;
00027 class FdoRfpRasterLocation;
00028 class FdoRfpRasterBandCollection;
00029 class FdoRfpRasterBandDefinition;
00030 class FdoCommonThreadMutex;
00031
00032 /// \brief
00033 ///
00034 /// The FdoRfpRasterFeatureDefinition class contains a collection of raster Features.
00035 class FdoRfpRasterFeatureDefinition : public FdoPhysicalElementMapping
00036 {
00037 typedef FdoPhysicalElementMapping BaseType;
00038
00039 public:
00040 /// \brief
00041 /// Constructs a new Raster Feature Definition.
00042 ///
00043 /// \return
00044 /// Returns the newly created FdoRfpRasterFeatureDefinition instance.
00045 ///
00046 FDORFP_API static FdoRfpRasterFeatureDefinition* Create();
00047
00048 /// \brief
00049 /// Gets the collection of raster band definitions.
00050 ///
00051 /// \return
00052 /// Returns the collection of raster bans.
00053 ///
00054 FDORFP_API FdoRfpRasterBandCollection* GetBands();
00055
00056 /// \cond DOXYGEN-IGNORE
00057
00058 /// XML Serialization functions, not part of supported API.
00059 FDORFP_API virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00060 FDORFP_API virtual FdoXmlSaxHandler* XmlStartElement(
00061 FdoXmlSaxContext* context,
00062 FdoString* uri,
00063 FdoString* name,
00064 FdoString* qname,
00065 FdoXmlAttributeCollection* atts
00066 );
00067 FDORFP_API virtual FdoBoolean XmlEndElement(FdoXmlSaxContext* context, FdoString* uri, FdoString* name, FdoString* qname);
00068 FDORFP_API void _writeXml( FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags );
00069
00070 // The following 3 functions help performance when a Raster Location contains many
00071 // features. Normally, the Raster Feature name can be modified. However, while features
00072 // are read from XML, we know that their names won't change. When reading from XML,
00073 // FdoRfpRasterLocation uses SetCanSetName to temporarily override the CanSetName()
00074 // return value to false. When CanSetName() returns false, the duplicate name checking
00075 // done by FdoRfpRasterFeatureCollection is more faster, saving time when populating
00076 // this collection.
00077 //
00078 // The above is definitely a hack, and should be replaced with a cleaner solution
00079 // when we allowed to change binary compatibility.
00080
00081 // Returns true if the Raster Feature name can be modified, false otherwise.
00082 virtual FdoBoolean CanSetName();
00083
00084 // Specify the value that CanSetName() will return. CanSetName() initially returns true.
00085 // Caller must warrant that it is not possible to change the name of any Raster
00086 // Feature while m_canSetName is false.
00087 // For thread safety, GetMutex() (and the Enter() function on the returned mutex)
00088 // must be called before SetCanSetName(false) is called. After the next call to
00089 // SetCanSetName(true), the Leave function on the mutex must be called.
00090 // See FdoRfpRasterLocation::XmlStartElement() for an example.
00091 static void SetCanSetName( bool canSetName );
00092
00093 // Return mutex used to prevent m_canSetName from being accessed by multiple threads.
00094 static FdoCommonThreadMutex* GetMutex();
00095
00096 protected:
00097 FDORFP_API FdoRfpRasterFeatureDefinition(void);
00098 FDORFP_API virtual ~FdoRfpRasterFeatureDefinition(void);
00099 void Dispose(void);
00100
00101 private:
00102 FdoPtr<FdoRfpRasterBandCollection> m_rasterBands;
00103 FdoStringP m_name;
00104
00105 static bool m_canSetName;
00106 static FdoCommonThreadMutex m_mutex;
00107
00108 /// \endcond
00109
00110 };
00111
00112 /// \brief
00113 /// FdoRfpRasterFeatureDefinitionP is a FdoPtr on FdoRfpRasterFeatureDefinition, provided for convenience.
00114 typedef FdoPtr<FdoRfpRasterFeatureDefinition> FdoRfpRasterFeatureDefinitionP;
00115
00116 /// \brief
00117 ///
00118 /// The FdoRfpRasterFeatureCollection class holds a list of Raster Feature Definition.
00119 class FdoRfpRasterFeatureCollection : public FdoPhysicalElementMappingCollection<FdoRfpRasterFeatureDefinition>
00120 {
00121 public:
00122 /// \brief
00123 /// Constructs a new empty collection of Raster Feature Definition.
00124 ///
00125 /// \param parent
00126 /// Input parent object
00127 ///
00128 /// \return
00129 /// Returns the newly created FdoRfpRasterFeatureCollection instance.
00130 ///
00131 FDORFP_API static FdoRfpRasterFeatureCollection* Create(FdoRfpRasterLocation *parent);
00132
00133 /// \cond DOXYGEN-IGNORE
00134
00135 protected:
00136 FdoRfpRasterFeatureCollection();
00137 FDORFP_API FdoRfpRasterFeatureCollection(FdoRfpRasterLocation *parent);
00138 FDORFP_API virtual ~FdoRfpRasterFeatureCollection(void);
00139 void Dispose();
00140
00141 /// \endcond
00142
00143 };
00144
00145 /// \brief
00146 /// FdoRfpRasterFeaturesP is a FdoPtr on FdoRfpRasterFeatureCollection, provided for convenience.
00147 typedef FdoPtr<FdoRfpRasterFeatureCollection> FdoRfpRasterFeaturesP;
00148
00149 #endif
00150
00151