Skip to content

Commit

Permalink
Use constGeometry() instead of geometry() where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 22, 2015
1 parent c592d9e commit a972a30
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/app/nodetool/qgsmaptoolnodetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,25 +410,25 @@ void QgsMapToolNodeTool::createTopologyRubberBands()
}
// Get VertexId of snapped vertex
QgsVertexId vid;
if ( !feature.geometry()->vertexIdFromVertexNr( snapResult.snappedVertexNr, vid ) )
if ( !feature.constGeometry()->vertexIdFromVertexNr( snapResult.snappedVertexNr, vid ) )
{
continue;
}
// Add rubberband if not already added
if ( !mMoveRubberBands.contains( snapFeatureId ) )
{
QgsGeometryRubberBand* rb = new QgsGeometryRubberBand( mCanvas, feature.geometry()->type() );
QgsGeometryRubberBand* rb = new QgsGeometryRubberBand( mCanvas, feature.constGeometry()->type() );
rb->setOutlineColor( Qt::blue );
rb->setBrushStyle( Qt::NoBrush );
rb->setOutlineWidth( 2 );
QgsAbstractGeometryV2* rbGeom = feature.geometry()->geometry()->clone();
QgsAbstractGeometryV2* rbGeom = feature.constGeometry()->geometry()->clone();
if ( mCanvas->mapSettings().layerTransform( vlayer ) )
rbGeom->transform( *mCanvas->mapSettings().layerTransform( vlayer ) );
rb->setGeometry( rbGeom );
mMoveRubberBands.insert( snapFeatureId, rb );
}
// Add to list of vertices to be moved
mMoveVertices[snapFeatureId].append( qMakePair( vid, toMapCoordinates( vlayer, feature.geometry()->geometry()->vertexAt( vid ) ) ) );
mMoveVertices[snapFeatureId].append( qMakePair( vid, toMapCoordinates( vlayer, feature.constGeometry()->geometry()->vertexAt( vid ) ) ) );
}
}
}
2 changes: 1 addition & 1 deletion src/app/nodetool/qgsselectedfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void QgsSelectedFeature::updateGeometry( QgsGeometry *geom )
QgsFeature f;
if ( mVlayer->getFeatures( QgsFeatureRequest().setFilterFid( mFeatureId ) ).nextFeature( f ) )
{
mGeometry = new QgsGeometry( *f.geometry() );
mGeometry = new QgsGeometry( *f.constGeometry() );
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayereditutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool QgsVectorLayerEditUtils::moveVertex( const QgsPointV2& p, QgsFeatureId atFe
{
// it's not in cache: let's fetch it from layer
QgsFeature f;
if ( !L->getFeatures( QgsFeatureRequest().setFilterFid( atFeatureId ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( f ) || !f.geometry() )
if ( !L->getFeatures( QgsFeatureRequest().setFilterFid( atFeatureId ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( f ) || !f.constGeometry() )
return false; // geometry not found

geometry = *f.geometry();
Expand Down

0 comments on commit a972a30

Please sign in to comment.