📄 ogrfeaturedefn.cpp
字号:
/* AddFieldDefn() *//************************************************************************//** * Add a new field definition. * * This method should only be called while there are no OGRFeature * objects in existance based on this OGRFeatureDefn. The OGRFieldDefn * passed in is copied, and remains the responsibility of the caller. * * This method is the same as the C function OGR_FD_AddFieldDefn(). * * @param poNewDefn the definition of the new field. */void OGRFeatureDefn::AddFieldDefn( OGRFieldDefn * poNewDefn ){ papoFieldDefn = (OGRFieldDefn **) CPLRealloc( papoFieldDefn, sizeof(void*)*(nFieldCount+1) ); papoFieldDefn[nFieldCount] = new OGRFieldDefn( poNewDefn ); nFieldCount++;}/************************************************************************//* OGR_FD_AddFieldDefn() *//************************************************************************//** * Add a new field definition to the passed feature definition. * * This function should only be called while there are no OGRFeature * objects in existance based on this OGRFeatureDefn. The OGRFieldDefn * passed in is copied, and remains the responsibility of the caller. * * This function is the same as the CPP method OGRFeatureDefn::AddFieldDefn. * * @param hDefn handle to the feature definition to add the field definition * to. * @param hNewField handle to the new field definition. */void OGR_FD_AddFieldDefn( OGRFeatureDefnH hDefn, OGRFieldDefnH hNewField ){ ((OGRFeatureDefn *) hDefn)->AddFieldDefn( (OGRFieldDefn *) hNewField );}/************************************************************************//* GetGeomType() *//************************************************************************//** * Fetch the geometry base type. * * This method is the same as the C function OGR_FD_GetGeomType(). * * @return the base type for all geometry related to this definition. *//************************************************************************//* OGR_FD_GetGeomType() *//************************************************************************//** * Fetch the geometry base type of the passed feature definition. * * This function is the same as the CPP method OGRFeatureDefn::GetGeomType(). * * @param hDefn handle to the feature definition to get the geometry type from. * @return the base type for all geometry related to this definition. */OGRwkbGeometryType OGR_FD_GetGeomType( OGRFieldDefnH hDefn ){ return ((OGRFeatureDefn *) hDefn)->GetGeomType();}/************************************************************************//* SetGeomType() *//************************************************************************//** * Assign the base geometry type for this layer. * * All geometry objects using this type must be of the defined type or * a derived type. The default upon creation is wkbUnknown which allows for * any geometry type. The geometry type should generally not be changed * after any OGRFeatures have been created against this definition. * * This method is the same as the C function OGR_FD_SetGeomType(). * * @param eNewType the new type to assign. */void OGRFeatureDefn::SetGeomType( OGRwkbGeometryType eNewType ){ eGeomType = eNewType;}/************************************************************************//* OGR_FD_SetGeomType() *//************************************************************************//** * Assign the base geometry type for the passed layer (the same as the * feature definition). * * All geometry objects using this type must be of the defined type or * a derived type. The default upon creation is wkbUnknown which allows for * any geometry type. The geometry type should generally not be changed * after any OGRFeatures have been created against this definition. * * This function is the same as the CPP method OGRFeatureDefn::SetGeomType(). * * @param hDefn handle to the layer or feature definition to set the geometry * type to. * @param eType the new type to assign. */void OGR_FD_SetGeomType( OGRFeatureDefnH hDefn, OGRwkbGeometryType eType ){ ((OGRFeatureDefn *) hDefn)->SetGeomType( eType );}/************************************************************************//* Reference() *//************************************************************************//** * \fn int OGRFeatureDefn::Reference(); * * Increments the reference count by one. * * The reference count is used keep track of the number of OGRFeature * objects referencing this definition. * * This method is the same as the C function OGR_FD_Reference(). * * @return the updated reference count. *//************************************************************************//* OGR_FD_Reference() *//************************************************************************//** * Increments the reference count by one. * * The reference count is used keep track of the number of OGRFeature * objects referencing this definition. * * This function is the same as the CPP method OGRFeatureDefn::Reference(). * * @param hDefn handle to the feature definition on witch OGRFeature are * based on. * @return the updated reference count. */int OGR_FD_Reference( OGRFeatureDefnH hDefn ){ return ((OGRFeatureDefn *) hDefn)->Reference();}/************************************************************************//* Dereference() *//************************************************************************//** * \fn int OGRFeatureDefn::Dereference(); * * Decrements the reference count by one. * * This method is the same as the C function OGR_FD_Dereference(). * * @return the updated reference count. *//************************************************************************//* OGR_FD_Dereference() *//************************************************************************//** * Decrements the reference count by one. * * This function is the same as the CPP method OGRFeatureDefn::Dereference(). * * @param hDefn handle to the feature definition on witch OGRFeature are * based on. * @return the updated reference count. */int OGR_FD_Dereference( OGRFeatureDefnH hDefn ){ return ((OGRFeatureDefn *) hDefn)->Dereference();}/************************************************************************//* GetReferenceCount() *//************************************************************************//** * \fn int OGRFeatureDefn::GetReferenceCount(); * * Fetch current reference count. * * This method is the same as the C function OGR_FD_GetReferenceCount(). * * @return the current reference count. *//************************************************************************//* OGR_FD_GetReferenceCount() *//************************************************************************//** * Fetch current reference count. * * This function is the same as the CPP method * OGRFeatureDefn::GetReferenceCount(). * * @param hDefn hanlde to the feature definition on witch OGRFeature are * based on. * @return the current reference count. */int OGR_FD_GetReferenceCount( OGRFeatureDefnH hDefn ){ return ((OGRFeatureDefn *) hDefn)->GetReferenceCount();}/************************************************************************//* GetFieldIndex() *//************************************************************************//** * Find field by name. * * The field index of the first field matching the passed field name (case * insensitively) is returned. * * This method is the same as the C function OGR_FD_GetFieldIndex(). * * @param pszFieldName the field name to search for. * * @return the field index, or -1 if no match found. */ int OGRFeatureDefn::GetFieldIndex( const char * pszFieldName ){ for( int i = 0; i < nFieldCount; i++ ) { if( EQUAL(pszFieldName, papoFieldDefn[i]->GetNameRef() ) ) return i; } return -1;}/************************************************************************//* OGR_FD_GetFieldIndex() *//************************************************************************//** * Find field by name. * * The field index of the first field matching the passed field name (case * insensitively) is returned. * * This function is the same as the CPP method OGRFeatureDefn::GetFieldIndex. * * @param hDefn handle to the feature definition to get field index from. * @param pszFieldName the field name to search for. * * @return the field index, or -1 if no match found. */int OGR_FD_GetFieldIndex( OGRFeatureDefnH hDefn, const char *pszFieldName ){ return ((OGRFeatureDefn *)hDefn)->GetFieldIndex( pszFieldName );}/************************************************************************//* CreateFeatureDefn() *//************************************************************************/OGRFeatureDefn *OGRFeatureDefn::CreateFeatureDefn( const char *pszName ){ return new OGRFeatureDefn( pszName );}/************************************************************************//* DestroyFeatureDefn() *//************************************************************************/void OGRFeatureDefn::DestroyFeatureDefn( OGRFeatureDefn *poDefn ){ delete poDefn;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -