本文整理汇总了C++中OGRFeature::GetStyleString方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRFeature::GetStyleString方法的具体用法?C++ OGRFeature::GetStyleString怎么用?C++ OGRFeature::GetStyleString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRFeature
的用法示例。
在下文中一共展示了OGRFeature::GetStyleString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBlocksSection
void OGRDXFDataSource::ReadBlocksSection()
{
char szLineBuf[257];
int nCode;
OGRDXFLayer *poReaderLayer = (OGRDXFLayer *) GetLayerByName( "Entities" );
iEntitiesSectionOffset = oReader.iSrcBufferFileOffset + oReader.iSrcBufferOffset;
while( (nCode = ReadValue( szLineBuf, sizeof(szLineBuf) )) > -1
&& !EQUAL(szLineBuf,"ENDSEC") )
{
// We are only interested in extracting blocks.
if( nCode != 0 || !EQUAL(szLineBuf,"BLOCK") )
continue;
// Process contents of BLOCK definition till we find the
// first entity.
CPLString osBlockName;
while( (nCode = ReadValue( szLineBuf,sizeof(szLineBuf) )) > 0 )
{
if( nCode == 2 )
osBlockName = szLineBuf;
// anything else we want?
}
if( EQUAL(szLineBuf,"ENDBLK") )
continue;
UnreadValue();
// Now we will process entities till we run out at the ENDBLK code.
// we aggregate the geometries of the features into a multi-geometry,
// but throw away other stuff attached to the features.
OGRFeature *poFeature;
OGRGeometryCollection *poColl = new OGRGeometryCollection();
std::vector<OGRFeature*> apoFeatures;
while( (poFeature = poReaderLayer->GetNextUnfilteredFeature()) != NULL )
{
if( poFeature->GetStyleString() != NULL
&& strstr(poFeature->GetStyleString(),"LABEL") != NULL )
{
apoFeatures.push_back( poFeature );
}
else
{
poColl->addGeometryDirectly( poFeature->StealGeometry() );
delete poFeature;
}
}
if( poColl->getNumGeometries() == 0 )
delete poColl;
else
oBlockMap[osBlockName].poGeometry = SimplifyBlockGeometry(poColl);
if( apoFeatures.size() > 0 )
oBlockMap[osBlockName].apoFeatures = apoFeatures;
}
CPLDebug( "DXF", "Read %d blocks with meaningful geometry.",
(int) oBlockMap.size() );
}
示例2: ReadBlocksSection
void OGRDWGDataSource::ReadBlocksSection()
{
OGRDWGLayer *poReaderLayer = (OGRDWGLayer *) GetLayerByName( "Entities" );
int bMergeBlockGeometries = CSLTestBoolean(
CPLGetConfigOption( "DWG_MERGE_BLOCK_GEOMETRIES", "TRUE" ) );
/* -------------------------------------------------------------------- */
/* Loop over all the block tables, skipping *Model_Space which */
/* we assume is primary entities. */
/* -------------------------------------------------------------------- */
OdDbBlockTableRecordPtr poModelSpace, poBlock;
OdDbBlockTablePtr pTable = GetDB()->getBlockTableId().safeOpenObject();
OdDbSymbolTableIteratorPtr pBlkIter = pTable->newIterator();
for (pBlkIter->start(); ! pBlkIter->done(); pBlkIter->step())
{
poBlock = pBlkIter->getRecordId().safeOpenObject();
CPLString osBlockName = (const char *) poBlock->getName();
if( EQUAL(osBlockName,"*Model_Space") )
{
poModelSpace = poBlock;
continue;
}
poReaderLayer->SetBlockTable( poBlock );
// Now we will process entities till we run out.
// We aggregate the geometries of the features into a multi-geometry,
// but throw away other stuff attached to the features.
OGRFeature *poFeature;
OGRGeometryCollection *poColl = new OGRGeometryCollection();
std::vector<OGRFeature*> apoFeatures;
while( (poFeature = poReaderLayer->GetNextUnfilteredFeature()) != NULL )
{
if( (poFeature->GetStyleString() != NULL
&& strstr(poFeature->GetStyleString(),"LABEL") != NULL)
|| !bMergeBlockGeometries )
{
apoFeatures.push_back( poFeature );
}
else
{
poColl->addGeometryDirectly( poFeature->StealGeometry() );
delete poFeature;
}
}
if( poColl->getNumGeometries() == 0 )
delete poColl;
else
oBlockMap[osBlockName].poGeometry = SimplifyBlockGeometry(poColl);
if( apoFeatures.size() > 0 )
oBlockMap[osBlockName].apoFeatures = apoFeatures;
}
CPLDebug( "DWG", "Read %d blocks with meaningful geometry.",
(int) oBlockMap.size() );
poReaderLayer->SetBlockTable( poModelSpace );
}