Skip to content

Commit

Permalink
Merge pull request #338 from GIScience/release-v0.5.4
Browse files Browse the repository at this point in the history
Release v0.5.4
  • Loading branch information
TheGreatRefrigerator committed Jul 23, 2020
2 parents e902508 + 6a25f0c commit cdeaab8
Show file tree
Hide file tree
Showing 24 changed files with 4,762 additions and 6,551 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Deprecated
### Removed-->

## [v0.5.4] - 2020-07-23

### Fixed
- gpx export exception ([#335](https://github.com/GIScience/openrouteservice-app/issues/335))
- distance markers not only on active route ([PR #337](https://github.com/GIScience/openrouteservice-app/pull/337))
- turn instruction with tcx export ([PR #323](https://github.com/GIScience/openrouteservice-app/pull/323))

### Removed
- unused code
- unused dependency

### Security
- updated some dependencies

## [v0.5.3] - 2020-05-18

### Added
Expand Down
98 changes: 56 additions & 42 deletions app/components/ors-map/ors-map.js
Expand Up @@ -57,8 +57,8 @@ angular.module("orsApp").directive("orsMap", () => {
ENV.key !== undefined
? ENV.key
: orsApikeyFactory.getApiKey() === undefined
? weathercheck
: orsApikeyFactory.getApiKey();
? weathercheck
: orsApikeyFactory.getApiKey();
let ak = "?api_key=" + apiKey;

$scope.translateFilter = $filter("translate");
Expand Down Expand Up @@ -103,15 +103,6 @@ angular.module("orsApp").directive("orsMap", () => {
attribution: orsNamespaces.layerCycleOsm.attribution,
id: 8
});
// const stamen = L.tileLayer(orsNamespaces.layerStamen.url, {
// attribution: orsNamespaces.layerStamen.attribution,
// });
/*const hillshade = L.tileLayer(orsNamespaces.overlayHillshade.url, {
format: 'image/png',
opacity: 0.45,
transparent: true,
attribution: '<a href="http://srtm.csi.cgiar.org/">SRTM</a>; ASTER GDEM is a product of <a href="http://www.meti.go.jp/english/press/data/20090626_03.html">METI</a> and <a href="https://lpdaac.usgs.gov/products/aster_policies">NASA</a>',
});*/
$scope.heightGraphData = [];
$scope.geofeatures = {
layerLocationMarker: L.featureGroup(),
Expand Down Expand Up @@ -187,12 +178,32 @@ angular.module("orsApp").directive("orsMap", () => {
for (let [key, value] of Object.entries(
$scope.alternativeRouteLayers
)) {
const routeLines = $scope.geofeatures.layerRouteLines;
if (key === idx.toString()) {
if (
orsSettingsFactory.getUserOptions().distanceMarkers === true
) {
const routeLeafletId = Object.keys(value._layers)[0];
routeLines.getLayer(routeLeafletId).addDistanceMarkers();
}
value.bringToFront();
Object.values(value._layers)[1]
.setStyle(lists.layerStyles.route())
.closeTooltip();
} else {
if (
orsSettingsFactory.getUserOptions().distanceMarkers === true
) {
for (let routeLeafletId of Object.keys(value._layers)) {
if (
Object.keys(routeLines._layers).includes(routeLeafletId)
) {
routeLines
.getLayer(routeLeafletId)
.removeDistanceMarkers();
}
}
}
Object.values(value._layers)[1]
.setStyle(lists.layerStyles.routeAlternative())
.closeTooltip();
Expand Down Expand Up @@ -233,6 +244,10 @@ angular.module("orsApp").directive("orsMap", () => {
* @param payload.setting {String} - holds the changed Setting
*/
$scope.$on("changeOptions", (func, payload) => {
let currentRouteIdx =
orsRouteService.getCurrentRouteIdx() === undefined
? 0
: orsRouteService.getCurrentRouteIdx();
let options = payload.options;
let setting = payload.setting;
if (setting === "heightgraph") {
Expand All @@ -258,10 +273,6 @@ angular.module("orsApp").directive("orsMap", () => {
close.bind("click", () => {
globals.showHeightgraph = false;
});
let idx =
orsRouteService.getCurrentRouteIdx() === undefined
? 0
: orsRouteService.getCurrentRouteIdx();
if (
angular.isDefined(orsRouteService.data) &&
angular.isDefined(orsRouteService.data.features)
Expand All @@ -276,7 +287,9 @@ angular.module("orsApp").directive("orsMap", () => {
);
}
}
orsRouteService.addHeightgraph($scope.heightGraphData[idx]);
orsRouteService.addHeightgraph(
$scope.heightGraphData[currentRouteIdx]
);
}
} else {
$scope.hg.remove();
Expand All @@ -288,17 +301,31 @@ angular.module("orsApp").directive("orsMap", () => {
}
}
if (setting === "distanceMarkers") {
// get Leaflet route object
let lines = $scope.mapModel.geofeatures.layerRouteLines._layers;
let route = lines[Object.keys(lines)[0]];

if (options.distanceMarkers === true) {
route.addDistanceMarkers();
} else {
$scope.toggleDistanceMarkerSetting(
options.distanceMarkers,
currentRouteIdx
);
}
});
/**
* Handles distance marker (DM) settings
* @param addDistanceMarkers - if DM should be added or removed
* @param currentRouteIdx - current route index
*/
$scope.toggleDistanceMarkerSetting = (
addDistanceMarkers,
currentRouteIdx
) => {
const lines = $scope.mapModel.geofeatures.layerRouteLines._layers;
if (addDistanceMarkers) {
// alternative routes are at every 2nd index
lines[Object.keys(lines)[2 * currentRouteIdx]].addDistanceMarkers();
} else {
for (const route of Object.values(lines)) {
route.removeDistanceMarkers();
}
}
});
};

/* FULLWIDTH CONTROLLER */
L.FullwidthControl = L.Control.extend({
Expand Down Expand Up @@ -510,7 +537,6 @@ angular.module("orsApp").directive("orsMap", () => {
orsSettingsFactory.setAvoidableAreas(avoidPolygons);
};
const shapeDrawn = function(e) {
//$scope.layerControls.addOverlay($scope.geofeatures.layerAvoid, 'Avoidable regions');
setSettings();
};
$scope.baseLayers = {
Expand All @@ -523,9 +549,6 @@ angular.module("orsApp").directive("orsMap", () => {
"World Imagery": worldImagery,
CycleOSM: cycleOSM
};
$scope.overlays = {
// "Hillshade": hillshade
};
$scope.mapModel.map.on("load", evt => {
// add mapstyle
angular.forEach($scope.baseLayers, (value, key) => {
Expand Down Expand Up @@ -554,7 +577,7 @@ angular.module("orsApp").directive("orsMap", () => {
}
// add layer control
$scope.layerControls = L.control
.layers($scope.baseLayers, $scope.overlays)
.layers($scope.baseLayers)
.addTo($scope.mapModel.map);
$scope.mapModel.map.editTools.featuresLayer =
$scope.geofeatures.layerAvoid;
Expand Down Expand Up @@ -620,9 +643,6 @@ angular.module("orsApp").directive("orsMap", () => {
$scope.popup.update();
}, 300);
});
//$scope.mapModel.map.on('baselayerchange', emitMapChangeBaseMap);
//$scope.mapModel.map.on('overlayadd', emitMapChangeOverlay);
//$scope.mapModel.map.on('overlayremove', emitMapChangeOverlay);
$scope.mapModel.map.on("zoomend", e => {
const currentZoom = $scope.mapModel.map.getZoom();
if (currentZoom >= 15) {
Expand Down Expand Up @@ -884,7 +904,6 @@ angular.module("orsApp").directive("orsMap", () => {
$timeout(function() {
$scope.mapModel.map.panTo(actionPackage.geometry);
}, 100);
//$scope.mapModel.map.setZoom(13);
} else {
let bounds = new L.LatLngBounds(actionPackage.geometry);
$scope.orsMap.fitBounds(bounds);
Expand Down Expand Up @@ -1100,7 +1119,6 @@ angular.module("orsApp").directive("orsMap", () => {
'<span class="fa-stack fa-lg"><i class="fa fa-stack-2x fa-map-marker"></i><i class="fa fa-stack-1x icon-back"></i>' +
lists.landmark_icons[feature.properties.type] +
"</span>";
//locationsIcon.options.html = lists.landmark_icons[feature.properties.type];//'<i class="fa fa-map-marker"><i class="fa fa-lg fa-institution"></i></i>';
return L.marker(latlng, {
icon: landmarksIcon,
draggable: "false"
Expand All @@ -1115,6 +1133,7 @@ angular.module("orsApp").directive("orsMap", () => {
*/
$scope.addFeatures = actionPackage => {
const isDistanceMarkers =
actionPackage.layerCode === "layerRouteLines" &&
orsSettingsFactory.getUserOptions().distanceMarkers === true;
let polyLine = L.polyline(actionPackage.geometry, {
index:
Expand Down Expand Up @@ -1193,7 +1212,7 @@ angular.module("orsApp").directive("orsMap", () => {
currentRouteIndex: actionPackage.currentRouteIndex
});
polyLine.bubblingMouseEvents = false;
// click inactive route geomgetry to activate
// click inactive route geometry to activate
polyLine.on("click", e => {
orsRouteService.setCurrentRouteIdx(
polyLine.options.currentRouteIndex
Expand Down Expand Up @@ -1354,7 +1373,6 @@ angular.module("orsApp").directive("orsMap", () => {
$scope.hoverPoint = new L.marker(snappedPosition.latlng, {
icon: hoverIcon,
draggable: "true"
//bubblingMouseEvents: true
})
.addTo(mapModel.geofeatures.layerRouteDrag)
.on("dragend", event => {
Expand Down Expand Up @@ -1394,7 +1412,6 @@ angular.module("orsApp").directive("orsMap", () => {
hoverPolyLine,
e.latlng
);
//$scope.mapModel.geofeatures.layerRouteDrag.clearLayers();
$scope.distanceAtInterpolatedPoint =
snappedPosition.factor *
pointList[pointList.length - 1].distance;
Expand Down Expand Up @@ -1579,10 +1596,8 @@ angular.module("orsApp").directive("orsMap", () => {
);
};
orsSettingsFactory.subscribeToNgRoute(function onNext(route) {
//let svg = d3.select($scope.mapModel.map.getPanes().overlayPane);
$scope.clearMap(true);
$scope.routing = route === "directions";
//if ($scope.routing) svg.style("opacity", 1);
});
orsSettingsFactory.subscribeToWaypoints(function onNext(d) {
const waypoints = d;
Expand All @@ -1595,7 +1610,6 @@ angular.module("orsApp").directive("orsMap", () => {
// re-add waypoints only after init
if (waypoints.length > 0)
$scope.reAddWaypoints(waypoints, $scope.routing, true);
// $scope.addWaypoint(idx, iconIdx, waypoint._latlng, fireRequest);
});
$scope.hereControl = L.control({
position: "bottomright"
Expand All @@ -1610,7 +1624,7 @@ angular.module("orsApp").directive("orsMap", () => {
$scope.mapModel.map.closePopup();
const lngLatString = orsUtilsService.parseLngLatString(pos);
const latLngString = orsUtilsService.parseLatLngString(pos);
// get the information of the rightclick location
// get the information of the right-click location
const payload = orsUtilsService.geocodingPayload(lngLatString, true);
const request = orsRequestService.geocode(payload, true);
request.promise.then(
Expand All @@ -1634,7 +1648,7 @@ angular.module("orsApp").directive("orsMap", () => {
$scope.address.latLng = latLngString;
$scope.mapModel.map.addControl($scope.hereControl);
// add temporary circle marker
var circleMarkerOptions = {
const circleMarkerOptions = {
radius: 5,
fillColor: "#FFF",
color: "#000",
Expand Down
2 changes: 1 addition & 1 deletion app/components/ors-navigation/ors-nav.js
Expand Up @@ -13,7 +13,7 @@ angular
if ($location.path() === "/") {
ctrl.activeMenu = "/directions";
} else ctrl.activeMenu = $location.path();
ctrl.version = "0.5.3";
ctrl.version = "0.5.4";
}
],
$routeConfig: [
Expand Down
Expand Up @@ -717,8 +717,8 @@ angular.module("orsApp.ors-options", []).component("orsOptions", {
list === "carYears"
? Object.keys(ctrl.carResponse[ctrl.queryModel])
: list === "carTypes" && ctrl.queryYear
? Object.keys(ctrl.carResponse[ctrl.queryModel][ctrl.queryYear])
: list;
? Object.keys(ctrl.carResponse[ctrl.queryModel][ctrl.queryYear])
: list;
};
ctrl.chooseCategory = () => {
// rename Object key of the filters.fuel_consumptions and keep value
Expand Down Expand Up @@ -755,20 +755,14 @@ angular.module("orsApp.ors-options", []).component("orsOptions", {
if (ctrl.queryType) {
ctrl.ofs.filters.cfd_ids =
ctrl.carResponse[ctrl.queryModel][ctrl.queryYear][ctrl.queryType];
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${
ctrl.queryModel
} (${ctrl.queryYear}) ${ctrl.queryType}`;
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${ctrl.queryModel} (${ctrl.queryYear}) ${ctrl.queryType}`;
} else if (ctrl.queryYear) {
ctrl.ofs.filters.cfd_ids =
ctrl.carResponse[ctrl.queryModel][ctrl.queryYear].all;
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${
ctrl.queryModel
} (${ctrl.queryYear})`;
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${ctrl.queryModel} (${ctrl.queryYear})`;
} else if (ctrl.queryModel) {
ctrl.ofs.filters.cfd_ids = ctrl.carResponse[ctrl.queryModel].all;
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${
ctrl.queryModel
}`;
ctrl.ofs.filters.request_id = `${ctrl.queryBrand} - ${ctrl.queryModel}`;
}
} else {
ctrl.ofs.filters.request_id =
Expand Down

0 comments on commit cdeaab8

Please sign in to comment.