2018-06-27 14:59:45 +02:00
|
|
|
import L from 'leaflet';
|
|
|
|
|
2018-07-10 15:19:24 +02:00
|
|
|
import accidentMarker from '@/assets/accidentMarker.svg';
|
2018-06-27 14:59:45 +02:00
|
|
|
import gcumMarker from '@/assets/gcumMarker.svg';
|
2018-06-30 22:54:38 +02:00
|
|
|
import interruptMarker from '@/assets/interruptMarker.svg';
|
2018-07-10 15:19:24 +02:00
|
|
|
import miscMarker from '@/assets/miscMarker.svg';
|
2018-06-27 14:59:45 +02:00
|
|
|
import obstacleMarker from '@/assets/obstacleMarker.svg';
|
|
|
|
import potholeMarker from '@/assets/potholeMarker.svg';
|
2018-07-10 15:19:24 +02:00
|
|
|
import accidentIcon from '@/assets/accident.svg';
|
|
|
|
import gcumIcon from '@/assets/gcum.svg';
|
2018-06-30 22:54:38 +02:00
|
|
|
import interruptIcon from '@/assets/interrupt.svg';
|
2018-07-10 15:19:24 +02:00
|
|
|
import miscIcon from '@/assets/misc.svg';
|
2018-06-30 22:54:38 +02:00
|
|
|
import obstacleIcon from '@/assets/obstacle.svg';
|
|
|
|
import potholeIcon from '@/assets/pothole.svg';
|
2018-06-27 14:59:45 +02:00
|
|
|
|
2018-07-27 16:13:16 +02:00
|
|
|
export const VERSION = '0.1';
|
|
|
|
|
2018-06-27 14:59:45 +02:00
|
|
|
export const REPORT_TYPES = {
|
2018-07-10 15:19:24 +02:00
|
|
|
accident: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.accidentDescription',
|
2018-07-10 15:19:24 +02:00
|
|
|
label: 'reportLabels.accident',
|
|
|
|
image: accidentIcon,
|
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: accidentMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: accidentMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
|
|
|
|
|
|
|
},
|
2018-06-27 14:59:45 +02:00
|
|
|
gcum: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.gcumDescription',
|
2018-06-27 14:59:45 +02:00
|
|
|
label: 'reportLabels.gcum',
|
2018-07-10 15:19:24 +02:00
|
|
|
image: gcumIcon,
|
2018-06-27 14:59:45 +02:00
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: gcumMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
2018-07-05 22:40:24 +02:00
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: gcumMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
|
|
|
|
2018-06-27 14:59:45 +02:00
|
|
|
},
|
|
|
|
interrupt: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.interruptDescription',
|
2018-06-27 14:59:45 +02:00
|
|
|
label: 'reportLabels.interrupt',
|
2018-06-30 22:54:38 +02:00
|
|
|
image: interruptIcon,
|
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: interruptMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
2018-07-05 22:40:24 +02:00
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: interruptMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
2018-06-30 22:54:38 +02:00
|
|
|
},
|
2018-07-10 15:19:24 +02:00
|
|
|
misc: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.miscDescription',
|
2018-07-10 15:19:24 +02:00
|
|
|
label: 'reportLabels.misc',
|
|
|
|
image: miscIcon,
|
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: miscMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: miscMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
|
|
|
},
|
2018-06-30 22:54:38 +02:00
|
|
|
obstacle: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.obstacleDescription',
|
2018-06-30 22:54:38 +02:00
|
|
|
label: 'reportLabels.obstacle',
|
|
|
|
image: obstacleIcon,
|
2018-06-27 14:59:45 +02:00
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: obstacleMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
2018-07-05 22:40:24 +02:00
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: obstacleMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
2018-06-27 14:59:45 +02:00
|
|
|
},
|
|
|
|
pothole: {
|
2018-07-16 17:26:10 +02:00
|
|
|
description: 'reportLabels.potholeDescription',
|
2018-06-27 14:59:45 +02:00
|
|
|
label: 'reportLabels.pothole',
|
2018-06-30 22:54:38 +02:00
|
|
|
image: potholeIcon,
|
2018-06-27 14:59:45 +02:00
|
|
|
marker: L.icon({
|
|
|
|
iconUrl: potholeMarker,
|
|
|
|
iconSize: [40, 40],
|
|
|
|
iconAnchor: [20, 40],
|
|
|
|
}),
|
2018-07-05 22:40:24 +02:00
|
|
|
markerLarge: L.icon({
|
|
|
|
iconUrl: potholeMarker,
|
|
|
|
iconSize: [60, 60],
|
|
|
|
iconAnchor: [30, 60],
|
|
|
|
}),
|
2018-06-27 14:59:45 +02:00
|
|
|
},
|
|
|
|
};
|
2018-07-10 15:19:24 +02:00
|
|
|
// Display order of the report types
|
|
|
|
export const REPORT_TYPES_ORDER = ['gcum', 'interrupt', 'obstacle', 'pothole', 'accident', 'misc'];
|
2018-06-27 14:59:45 +02:00
|
|
|
|
2018-07-12 17:48:26 +02:00
|
|
|
export const MIN_DISTANCE_REPORT_DETAILS = 40; // in meters
|
|
|
|
|
2018-07-13 16:25:21 +02:00
|
|
|
export const MOCK_LOCATION = false;
|
2018-07-21 20:00:37 +02:00
|
|
|
export const MOCK_LOCATION_UPDATE_INTERVAL = 5 * 1000; // in milliseconds
|
2018-06-27 11:17:38 +02:00
|
|
|
|
2018-07-21 20:00:37 +02:00
|
|
|
export const UPDATE_REPORTS_DISTANCE_THRESHOLD = 500; // in meters
|
2018-06-27 11:17:38 +02:00
|
|
|
|
2018-07-05 22:40:24 +02:00
|
|
|
// Minimal ratio between upvotes and downvotes needed for a report to be shown
|
|
|
|
export const REPORT_VOTES_THRESHOLD = 0.5;
|
|
|
|
|
2018-07-21 20:00:37 +02:00
|
|
|
export const EARTH_RADIUS = 6378137; // in meters
|
2018-06-27 14:59:45 +02:00
|
|
|
|
|
|
|
export const DEFAULT_ZOOM = 17;
|
2018-06-30 22:56:33 +02:00
|
|
|
export const MIN_ZOOM = 10;
|
2018-06-27 14:59:45 +02:00
|
|
|
export const MAX_ZOOM = 18;
|
2018-07-17 16:32:34 +02:00
|
|
|
|
2018-07-21 20:00:37 +02:00
|
|
|
export const ACCURACY_DISPLAY_THRESHOLD = 100; // in meters
|
|
|
|
|
2018-07-17 16:32:34 +02:00
|
|
|
let opencyclemapURL = 'https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png';
|
|
|
|
if (process.env.THUNDERFOREST_API_KEY) {
|
|
|
|
opencyclemapURL += `?apikey=${process.env.THUNDERFOREST_API_KEY}`;
|
|
|
|
}
|
|
|
|
export const TILE_SERVERS = {
|
|
|
|
'cartodb-voyager': 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png',
|
|
|
|
opencyclemap: opencyclemapURL,
|
|
|
|
};
|
|
|
|
export const DEFAULT_TILE_SERVER = 'cartodb-voyager';
|
2018-07-17 23:19:28 +02:00
|
|
|
|
|
|
|
export const GEOCODING_API_ENDPOINT = 'https://api-adresse.data.gouv.fr/search/';
|
2018-07-26 13:55:08 +02:00
|
|
|
|
|
|
|
// Delay in milliseconds between two consecutive calls to the backend API when
|
|
|
|
// doing batch requests
|
|
|
|
export const DELAY_BETWEEN_API_BATCH_REQUESTS = 1000;
|
2018-07-30 23:08:10 +02:00
|
|
|
|
|
|
|
// A vibration sequence for report alarms
|
|
|
|
export const REPORT_ALARM_VIBRATION_SEQUENCE = [500];
|