FDO API Reference | Feature Data Objects |
00001 #ifndef _ENVELOPEIMPL_H_ 00002 #define _ENVELOPEIMPL_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 00022 00023 #ifdef _WIN32 00024 #pragma once 00025 #endif 00026 00027 #include <Geometry/IEnvelope.h> 00028 #include <Geometry/IDirectPosition.h> 00029 00030 /// \brief 00031 /// The FdoEnvelopeImpl class is a default implementation of FdoIEnvelope. 00032 /// FdoEnvelopeImpl implements accessors from FdoIEnvelope, matching mutators, and simple data members. 00033 /// Assignment, exact equality operators, and utility methods are also provided. 00034 class FdoEnvelopeImpl : public FdoIEnvelope 00035 { 00036 00037 protected: 00038 /// \cond DOXYGEN-IGNORE 00039 /// \brief 00040 /// Constructs a default instance of a FdoEnvelopeImpl object. 00041 /// 00042 /// \remarks 00043 /// Ordinate values default to numeric_limits<double>::quiet_NaN(). 00044 /// 00045 /// \return 00046 /// Returns nothing 00047 /// 00048 FDO_GEOM_API FdoEnvelopeImpl(); 00049 00050 /// \brief 00051 /// Constructs a 2D FdoEnvelopeImpl object from X and Y ordinates. 00052 /// 00053 /// \remarks 00054 /// Z ordinate value defaults to numeric_limits<double>::quiet_NaN(). 00055 /// 00056 /// \param minX 00057 /// Input Lower-left X ordinate 00058 /// \param minY 00059 /// Input Lower-left Y ordinate 00060 /// \param maxX 00061 /// Input Upper-right X ordinate 00062 /// \param maxY 00063 /// Input Upper-right Y ordinate 00064 /// 00065 /// \return 00066 /// Returns nothing 00067 /// 00068 FDO_GEOM_API FdoEnvelopeImpl(double minX, double minY, 00069 double maxX, double maxY); 00070 00071 /// \brief 00072 /// Constructs a 3D FdoEnvelopeImpl object from X, Y and Z ordinates. 00073 /// 00074 /// \param minX 00075 /// Input Lower-left X ordinate 00076 /// \param minY 00077 /// Input Lower-left Y ordinate 00078 /// \param minZ 00079 /// Input Lower-left, rear Z ordinate 00080 /// \param maxX 00081 /// Input Upper-right X ordinate 00082 /// \param maxY 00083 /// Input Upper-right Y ordinate 00084 /// \param maxZ 00085 /// Input Upper-right, front Z ordinate 00086 /// 00087 /// \return 00088 /// Returns nothing 00089 /// 00090 FDO_GEOM_API FdoEnvelopeImpl(double minX, double minY, double minZ, 00091 double maxX, double maxY, double maxZ); 00092 00093 /// \brief 00094 /// Copy constructor for FdoEnvelopeImpl. 00095 /// 00096 /// \param envelopeImpl 00097 /// Input envelope to copy 00098 /// 00099 /// \return 00100 /// Returns nothing 00101 /// 00102 FDO_GEOM_API FdoEnvelopeImpl(FdoEnvelopeImpl& envelopeImpl); 00103 00104 /// \brief 00105 /// Constructs a FdoEnvelopeImpl object from two positions. 00106 /// 00107 /// \param lowerLeft 00108 /// Input Lower-left position 00109 /// \param upperRight 00110 /// Input Upper-right position 00111 /// 00112 /// \return 00113 /// Returns nothing 00114 /// 00115 FDO_GEOM_API FdoEnvelopeImpl(FdoIDirectPosition* lowerLeft, FdoIDirectPosition * upperRight); 00116 00117 /// \brief 00118 /// Constructs a FdoEnvelopeImpl object by copying from an array of ordinates. 00119 /// 00120 /// \param dimensionType 00121 /// Input dimensionality of the ordinates (see FdoDimensionality) 00122 /// \param ordinates 00123 /// Input ordinate array representing two positions 00124 /// 00125 /// \return 00126 /// Returns nothing 00127 /// 00128 FDO_GEOM_API FdoEnvelopeImpl(FdoInt32 dimensionType, double * ordinates); 00129 00130 /// \brief 00131 /// Default destructor. 00132 /// 00133 /// \return 00134 /// Returns nothing 00135 /// 00136 virtual ~FdoEnvelopeImpl(); 00137 00138 /// \endcond 00139 00140 public: 00141 00142 /// \brief 00143 /// Constructs a default instance of a FdoEnvelopeImpl object. 00144 /// 00145 /// \remarks 00146 /// Ordinate values default to numeric_limits<double>::quiet_NaN(). 00147 /// 00148 /// \return 00149 /// Returns nothing 00150 /// 00151 FDO_GEOM_API static FdoEnvelopeImpl* Create(); 00152 00153 /// \brief 00154 /// Constructs a 2D FdoEnvelopeImpl object from X and Y ordinates. 00155 /// 00156 /// \remarks 00157 /// Z ordinate value defaults to numeric_limits<double>::quiet_NaN(). 00158 /// 00159 /// \param minX 00160 /// Input Lower-left X ordinate 00161 /// \param minY 00162 /// Input Lower-left Y ordinate 00163 /// \param maxX 00164 /// Input Upper-right X ordinate 00165 /// \param maxY 00166 /// Input Upper-right Y ordinate 00167 /// 00168 /// \return 00169 /// Returns nothing 00170 /// 00171 FDO_GEOM_API static FdoEnvelopeImpl* Create(double minX, double minY, 00172 double maxX, double maxY); 00173 00174 /// \brief 00175 /// Constructs a 3D FdoEnvelopeImpl object from X, Y and Z ordinates. 00176 /// 00177 /// \param minX 00178 /// Input Lower-left X ordinate 00179 /// \param minY 00180 /// Input Lower-left Y ordinate 00181 /// \param minZ 00182 /// Input Lower-left, rear Z ordinate 00183 /// \param maxX 00184 /// Input Upper-right X ordinate 00185 /// \param maxY 00186 /// Input Upper-right Y ordinate 00187 /// \param maxZ 00188 /// Input Upper-right, front Z ordinate 00189 /// 00190 /// \return 00191 /// Returns nothing 00192 /// 00193 FDO_GEOM_API static FdoEnvelopeImpl* Create(double minX, double minY, double minZ, 00194 double maxX, double maxY, double maxZ); 00195 00196 /// \brief 00197 /// Constructs a copy of a FdoEnvelopeImpl. 00198 /// 00199 /// \param envelopeImpl 00200 /// Input envelope to copy 00201 /// 00202 /// \return 00203 /// Returns nothing 00204 /// 00205 FDO_GEOM_API static FdoEnvelopeImpl* Create(FdoEnvelopeImpl& envelopeImpl); 00206 00207 /// \brief 00208 /// Constructs a FdoEnvelopeImpl object from two positions. 00209 /// 00210 /// \param lowerLeft 00211 /// Input Lower-left position 00212 /// \param upperRight 00213 /// Input Upper-right position 00214 /// 00215 /// \return 00216 /// Returns nothing 00217 /// 00218 FDO_GEOM_API static FdoEnvelopeImpl* Create(FdoIDirectPosition* lowerLeft, FdoIDirectPosition * upperRight); 00219 00220 /// \brief 00221 /// Constructs a FdoEnvelopeImpl object by copying from an array of ordinates. 00222 /// 00223 /// \param dimensionType 00224 /// Input dimensionality of the ordinates (see FdoDimensionality) 00225 /// \param ordinates 00226 /// Input ordinate array representing two positions 00227 /// 00228 /// \return 00229 /// Returns nothing 00230 /// 00231 FDO_GEOM_API static FdoEnvelopeImpl *Create(FdoInt32 dimensionType, double * ordinates); 00232 00233 /// \brief 00234 /// Equality operator for FdoEnvelopeImpl. 00235 /// 00236 /// \param rhs 00237 /// Input envelope for comparison (right-hand-side of equation) 00238 /// 00239 /// \return 00240 /// Returns true if all non-NaN ordinates exactly equal. All NaN values compare as equal to each other. 00241 /// 00242 FDO_GEOM_API bool operator==(FdoEnvelopeImpl& rhs) const; 00243 00244 /// \brief 00245 /// Gets the minimum X coordinate value. 00246 /// 00247 /// \return 00248 /// Returns the minimum X ordinate; numeric_limits<double>::quiet_NaN() by default 00249 /// 00250 FDO_GEOM_API double GetMinX() const; 00251 00252 /// \brief 00253 /// Gets the minimum Y coordinate value. 00254 /// 00255 /// \return 00256 /// Returns the minimum Y ordinate; numeric_limits<double>::quiet_NaN() by default 00257 /// 00258 FDO_GEOM_API double GetMinY() const; 00259 00260 /// \brief 00261 /// Gets the minimum Z coordinate value. 00262 /// 00263 /// \return 00264 /// Returns the minimum Z ordinate; numeric_limits<double>::quiet_NaN() by default 00265 /// 00266 FDO_GEOM_API double GetMinZ() const; 00267 00268 /// \brief 00269 /// Gets the maximum X coordinate value. 00270 /// 00271 /// \return 00272 /// Returns the maximum X ordinate; numeric_limits<double>::quiet_NaN() by default 00273 /// 00274 FDO_GEOM_API double GetMaxX() const; 00275 00276 /// \brief 00277 /// Gets the maximum Y coordinate value. 00278 /// 00279 /// \return 00280 /// Returns the maximum Y ordinate; numeric_limits<double>::quiet_NaN() by default 00281 /// 00282 FDO_GEOM_API double GetMaxY() const; 00283 00284 /// \brief 00285 /// Gets the maximum Z coordinate value. 00286 /// 00287 /// \return 00288 /// Returns the maximum Z ordinate; numeric_limits<double>::quiet_NaN() by default 00289 /// 00290 FDO_GEOM_API double GetMaxZ() const; 00291 00292 /// \brief 00293 /// Gets the ordinates as an array. 00294 /// 00295 /// \remarks 00296 /// The caller must not free the returned array. 00297 /// The ordinates are in the order XYZM, with only those present 00298 /// according to the dimensionality. 00299 /// 00300 /// \return 00301 /// Returns the ordinates 00302 /// 00303 FDO_GEOM_API virtual const double * GetOrdinates(); 00304 00305 /// \brief 00306 /// Indicates whether the envelope's extents are set. 00307 /// 00308 /// \return 00309 /// Returns 'true' if none of the X, Y and Z extents have been set; 'false' otherwise 00310 /// 00311 FDO_GEOM_API bool GetIsEmpty() const; 00312 00313 /// \brief 00314 /// Sets the minimum X coordinate value. 00315 /// 00316 /// \param minX 00317 /// Input Lower-left X ordinate 00318 /// 00319 /// \return 00320 /// Returns nothing 00321 /// 00322 FDO_GEOM_API void SetMinX(double minX); 00323 00324 /// \brief 00325 /// Sets the minimum Y coordinate value. 00326 /// 00327 /// \param minY 00328 /// Input Lower-left Y ordinate 00329 /// 00330 /// \return 00331 /// Returns nothing 00332 /// 00333 FDO_GEOM_API void SetMinY(double minY); 00334 00335 /// \brief 00336 /// Sets the minimum Z coordinate value. 00337 /// 00338 /// \param minZ 00339 /// Input Lower-left, rear Z ordinate 00340 /// 00341 /// \return 00342 /// Returns nothing 00343 /// 00344 FDO_GEOM_API void SetMinZ(double minZ); 00345 00346 /// \brief 00347 /// Sets the maximum X coordinate value. 00348 /// 00349 /// \param maxX 00350 /// Input Upper-right X ordinate 00351 /// 00352 /// \return 00353 /// Returns nothing 00354 /// 00355 FDO_GEOM_API void SetMaxX(double maxX); 00356 00357 /// \brief 00358 /// Sets the maximum Y coordinate value. 00359 /// 00360 /// \param maxY 00361 /// Input Upper-right Y ordinate 00362 /// 00363 /// \return 00364 /// Returns nothing 00365 /// 00366 FDO_GEOM_API void SetMaxY(double maxY); 00367 00368 /// \brief 00369 /// Sets the maximum Z coordinate value. 00370 /// 00371 /// \param maxZ 00372 /// Input Upper-right, front Z ordinate 00373 /// 00374 /// \return 00375 /// Returns nothing 00376 /// 00377 FDO_GEOM_API void SetMaxZ(double maxZ); 00378 00379 /// \brief 00380 /// Expands the envelope's extents to include a given position. 00381 /// 00382 /// \param position 00383 /// Input position to include in extent 00384 /// 00385 /// \return 00386 /// Returns nothing 00387 /// 00388 FDO_GEOM_API void Expand(FdoIDirectPosition* position); 00389 00390 /// \brief 00391 /// Expands the envelope's extents to include another envelope. 00392 /// 00393 /// \param envelope 00394 /// Input envelope to include in extent 00395 /// 00396 /// \return 00397 /// Returns nothing 00398 /// 00399 FDO_GEOM_API void Expand(FdoIEnvelope* envelope); 00400 00401 protected: 00402 00403 /// \cond DOXYGEN-IGNORE 00404 void Dispose(); 00405 00406 double m_minX; 00407 double m_minY; 00408 double m_minZ; 00409 double m_maxX; 00410 double m_maxY; 00411 double m_maxZ; 00412 bool m_isEmpty; 00413 00414 /// The following is just to retain ownership of the ordinate array in 00415 /// case GetOrdinates() is called. An alternative implementation might 00416 /// optimise for GetOrdinates() by always using "double m_ordinates[4]" 00417 /// instead of the individual ordinate members above. 00418 double * m_ordinates; 00419 /// \endcond 00420 }; 00421 #endif 00422 00423
Comments or suggestions? Send us feedback. |