📄 gmlfeatureclass.cpp
字号:
/********************************************************************** * $Id: gmlfeatureclass.cpp,v 1.5 2003/09/11 20:01:21 warmerda Exp $ * * Project: GML Reader * Purpose: Implementation of GMLFeatureClass. * Author: Frank Warmerdam, warmerdam@pobox.com * ********************************************************************** * Copyright (c) 2002, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ********************************************************************** * * $Log: gmlfeatureclass.cpp,v $ * Revision 1.5 2003/09/11 20:01:21 warmerda * removed unused variable * * Revision 1.4 2003/05/21 03:48:35 warmerda * Expand tabs * * Revision 1.3 2002/03/06 20:07:35 warmerda * added tracking of extents, feature count and extrainfo * * Revision 1.2 2002/01/24 17:37:33 warmerda * added to/from XML support * * Revision 1.1 2002/01/04 19:46:30 warmerda * New * * **********************************************************************/#include "gmlreader.h"#include "cpl_conv.h"/************************************************************************//* GMLFeatureClass() *//************************************************************************/GMLFeatureClass::GMLFeatureClass( const char *pszName ){ m_pszName = CPLStrdup( pszName ); m_pszElementName = NULL; m_pszGeometryElement = NULL; m_nPropertyCount = 0; m_papoProperty = NULL; m_bSchemaLocked = FALSE; m_pszExtraInfo = NULL; m_bHaveExtents = FALSE; m_nFeatureCount = -1; // unknown}/************************************************************************//* ~GMLFeatureClass() *//************************************************************************/GMLFeatureClass::~GMLFeatureClass(){ CPLFree( m_pszName ); CPLFree( m_pszElementName ); CPLFree( m_pszGeometryElement ); for( int i = 0; i < m_nPropertyCount; i++ ) delete m_papoProperty[i]; CPLFree( m_papoProperty );}/************************************************************************//* GetProperty(int) *//************************************************************************/GMLPropertyDefn *GMLFeatureClass::GetProperty( int iIndex ) const{ if( iIndex < 0 || iIndex >= m_nPropertyCount ) return NULL; else return m_papoProperty[iIndex];}/************************************************************************//* GetPropertyIndex() *//************************************************************************/int GMLFeatureClass::GetPropertyIndex( const char *pszName ) const{ for( int i = 0; i < m_nPropertyCount; i++ ) if( EQUAL(pszName,m_papoProperty[i]->GetName()) ) return i; return -1;}/************************************************************************//* AddProperty() *//************************************************************************/int GMLFeatureClass::AddProperty( GMLPropertyDefn *poDefn ){ CPLAssert( GetProperty(poDefn->GetName()) == NULL ); m_nPropertyCount++; m_papoProperty = (GMLPropertyDefn **) CPLRealloc( m_papoProperty, sizeof(void*) * m_nPropertyCount ); m_papoProperty[m_nPropertyCount-1] = poDefn; return m_nPropertyCount-1;}/************************************************************************//* SetElementName() *//************************************************************************/void GMLFeatureClass::SetElementName( const char *pszElementName ){ CPLFree( m_pszElementName ); m_pszElementName = CPLStrdup( pszElementName );}/************************************************************************//* GetElementName() *//************************************************************************/const char *GMLFeatureClass::GetElementName() const{ if( m_pszElementName == NULL ) return m_pszName; else return m_pszElementName;}/************************************************************************//* SetGeometryElement() *//************************************************************************/void GMLFeatureClass::SetGeometryElement( const char *pszElement ){ CPLFree( m_pszGeometryElement ); m_pszGeometryElement = CPLStrdup( pszElement );}/************************************************************************//* GetFeatureCount() *//************************************************************************/int GMLFeatureClass::GetFeatureCount(){ return m_nFeatureCount;}/************************************************************************//* SetFeatureCount() *//************************************************************************/void GMLFeatureClass::SetFeatureCount( int nNewCount ){ m_nFeatureCount = nNewCount;}/************************************************************************//* GetExtraInfo() *//************************************************************************/const char *GMLFeatureClass::GetExtraInfo(){ return m_pszExtraInfo;}/************************************************************************//* SetExtraInfo() *//************************************************************************/void GMLFeatureClass::SetExtraInfo( const char *pszExtraInfo ){ CPLFree( m_pszExtraInfo ); m_pszExtraInfo = NULL; if( pszExtraInfo != NULL ) m_pszExtraInfo = CPLStrdup( pszExtraInfo );}/************************************************************************//* SetExtents() *//************************************************************************/void GMLFeatureClass::SetExtents( double dfXMin, double dfXMax, double dfYMin, double dfYMax ){ m_dfXMin = dfXMin; m_dfXMax = dfXMax; m_dfYMin = dfYMin; m_dfYMax = dfYMax; m_bHaveExtents = TRUE;}/************************************************************************//* GetExtents() *//************************************************************************/int GMLFeatureClass::GetExtents( double *pdfXMin, double *pdfXMax, double *pdfYMin, double *pdfYMax )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -