Skip to content

Commit

Permalink
wedgebuffer constructed by qgsCircles
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondnijssen authored and nyalldawson committed Aug 8, 2018
1 parent 5c285aa commit faaa590
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -264,17 +264,8 @@ QgsGeometry QgsGeometry::createWedgeBuffer( const QgsPoint &center, const double
{
std::unique_ptr< QgsCompoundCurve > outerCc = qgis::make_unique< QgsCompoundCurve >();

QgsPointSequence outerPs = QgsPointSequence()
<< QgsPoint( center.x(), center.y() + outerRadius )
<< QgsPoint( center.x() + outerRadius, center.y() )
<< QgsPoint( center.x(), center.y() - outerRadius )
<< QgsPoint( center.x() - outerRadius, center.y() )
<< QgsPoint( center.x(), center.y() + outerRadius );

QgsCircularString *outerCs = new QgsCircularString;
outerCs->setPoints( outerPs );

outerCc->addCurve( outerCs );
QgsCircle outerCircle = QgsCircle( center, outerRadius );
outerCc->addCurve( outerCircle.toCircularString() );

std::unique_ptr< QgsCurvePolygon > cp = qgis::make_unique< QgsCurvePolygon >();
cp->setExteriorRing( outerCc.release() );
Expand All @@ -283,17 +274,8 @@ QgsGeometry QgsGeometry::createWedgeBuffer( const QgsPoint &center, const double
{
std::unique_ptr< QgsCompoundCurve > innerCc = qgis::make_unique< QgsCompoundCurve >();

QgsPointSequence innerPs = QgsPointSequence()
<< QgsPoint( center.x(), center.y() + innerRadius )
<< QgsPoint( center.x() + innerRadius, center.y() )
<< QgsPoint( center.x(), center.y() - innerRadius )
<< QgsPoint( center.x() - innerRadius, center.y() )
<< QgsPoint( center.x(), center.y() + innerRadius );

QgsCircularString *innerCs = new QgsCircularString;
innerCs->setPoints( innerPs );

innerCc->addCurve( innerCs );
QgsCircle innerCircle = QgsCircle( center, innerRadius);
innerCc->addCurve( innerCircle.toCircularString() );

cp->setInteriorRings( { innerCc.release() } );
}
Expand Down

0 comments on commit faaa590

Please sign in to comment.