Mercurial > gemma
view client/src/bottlenecks/store.js @ 1063:7ec2133c6404
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.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Thu, 25 Oct 2018 23:16:53 +0200 |
parents | c9badb264d16 |
children | dbf0221b1cf1 |
line wrap: on
line source
/* * 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): * Markus Kottländer <markuks.kottlaender@intevation.de> */ import { HTTP } from "../application/lib/http"; const Bottlenecks = { namespaced: true, state: { bottlenecks: [] }, mutations: { setBottlenecks: (state, bottlenecks) => { state.bottlenecks = bottlenecks; } }, actions: { loadBottlenecks({ commit }) { return new Promise((resolve, reject) => { HTTP.get("/bottlenecks", { headers: { "X-Gemma-Auth": localStorage.getItem("token") } }) .then(response => { commit("setBottlenecks", response.data); resolve(response); }) .catch(error => { reject(error); }); }); } } }; export default Bottlenecks;