本文整理汇总了C++中OGRGeometryCollection::getEnvelope方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometryCollection::getEnvelope方法的具体用法?C++ OGRGeometryCollection::getEnvelope怎么用?C++ OGRGeometryCollection::getEnvelope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometryCollection
的用法示例。
在下文中一共展示了OGRGeometryCollection::getEnvelope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGRDXFFeature
OGRDXFFeature *OGRDXFLayer::TranslateHATCH()
{
char szLineBuf[257];
int nCode = 0;
OGRDXFFeature *poFeature = new OGRDXFFeature( poFeatureDefn );
CPLString osHatchPattern;
double dfElevation = 0.0; // Z value to be used for EVERY point
/* int nFillFlag = 0; */
OGRGeometryCollection oGC;
while( (nCode = poDS->ReadValue(szLineBuf,sizeof(szLineBuf))) > 0 )
{
switch( nCode )
{
case 30:
// Constant elevation.
dfElevation = CPLAtof( szLineBuf );
break;
case 70:
/* nFillFlag = atoi(szLineBuf); */
break;
case 2:
osHatchPattern = szLineBuf;
poFeature->SetField( "Text", osHatchPattern.c_str() );
break;
case 91:
{
int nBoundaryPathCount = atoi(szLineBuf);
for( int iBoundary = 0;
iBoundary < nBoundaryPathCount;
iBoundary++ )
{
if (CollectBoundaryPath( &oGC, dfElevation ) != OGRERR_NONE)
break;
}
}
break;
default:
TranslateGenericProperty( poFeature, nCode, szLineBuf );
break;
}
}
if( nCode < 0 )
{
DXF_LAYER_READER_ERROR();
delete poFeature;
return nullptr;
}
if( nCode == 0 )
poDS->UnreadValue();
/* -------------------------------------------------------------------- */
/* Obtain a tolerance value used when building the polygon. */
/* -------------------------------------------------------------------- */
double dfTolerance = atof( CPLGetConfigOption( "DXF_HATCH_TOLERANCE", "-1" ) );
if( dfTolerance < 0 )
{
// If the configuration variable isn't set, compute the bounding box
// and work out a tolerance from that
OGREnvelope oEnvelope;
oGC.getEnvelope( &oEnvelope );
dfTolerance = std::max( oEnvelope.MaxX - oEnvelope.MinX,
oEnvelope.MaxY - oEnvelope.MinY ) * 1e-7;
}
/* -------------------------------------------------------------------- */
/* Try to turn the set of lines into something useful. */
/* -------------------------------------------------------------------- */
OGRErr eErr;
OGRGeometry* poFinalGeom = (OGRGeometry *)
OGRBuildPolygonFromEdges( (OGRGeometryH) &oGC,
TRUE, TRUE, dfTolerance, &eErr );
if( eErr != OGRERR_NONE )
{
delete poFinalGeom;
OGRMultiLineString* poMLS = new OGRMultiLineString();
for(int i=0;i<oGC.getNumGeometries();i++)
poMLS->addGeometry(oGC.getGeometryRef(i));
poFinalGeom = poMLS;
}
poFeature->ApplyOCSTransformer( poFinalGeom );
poFeature->SetGeometryDirectly( poFinalGeom );
PrepareBrushStyle( poFeature );
return poFeature;
}