Skip to content

Commit

Permalink
fixing crs and ellipsoid
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Aug 23, 2024
1 parent df49a6e commit 329a78a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 6 additions & 2 deletions app/maptools/measurementmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ double MeasurementMapTool::updateDistance( const QgsPoint &crosshairPoint )

QgsDistanceArea mDistanceArea;
mDistanceArea.setEllipsoid( QStringLiteral( "WGS84" ) );
mDistanceArea.setSourceCrs( mapSettings()->destinationCrs(), mapSettings()->transformContext() );
//mDistanceArea.setSourceCrs( mapSettings()->destinationCrs(), mapSettings()->transformContext() );

mDistanceArea.setSourceCrs( QgsCoordinateReferenceSystem::fromEpsgId( 4326 ), QgsCoordinateTransformContext() );

return mDistanceArea.measureLine( crosshairPoint, lastPoint );
}
Expand All @@ -110,7 +112,9 @@ void MeasurementMapTool::closeShape()

QgsDistanceArea mDistanceArea;
mDistanceArea.setEllipsoid( QStringLiteral( "WGS84" ) );
mDistanceArea.setSourceCrs( mapSettings()->destinationCrs(), mapSettings()->transformContext() );
//mDistanceArea.setSourceCrs( mapSettings()->destinationCrs(), mapSettings()->transformContext() );

mDistanceArea.setSourceCrs( QgsCoordinateReferenceSystem::fromEpsgId( 4326 ), QgsCoordinateTransformContext() );

double area = mDistanceArea.measureArea( polygonGeometry );
double perimeter = mDistanceArea.measurePerimeter( polygonGeometry );
Expand Down
5 changes: 2 additions & 3 deletions app/qml/map/MMMeasurementTools.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Item {
onCanUndo: function( canUndo ) { measurePanel.canUndo = canUndo; }
onShapeAreaAndPerimeter: function( area, perimeter) {
measurePanel.area = area.toFixed( 1 ) + "";
measurePanel.perimeter = perimeter.toFixed( 1 ) + " m";
measurePanel.perimeter = __inputUtils.formatDistanceInProjectUnit( perimeter, 1 ) //perimeter.toFixed( 1 ) + " m";
}
}

Expand Down Expand Up @@ -116,8 +116,7 @@ Item {
function onScreenPositionChanged() {
let distance = mapTool.updateDistance( crosshair.recordPoint );

measurePanel.length = distance.toFixed( 1 ) + " m";

measurePanel.length = __inputUtils.formatDistanceInProjectUnit( distance, 1 ); //distance.toFixed( 1 ) + " m";
if ( measurePanel.canCloseShape ) {
mapLabel.text = qsTr( "Close shape" )
mapLabel.iconSource = __style.closeShapeIcon
Expand Down

0 comments on commit 329a78a

Please sign in to comment.