Skip to content

Commit

Permalink
fixing perimeter and area
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ committed Aug 23, 2024
1 parent a0c0791 commit fd43f6c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
5 changes: 2 additions & 3 deletions app/maptools/measurementmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ void MeasurementMapTool::closeShape()

QgsDistanceArea distanceArea;
double area = distanceArea.measureArea( polygonGeometry );
double perimeter = distanceArea.measureLength( polygonGeometry );
double perimeter = distanceArea.measurePerimeter( polygonGeometry );

emit shapeArea( area );
emit shapePerimeter( perimeter );
emit shapeAreaAndPerimeter( area , perimeter );
emit canCloseShape( false );
}

Expand Down
3 changes: 1 addition & 2 deletions app/maptools/measurementmaptool.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ class MeasurementMapTool : public AbstractMapTool
void canCloseShape( bool canClose );
void canUndo( bool canUndo );

void shapeArea( double area );
void shapePerimeter( double perimeter );
void shapeAreaAndPerimeter( double area , double perimeter );

protected:
void rebuildGeometry();
Expand Down
2 changes: 1 addition & 1 deletion app/qml/gps/MMMeasureDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MMDrawer {

property string length: qsTr( "0.0 m" )
property string perimeter: qsTr( "0.0 m" )
property string area: qsTr( "0.0 m" )
property string area: qsTr( "0.0 m²" )

signal addMeasurePoint()
signal measureFinished()
Expand Down
15 changes: 3 additions & 12 deletions app/qml/map/MMMeasurementTools.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ Item {
measurePanel.canCloseShape = canClose;
}

onShapeArea: function( area ) {
measurePanel.area = area;
}

onShapePerimeter: function( perimeter ) {
measurePanel.perimeter = perimeter;
onShapeAreaAndPerimeter: function( area, perimeter) {
measurePanel.area = area.toFixed( 1 ) + "";;
measurePanel.perimeter = perimeter.toFixed( 1 ) + " m";;
}

onCanUndo: function( canUndo ) {
Expand Down Expand Up @@ -102,17 +99,11 @@ Item {
anchors.fill: parent
qgsProject: __activeProject.qgsProject
mapSettings: root.map.mapSettings
//hasLabel: true
//crosshairLabelText: qsTr( "N/A")
//crosshairLabelIcon: measurePanel.canCloseShape ? __style.closeShapeIcon : ""
}

MMMapLabel {
id: mapLabel

anchors.top: crosshair.bottom
anchors.horizontalCenter: crosshair.horizontalCenter

text: qsTr( "0.0 m" )
bgColor: __style.forestColor
textColor: __style.polarColor
Expand Down

0 comments on commit fd43f6c

Please sign in to comment.