Remove unused map code

This commit is contained in:
Franc Camps-Febrer
2018-12-19 15:46:55 +01:00
parent d47dabab10
commit 775608edf4
3 changed files with 0 additions and 93 deletions

View File

@@ -16,7 +16,6 @@
"es6-promise": "^4.1.1",
"joi": "^14.0.1",
"leaflet": "^1.0.3",
"leaflet-polylinedecorator": "^1.3.2",
"normalizr": "^3.2.3",
"object-hash": "^1.3.0",
"react": "^16.6.3",

View File

@@ -1,82 +0,0 @@
import { isNotNullNorUndefined } from '../utilities';
import hash from 'object-hash';
import 'leaflet-polylinedecorator';
export default function(lMap, svg, newApp, ui) {
const app = {
selected: [],
highlighted: null,
}
// Icons for markPoint flags (a yellow ring around a location)
const eventCircleMarkers = {};
/**
* Removes the circular ring to mark a particular location
*/
function unmarkPoint() {
Object.keys(eventCircleMarkers).forEach(markerId => {
lMap.removeLayer(eventCircleMarkers[markerId]);
delete eventCircleMarkers[markerId];
});
}
/**
* Makes a circular ring mark in one particular location at a time
* @param {object} location object, with lat and long
*/
function renderSelected() {
unmarkPoint();
app.selected.forEach(eventPoint => {
if (isNotNullNorUndefined(eventPoint) && isNotNullNorUndefined(eventPoint.location)) {
if (eventPoint.latitude && eventPoint.latitude !== "" && eventPoint.longitude && eventPoint.longitude !== "") {
const location = new L.LatLng(eventPoint.latitude, eventPoint.longitude);
eventCircleMarkers[eventPoint.id] = L.circleMarker(location, {
radius: 32,
fill: false,
color: '#ffffff',
weight: 3,
lineCap: '',
dashArray: '5,2'
});
eventCircleMarkers[eventPoint.id].addTo(lMap);
}
}
})
}
function renderHighlighted() {
// Fly to first of events selected
const eventPoint = (app.selected.length > 0) ? app.selected[0] : null;
if (isNotNullNorUndefined(eventPoint) && isNotNullNorUndefined(eventPoint.location)) {
if (eventPoint.latitude && eventPoint.longitude) {
const location = new L.LatLng(eventPoint.latitude, eventPoint.longitude);
lMap.flyTo(location);
}
}
}
/**
* Updates displayable data on the map: events, coevents and paths
*/
function update(newApp) {
if (hash(app) !== hash(newApp)) {
app.selected = newApp.selected;
app.highlighted = newApp.highlighted;
renderSelectedAndHighlight();
}
}
function renderSelectedAndHighlight () {
renderSelected();
renderHighlighted();
}
/**
* Expose only relevant functions
*/
return {
update
};
}

View File

@@ -3940,16 +3940,6 @@ lcid@^2.0.0:
dependencies:
invert-kv "^2.0.0"
leaflet-polylinedecorator@^1.3.2:
version "1.6.0"
resolved "https://registry.yarnpkg.com/leaflet-polylinedecorator/-/leaflet-polylinedecorator-1.6.0.tgz#9ef79fd1b5302d67b72efe959a8ecd2553f27266"
dependencies:
leaflet-rotatedmarker "^0.2.0"
leaflet-rotatedmarker@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz#4467f49f98d1bfd56959bd9c6705203dd2601277"
leaflet@^1.0.3:
version "1.3.4"
resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.3.4.tgz#7f006ea5832603b53d7269ef5c595fd773060a40"