Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default {
...mapGetters("Tools/DistrictSelector", ["boundingGeometry"]),
...mapGetters("Tools/FeaturesList", ["activeVectorLayerList", "isFeatureActive"]),
...mapGetters("Tools/AreaSelector", {areaSelectorGeom: "geometry"}),
...mapGetters("Tools/SelectionManager", ["activeSelection"]),
...mapGetters("Tools/ScenarioBuilder", ["scenarioUpdated"]),
...mapGetters("Tools/Routing/Directions", ["directionsRouteSource", "directionsRouteLayer", "routingDirections"]),
...mapGetters("Tools/Routing", {routingActive: "active", activeRoutingToolOption: "activeRoutingToolOption"}),
Expand Down Expand Up @@ -255,7 +256,7 @@ export default {
mode () {
this.setSetByFeature(false);

if (this.mode === "region") {
if (this.mode === "region" && this.activeSelection === null) {
this.resetIsochroneBBox();
}

Expand Down Expand Up @@ -494,7 +495,7 @@ export default {
}

this.dataSets[this.activeSet].geojson = this.exportAsGeoJson(this.mapLayer);
this.addNewSelection({selection: analysisSet.results, source: this.$t("additional:modules.tools.cosi.accessibilityAnalysis.title"), id: this._mode + ", " + this._transportType + ", [...]"});
this.addNewSelection({selection: analysisSet.results, source: this.$t("additional:modules.tools.cosi.accessibilityAnalysis.title"), id: this.$t("additional:modules.tools.cosi.accessibilityAnalysis.transportTypes." + this._transportType) + ", " + this.$t("additional:modules.tools.cosi.accessibilityAnalysis.scaleUnits." + this._scaleUnit) + ", [...]"});
},
exportAsGeoJson,
// pagination features
Expand Down
8 changes: 6 additions & 2 deletions cosi/AreaSelector/components/AreaSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ export default {
geometry (geom) {
this.feature = geomPickerGetFeature(this.$refs["geometry-picker"]) || new Feature({geometry: geom});
this.drawingLayer.getSource().clear();
this.drawingLayer.getSource().addFeature(this.feature);
this.addNewSelection({selection: [new Feature(geom)], source: this.$t("additional:modules.tools.cosi.areaSelector.title"), id: "areaselector-index"});

if (this.feature) {
this.drawingLayer.getSource().addFeature(this.feature);
}

this.addNewSelection({selection: [new Feature(geom)], source: this.$t("additional:modules.tools.cosi.areaSelector.title"), id: this.$t("additional:modules.tools.cosi.areaSelector.title") + " #" + new Feature(geom).ol_uid});
setBBoxToGeom.call(this, geom || this.boundingGeometry);
}
},
Expand Down
2 changes: 1 addition & 1 deletion cosi/DistrictSelector/store/actionsDistrictSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const actions = {
const referenceLevel = districtLevel.referenceLevel,
// reference names of the districts
refNames = districts.map(district => {
return district.statFeatures[0].get(districtLevel.referenceLevel.stats.keyOfAttrName);
return district.statFeatures[0]?.get(districtLevel.referenceLevel.stats.keyOfAttrName);
}),
// reference districts
refDistricts = referenceLevel.districts.filter(district => {
Expand Down
437 changes: 317 additions & 120 deletions cosi/SelectionManager/components/SelectionManager.vue

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions cosi/SelectionManager/locales/de/additional.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"noData": "Keine Daten vorhanden",
"mergedSelections": "Kombinierte Auswahl",
"allSelections": "Alle aktiven ausgewählt",
"allSelectionsMenu": "Alle Auswahlen",
"connectedSelections": "Auswahl verbunden",
"buffer": "Veränderte Auswahl",
"cache": "Zwischenspeicher",
"dataLoaded": "Die gewünschten Themendaten wurden erfolgreich geladen",
"title_view": "Auswahl ein/aus",
"title_add": "Auswahl zum Zwischenspeicher hinzufügen",
"title_merge": "Zwischenauswahl zusammenführen",
Expand All @@ -18,6 +21,7 @@
"title_remove": "Auswahl entfernen",
"title_remove_all": "Auswahlverwaltung zurücksetzen",
"title_all_selections": "Alle aktiven Auswahlen auswählen",
"title_remove_cached_selection": "Auswahl aus Zwischenspeicher entfernen",
"title_connect_selections": "Alle aktiven Auswahlen mit Polygon verbinden",
"title_slider": "Buffer (m) einstellen",
"title_toggle_buffer": "Bufferauswahl aktivieren",
Expand Down
5 changes: 3 additions & 2 deletions cosi/SelectionManager/store/actionsSelectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import GeoJSON from "ol/format/GeoJSON";
* @returns {void}
*/
const actions = {
addNewSelection ({commit}, {selection, source, id}) {
addNewSelection ({state, commit}, {selection, source, id}) {
let collection;
const format = new GeoJSON(),
selectionObject = {
selection: Array,
bufferedSelection: Array,
source: String,
id: String,
abv: String,
storedLayers: [],
filterSettings: [],
settings: {
Expand All @@ -27,7 +28,6 @@ const actions = {
},
mergedPolygons = [];


for (let i = 0; i < selection.length; i++) {

// turns feature into geojson readable for turf
Expand All @@ -53,6 +53,7 @@ const actions = {
selectionObject.selection = mergedPolygons;
selectionObject.source = source;
selectionObject.id = id;
selectionObject.abv = state.selections.filter(sel => sel.abv === id.match(/\b([A-Z0-9])/g).join("")).length > 0 ? id.match(/\b([A-Z0-9])/g).join("") + "-" + state.selections.filter(sel => sel.abv === id.match(/\b([A-Z0-9])/g).join("")).length : id.match(/\b([A-Z0-9])/g).join("");

commit("addSelection", selectionObject);
}
Expand Down
16 changes: 12 additions & 4 deletions cosi/SelectionManager/store/gettersSelectionManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import GeoJSON from "ol/format/GeoJSON";
import {generateSimpleGetters} from "../../../../src/app-store/utils/generators";
import selectionManagerState from "./stateSelectionManager";

Expand All @@ -24,12 +25,19 @@ const getters = {
// pick currently active data layers from FeatureList
activeVectorLayerList = rootGetters["Tools/FeaturesList/activeVectorLayerList"],
// store the names only
activeLayerList = activeVectorLayerList.map(layer => layer.getProperties().name); // as in activeLayers() computed prop. better duplicate this line than put the whole logic in store
activeLayerList = activeVectorLayerList.map(layer => layer.getProperties().name), // as in activeLayers() computed prop. better duplicate this line than put the whole logic in store
format = new GeoJSON(),
selectionHelper = {
selection: state.selections[index].selection.map(selection => format.writeFeatureObject(selection)),
storedLayers: activeLayerList,
settings: state.selections[index].settings,
id: state.selections[index].id,
bufferedSelection: state.selections[index].bufferedSelection,
source: state.selections[index].source
};

// update the selection in selectionManager
state.selections[index].storedLayers = activeLayerList;
// return the selection settings
return state.selections[index];
return selectionHelper;

}
};
Expand Down
9 changes: 8 additions & 1 deletion cosi/SelectionManager/store/mutationsSelectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ const mutations = {
toggleVisualizationState (state) {
state.visualizationState = !state.visualizationState;
},

inputActiveSelection: (state, payload) => {
if (payload !== null & state.activeSelection === payload) {
state.activeSelection = null;
}
else {
state.activeSelection = payload;
}
},
/**
* @param {object} state of this component
* @param {string} payload selection object that has been created through the addNewSelection action
Expand Down
135 changes: 135 additions & 0 deletions cosi/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cosi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@turf/buffer": "^6.5.0",
"@turf/center-of-mass": "^6.5.0",
"@turf/circle": "^6.5.0",
"@turf/concave": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/intersect": "^6.5.0",
"@turf/simplify": "^6.5.0",
Expand All @@ -28,6 +29,7 @@
"object-hash": "^2.1.1",
"pdfmake": "^0.2.6",
"tableify": "^1.1.1",
"turf-featurecollection": "^1.0.1",
"vue-chartjs": "^3.5.1",
"vue-inline-svg": "^2.1.0",
"vue-json-excel": "^0.3.0",
Expand Down