FDO API Reference Feature Data Objects

IDirectPosition.h

Go to the documentation of this file.
00001 #ifndef _IDIRECTPOSITION_H_
00002 #define _IDIRECTPOSITION_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 <FdoCommon.h>
00028 #include <Common/Collection.h>
00029 #include <Common/Dimensionality.h>
00030 
00031 /// \brief
00032 /// The FdoIDirectPosition class is a direct position object.  
00033 /// FdoIDirectPosition is a simple coordinate position in any allowed dimension.  
00034 /// The actual object may have several implementations, depending on
00035 /// the dimension and other factors.
00036 /// This is a lightweight helper type for Geometries in the Geometry package.
00037 /// \note
00038 /// It does not derive from IGeometry.
00039 class FdoIDirectPosition : public FdoIDisposable
00040 {
00041 public:
00042 
00043 
00044     /// \brief
00045     /// Gets the X ordinate.
00046     /// 
00047     /// \return
00048     /// Returns the X ordinate; default is numeric_limits<double>::quiet_NaN()
00049     /// 
00050     FDO_GEOM_API virtual double GetX() const = 0;
00051     
00052     /// \brief
00053     /// Gets the Y ordinate.
00054     /// 
00055     /// \return
00056     /// Returns the Y ordinate; default is numeric_limits<double>::quiet_NaN()
00057     /// 
00058     FDO_GEOM_API virtual double GetY() const = 0;
00059     
00060     /// \brief
00061     /// Gets the Z ordinate.
00062     /// 
00063     /// \return
00064     /// Returns the Z ordinate; default is numeric_limits<double>::quiet_NaN()
00065     /// 
00066     FDO_GEOM_API virtual double GetZ() const = 0;
00067 
00068     /// \brief
00069     /// Gets the M ordinate.
00070     /// 
00071     /// \return
00072     /// Returns the M ordinate; default is numeric_limits<double>::quiet_NaN()
00073     /// 
00074     FDO_GEOM_API virtual double GetM() const = 0;
00075 
00076     /// \brief
00077     /// Gets the ordinates as an array.
00078     /// 
00079     /// \remarks
00080     /// The caller must not free the returned array.
00081     /// The ordinates are in the order XYZM, with only those present 
00082     /// according to the dimensionality.
00083     /// 
00084     /// \return
00085     /// Returns the ordinates
00086     /// 
00087     FDO_GEOM_API virtual const double * GetOrdinates() = 0;
00088 
00089     /// \brief
00090     /// Gets the dimensionality of ordinates in this position.
00091     /// 
00092     /// \remarks
00093     ///  Values are from the FdoDimensionality enumeration.
00094     /// A return type of "FdoInt32" is used instead of the enumeration, catering to typical use with bit masking.
00095     /// 
00096     /// \return
00097     /// Returns the ordinate dimensionality
00098     /// 
00099     FDO_GEOM_API virtual FdoInt32 GetDimensionality() const = 0;
00100 
00101 protected:
00102 
00103     /// \brief
00104     /// Constructs a default instance.
00105     /// 
00106     /// \return
00107     /// Returns nothing
00108     /// 
00109     FDO_GEOM_API FdoIDirectPosition() {};
00110 
00111     /// \brief
00112     /// Default destructor.
00113     /// 
00114     /// \return
00115     /// Returns nothing
00116     /// 
00117     FDO_GEOM_API virtual ~FdoIDirectPosition() {};
00118 };
00119 
00120 
00121 /// \brief
00122 ///  The FdoDirectPositionCollection class is a collection of DirectPosition objects.
00123 class FdoDirectPositionCollection : public FdoCollection<FdoIDirectPosition, FdoException>
00124 {
00125 public:
00126     /// \brief
00127     ///  Creates an instance of FdoDirectPositionCollection with no contained elements.
00128     /// 
00129     /// \return
00130     /// Returns an empty collection
00131     /// 
00132     static FdoDirectPositionCollection* Create()
00133     {
00134         FdoDirectPositionCollection* value = new FdoDirectPositionCollection();
00135         if (NULL == value)
00136             throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID(FDO_1_BADALLOC)));
00137 
00138         return value;
00139     }
00140 
00141 protected:
00142     void Dispose()
00143     {
00144         delete this;
00145     }
00146 };
00147 
00148 #endif
00149 
00150 

Comments or suggestions? Send us feedback.