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

Comments or suggestions? Send us feedback.