OGRFeature的DestroyFeature方法
Ogr的销毁DestroyFeature方法:
1 void OGRFeature::DestroyFeature( OGRFeature *poFeature ) 2 { 3 delete poFeature; 4 }
析构函数中删除了几何对象和空间参考定义, ogrfeature.cpp文件中查看:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 OGRFeature::~OGRFeature() 2 3 { 4 if( poGeometry != NULL ) 5 delete poGeometry; 6 7 for( int i = 0; i < poDefn->GetFieldCount(); i++ ) 8 { 9 OGRFieldDefn *poFDefn = poDefn->GetFieldDefn(i); 10 11 if( !IsFieldSet(i) ) 12 continue; 13 14 switch( poFDefn->GetType() ) 15 { 16 case OFTString: 17 if( pauFields[i].String != NULL ) 18 VSIFree( pauFields[i].String ); 19 break; 20 21 case OFTBinary: 22 if( pauFields[i].Binary.paData != NULL ) 23 VSIFree( pauFields[i].Binary.paData ); 24 break; 25 26 case OFTStringList: 27 CSLDestroy( pauFields[i].StringList.paList ); 28 break; 29 30 case OFTIntegerList: 31 case OFTRealList: 32 CPLFree( pauFields[i].IntegerList.paList ); 33 break; 34 35 default: 36 // should add support for wide strings. 37 break; 38 } 39 } 40 41 poDefn->Release(); 42 43 CPLFree( pauFields ); 44 CPLFree(m_pszStyleString); 45 CPLFree(m_pszTmpFieldValue); 46 }
作者:太一吾鱼水
文章未经说明均属原创,学习笔记可能有大段的引用,一般会注明参考文献。
欢迎大家留言交流,转载请注明出处。