LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/gml - gmlreader.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 19 18 94.7 %
Date: 2010-01-09 Functions: 19 18 94.7 %

       1                 : /******************************************************************************
       2                 :  * $Id: gmlreader.h 17629 2009-09-10 14:51:45Z chaitanya $
       3                 :  *
       4                 :  * Project:  GML Reader
       5                 :  * Purpose:  Public Declarations for OGR free GML Reader code.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2002, Frank Warmerdam
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  * 
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  * 
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      22                 :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef _GMLREADER_H_INCLUDED
      31                 : #define _GMLREADER_H_INCLUDED
      32                 : 
      33                 : #include "cpl_port.h"
      34                 : #include "cpl_minixml.h"
      35                 : 
      36                 : typedef enum {
      37                 :     GMLPT_Untyped = 0,
      38                 :     GMLPT_String = 1,
      39                 :     GMLPT_Integer = 2,
      40                 :     GMLPT_Real = 3,
      41                 :     GMLPT_Complex = 4,
      42                 :     GMLPT_StringList = 5,
      43                 :     GMLPT_IntegerList = 6, 
      44                 :     GMLPT_RealList = 7
      45                 : } GMLPropertyType;
      46                 : 
      47                 : /************************************************************************/
      48                 : /*                           GMLPropertyDefn                            */
      49                 : /************************************************************************/
      50                 : class CPL_DLL GMLPropertyDefn
      51                 : {
      52                 :     char             *m_pszName;
      53                 :     GMLPropertyType   m_eType;
      54                 :     int               m_nWidth;
      55                 :     int               m_nPrecision;
      56                 :     char             *m_pszSrcElement;
      57                 : 
      58                 : public:
      59                 :     
      60                 :         GMLPropertyDefn( const char *pszName, const char *pszSrcElement=NULL );
      61                 :        ~GMLPropertyDefn();
      62                 : 
      63              70 :     const char *GetName() const { return m_pszName; } 
      64                 : 
      65             155 :     GMLPropertyType GetType() const { return m_eType; } 
      66              28 :     void        SetType( GMLPropertyType eType ) { m_eType = eType; }
      67              33 :     void        SetWidth( int nWidth) { m_nWidth = nWidth; }
      68             114 :     int         GetWidth() { return m_nWidth; }
      69               3 :     void        SetPrecision( int nPrecision) { m_nPrecision = nPrecision; }
      70              51 :     int         GetPrecision() { return m_nPrecision; }
      71                 :     void        SetSrcElement( const char *pszSrcElement );
      72             696 :     const char *GetSrcElement() { return m_pszSrcElement; }
      73                 : 
      74                 :     void        AnalysePropertyValue( const char *pszValue, 
      75                 :                                       const char *pszOldValue = NULL );
      76                 : };
      77                 : 
      78                 : /************************************************************************/
      79                 : /*                           GMLFeatureClass                            */
      80                 : /************************************************************************/
      81                 : class CPL_DLL GMLFeatureClass
      82                 : {
      83                 :     char        *m_pszName;
      84                 :     char        *m_pszElementName;
      85                 :     char        *m_pszGeometryElement;
      86                 :     int         m_nPropertyCount;
      87                 :     GMLPropertyDefn **m_papoProperty;
      88                 : 
      89                 :     int         m_bSchemaLocked;
      90                 : 
      91                 :     int         m_nFeatureCount;
      92                 : 
      93                 :     char        *m_pszExtraInfo;
      94                 : 
      95                 :     int         m_bHaveExtents;
      96                 :     double      m_dfXMin;
      97                 :     double      m_dfXMax;
      98                 :     double      m_dfYMin;
      99                 :     double      m_dfYMax;
     100                 : 
     101                 :     int         m_nGeometryType;
     102                 : 
     103                 : public:
     104                 :             GMLFeatureClass( const char *pszName = "" );
     105                 :            ~GMLFeatureClass();
     106                 : 
     107                 :     const char *GetElementName() const;
     108                 :     void        SetElementName( const char *pszElementName );
     109                 : 
     110               8 :     const char *GetGeometryElement() const { return m_pszGeometryElement; }
     111                 :     void        SetGeometryElement( const char *pszElementName );
     112                 : 
     113              39 :     const char *GetName() const { return m_pszName; } 
     114            1691 :     int         GetPropertyCount() const { return m_nPropertyCount; }
     115                 :     GMLPropertyDefn *GetProperty( int iIndex ) const;
     116                 :     int GetPropertyIndex( const char *pszName ) const;
     117                 :     GMLPropertyDefn *GetProperty( const char *pszName ) const 
     118                 :         { return GetProperty( GetPropertyIndex(pszName) ); }
     119                 : 
     120                 :     int         AddProperty( GMLPropertyDefn * );
     121                 : 
     122             436 :     int         IsSchemaLocked() const { return m_bSchemaLocked; }
     123               7 :     void        SetSchemaLocked( int bLock ) { m_bSchemaLocked = bLock; }
     124                 : 
     125                 :     const char  *GetExtraInfo();
     126                 :     void        SetExtraInfo( const char * );
     127                 : 
     128                 :     int         GetFeatureCount();
     129                 :     void        SetFeatureCount( int );
     130                 : 
     131                 :     void        SetExtents( double dfXMin, double dfXMax, 
     132                 :                             double dFYMin, double dfYMax );
     133                 :     int         GetExtents( double *pdfXMin, double *pdfXMax, 
     134                 :                             double *pdFYMin, double *pdfYMax );
     135                 : 
     136               8 :     int         GetGeometryType() const { return m_nGeometryType; }
     137               0 :     void        SetGeometryType( int nNewType ) { m_nGeometryType = nNewType; }
     138                 : 
     139                 :     CPLXMLNode *SerializeToXML();
     140                 :     int         InitializeFromXML( CPLXMLNode * );
     141                 : };
     142                 : 
     143                 : /************************************************************************/
     144                 : /*                              GMLFeature                              */
     145                 : /************************************************************************/
     146                 : class CPL_DLL GMLFeature
     147                 : {
     148                 :     GMLFeatureClass *m_poClass;
     149                 :     char            *m_pszFID;
     150                 : 
     151                 :     int              m_nPropertyCount;
     152                 :     char           **m_papszProperty;
     153                 : 
     154                 :     char            *m_pszGeometry;
     155                 : 
     156                 :     // string list of named non-schema properties - used by NAS driver.
     157                 :     char           **m_papszOBProperties; 
     158                 :     
     159                 : public:
     160                 :                     GMLFeature( GMLFeatureClass * );
     161                 :                    ~GMLFeature();
     162                 : 
     163             526 :     GMLFeatureClass*GetClass() const { return m_poClass; }
     164                 : 
     165                 :     void            SetGeometryDirectly( char * );
     166             128 :     const char     *GetGeometry() const { return m_pszGeometry; }
     167                 : 
     168                 :     void            SetProperty( int i, const char *pszValue );
     169                 :     void            SetProperty( const char *pszName, const char *pszValue )
     170                 :         { SetProperty( m_poClass->GetPropertyIndex(pszName), pszValue ); }
     171                 : 
     172                 :     const char      *GetProperty( int i ) const;
     173                 :     const char      *GetProperty( const char *pszName ) const
     174                 :         { return GetProperty( m_poClass->GetPropertyIndex(pszName) ); }
     175                 : 
     176              32 :     const char      *GetFID() const { return m_pszFID; }
     177                 :     void             SetFID( const char *pszFID );
     178                 : 
     179                 :     void             Dump( FILE *fp );
     180                 : 
     181                 :     // Out of Band property handling - special stuff like relations for NAS.
     182                 :     void             AddOBProperty( const char *pszName, const char *pszValue );
     183                 :     const char      *GetOBProperty( const char *pszName );
     184                 :     char           **GetOBProperties();
     185                 : };
     186                 : 
     187                 : /************************************************************************/
     188                 : /*                              IGMLReader                              */
     189                 : /************************************************************************/
     190                 : class CPL_DLL IGMLReader
     191              17 : {
     192                 : public:
     193                 :     virtual     ~IGMLReader();
     194                 : 
     195                 :     virtual int  IsClassListLocked() const = 0;
     196                 :     virtual void SetClassListLocked( int bFlag ) = 0;
     197                 : 
     198                 :     virtual void SetSourceFile( const char *pszFilename ) = 0;
     199                 : 
     200                 :     virtual int  GetClassCount() const = 0;
     201                 :     virtual GMLFeatureClass *GetClass( int i ) const = 0;
     202                 :     virtual GMLFeatureClass *GetClass( const char *pszName ) const = 0;
     203                 : 
     204                 :     virtual int        AddClass( GMLFeatureClass *poClass ) = 0;
     205                 :     virtual void       ClearClasses() = 0;
     206                 : 
     207                 :     virtual GMLFeature *NextFeature() = 0;
     208                 :     virtual void       ResetReading() = 0;
     209                 : 
     210                 :     virtual int  LoadClasses( const char *pszFile = NULL ) = 0;
     211                 :     virtual int  SaveClasses( const char *pszFile = NULL ) = 0;
     212                 : 
     213                 :     virtual int  ParseXSD( const char *pszFile ) = 0;
     214                 : 
     215                 :     virtual int PrescanForSchema( int bGetExtents = TRUE ) = 0;
     216                 : 
     217                 :     virtual int HasStoppedParsing() = 0;
     218                 : };
     219                 : 
     220                 : IGMLReader *CreateGMLReader();
     221                 : 
     222                 : 
     223                 : #endif /* _GMLREADER_H_INCLUDED */

Generated by: LCOV version 1.7