本文整理汇总了C++中QgsMultiPolyline::constBegin方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsMultiPolyline::constBegin方法的具体用法?C++ QgsMultiPolyline::constBegin怎么用?C++ QgsMultiPolyline::constBegin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsMultiPolyline
的用法示例。
在下文中一共展示了QgsMultiPolyline::constBegin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToSingleLine
QgsGeometry* QgsMapToolOffsetCurve::convertToSingleLine( QgsGeometry* geom, int vertex, bool& isMulti )
{
if ( !geom )
{
return 0;
}
isMulti = false;
QGis::WkbType geomType = geom->wkbType();
if ( geomType == QGis::WKBLineString || geomType == QGis::WKBLineString25D )
{
return geom;
}
else if ( geomType == QGis::WKBMultiLineString || geomType == QGis::WKBMultiLineString25D )
{
//search vertex
isMulti = true;
int currentVertex = 0;
QgsMultiPolyline multiLine = geom->asMultiPolyline();
QgsMultiPolyline::const_iterator it = multiLine.constBegin();
for ( ; it != multiLine.constEnd(); ++it )
{
currentVertex += it->size();
if ( vertex < currentVertex )
{
QgsGeometry* g = QgsGeometry::fromPolyline( *it );
delete geom;
return g;
}
}
}
delete geom;
return 0;
}
示例2: closestMultilineElement
QgsGeometry QgsTransectSample::closestMultilineElement( const QgsPoint& pt, const QgsGeometry& multiLine )
{
if ( !multiLine || ( multiLine.wkbType() != QgsWkbTypes::MultiLineString
&& multiLine.wkbType() != QgsWkbTypes::MultiLineString25D ) )
{
return QgsGeometry();
}
double minDist = DBL_MAX;
double currentDist = 0;
QgsGeometry currentLine;
QgsGeometry closestLine;
QgsGeometry pointGeom = QgsGeometry::fromPoint( pt );
QgsMultiPolyline multiPolyline = multiLine.asMultiPolyline();
QgsMultiPolyline::const_iterator it = multiPolyline.constBegin();
for ( ; it != multiPolyline.constEnd(); ++it )
{
currentLine = QgsGeometry::fromPolyline( *it );
currentDist = pointGeom.distance( currentLine );
if ( currentDist < minDist )
{
minDist = currentDist;
closestLine = currentLine;
}
}
return closestLine;
}
示例3: closestMultilineElement
QgsGeometry* QgsTransectSample::closestMultilineElement( const QgsPoint& pt, QgsGeometry* multiLine )
{
if ( !multiLine || ( multiLine->wkbType() != QGis::WKBMultiLineString
&& multiLine->wkbType() != QGis::WKBMultiLineString25D ) )
{
return 0;
}
double minDist = DBL_MAX;
double currentDist = 0;
QgsGeometry* currentLine = 0;
QgsGeometry* closestLine = 0;
QgsGeometry* pointGeom = QgsGeometry::fromPoint( pt );
QgsMultiPolyline multiPolyline = multiLine->asMultiPolyline();
QgsMultiPolyline::const_iterator it = multiPolyline.constBegin();
for ( ; it != multiPolyline.constEnd(); ++it )
{
currentLine = QgsGeometry::fromPolyline( *it );
currentDist = pointGeom->distance( *currentLine );
if ( currentDist < minDist )
{
minDist = currentDist;
closestLine = currentLine;
}
else
{
delete currentLine;
}
}
delete pointGeom;
return closestLine;
}
示例4: createMultiLineStringElem
QDomElement QgsWFSServer::createMultiLineStringElem( QgsGeometry* geom, QDomDocument& doc ) const
{
if ( !geom )
{
return QDomElement();
}
QDomElement multiLineStringElem = doc.createElement( "gml:MultiLineString" );
QgsMultiPolyline multiline = geom->asMultiPolyline();
QgsMultiPolyline::const_iterator multiLineIt = multiline.constBegin();
for ( ; multiLineIt != multiline.constEnd(); ++multiLineIt )
{
QgsGeometry* lineGeom = QgsGeometry::fromPolyline( *multiLineIt );
if ( lineGeom )
{
QDomElement lineStringMemberElem = doc.createElement( "gml:lineStringMember" );
QDomElement lineElem = createLineStringElem( lineGeom, doc );
lineStringMemberElem.appendChild( lineElem );
multiLineStringElem.appendChild( lineStringMemberElem );
}
delete lineGeom;
}
return multiLineStringElem;
}
示例5: addFeature
void QgsDxfExport::addFeature( const QgsSymbolV2RenderContext& ctx, const QString& layer, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol )
{
const QgsFeature* fet = ctx.feature();
if ( !fet )
{
return;
}
QgsGeometry* geom = fet->geometry();
if ( geom )
{
int c = 0;
if ( mSymbologyExport != NoSymbology )
{
c = colorFromSymbolLayer( symbolLayer, ctx );
}
double width = -1;
if ( mSymbologyExport != NoSymbology && symbolLayer )
{
width = symbolLayer->dxfWidth( *this, ctx );
}
QString lineStyleName = "CONTINUOUS";
if ( mSymbologyExport != NoSymbology )
{
lineStyleName = lineStyleFromSymbolLayer( symbolLayer );
}
QGis::WkbType geometryType = geom->wkbType();
//single point
if ( geometryType == QGis::WKBPoint || geometryType == QGis::WKBPoint25D )
{
writePoint( geom->asPoint(), layer, c, fet, symbolLayer, symbol );
}
//multipoint
if ( geometryType == QGis::WKBMultiPoint || geometryType == QGis::WKBMultiPoint25D )
{
QgsMultiPoint multiPoint = geom->asMultiPoint();
QgsMultiPoint::const_iterator it = multiPoint.constBegin();
for ( ; it != multiPoint.constEnd(); ++it )
{
writePoint( *it, layer, c, fet, symbolLayer, symbol );
}
}
//single line
if ( geometryType == QGis::WKBLineString || geometryType == QGis::WKBLineString25D )
{
writePolyline( geom->asPolyline(), layer, lineStyleName, c, width, false );
}
//multiline
if ( geometryType == QGis::WKBMultiLineString || geometryType == QGis::WKBMultiLineString25D )
{
QgsMultiPolyline multiLine = geom->asMultiPolyline();
QgsMultiPolyline::const_iterator lIt = multiLine.constBegin();
for ( ; lIt != multiLine.constEnd(); ++lIt )
{
writePolyline( *lIt, layer, lineStyleName, c, width, false );
}
}
//polygon
if ( geometryType == QGis::WKBPolygon || geometryType == QGis::WKBPolygon25D )
{
QgsPolygon polygon = geom->asPolygon();
QgsPolygon::const_iterator polyIt = polygon.constBegin();
for ( ; polyIt != polygon.constEnd(); ++polyIt ) //iterate over rings
{
writePolyline( *polyIt, layer, lineStyleName, c, width, true );
}
}
//multipolygon or polygon
if ( geometryType == QGis::WKBMultiPolygon || geometryType == QGis::WKBMultiPolygon25D )
{
QgsMultiPolygon mp = geom->asMultiPolygon();
QgsMultiPolygon::const_iterator mpIt = mp.constBegin();
for ( ; mpIt != mp.constEnd(); ++mpIt )
{
QgsPolygon::const_iterator polyIt = mpIt->constBegin();
for ( ; polyIt != mpIt->constEnd(); ++polyIt )
{
writePolyline( *polyIt, layer, lineStyleName, c, width, true );
}
}
}
}
}