Skip to content

Commit ac34868

Browse files
committedApr 24, 2018
[processing] Adjust code for line intersection with collection intersections
1 parent 49ee8bb commit ac34868

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed
 

‎src/analysis/processing/qgsalgorithmlineintersection.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ QVariantMap QgsLineIntersectionAlgorithm::processAlgorithm( const QVariantMap &p
196196
{
197197
outAttributes.append( inFeatureB.attribute( b ) );
198198
}
199-
if ( intersectGeom.wkbType() == QgsWkbTypes::GeometryCollection )
199+
if ( QgsWkbTypes::flatType( intersectGeom.wkbType() ) == QgsWkbTypes::GeometryCollection )
200200
{
201-
QVector<QgsGeometry> geomCollection = intersectGeom.asGeometryCollection();
202-
for ( const QgsGeometry &part : qgis::as_const( geomCollection ) )
201+
const QVector<QgsGeometry> geomCollection = intersectGeom.asGeometryCollection();
202+
for ( const QgsGeometry &part : geomCollection )
203203
{
204204
if ( part.type() == QgsWkbTypes::PointGeometry )
205205
{
@@ -214,18 +214,15 @@ QVariantMap QgsLineIntersectionAlgorithm::processAlgorithm( const QVariantMap &p
214214
}
215215
}
216216
}
217-
else
217+
else if ( intersectGeom.type() == QgsWkbTypes::PointGeometry )
218218
{
219-
if ( intersectGeom.type() == QgsWkbTypes::PointGeometry )
219+
if ( intersectGeom.isMultipart() )
220220
{
221-
if ( intersectGeom.isMultipart() )
222-
{
223-
points = intersectGeom.asMultiPoint();
224-
}
225-
else
226-
{
227-
points.append( intersectGeom.asPoint() );
228-
}
221+
points = intersectGeom.asMultiPoint();
222+
}
223+
else
224+
{
225+
points.append( intersectGeom.asPoint() );
229226
}
230227
}
231228
for ( const QgsPointXY &j : qgis::as_const( points ) )

0 commit comments

Comments
 (0)
Please sign in to comment.