FDO API Reference Feature Data Objects

Factory.h

Go to the documentation of this file.
00001 #ifndef _FGFGEOMETRYFACTORY_H_
00002 #define _FGFGEOMETRYFACTORY_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/IGeometry.h>
00028 #include <Geometry/GeometryFactoryAbstract.h>
00029 #include <Geometry/GeometryStream/GeometryStreamFactory.h>
00030 #include <Common/Array.h>
00031 
00032 struct FdoFgfGeometryFactory2;   // Forward declaration (private data for class).
00033 
00034 /// \brief
00035 /// The FdoFgfGeometryFactory class is an FGF-based Geometry factory, a concrete class that
00036 /// implements all the members from FdoGeometryFactoryAbstract
00037 class FdoFgfGeometryFactory : public FdoGeometryFactoryAbstract
00038 {
00039 public:
00040 
00041 
00042     /// \brief
00043     /// Acquires an object of this class.
00044     /// 
00045     /// \remarks
00046     /// This class is its own factory.
00047     /// The object returned might not be a new instance,
00048     /// and might not be a private instance.
00049     /// The object returned may maintain internal pools
00050     /// of other objects in this package, for performance.
00051     /// Pools will be small, tuned to transient object use.
00052     /// 
00053     /// \return
00054     /// Returns a FdoFgfGeometryFactory object
00055     /// 
00056     FDO_GEOM_API static FdoFgfGeometryFactory * GetInstance();
00057 
00058     /// \brief
00059     /// Instantiates an object of this class.
00060     /// 
00061     /// \remarks
00062     /// This class is its own factory. 
00063     /// This method will return a new, private instance, with any internal
00064     /// object pools tuned to the input parameters.
00065     /// 
00066     /// \param numGeometries 
00067     /// Input Minimum number of geometries to pool.
00068     /// \param numPositions 
00069     /// Input Minimum number of positions to pool.
00070     /// \param numEnvelopes 
00071     /// Input Minimum number of envelopes to pool.
00072     /// \param numCurveSegments 
00073     /// Input Minimum number of curve segments to pool.
00074     /// \param numRings 
00075     /// Input Minimum number of polygon rings to pool.
00076     /// 
00077     /// \return
00078     /// Returns a FdoFgfGeometryFactory object
00079     /// 
00080     FDO_GEOM_API static FdoFgfGeometryFactory * GetPrivateInstance(
00081         FdoInt32 numGeometries,
00082         FdoInt32 numPositions,
00083         FdoInt32 numEnvelopes,
00084         FdoInt32 numCurveSegments,
00085         FdoInt32 numRings);
00086 
00087     /// \brief
00088     /// Creates a Geometry from FGF data.
00089     /// 
00090     /// \param byteArray 
00091     /// Input FGF data that defines the Geometry.
00092     /// 
00093     /// \return
00094     /// Returns a Geometry
00095     /// 
00096     FDO_GEOM_API virtual FdoIGeometry * CreateGeometryFromFgf(
00097         FdoByteArray * byteArray);
00098 
00099     /// \brief
00100     /// Creates a Geometry from FGF data.
00101     /// 
00102     /// \param byteArray 
00103     /// Input FGF data that defines the Geometry.
00104     /// The caller must guarantee the validity of the array for the lifetime
00105     /// of the associated geometry object.
00106     /// \param count 
00107     /// Input Number of bytes of FGF data.
00108     /// 
00109     /// \return
00110     /// Returns a Geometry
00111     /// 
00112     FDO_GEOM_API virtual FdoIGeometry * CreateGeometryFromFgf(
00113         const FdoByte * byteArray, FdoInt32 count);
00114 
00115     /// \brief
00116     /// Gets FGF data from a Geometry.
00117     /// 
00118     /// \param geometry 
00119     /// Input a Geometry, which must be FGF-based
00120     /// 
00121     /// \return
00122     /// Returns FGF data representing the Geometry
00123     /// 
00124     FDO_GEOM_API virtual FdoByteArray * GetFgf(
00125         FdoIGeometry * geometry);
00126 
00127     /// \brief
00128     /// Creates an FGF-based Geometry from OpenGIS WKB data.
00129     /// 
00130     /// \param byteArray 
00131     /// Input WKB data that defines the Geometry.
00132     /// 
00133     /// \return
00134     /// Returns a Geometry
00135     /// 
00136     FDO_GEOM_API virtual FdoIGeometry * CreateGeometryFromWkb(
00137         FdoByteArray * byteArray);
00138 
00139     /// \brief
00140     /// Gets OpenGIS WKB data from a Geometry.
00141     /// 
00142     /// \param geometry 
00143     /// Input a Geometry, which must be FGF-based
00144     /// 
00145     /// \return
00146     /// Returns WKB data representing the Geometry
00147     /// 
00148     FDO_GEOM_API virtual FdoByteArray * GetWkb(
00149         FdoIGeometry * geometry);
00150 
00151     /// Methods from FdoGeometryFactoryAbstract
00152 
00153     /// \brief
00154     ///  Creates a LineString object by copying from a collection of positions.
00155     /// 
00156     /// \param positions 
00157     /// Input collection of positions to copy
00158     /// 
00159     /// \return
00160     /// Returns a LineString
00161     /// 
00162     FDO_GEOM_API virtual FdoILineString* CreateLineString(
00163         FdoDirectPositionCollection * positions);
00164 
00165     /// \brief
00166     ///  Creates a LineString object by copying from an array of ordinates.
00167     /// 
00168     /// \param dimensionType 
00169     /// Input dimensionality of the ordinates (see FdoDimensionality)
00170     /// \param numOrdinates 
00171     /// Input total number of ordinates in the array
00172     /// \param ordinates 
00173     /// Input ordinate array representing positions
00174     /// 
00175     /// \return
00176     /// Returns a LineString
00177     /// 
00178     FDO_GEOM_API virtual FdoILineString* CreateLineString(
00179         FdoInt32 dimensionType,
00180         FdoInt32 numOrdinates,
00181         double* ordinates);
00182 
00183     /// \brief
00184     ///  Creates a Geometry object by copying from another Geometry.
00185     /// 
00186     /// \remarks
00187     ///  This is a pseudo-copy-constructor.
00188     /// It is required that any implementation use only public methods on the underlying 
00189     /// Geometry object, thus enabling conversion from Geometries of the same, or any
00190     /// other, implementation of this Geometry package.  Thus, this implementation creates
00191     /// FGF-based Geometry objects based on any implementation of the Geometry API.
00192     /// 
00193     /// \param geometry 
00194     /// Input Source geometry
00195     /// 
00196     /// \return
00197     /// Returns an envelope
00198     /// 
00199     FDO_GEOM_API virtual FdoIGeometry * CreateGeometry(
00200         FdoIGeometry * geometry);
00201 
00202     /// \brief
00203     ///  Creates a Geometry object by converting from a text string.
00204     /// 
00205     /// \param text 
00206     /// Input Source geometry
00207     /// 
00208     /// \return
00209     /// Returns a geometry
00210     /// 
00211     FDO_GEOM_API virtual FdoIGeometry * CreateGeometry(
00212         FdoString* text);
00213 
00214     /// \brief
00215     ///  Creates a Geometry object by converting from an envelope.
00216     /// 
00217     /// \remarks
00218     ///  This method will produce a new FGF-based Geometry 
00219     /// based on the given envelope.
00220     /// 
00221     /// \param envelope 
00222     /// Input Source envelope
00223     /// 
00224     /// \return
00225     /// Returns a geometry
00226     /// 
00227     FDO_GEOM_API virtual FdoIGeometry * CreateGeometry(
00228         FdoIEnvelope * envelope);
00229 
00230     /// Point
00231 
00232     /// \brief
00233     ///  Creates a point object by copying from a position.
00234     /// 
00235     /// \param position 
00236     /// Input position to copy
00237     /// 
00238     /// \return
00239     /// Returns a point
00240     /// 
00241     FDO_GEOM_API virtual FdoIPoint* CreatePoint(
00242         FdoIDirectPosition* position);
00243 
00244     /// \brief
00245     ///  Creates an point object by copying from an array of ordinates.
00246     /// 
00247     /// \param dimensionality 
00248     /// Input dimensionality of the ordinates (see FdoDimensionality)
00249     /// \param ordinates 
00250     /// Input ordinate array representing one position
00251     /// 
00252     /// \return
00253     /// Returns a point
00254     /// 
00255     FDO_GEOM_API virtual FdoIPoint* CreatePoint(
00256         FdoInt32 dimensionality,
00257         double* ordinates);
00258 
00259     /// LinearRing
00260 
00261     /// \brief
00262     ///  Creates a LinearRing object by copying from a collection of positions.
00263     /// 
00264     /// \remarks
00265     ///  The first and last positions must be equal.
00266     /// 
00267     /// \param positions 
00268     /// Input collection of positions to copy
00269     /// 
00270     /// \return
00271     /// Returns a LinearRing
00272     /// 
00273     FDO_GEOM_API virtual FdoILinearRing* CreateLinearRing(
00274         FdoDirectPositionCollection* positions);
00275 
00276     /// \brief
00277     ///  Creates a LinearRing object by copying from an array of ordinates.
00278     /// 
00279     /// \remarks
00280     ///  The ordinates representing the first and last positions must be equal.
00281     /// 
00282     /// \param dimensionality 
00283     /// Input dimensionality of the ordinates (see FdoDimensionality)
00284     /// \param numOrdinates 
00285     /// Input total number of ordinates in the array
00286     /// \param ordinates 
00287     /// Input ordinate array representing positions
00288     /// 
00289     /// \return
00290     /// Returns a LinearRing
00291     /// 
00292     FDO_GEOM_API virtual FdoILinearRing* CreateLinearRing(
00293         FdoInt32 dimensionality,
00294         FdoInt32 numOrdinates,
00295         double* ordinates);
00296 
00297     /// LineStringSegment
00298 
00299     /// \brief
00300     ///  Creates a LineStringSegment object by copying from a collection of positions.
00301     /// 
00302     /// \param positions 
00303     /// Input collection of positions to copy
00304     /// 
00305     /// \return
00306     /// Returns a LineStringSegment
00307     /// 
00308     FDO_GEOM_API virtual FdoILineStringSegment* CreateLineStringSegment(
00309         FdoDirectPositionCollection* positions);
00310 
00311     /// \brief
00312     ///  Creates a LineStringSegment object by copying from an array of ordinates.
00313     /// 
00314     /// \param dimtype 
00315     /// Input dimensionality of the ordinates (see FdoDimensionality)
00316     /// \param numOrdinates 
00317     /// Input total number of ordinates in the array
00318     /// \param ordinates 
00319     /// Input ordinate array representing positions
00320     /// 
00321     /// \return
00322     /// Returns a LineStringSegment
00323     /// 
00324     FDO_GEOM_API virtual FdoILineStringSegment* CreateLineStringSegment(
00325         FdoInt32 dimtype,
00326         FdoInt32 numOrdinates, 
00327         double* ordinates);
00328 
00329     /// Polygon
00330 
00331     /// \brief
00332     ///  Creates a polygon object by copying from given LinearRing objects.
00333     /// 
00334     /// \param exteriorRing 
00335     /// Input exterior ring to copy
00336     /// \param interiorRings 
00337     /// Input collection of interior rings to copy
00338     /// 
00339     /// \return
00340     /// Returns a polygon
00341     /// 
00342     FDO_GEOM_API virtual FdoIPolygon* CreatePolygon(
00343         FdoILinearRing* exteriorRing, 
00344         FdoLinearRingCollection* interiorRings);
00345 
00346     /// MultiPoint
00347 
00348     /// \brief
00349     ///  Creates a MultiPoint object by copying from a collection of point objects.
00350     /// 
00351     /// \param points 
00352     /// Input collection of point objects to copy
00353     /// 
00354     /// \return
00355     /// Returns a MultiPoint
00356     /// 
00357     FDO_GEOM_API virtual FdoIMultiPoint* CreateMultiPoint(
00358         FdoPointCollection* points);
00359 
00360     /// \brief
00361     ///  Creates a MultiPoint object by copying from an array of ordinates.
00362     /// 
00363     /// \param dimensionality 
00364     /// Input dimensionality of the ordinates (see FdoDimensionality)
00365     /// \param numOrdinates 
00366     /// Input total number of ordinates in the array
00367     /// \param ordinates 
00368     /// Input ordinate array representing positions
00369     /// 
00370     /// \return
00371     /// Returns a MultiPoint
00372     /// 
00373     FDO_GEOM_API virtual FdoIMultiPoint* CreateMultiPoint(
00374         FdoInt32 dimensionality,
00375         FdoInt32 numOrdinates, 
00376         double* ordinates);
00377 
00378     /// MultiLineString
00379 
00380     /// \brief
00381     ///  Creates a MultiLineString object by copying from a collection of LineString objects.
00382     /// 
00383     /// \param lineStrings 
00384     /// Input collection of LineString objects to copy
00385     /// 
00386     /// \return
00387     /// Returns a MultiLineString
00388     /// 
00389     FDO_GEOM_API virtual FdoIMultiLineString* CreateMultiLineString(
00390         FdoLineStringCollection* lineStrings);
00391 
00392     //MultiPolygon
00393 
00394     /// \brief
00395     ///  Creates a MultiPolygon object by copying from a collection of polygon objects.
00396     /// 
00397     /// \param polygons 
00398     /// Input collection of polygon objects to copy
00399     /// 
00400     /// \return
00401     /// Returns a MultiPolygon
00402     /// 
00403     FDO_GEOM_API virtual FdoIMultiPolygon* CreateMultiPolygon(
00404         FdoPolygonCollection* polygons);
00405 
00406     /// CircularArcSegment
00407 
00408     /// \brief
00409     ///  Creates a CircularArcSegment object by copying from three points on the arc.
00410     /// 
00411     /// \param startPosition 
00412     /// Input starting position of the arc
00413     /// \param midPosition 
00414     /// Input a position on the arc, and not equal to the starting or ending positions
00415     /// \param endPosition 
00416     /// Input ending position of the arc
00417     /// 
00418     /// \return
00419     /// Returns a CircularArcSegment
00420     /// 
00421     FDO_GEOM_API virtual FdoICircularArcSegment* CreateCircularArcSegment(
00422         FdoIDirectPosition* startPosition,
00423         FdoIDirectPosition* midPosition,
00424         FdoIDirectPosition* endPosition);
00425 
00426     /// CurveString
00427 
00428     /// \brief
00429     ///  Creates a CurveString object by copying from a collection of CurveSegment objects.
00430     /// 
00431     /// \param curveSegments 
00432     /// Input collection of CurveSegment objects to copy
00433     /// 
00434     /// \return
00435     /// Returns a CurveString
00436     /// 
00437     FDO_GEOM_API virtual FdoICurveString* CreateCurveString(
00438         FdoCurveSegmentCollection* curveSegments);
00439 
00440     /// MultiCurveString
00441 
00442     /// \brief
00443     ///  Creates a MultiCurveString object by copying from a collection of CurveString objects.
00444     /// 
00445     /// \param curveStrings 
00446     /// Input collection of CurveString objects to copy
00447     /// 
00448     /// \return
00449     /// Returns a MultiCurveString
00450     /// 
00451     FDO_GEOM_API virtual FdoIMultiCurveString* CreateMultiCurveString(
00452         FdoCurveStringCollection* curveStrings);
00453 
00454     /// Ring
00455 
00456     /// \brief
00457     ///  Creates a ring object by copying from a collection of CurveSegment objects.
00458     /// 
00459     /// \param curveSegments 
00460     /// Input collection of CurveSegment objects to copy
00461     /// 
00462     /// \return
00463     /// Returns a Ring
00464     /// 
00465     FDO_GEOM_API virtual FdoIRing* CreateRing(
00466         FdoCurveSegmentCollection* curveSegments);
00467 
00468     /// CurvePolygon
00469 
00470     /// \brief
00471     ///  Creates a CurvePolygon object by copying from given ring objects.
00472     /// 
00473     /// \param exteriorRing 
00474     /// Input exterior ring to copy
00475     /// \param interiorRings 
00476     /// Input collection of interior rings to copy
00477     /// 
00478     /// \return
00479     /// Returns a CurvePolygon
00480     /// 
00481     FDO_GEOM_API virtual FdoICurvePolygon* CreateCurvePolygon(
00482         FdoIRing* exteriorRing,
00483         FdoRingCollection* interiorRings);
00484 
00485     /// MultiCurvePolygon
00486 
00487     /// \brief
00488     ///  Creates a MultiCurvePolygon object by copying from a collection of CurvePolygon objects.
00489     /// 
00490     /// \param curvePolygons 
00491     /// Input collection of CurvePolygon objects to copy
00492     /// 
00493     /// \return
00494     /// Returns a MultiCurvePolygon
00495     /// 
00496     FDO_GEOM_API virtual FdoIMultiCurvePolygon* CreateMultiCurvePolygon(
00497         FdoCurvePolygonCollection* curvePolygons);
00498 
00499     /// MultiGeometry
00500 
00501     /// \brief
00502     ///  Creates a MultiGeometry object by copying from a collection of Geometry objects.
00503     /// 
00504     /// \param geometries 
00505     /// Input collection of Geometry objects to copy
00506     /// 
00507     /// \return
00508     /// Returns a MultiGeometry
00509     /// 
00510     FDO_GEOM_API virtual FdoIMultiGeometry* CreateMultiGeometry(
00511         FdoGeometryCollection* geometries);
00512 
00513     /// Get an empty (possibly pooled) byte array.
00514     FDO_GEOM_API virtual FdoByteArray * GetByteArray();
00515 
00516     /// Pool this array, released from some geometry.
00517     FDO_GEOM_API virtual void TakeReleasedByteArray(FdoByteArray * byteArray);
00518 
00519 protected:
00520 /// \cond DOXYGEN-IGNORE
00521     FdoFgfGeometryFactory2 *         m_private;
00522 /// \endcond
00523 
00524     FDO_GEOM_API void Dispose();
00525 
00526 /// \cond DOXYGEN-IGNORE
00527     /// Union of public CreateGeometryFromFgf methods. One of byteArray or byteArrayData must be non-NULL.
00528     FdoIGeometry * CreateGeometryFromFgf(FdoByteArray * byteArray, const FdoByte * byteArrayData, FdoInt32 count);
00529 /// \endcond
00530 
00531     /// \brief
00532     /// Constructs a default instance of a FdoFgfGeometryFactory.
00533     /// 
00534     /// \return
00535     /// Returns nothing
00536     /// 
00537     FDO_GEOM_API FdoFgfGeometryFactory();
00538 
00539     /// \brief
00540     /// Default destructor.
00541     /// 
00542     /// \return
00543     /// Returns nothing
00544     /// 
00545     FDO_GEOM_API ~FdoFgfGeometryFactory();
00546 
00547 };
00548 #endif
00549 
00550 

Comments or suggestions? Send us feedback.