FDO API Reference | Feature Data Objects |
00001 #ifndef FDO_XML_SPATIALCONTEXTREADER_H_ 00002 #define FDO_XML_SPATIALCONTEXTREADER_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/Commands/SpatialContext/ISpatialContextReader.h> 00028 #include <Fdo/Xml/SpatialContextFlags.h> 00029 00030 class FdoXmlSCReadHandler; 00031 00032 /// \brief 00033 /// FdoXmlSpatialContextReader reads Spatial Contexts from an XML 00034 /// document. Unlike other XML Readers, the reading is done procedurally, 00035 /// rather than through events. FdoXmlSpatialContextReader implements 00036 /// FdoISpatialContextReader to provide the functions for retrieving the 00037 /// spatial contexts that were read. 00038 class FdoXmlSpatialContextReader : 00039 public FdoISpatialContextReader, 00040 public FdoXmlSaxHandler 00041 { 00042 public: 00043 00044 /// \brief 00045 /// creates a Spatial Context Reader. 00046 /// 00047 /// \param reader 00048 /// Input XML document reader. Specifies the XML 00049 /// document that the Spatial Contexts will be read from. 00050 /// \param flags 00051 /// Input options for controlling the 00052 /// deserializing of the Spatial Contexts. If NULL then the 00053 /// default flags are used. 00054 /// 00055 /// \return 00056 /// Returns FdoXmlSpatialContextReader 00057 /// 00058 FDO_API static FdoXmlSpatialContextReader * Create( 00059 FdoXmlReader* reader, 00060 FdoXmlSpatialContextFlags* flags = NULL 00061 ); 00062 00063 /// \brief 00064 /// Gets the Xml document reader that was passed to this object. 00065 /// 00066 /// \return 00067 /// Returns the XML document reader. 00068 /// 00069 FDO_API FdoXmlReader* GetXmlReader(); 00070 00071 // FdoISpatialContextReader implementation 00072 00073 /// \brief 00074 /// Gets the name of the spatial context currently being read. 00075 /// 00076 /// \return 00077 /// Returns the name of the spatial context. 00078 /// 00079 FDO_API virtual FdoString* GetName(); 00080 00081 /// \brief 00082 /// Gets the description of the spatial context currently being read. 00083 /// 00084 /// \return 00085 /// Returns the description of the spatial context. 00086 /// 00087 FDO_API virtual FdoString* GetDescription(); 00088 00089 /// \brief 00090 /// Gets the name of the coordinate system of the spatial context currently 00091 /// being read. If the result is a null or empty string, the coordinate system is 00092 /// unknown to the spatial context. 00093 /// 00094 /// \return 00095 /// Returns the coordinate system name of the spatial context. 00096 /// 00097 FDO_API virtual FdoString* GetCoordinateSystem(); 00098 00099 /// \brief 00100 /// Gets the coordinate system in OpenGIS SRS WKT format of the spatial context currently 00101 /// being read. If the result is an empty string, the coordinate system WKT description is 00102 /// not available. 00103 /// 00104 /// \return 00105 /// Returns the coordinate system description in WKT of of the spatial context. 00106 /// 00107 FDO_API virtual FdoString* GetCoordinateSystemWkt(); 00108 00109 /// \brief 00110 /// Gets the extent type of the spatial context currently being read. 00111 /// 00112 /// \return 00113 /// Returns the extent type. 00114 /// 00115 FDO_API virtual FdoSpatialContextExtentType GetExtentType(); 00116 00117 /// \brief 00118 /// Gets the extent of the spatial context currently being read as a byte 00119 /// array in FGF format. 00120 /// 00121 /// \return 00122 /// Returns the extent as a byte array in FGF format. 00123 /// 00124 FDO_API virtual FdoByteArray* GetExtent(); 00125 00126 /// \brief 00127 /// Gets the tolerance value for XY ordinates of the spatial context 00128 /// currently being read. Tolerances are used in some geometric tests, 00129 /// mostly for equality between coordinates. This occurs frequently in spatial 00130 /// queries, especially with "on boundary" or "just touching" conditions. 00131 /// It is also an objective amount that can be used when formulating step 00132 /// distances for parametric curve interpolation. 00133 /// 00134 /// \return 00135 /// Returns the tolerance 00136 /// 00137 FDO_API virtual const double GetXYTolerance(); 00138 00139 /// \brief 00140 /// Gets the tolerance value for Z ordinates of the spatial context 00141 /// currently being read. Tolerances are used in some geometric tests, 00142 /// mostly for equality between coordinates. This occurs a frequently in spatial 00143 /// queries, especially with "on boundary" or "just touching" conditions. 00144 /// It is also an objective amount that can be used when formulating step 00145 /// distances for parametric curve interpolation. 00146 /// 00147 /// \return 00148 /// Returns the tolerance 00149 /// 00150 FDO_API virtual const double GetZTolerance(); 00151 00152 /// \brief 00153 /// Returns true if the spatial context currently being read is the active 00154 /// spatial context. 00155 /// 00156 /// \return 00157 /// Returns true if the current spatial context is the active one. 00158 /// 00159 FDO_API virtual const bool IsActive(); 00160 00161 /// \brief 00162 /// Advances the reader to the next item. The default position of the reader 00163 /// is prior to the first item. Thus, you must call ReadNext to begin 00164 /// accessing any data. 00165 /// 00166 /// \return 00167 /// Returns true if there is a next item. 00168 /// 00169 FDO_API virtual bool ReadNext(); 00170 00171 FDO_API virtual FdoXmlSaxHandler* XmlStartDocument(FdoXmlSaxContext* saxContext); 00172 00173 /// The following callbacks catch the start element and end element 00174 /// SAX events. 00175 FDO_API virtual FdoXmlSaxHandler* XmlStartElement( 00176 FdoXmlSaxContext* saxContext, 00177 FdoString* uri, 00178 FdoString* name, 00179 FdoString* qname, 00180 FdoXmlAttributeCollection* atts 00181 ); 00182 00183 FDO_API virtual FdoBoolean XmlEndElement( 00184 FdoXmlSaxContext* saxContext, 00185 FdoString* uri, 00186 FdoString* name, 00187 FdoString* qname 00188 ); 00189 00190 00191 protected: 00192 /// default constructor to keep linux from complaining. 00193 FdoXmlSpatialContextReader() {} 00194 00195 FDO_API FdoXmlSpatialContextReader( 00196 FdoXmlReader* reader, 00197 FdoXmlSpatialContextFlags* flags 00198 ); 00199 FDO_API virtual ~FdoXmlSpatialContextReader(); 00200 00201 /// Closes the FdoXmlSpatialContextReader object, freeing any resources it may 00202 /// be holding. 00203 FDO_API virtual void Dispose(); 00204 00205 /// Throws an exception if a getter is called but there is no currently read Spatial Context. 00206 void ThrowOnNotRead( FdoString* function ); 00207 00208 private: 00209 00210 FdoXmlReaderP mXmlReader; 00211 FdoXmlSpatialContextFlagsP mXmlFlags; 00212 00213 FdoBoolean mIsActiveSC; 00214 FdoPtr<FdoByteArray> mExtent; 00215 00216 FdoXmlSCReadHandler* mSCHandler; 00217 }; 00218 00219 /// \ingroup (typedefs) 00220 /// \brief 00221 /// FdoXmlSpatialContextReaderP is a FdoPtr on FdoXmlSpatialContextReader, provided for convenience. 00222 typedef FdoPtr<FdoXmlSpatialContextReader> FdoXmlSpatialContextReaderP; 00223 00224 00225 #endif 00226 00227
Comments or suggestions? Send us feedback. |