FDO API Reference Feature Data Objects

SpatialContextWriter.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_SPATIALCONTEXTWRITER_H
00002 #define FDO_XML_SPATIALCONTEXTWRITER_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/Commands/SpatialContext/SpatialContextExtentType.h>
00027 #include <Fdo/Xml/SpatialContextFlags.h>
00028 
00029 /// \brief
00030 /// FdoXmlSpatialContextWriter writes Spatial Contexts to an 
00031 /// XML document. This is done by calling the various setter functions 
00032 /// to set the spatial context attributes and then calling 
00033 /// WriteSpatialContext() to write the spatial context using the current 
00034 /// attributes. 
00035 class FdoXmlSpatialContextWriter : public FdoIDisposable
00036 {
00037 public:
00038     /// \brief
00039     /// creates a Spatial Context Writer.
00040     /// 
00041     /// \param writer 
00042     /// Input XML document writer. Specifies the XML
00043     /// document that the Spatial Contexts will be written to.
00044     /// \param flags 
00045     /// Input options for controlling the 
00046     /// deserializing of the Spatial Contexts. If NULL then the 
00047     /// default flags are used.
00048     /// 
00049     /// \return
00050     /// Returns FdoXmlSpatialContextWriter
00051     /// 
00052     FDO_API static FdoXmlSpatialContextWriter * Create( 
00053         FdoXmlWriter*               writer,
00054         FdoXmlSpatialContextFlags*  flags = NULL
00055     );
00056 
00057     /// \brief
00058     /// Gets the name of the context to create as a string.
00059     /// 
00060     /// \return
00061     /// Returns the name of the spatial context
00062     /// 
00063     FDO_API FdoString* GetName();
00064 
00065     /// \brief
00066     /// Sets the name of the context to create as a string.
00067     /// 
00068     /// \param value 
00069     /// Input the name of the spatial context
00070     /// 
00071     /// \return
00072     /// Returns nothing
00073     /// 
00074     FDO_API void SetName(FdoString* value);
00075 
00076     /// \brief
00077     /// Gets the description of the context to create as a string.
00078     /// 
00079     /// \return
00080     /// Returns the description of the spatial context
00081     /// 
00082     FDO_API FdoString* GetDescription();
00083 
00084     /// \brief
00085     /// Sets the description of the context to create as a string.
00086     /// 
00087     /// \param value 
00088     /// Input the description of the spatial context
00089     /// 
00090     /// \return
00091     /// Returns nothing
00092     /// 
00093     FDO_API void SetDescription(FdoString* value);
00094 
00095     /// \brief
00096     /// Gets the name of the coordinate system of the context to create.
00097     /// 
00098     /// \return
00099     /// Returns the coordinate system name
00100     /// 
00101     FDO_API FdoString* GetCoordinateSystem();
00102 
00103     /// \brief
00104     /// Gets the name of the coordinate system of the context to create.
00105     /// 
00106     /// \param value 
00107     /// Input the coordinate system name
00108     /// 
00109     /// \return
00110     /// Returns nothing
00111     /// 
00112     FDO_API void SetCoordinateSystem(FdoString* value);
00113 
00114     /// \brief
00115     /// Gets the coordinate system of the context to create as a string
00116     /// in OpenGIS SRS WKT format.
00117     /// 
00118     /// \return
00119     /// Returns the coordinate system
00120     /// 
00121     FDO_API FdoString* GetCoordinateSystemWkt();
00122 
00123     /// \brief
00124     /// Sets the coordinate system of the context to create as a string in
00125     /// OpenGIS SRS WKT format.
00126     /// 
00127     /// \param value 
00128     /// Input the coordinate system
00129     /// 
00130     /// \return
00131     /// Returns nothing
00132     /// 
00133     FDO_API void SetCoordinateSystemWkt(FdoString* value);
00134 
00135     /// \brief
00136     /// Gets the desired extent type of the context to create, either static or dynamic.
00137     /// 
00138     /// \return
00139     /// Returns the extent type
00140     /// 
00141     FDO_API FdoSpatialContextExtentType GetExtentType();
00142 
00143     /// \brief
00144     /// Sets the desired extent type of the context to create, either static or dynamic.
00145     /// 
00146     /// \param value 
00147     /// Input the extent type
00148     /// 
00149     /// \return
00150     /// Returns nothing
00151     /// 
00152     FDO_API void SetExtentType(FdoSpatialContextExtentType value);
00153 
00154     /// \brief
00155     /// Gets the extent of the context to create as a byte array in FGF format.
00156     /// If the extent type is dynamic, any value specified via this function is ignored.
00157     /// 
00158     /// \return
00159     /// Returns the extent of the spatial context
00160     /// 
00161     FDO_API FdoByteArray* GetExtent();
00162 
00163     /// \brief
00164     /// Sets the extent of the context to create as a byte array in FGF format.
00165     /// If the extent type is dynamic this is optional and any value specified is ignored.
00166     /// 
00167     /// \param value 
00168     /// Input the extent of the spatial context
00169     /// 
00170     /// \return
00171     /// Returns nothing
00172     /// 
00173     FDO_API void SetExtent(FdoByteArray* value);
00174 
00175     /// \brief
00176     /// Gets the tolerance value to use for X/Y ordinates. Tolerances are used
00177     /// in some geometric tests, mostly for equality between coordinates.  This
00178     /// occurs frequently in spatial queries, especially with "on boundary" or "just
00179     /// touching" conditions.  It is also an objective amount that can be used
00180     /// when formulating step distances for parametric curve interpolation.
00181     /// 
00182     /// \return
00183     /// Returns the tolerance
00184     /// 
00185     FDO_API const double GetXYTolerance();
00186 
00187     /// \brief
00188     /// Sets the tolerance value to use for X/Y ordinates. Tolerances are used
00189     /// in some geometric tests, mostly for equality between coordinates.  This
00190     /// occurs frequently in spatial queries, especially with "on boundary" or "just
00191     /// touching" conditions.  It is also an objective amount that can be used
00192     /// when formulating step distances for parametric curve interpolation.
00193     /// 
00194     /// \param value 
00195     /// Input the tolerance
00196     /// 
00197     /// \return
00198     /// Returns nothing
00199     /// 
00200     FDO_API void SetXYTolerance(const double value);
00201 
00202     /// \brief
00203     /// Gets the tolerance value to use for Z ordinates. Tolerances are used in
00204     /// some geometric tests, mostly for equality between coordinates.  This
00205     /// occurs frequently in spatial queries, especially with "on boundary" or "just
00206     /// touching" conditions.  It is also an objective amount that can be used
00207     /// when formulating step distances for parametric curve interpolation.
00208     /// 
00209     /// \return
00210     /// Returns the tolerance
00211     /// 
00212     FDO_API const double GetZTolerance();
00213 
00214     /// \brief
00215     /// Sets the tolerance value to use for Z ordinates. Tolerances are used in
00216     /// some geometric tests, mostly for equality between coordinates.  This
00217     /// occurs frequently in spatial queries, especially with "on boundary" or "just
00218     /// touching" conditions.  It is also an objective amount that can be used
00219     /// when formulating step distances for parametric curve interpolation.
00220     /// 
00221     /// \param value 
00222     /// Input the tolerance
00223     /// 
00224     /// \return
00225     /// Returns nothing
00226     /// 
00227     FDO_API void SetZTolerance(const double value);
00228 
00229     /// \brief
00230     /// Writes the current Spatial Context to the XML document.
00231     /// 
00232     FDO_API void WriteSpatialContext();
00233 
00234 protected:
00235     /// default constructor to keep linux from complaining.
00236     FdoXmlSpatialContextWriter() {}
00237     FdoXmlSpatialContextWriter( 
00238         FdoXmlWriter*               writer,
00239         FdoXmlSpatialContextFlags*  flags = NULL
00240     );
00241     virtual ~FdoXmlSpatialContextWriter() { FDO_SAFE_RELEASE (mExtent) };
00242 
00243     /// Closes the FdoXmlSpatialContextWriter object, freeing any resources it may
00244     /// be holding.
00245     FDO_API virtual void Dispose();
00246 
00247 private:
00248     FdoXmlWriterP               mXmlWriter;
00249     FdoXmlSpatialContextFlagsP  mXmlFlags;
00250 
00251     FdoStringP                  mSCName;
00252     FdoStringP                  mDescription;
00253     FdoStringP                  mCoordSysName;
00254     FdoStringP                  mCoordSysWkt;
00255 
00256     FdoSpatialContextExtentType mExtentType;
00257     FdoByteArray*               mExtent;
00258     FdoInt32                    mExtentLength;
00259 
00260     FdoDouble                   mXYTolerance;
00261     FdoDouble                   mZTolerance;
00262 
00263 };
00264 
00265 /// \brief
00266 /// FdoXmlSpatialContextWriterP is a FdoPtr on FdoXmlSpatialContextWriter, provided for convenience.
00267 typedef FdoPtr<FdoXmlSpatialContextWriter> FdoXmlSpatialContextWriterP;
00268 
00269 #endif
00270 
00271 

Comments or suggestions? Send us feedback.