本文整理汇总了C++中OGRFeature::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRFeature::Clone方法的具体用法?C++ OGRFeature::Clone怎么用?C++ OGRFeature::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRFeature
的用法示例。
在下文中一共展示了OGRFeature::Clone方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
oLine.setPoint( 1,
dfArrowX2 - dfVec2X*3 - dfVec1X,
dfArrowY2 - dfVec2Y*3 - dfVec1Y );
poMLS->addGeometry( &oLine );
poFeature->SetGeometryDirectly( poMLS );
PrepareLineStyle( poFeature );
/* -------------------------------------------------------------------- */
/* Is the layer disabled/hidden/frozen/off? */
/* -------------------------------------------------------------------- */
CPLString osLayer = poFeature->GetFieldAsString("Layer");
int bHidden =
EQUAL(poDS->LookupLayerProperty( osLayer, "Hidden" ), "1");
/* -------------------------------------------------------------------- */
/* Work out the color for this feature. */
/* -------------------------------------------------------------------- */
int nColor = 256;
if( oStyleProperties.count("Color") > 0 )
nColor = atoi(oStyleProperties["Color"]);
// Use layer color?
if( nColor < 1 || nColor > 255 )
{
const char *pszValue = poDS->LookupLayerProperty( osLayer, "Color" );
if( pszValue != NULL )
nColor = atoi(pszValue);
}
if( nColor < 1 || nColor > 255 )
nColor = 8;
/* -------------------------------------------------------------------- */
/* Prepare a new feature to serve as the dimension text label */
/* feature. We will push it onto the layer as a pending */
/* feature for the next feature read. */
/* -------------------------------------------------------------------- */
// a single space suppresses labeling.
if( osText == " " )
return poFeature;
OGRFeature *poLabelFeature = poFeature->Clone();
poLabelFeature->SetGeometryDirectly( new OGRPoint( oTextPos.x, oTextPos.y ) );
// Do we need to compute the dimension value?
if( osText.empty() )
{
FormatDimension( osText, POINT_DIST( oArrow1.x, oArrow1.y,
dfArrowX2, dfArrowY2 ) );
}
CPLString osStyle;
char szBuffer[64];
char* pszComma = NULL;
osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\",p:5",osText.c_str());
if( dfAngle != 0.0 )
{
CPLsnprintf(szBuffer, sizeof(szBuffer), "%.3g", dfAngle);
pszComma = strchr(szBuffer, ',');
if (pszComma)
*pszComma = '.';
osStyle += CPLString().Printf(",a:%s", szBuffer);
}
if( dfHeight != 0.0 )
{
CPLsnprintf(szBuffer, sizeof(szBuffer), "%.3g", dfHeight);
pszComma = strchr(szBuffer, ',');
if (pszComma)
*pszComma = '.';
osStyle += CPLString().Printf(",s:%sg", szBuffer);
}
const unsigned char *pabyDWGColors = ACGetColorTable();
snprintf( szBuffer, sizeof(szBuffer), ",c:#%02x%02x%02x",
pabyDWGColors[nColor*3+0],
pabyDWGColors[nColor*3+1],
pabyDWGColors[nColor*3+2] );
osStyle += szBuffer;
if( bHidden )
osStyle += "00";
osStyle += ")";
poLabelFeature->SetStyleString( osStyle );
apoPendingFeatures.push( poLabelFeature );
return poFeature;
}
示例2: GetNextFeature
OGRFeature* OGRGeoJSONLayer::GetNextFeature()
{
while ( iterCurrent_ != seqFeatures_.end() )
{
OGRFeature* poFeature = (*iterCurrent_);
CPLAssert( NULL != poFeature );
++iterCurrent_;
if((m_poFilterGeom == NULL
|| FilterGeometry( poFeature->GetGeometryRef() ) )
&& (m_poAttrQuery == NULL
|| m_poAttrQuery->Evaluate( poFeature )) )
{
OGRFeature* poFeatureCopy = poFeature->Clone();
CPLAssert( NULL != poFeatureCopy );
if (poFeatureCopy->GetGeometryRef() != NULL && GetSpatialRef() != NULL)
{
poFeatureCopy->GetGeometryRef()->assignSpatialReference( GetSpatialRef() );
}
return poFeatureCopy;
}
}
return NULL;
}
示例3: while
OGRFeature *OGRILI1Layer::GetNextFeature()
{
if (!bGeomsJoined) JoinGeomLayers();
while(nFeatureIdx < nFeatures)
{
OGRFeature *poFeature = GetNextFeatureRef();
if (poFeature)
return poFeature->Clone();
}
return nullptr;
}
示例4: while
OGRFeature *OGRILI2Layer::GetNextFeature()
{
while (listFeatureIt != listFeature.end())
{
OGRFeature *poFeature = *(listFeatureIt++);
//apply filters
if( (m_poFilterGeom == NULL
|| FilterGeometry( poFeature->GetGeometryRef() ) )
&& (m_poAttrQuery == NULL
|| m_poAttrQuery->Evaluate( poFeature )) )
return poFeature->Clone();
}
return NULL;
}
示例5: while
OGRFeature *OGRILI1Layer::GetNextFeature()
{
OGRFeature *poFeature;
if (poSurfacePolyLayer != 0) JoinSurfaceLayer();
if (poAreaLineLayer != 0) PolygonizeAreaLayer();
while(nFeatureIdx < nFeatures)
{
poFeature = GetNextFeatureRef();
if (poFeature)
return poFeature->Clone();
}
return NULL;
}
示例6: while
OGRFeature *OGRMemLayer::GetNextFeature()
{
while( iNextReadFID < nMaxFeatureCount )
{
OGRFeature *poFeature = papoFeatures[iNextReadFID++];
if( poFeature == NULL )
continue;
if( (m_poFilterGeom == NULL
|| FilterGeometry( poFeature->GetGeomFieldRef(m_iGeomFieldFilter) ) )
&& (m_poAttrQuery == NULL
|| m_poAttrQuery->Evaluate( poFeature ) ) )
{
m_nFeaturesRead++;
return poFeature->Clone();
}
}
return NULL;
}
示例7: OGRFeature
OGRFeature*
OGRXPlaneAirwayIntersectionLayer::AddFeature(const char* pszIntersectionName,
double dfLat,
double dfLon)
{
OGRFeature* poFeature = new OGRFeature(poFeatureDefn);
poFeature->SetGeometryDirectly( new OGRPoint( dfLon, dfLat ) );
poFeature->SetField( 0, pszIntersectionName );
if (CPLHashSetLookup(poSet, poFeature) == NULL)
{
CPLHashSetInsert(poSet, poFeature->Clone());
RegisterFeature(poFeature);
return poFeature;
}
else
{
delete poFeature;
return NULL;
}
}
示例8:
virtual OGRFeature *GetNextFeature() override
{
if( bEnd ) return NULL;
bEnd = true;
return poFeature->Clone();
}
示例9:
virtual OGRFeature *GetNextFeature()
{
if (bEnd) return NULL;
bEnd = TRUE;
return poFeature->Clone();
}