本文整理汇总了C++中geometrycollection::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
ConstGeometryIterator::fetchNext()
{
_next = 0L;
if ( _stack.size() == 0 )
return;
const Geometry* current = _stack.top();
_stack.pop();
if ( current->getType() == Geometry::TYPE_MULTI && _traverseMulti )
{
const MultiGeometry* m = static_cast<const MultiGeometry*>(current);
for( GeometryCollection::const_iterator i = m->getComponents().begin(); i != m->getComponents().end(); ++i )
_stack.push( i->get() );
fetchNext();
}
else if ( current->getType() == Geometry::TYPE_POLYGON && _traversePolyHoles )
{
const Polygon* p = static_cast<const Polygon*>(current);
for( RingCollection::const_iterator i = p->getHoles().begin(); i != p->getHoles().end(); ++i )
_stack.push( i->get() );
_next = current;
}
else
{
_next = current;
}
}
示例2:
unsigned
MultiGeometry::getNumGeometries() const
{
unsigned total = 0;
for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
total += i->get()->getNumGeometries();
return total;
}
示例3: MultiGeometry
Geometry*
MultiGeometry::cloneAs( const Geometry::Type& newType ) const
{
MultiGeometry* multi = new MultiGeometry();
for( GeometryCollection::const_iterator i = _parts.begin(); i != _parts.end(); ++i )
{
Geometry* part = i->get()->cloneAs( i->get()->getType() );
if ( part ) multi->getComponents().push_back( part );
}
return multi;
}
示例4: switch
OGRGeometryH
OgrUtils::createOgrGeometry(const osgEarth::Symbology::Geometry* geometry, OGRwkbGeometryType requestedType)
{
if (!geometry) return NULL;
if (requestedType == wkbUnknown)
{
osgEarth::Symbology::Geometry::Type geomType = geometry->getType();
switch( geomType)
{
case osgEarth::Symbology::Geometry::TYPE_POLYGON:
requestedType = wkbPolygon;
break;
case osgEarth::Symbology::Geometry::TYPE_POINTSET:
requestedType = wkbPoint;
break;
case osgEarth::Symbology::Geometry::TYPE_LINESTRING:
requestedType = wkbLineString;
break;
case osgEarth::Symbology::Geometry::TYPE_RING:
requestedType = wkbLinearRing;
break;
case Geometry::TYPE_UNKNOWN: break;
case Geometry::TYPE_MULTI:
{
const osgEarth::Symbology::MultiGeometry* multi = dynamic_cast<const MultiGeometry*>(geometry);
osgEarth::Symbology::Geometry::Type componentType = multi->getComponentType();
requestedType = componentType == Geometry::TYPE_POLYGON ? wkbMultiPolygon :
componentType == Geometry::TYPE_POINTSET ? wkbMultiPoint :
componentType == Geometry::TYPE_LINESTRING ? wkbMultiLineString :
wkbNone;
}
break;
}
}
OGRwkbGeometryType shape_type =
requestedType == wkbPolygon || requestedType == wkbMultiPolygon ? wkbPolygon :
requestedType == wkbPolygon25D || requestedType == wkbMultiPolygon25D? wkbPolygon25D :
requestedType == wkbLineString || requestedType == wkbMultiLineString? wkbMultiLineString :
requestedType == wkbLineString25D || requestedType == wkbMultiLineString25D? wkbMultiLineString25D :
requestedType == wkbPoint || requestedType == wkbMultiPoint? wkbMultiPoint :
requestedType == wkbPoint25D || requestedType == wkbMultiPoint25D? wkbMultiPoint25D :
wkbNone;
OGRwkbGeometryType part_type =
shape_type == wkbPolygon || shape_type == wkbPolygon25D? wkbLinearRing :
shape_type == wkbMultiLineString? wkbLineString :
shape_type == wkbMultiLineString25D? wkbLineString25D :
shape_type == wkbMultiPoint? wkbPoint :
shape_type == wkbMultiPoint25D? wkbPoint25D :
wkbNone;
//OE_NOTICE << "shape_type = " << shape_type << " part_type=" << part_type << std::endl;
const osgEarth::Symbology::MultiGeometry* multi = dynamic_cast<const MultiGeometry*>(geometry);
if ( multi )
{
OGRGeometryH group_handle = OGR_G_CreateGeometry( wkbGeometryCollection );
for (GeometryCollection::const_iterator itr = multi->getComponents().begin(); itr != multi->getComponents().end(); ++itr)
{
OGRGeometryH shape_handle = encodeShape( itr->get(), shape_type, part_type );
if ( shape_handle )
{
OGRErr error = OGR_G_AddGeometryDirectly( group_handle, shape_handle );
if ( error != OGRERR_NONE )
{
OE_WARN << "OGR_G_AddGeometryDirectly failed! " << error << std::endl;
OE_WARN << "shape_type = " << shape_type << " part_type=" << part_type << std::endl;
}
}
}
return group_handle;
}
else
{
OGRGeometryH shape_handle = encodeShape( geometry, shape_type, part_type );
return shape_handle;
}
}