# HG changeset patch # User Bernhard Reiter # Date 1540502213 -7200 # Node ID 7ec2133c6404999fd01a4ba0121245326b5b8104 # Parent d3bdad8ed8d3fae26260b623c6acbc26e0c582d7 client: add area measurement. simpify code * Add a third draw mode which can only be activated when no morphology is selected and we are already in LineString mode. It adds an area calculation. Because the Polygon drawMode ends on a double click, there needs to be an extra callback for this to run identify so that the area calculation is shown all times. * Add Bernhard as author to some files and also simplify copyright note. * Remove DRAWMODES in the code to simplify as this is just one indirection used once in stores/application.js. * Use mapState instead mapGetters to get the drawMode at all places to save some code lines. diff -r d3bdad8ed8d3 -r 7ec2133c6404 client/src/application/stores/application.js --- a/client/src/application/stores/application.js Thu Oct 25 21:10:23 2018 +0200 +++ b/client/src/application/stores/application.js Thu Oct 25 23:16:53 2018 +0200 @@ -1,17 +1,17 @@ -/* - * This is Free Software under GNU Affero General Public License v >= 3.0 +/* This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. - * + * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt - * + * * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH - * + * * Author(s): - * Thomas Junk - * Markus Kottländer + * Thomas Junk + * Markus Kottländer + * Bernhard E. Reiter */ import { version } from "../../../package.json"; @@ -25,10 +25,6 @@ }; }; -const DRAWMODES = { - LINE: "LineString" -}; - const Application = { namespaced: true, state: { @@ -43,6 +39,7 @@ iscollapsed: defaultCollapseState }, countries: ["AT", "SK", "HU", "HR", "RS", "BiH", "BG", "RO", "UA"], + // there are three states of drawMode: null, "LineString", "Polygon" drawMode: null, version }, @@ -68,9 +65,6 @@ splitMode: state => { return state.splitsceen.mode; }, - drawMode: state => { - return state.drawMode; - }, versionStr: state => { // version number from package.json let versionStr = "v" + state.version; @@ -122,11 +116,14 @@ state.splitsceen = initializeSplitScreen(); }, toggleDrawModeLine: state => { - if (state.drawMode && state.drawMode === DRAWMODES.LINE) { + if (state.drawMode) { state.drawMode = null; - return; + } else { + state.drawMode = "LineString"; } - state.drawMode = DRAWMODES.LINE; + }, + activateDrawModePolygon: state => { + state.drawMode = "Polygon"; } }, actions: {} diff -r d3bdad8ed8d3 -r 7ec2133c6404 client/src/identify/Identify.vue --- a/client/src/identify/Identify.vue Thu Oct 25 21:10:23 2018 +0200 +++ b/client/src/identify/Identify.vue Thu Oct 25 23:16:53 2018 +0200 @@ -78,19 +78,19 @@