LCOV - code coverage report
Current view: directory - ogr - ogr_geometry.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 13 13 100.0 %
Date: 2010-01-09 Functions: 17 16 94.1 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_geometry.h 18155 2009-12-02 15:27:29Z warmerdam $
       3                 :  *
       4                 :  * Project:  OpenGIS Simple Features Reference Implementation
       5                 :  * Purpose:  Classes for manipulating simple features that is not specific
       6                 :  *           to a particular interface technology.
       7                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       8                 :  *
       9                 :  ******************************************************************************
      10                 :  * Copyright (c) 1999, Frank Warmerdam
      11                 :  *
      12                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      13                 :  * copy of this software and associated documentation files (the "Software"),
      14                 :  * to deal in the Software without restriction, including without limitation
      15                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      16                 :  * and/or sell copies of the Software, and to permit persons to whom the
      17                 :  * Software is furnished to do so, subject to the following conditions:
      18                 :  *
      19                 :  * The above copyright notice and this permission notice shall be included
      20                 :  * in all copies or substantial portions of the Software.
      21                 :  *
      22                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      23                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      25                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      27                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      28                 :  * DEALINGS IN THE SOFTWARE.
      29                 :  ****************************************************************************/
      30                 : 
      31                 : #ifndef _OGR_GEOMETRY_H_INCLUDED
      32                 : #define _OGR_GEOMETRY_H_INCLUDED
      33                 : 
      34                 : #include "ogr_core.h"
      35                 : #include "ogr_spatialref.h"
      36                 : 
      37                 : /**
      38                 :  * \file ogr_geometry.h
      39                 :  *
      40                 :  * Simple feature geometry classes.
      41                 :  */
      42                 : 
      43                 : /**
      44                 :  * Simple container for a position.
      45                 :  */
      46                 : class OGRRawPoint
      47                 : {
      48                 :   public:
      49                 :           OGRRawPoint()
      50                 :           {
      51                 :                   x = y = 0.0;
      52                 :           }
      53                 :     double      x;
      54                 :     double      y;
      55                 : };
      56                 : 
      57                 : typedef struct GEOSGeom_t *GEOSGeom;
      58                 : 
      59                 : /************************************************************************/
      60                 : /*                             OGRGeometry                              */
      61                 : /************************************************************************/
      62                 : 
      63                 : /**
      64                 :  * Abstract base class for all geometry classes.
      65                 :  *
      66                 :  * Note that the family of spatial analysis methods (Equal(), Disjoint(), ...,
      67                 :  * ConvexHull(), Buffer(), ...) are not implemented at ths time.  Some other
      68                 :  * required and optional geometry methods have also been omitted at this
      69                 :  * time.
      70                 :  *
      71                 :  * Some spatial analysis methods require that OGR is built on the GEOS library
      72                 :  * to work properly. The precise meaning of methods that describe spatial relationships
      73                 :  * between geometries is described in the SFCOM, or other simple features interface
      74                 :  * specifications, like "OpenGISĀ® Implementation Specification for
      75                 :  * Geographic information - Simple feature access - Part 1: Common architecture"
      76                 :  * (<a href="http://www.opengeospatial.org/standards/sfa">OGC 06-103r3</a>)
      77                 :  *
      78                 :  */
      79                 :  
      80                 : class CPL_DLL OGRGeometry
      81                 : {
      82                 :   private:
      83                 :     OGRSpatialReference * poSRS;                // may be NULL
      84                 : 
      85                 :   protected:
      86                 :     int                   nCoordDimension;
      87                 :     
      88                 :   public:
      89                 :                 OGRGeometry();
      90                 :     virtual     ~OGRGeometry();
      91                 :                         
      92                 :     // standard IGeometry
      93                 :     virtual int getDimension() const = 0;
      94                 :     virtual int getCoordinateDimension() const;
      95                 :     virtual OGRBoolean  IsEmpty() const = 0; 
      96                 :     virtual OGRBoolean  IsValid() const;
      97                 :     virtual OGRBoolean  IsSimple() const;
      98                 :     virtual OGRBoolean  IsRing() const;
      99                 :     virtual void        empty() = 0;
     100                 :     virtual OGRGeometry *clone() const = 0;
     101                 :     virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
     102                 : 
     103                 :     // IWks Interface
     104                 :     virtual int WkbSize() const = 0;
     105                 :     virtual OGRErr importFromWkb( unsigned char *, int=-1 )=0;
     106                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const = 0;
     107                 :     virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
     108                 :     virtual OGRErr exportToWkt( char ** ppszDstText ) const = 0;
     109                 :     
     110                 :     // non-standard
     111                 :     virtual OGRwkbGeometryType getGeometryType() const = 0;
     112                 :     virtual const char *getGeometryName() const = 0;
     113                 :     virtual void   dumpReadable( FILE *, const char * = NULL, char** papszOptions = NULL ) const;
     114                 :     virtual void   flattenTo2D() = 0;
     115                 :     virtual char * exportToGML() const;
     116                 :   virtual char * exportToKML() const;
     117                 :     virtual char * exportToJson() const;
     118                 :     virtual GEOSGeom exportToGEOS() const;
     119                 :     virtual void closeRings();
     120                 : 
     121                 :     virtual void setCoordinateDimension( int nDimension ); 
     122                 : 
     123                 :     void    assignSpatialReference( OGRSpatialReference * poSR );
     124           17186 :     OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
     125                 : 
     126                 :     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) = 0;
     127                 :     OGRErr  transformTo( OGRSpatialReference *poSR );
     128                 :     
     129                 :     virtual void segmentize(double dfMaxLength);
     130                 : 
     131                 :     // ISpatialRelation
     132                 :     virtual OGRBoolean  Intersects( OGRGeometry * ) const;
     133                 :     virtual OGRBoolean  Equals( OGRGeometry * ) const = 0;
     134                 :     virtual OGRBoolean  Disjoint( const OGRGeometry * ) const;
     135                 :     virtual OGRBoolean  Touches( const OGRGeometry * ) const;
     136                 :     virtual OGRBoolean  Crosses( const OGRGeometry * ) const;
     137                 :     virtual OGRBoolean  Within( const OGRGeometry * ) const;
     138                 :     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
     139                 :     virtual OGRBoolean  Overlaps( const OGRGeometry * ) const;
     140                 : //    virtual OGRBoolean  Relate( const OGRGeometry *, const char * ) const;
     141                 : 
     142                 :     virtual OGRGeometry *getBoundary() const;
     143                 :     virtual double  Distance( const OGRGeometry * ) const;
     144                 :     virtual OGRGeometry *ConvexHull() const;
     145                 :     virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 ) const;
     146                 :     virtual OGRGeometry *Intersection( const OGRGeometry *) const;
     147                 :     virtual OGRGeometry *Union( const OGRGeometry * ) const;
     148                 :     virtual OGRGeometry *Difference( const OGRGeometry * ) const;
     149                 :     virtual OGRGeometry *SymmetricDifference( const OGRGeometry * ) const;
     150                 : 
     151                 :     // backward compatibility methods. 
     152                 :     OGRBoolean  Intersect( OGRGeometry * ) const;
     153                 :     OGRBoolean  Equal( OGRGeometry * ) const;
     154                 : 
     155                 :     // Special HACK for DB2 7.2 support
     156                 :     static int bGenerate_DB2_V72_BYTE_ORDER;
     157                 : };
     158                 : 
     159                 : /************************************************************************/
     160                 : /*                               OGRPoint                               */
     161                 : /************************************************************************/
     162                 : 
     163                 : /**
     164                 :  * Point class.
     165                 :  *
     166                 :  * Implements SFCOM IPoint methods.
     167                 :  */
     168                 : 
     169                 : class CPL_DLL OGRPoint : public OGRGeometry
     170                 : {
     171                 :     double      x;
     172                 :     double      y;
     173                 :     double      z;
     174                 : 
     175                 :   public:
     176                 :                 OGRPoint();
     177                 :                 OGRPoint( double x, double y );
     178                 :                 OGRPoint( double x, double y, double z );
     179                 :     virtual     ~OGRPoint();
     180                 : 
     181                 :     // IWks Interface
     182                 :     virtual int WkbSize() const;
     183                 :     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
     184                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
     185                 :     virtual OGRErr importFromWkt( char ** );
     186                 :     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
     187                 :     
     188                 :     // IGeometry
     189                 :     virtual int getDimension() const;
     190                 :     virtual OGRGeometry *clone() const;
     191                 :     virtual void empty();
     192                 :     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
     193                 :     virtual OGRBoolean  IsEmpty() const;
     194                 : 
     195                 :     // IPoint
     196           30623 :     double      getX() const { return x; } 
     197           30339 :     double      getY() const { return y; }
     198           29686 :     double      getZ() const { return z; }
     199                 : 
     200                 :     // Non standard
     201                 :     virtual void setCoordinateDimension( int nDimension ); 
     202             643 :     void        setX( double xIn ) { x = xIn; if (nCoordDimension == 0) nCoordDimension = 2; }
     203             643 :     void        setY( double yIn ) { y = yIn; if (nCoordDimension == 0) nCoordDimension = 2; }
     204              75 :     void        setZ( double zIn ) { z = zIn; nCoordDimension=3; }
     205                 : 
     206                 :     // ISpatialRelation
     207                 :     virtual OGRBoolean  Equals( OGRGeometry * ) const;
     208                 :     
     209                 :     // Non standard from OGRGeometry
     210                 :     virtual const char *getGeometryName() const;
     211                 :     virtual OGRwkbGeometryType getGeometryType() const;
     212                 :     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
     213                 :     virtual void flattenTo2D();
     214                 : };
     215                 : 
     216                 : /************************************************************************/
     217                 : /*                               OGRCurve                               */
     218                 : /************************************************************************/
     219                 : 
     220                 : /**
     221                 :  * Abstract curve base class.
     222                 :  */
     223                 : 
     224                 : class CPL_DLL OGRCurve : public OGRGeometry
     225                 : {
     226                 :   public:
     227                 :             OGRCurve();
     228                 :     virtual ~OGRCurve();
     229                 :     // ICurve methods
     230                 :     virtual double get_Length() const = 0;
     231                 :     virtual void StartPoint(OGRPoint *) const = 0;
     232                 :     virtual void EndPoint(OGRPoint *) const = 0;
     233                 :     virtual int  get_IsClosed() const;
     234                 :     virtual void Value( double, OGRPoint * ) const = 0;
     235                 : 
     236                 : };
     237                 : 
     238                 : /************************************************************************/
     239                 : /*                            OGRLineString                             */
     240                 : /************************************************************************/
     241                 : 
     242                 : /**
     243                 :  * Concrete representation of a multi-vertex line.
     244                 :  */
     245                 : 
     246                 : class CPL_DLL OGRLineString : public OGRCurve
     247                 : {
     248                 :   protected:
     249                 :     int         nPointCount;
     250                 :     OGRRawPoint *paoPoints;
     251                 :     double      *padfZ;
     252                 : 
     253                 :     void        Make3D();
     254                 :     void        Make2D();
     255                 : 
     256                 :   public:
     257                 :                 OGRLineString();
     258                 :     virtual     ~OGRLineString();
     259                 : 
     260                 :     // IWks Interface
     261                 :     virtual int WkbSize() const;
     262                 :     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
     263                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
     264                 :     virtual OGRErr importFromWkt( char ** );
     265                 :     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
     266                 : 
     267                 :     // IGeometry interface
     268                 :     virtual int getDimension() const;
     269                 :     virtual OGRGeometry *clone() const;
     270                 :     virtual void empty();
     271                 :     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
     272                 :     virtual OGRBoolean  IsEmpty() const;
     273                 : 
     274                 :     // ICurve methods
     275                 :     virtual double get_Length() const;
     276                 :     virtual void StartPoint(OGRPoint *) const;
     277                 :     virtual void EndPoint(OGRPoint *) const;
     278                 :     virtual void Value( double, OGRPoint * ) const;
     279                 :     
     280                 :     // ILineString methods
     281           17064 :     int         getNumPoints() const { return nPointCount; }
     282                 :     void        getPoint( int, OGRPoint * ) const;
     283          179721 :     double      getX( int i ) const { return paoPoints[i].x; }
     284          181151 :     double      getY( int i ) const { return paoPoints[i].y; }
     285                 :     double      getZ( int i ) const;
     286                 : 
     287                 :     // ISpatialRelation
     288                 :     virtual OGRBoolean  Equals( OGRGeometry * ) const;
     289                 :     
     290                 :     // non standard.
     291                 :     virtual void setCoordinateDimension( int nDimension ); 
     292                 :     void        setNumPoints( int );
     293                 :     void        setPoint( int, OGRPoint * );
     294                 :     void        setPoint( int, double, double );
     295                 :     void        setPoint( int, double, double, double );
     296                 :     void        setPoints( int, OGRRawPoint *, double * = NULL );
     297                 :     void        setPoints( int, double * padfX, double * padfY,
     298                 :                            double *padfZ = NULL );
     299                 :     void        addPoint( OGRPoint * );
     300                 :     void        addPoint( double, double );
     301                 :     void        addPoint( double, double, double );
     302                 : 
     303                 :     void        getPoints( OGRRawPoint *, double * = NULL ) const;
     304                 : 
     305                 :     void        addSubLineString( const OGRLineString *, 
     306                 :                                   int nStartVertex = 0, int nEndVertex = -1 );
     307                 : 
     308                 :     // non-standard from OGRGeometry
     309                 :     virtual OGRwkbGeometryType getGeometryType() const;
     310                 :     virtual const char *getGeometryName() const;
     311                 :     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
     312                 :     virtual void flattenTo2D();
     313                 :     virtual void segmentize(double dfMaxLength);
     314                 : };
     315                 : 
     316                 : /************************************************************************/
     317                 : /*                            OGRLinearRing                             */
     318                 : /************************************************************************/
     319                 : 
     320                 : /**
     321                 :  * Concrete representation of a closed ring.
     322                 :  *
     323                 :  * This class is functionally equivelent to an OGRLineString, but has a
     324                 :  * separate identity to maintain alignment with the OpenGIS simple feature
     325                 :  * data model.  It exists to serve as a component of an OGRPolygon.  
     326                 :  *
     327                 :  * The OGRLinearRing has no corresponding free standing well known binary
     328                 :  * representation, so importFromWkb() and exportToWkb() will not actually
     329                 :  * work.  There is a non-standard GDAL WKT representation though.
     330                 :  *
     331                 :  * Because OGRLinearRing is not a "proper" free standing simple features 
     332                 :  * object, it cannot be directly used on a feature via SetGeometry(), and
     333                 :  * cannot genearally be used with GEOS for operations like Intersects(). 
     334                 :  * Instead the polygon should be used, or the OGRLinearRing should be
     335                 :  * converted to an OGRLineString for such operations. 
     336                 :  */
     337                 : 
     338                 : class CPL_DLL OGRLinearRing : public OGRLineString
     339                 : {
     340                 :   private:
     341                 :     friend class OGRPolygon; 
     342                 :     
     343                 :     // These are not IWks compatible ... just a convenience for OGRPolygon.
     344                 :     virtual int _WkbSize( int b3D ) const;
     345                 :     virtual OGRErr _importFromWkb( OGRwkbByteOrder, int b3D,
     346                 :                                    unsigned char *, int=-1 );
     347                 :     virtual OGRErr _exportToWkb( OGRwkbByteOrder, int b3D, 
     348                 :                                  unsigned char * ) const;
     349                 :     
     350                 :   public:
     351                 :                         OGRLinearRing();
     352                 :                         OGRLinearRing( OGRLinearRing * );
     353                 :                         ~OGRLinearRing();
     354                 : 
     355                 :     // Non standard.
     356                 :     virtual const char *getGeometryName() const;
     357                 :     virtual OGRGeometry *clone() const;
     358                 :     virtual int isClockwise() const;
     359                 :     virtual void reverseWindingOrder();
     360                 :     virtual void closeRings();
     361                 :     virtual double get_Area() const;
     362                 :     OGRBoolean isPointInRing(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
     363                 :     OGRBoolean isPointOnRingBoundary(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
     364                 :     
     365                 :     // IWks Interface - Note this isnt really a first class object
     366                 :     // for the purposes of WKB form.  These methods always fail since this
     367                 :     // object cant be serialized on its own. 
     368                 :     virtual int WkbSize() const;
     369                 :     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
     370                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
     371                 : };
     372                 : 
     373                 : /************************************************************************/
     374                 : /*                              OGRSurface                              */
     375                 : /************************************************************************/
     376                 : 
     377                 : /**
     378                 :  * Abstract base class for 2 dimensional objects like polygons.
     379                 :  */
     380                 : 
     381                 : class CPL_DLL OGRSurface : public OGRGeometry
     382            7218 : {
     383                 :   public:
     384                 :     virtual double      get_Area() const = 0;
     385                 :     virtual OGRErr      Centroid( OGRPoint * poPoint ) const = 0;
     386                 :     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const = 0;
     387                 : };
     388                 : 
     389                 : /************************************************************************/
     390                 : /*                              OGRPolygon                              */
     391                 : /************************************************************************/
     392                 : 
     393                 : /**
     394                 :  * Concrete class representing polygons.
     395                 :  *
     396                 :  * Note that the OpenGIS simple features polygons consist of one outer
     397                 :  * ring, and zero or more inner rings.  A polygon cannot represent disconnected
     398                 :  * regions (such as multiple islands in a political body).  The
     399                 :  * OGRMultiPolygon must be used for this.
     400                 :  */
     401                 : 
     402                 : class CPL_DLL OGRPolygon : public OGRSurface
     403                 : {
     404                 :     int         nRingCount;
     405                 :     OGRLinearRing **papoRings;
     406                 :     
     407                 :   public:
     408                 :                 OGRPolygon();
     409                 :     virtual     ~OGRPolygon();
     410                 : 
     411                 :     // Non standard (OGRGeometry).
     412                 :     virtual const char *getGeometryName() const;
     413                 :     virtual OGRwkbGeometryType getGeometryType() const;
     414                 :     virtual OGRGeometry *clone() const;
     415                 :     virtual void empty();
     416                 :     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
     417                 :     virtual void flattenTo2D();
     418                 :     virtual OGRBoolean  IsEmpty() const;
     419                 :     virtual void segmentize(double dfMaxLength);
     420                 : 
     421                 :     // ISurface Interface
     422                 :     virtual double      get_Area() const;
     423                 :     virtual int         Centroid( OGRPoint * poPoint ) const;
     424                 :     virtual int         PointOnSurface( OGRPoint * poPoint ) const;
     425                 :     
     426                 :     // IWks Interface
     427                 :     virtual int WkbSize() const;
     428                 :     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
     429                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
     430                 :     virtual OGRErr importFromWkt( char ** );
     431                 :     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
     432                 : 
     433                 :     // IGeometry
     434                 :     virtual int getDimension() const;
     435                 :     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
     436                 : 
     437                 :     // ISpatialRelation
     438                 :     virtual OGRBoolean  Equals( OGRGeometry * ) const;
     439                 :     
     440                 :     // Non standard
     441                 :     virtual void setCoordinateDimension( int nDimension ); 
     442                 : 
     443                 :     void        addRing( OGRLinearRing * );
     444                 :     void        addRingDirectly( OGRLinearRing * );
     445                 : 
     446                 :     OGRLinearRing *getExteriorRing();
     447                 :     const OGRLinearRing *getExteriorRing() const;
     448                 :     int         getNumInteriorRings() const;
     449                 :     OGRLinearRing *getInteriorRing( int );
     450                 :     const OGRLinearRing *getInteriorRing( int ) const;
     451                 : 
     452                 :     OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
     453                 : 
     454                 :     virtual void closeRings();
     455                 : };
     456                 : 
     457                 : /************************************************************************/
     458                 : /*                        OGRGeometryCollection                         */
     459                 : /************************************************************************/
     460                 : 
     461                 : /**
     462                 :  * A collection of 1 or more geometry objects.
     463                 :  *
     464                 :  * All geometries must share a common spatial reference system, and
     465                 :  * Subclasses may impose additional restrictions on the contents.
     466                 :  */
     467                 : 
     468                 : class CPL_DLL OGRGeometryCollection : public OGRGeometry
     469                 : {
     470                 :     int         nGeomCount;
     471                 :     OGRGeometry **papoGeoms;
     472                 : 
     473                 :   public:
     474                 :                 OGRGeometryCollection();
     475                 :     virtual     ~OGRGeometryCollection();
     476                 : 
     477                 :     // Non standard (OGRGeometry).
     478                 :     virtual const char *getGeometryName() const;
     479                 :     virtual OGRwkbGeometryType getGeometryType() const;
     480                 :     virtual OGRGeometry *clone() const;
     481                 :     virtual void empty();
     482                 :     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
     483                 :     virtual void flattenTo2D();
     484                 :     virtual OGRBoolean  IsEmpty() const;
     485                 :     virtual void segmentize(double dfMaxLength);
     486                 : 
     487                 :     // IWks Interface
     488                 :     virtual int WkbSize() const;
     489                 :     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
     490                 :     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
     491                 :     virtual OGRErr importFromWkt( char ** );
     492                 :     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
     493                 : 
     494                 :     virtual double get_Area() const;
     495                 : 
     496                 :     // IGeometry methods
     497                 :     virtual int getDimension() const;
     498                 :     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
     499                 : 
     500                 :     // IGeometryCollection
     501                 :     int         getNumGeometries() const;
     502                 :     OGRGeometry *getGeometryRef( int );
     503                 :     const OGRGeometry *getGeometryRef( int ) const;
     504                 : 
     505                 :     // ISpatialRelation
     506                 :     virtual OGRBoolean  Equals( OGRGeometry * ) const;
     507                 :     
     508                 :     // Non standard
     509                 :     virtual void setCoordinateDimension( int nDimension ); 
     510                 :     virtual OGRErr addGeometry( const OGRGeometry * );
     511                 :     virtual OGRErr addGeometryDirectly( OGRGeometry * );
     512                 :     virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
     513                 : 
     514                 :     void closeRings();
     515                 : };
     516                 : 
     517                 : /************************************************************************/
     518                 : /*                           OGRMultiPolygon                            */
     519                 : /************************************************************************/
     520                 : 
     521                 : /**
     522                 :  * A collection of non-overlapping OGRPolygons.
     523                 :  *
     524                 :  * Note that the IMultiSurface class hasn't been modelled, nor have any
     525                 :  * of it's methods. 
     526                 :  */
     527                 : 
     528                 : class CPL_DLL OGRMultiPolygon : public OGRGeometryCollection
     529             448 : {
     530                 :   public:
     531                 :             OGRMultiPolygon();
     532                 :     // Non standard (OGRGeometry).
     533                 :     virtual const char *getGeometryName() const;
     534                 :     virtual OGRwkbGeometryType getGeometryType() const;
     535                 :     virtual OGRGeometry *clone() const;
     536                 :     virtual OGRErr importFromWkt( char ** );
     537                 :     virtual OGRErr exportToWkt( char ** ) const;
     538                 :     
     539                 :     // Non standard
     540                 :     virtual OGRErr addGeometryDirectly( OGRGeometry * );
     541                 : 
     542                 :     virtual double  get_Area() const;
     543                 : };
     544                 : 
     545                 : /************************************************************************/
     546                 : /*                            OGRMultiPoint                             */
     547                 : /************************************************************************/
     548                 : 
     549                 : /**
     550                 :  * A collection of OGRPoints.
     551                 :  */
     552                 : 
     553                 : class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
     554             200 : {
     555                 :   private:
     556                 :     OGRErr  importFromWkt_Bracketed( char ** );
     557                 : 
     558                 :   public:
     559                 :             OGRMultiPoint();
     560                 :     // Non standard (OGRGeometry).
     561                 :     virtual const char *getGeometryName() const;
     562                 :     virtual OGRwkbGeometryType getGeometryType() const;
     563                 :     virtual OGRGeometry *clone() const;
     564                 :     virtual OGRErr importFromWkt( char ** );
     565                 :     virtual OGRErr exportToWkt( char ** ) const;
     566                 :     
     567                 :     // Non standard
     568                 :     virtual OGRErr addGeometryDirectly( OGRGeometry * );
     569                 : };
     570                 : 
     571                 : /************************************************************************/
     572                 : /*                          OGRMultiLineString                          */
     573                 : /************************************************************************/
     574                 : 
     575                 : /**
     576                 :  * A collection of OGRLineStrings.
     577                 :  */
     578                 : 
     579                 : class CPL_DLL OGRMultiLineString : public OGRGeometryCollection
     580                 : {
     581                 :   public:
     582                 :             OGRMultiLineString();
     583                 :             ~OGRMultiLineString();
     584                 :     // Non standard (OGRGeometry).
     585                 :     virtual const char *getGeometryName() const;
     586                 :     virtual OGRwkbGeometryType getGeometryType() const;
     587                 :     virtual OGRGeometry *clone() const;
     588                 :     virtual OGRErr importFromWkt( char ** );
     589                 :     virtual OGRErr exportToWkt( char ** ) const;
     590                 :     
     591                 :     // Non standard
     592                 :     virtual OGRErr addGeometryDirectly( OGRGeometry * );
     593                 : };
     594                 : 
     595                 : 
     596                 : /************************************************************************/
     597                 : /*                          OGRGeometryFactory                          */
     598                 : /************************************************************************/
     599                 : 
     600                 : /**
     601                 :  * Create geometry objects from well known text/binary.
     602                 :  */
     603                 : 
     604                 : class CPL_DLL OGRGeometryFactory
     605                 : {
     606                 :   public:
     607                 :     static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
     608                 :                                  OGRGeometry **, int = -1 );
     609                 :     static OGRErr createFromWkt( char **, OGRSpatialReference *,
     610                 :                                  OGRGeometry ** );
     611                 :     static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
     612                 :                                  OGRGeometry **, int = -1, int * = NULL );
     613                 :     static OGRGeometry *createFromGML( const char * );
     614                 :     static OGRGeometry *createFromGEOS( GEOSGeom );
     615                 : 
     616                 :     static void   destroyGeometry( OGRGeometry * );
     617                 :     static OGRGeometry *createGeometry( OGRwkbGeometryType );
     618                 : 
     619                 :     static OGRGeometry * forceToPolygon( OGRGeometry * );
     620                 :     static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
     621                 :     static OGRGeometry * forceToMultiPoint( OGRGeometry * );
     622                 :     static OGRGeometry * forceToMultiLineString( OGRGeometry * );
     623                 : 
     624                 :     static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
     625                 :                                            int nPolygonCount,
     626                 :                                            int *pbResultValidGeometry,
     627                 :                                            const char **papszOptions = NULL);
     628                 : 
     629                 :     static void *getGEOSGeometryFactory();
     630                 : 
     631                 :     static int haveGEOS();
     632                 : 
     633                 :     static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
     634                 :                                               OGRCoordinateTransformation *poCT,
     635                 :                                               char** papszOptions );
     636                 : 
     637                 :     static OGRGeometry* 
     638                 :         approximateArcAngles( double dfX, double dfY, double dfZ,
     639                 :                               double dfPrimaryRadius, double dfSecondaryAxis, 
     640                 :                               double dfRotation, 
     641                 :                               double dfStartAngle, double dfEndAngle,
     642                 :                               double dfMaxAngleStepSizeDegrees );
     643                 : };
     644                 : 
     645                 : #endif /* ndef _OGR_GEOMETRY_H_INCLUDED */

Generated by: LCOV version 1.7