Skip to content

Commit

Permalink
Merge pull request #338 from wegue-oss/measure-perimeter
Browse files Browse the repository at this point in the history
Show perimeter of measure polygon
  • Loading branch information
chrismayer authored Jul 13, 2023
2 parents 933e781 + f5b9d42 commit 6850848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/measuretool/MeasureResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export default {
if (geom instanceof PolygonGeom) {
output = me.formatArea(geom);
me.area = output;
// perimeter of outer LinearRing of measure polygon
me.distance = me.formatLength(new LineStringGeom(
geom.getLinearRing(0).getCoordinates()
));
} else if (geom instanceof LineStringGeom) {
output = me.formatLength(geom);
me.distance = output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('measuretool/MeasureResult.vue', () => {
comp.setProps({ measureGeom: { geom: polyGeom } });
comp.vm.$nextTick(() => {
expect(comp.vm.area).to.equal('1 m²');
expect(comp.vm.distance).to.equal('4 m');
done();
});
});
Expand Down

0 comments on commit 6850848

Please sign in to comment.