Commit c73b0b8f authored by Vincent Dubois's avatar Vincent Dubois

Indicateur/Couleur de marker pour les requetes

Ajout de la couche d'éléments éloignés
parent 67339314
This diff is collapsed.
......@@ -74,17 +74,17 @@ $(document).ready(() => {
let $geocropping = $(geocropping);
// Ajouter les serveur Overpass dans le menu déroulant
for (var key in geocropping._app_server_interpreter_list) {
/*for (var key in geocropping._app_server_interpreter_list) {
$('#urlInterpreter').append(`<option value="${key}">${key}</option>`);
}
}*/
////////
// EVENTS
// Si le serveur Overpass est changé par Geocropping.ts
$geocropping.on('urlInterpreterUpdated', (e, index) => {
/*$geocropping.on('urlInterpreterUpdated', (e, index) => {
$('#urlInterpreter').val(index);
});
});*/
$('#userAction #login').click(() => {
geocropping.connect();
......@@ -93,6 +93,14 @@ $(document).ready(() => {
geocropping.userDisconnect();
});
// Mode d'affichage des éléments (zoom large)
$('#menu #modeDisplayFar').on('change','input[name=modeDisplayFar]', function (e) {
let $this = $(this);
if($this.is(':checked')){
geocropping.setDisplayModeFar($this.val());
}
});
// Checkbox pour se déplacer sur la carte au clic
$('#menu #clickPos').change(function (e) {
let val = $(this).prop('checked');
......
/// <reference path="./../typings/leaflet/index.d.ts" />
declare namespace L {
export interface heatLayerOptions {
/**
* The minimum opacity the heat will start at
*/
minOpacity?: number,
/**
* Zoom level where the points reach maximum intensity (as intensity scales with zoom), equals maxZoom of the map by default
*/
maxZoom?: number,
/**
* Maximum point intensity, 1.0 by default
*/
max?: number,
/**
* Radius of each "point" of the heatmap, 25 by default
*/
radius?: number,
/**
* Amount of blur, 15 by default
*/
blur?: number,
/**
* Color gradient config, e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'}
*/
gradient?: any,
relative?: boolean,
}
export interface HeatLayer extends L.Layer {
/**
* Sets new heatmap options and redraws it
*/
setOptions: (options: heatLayerOptions) => void,
/**
* Adds a new point to the heatmap and redraws it
*/
addLatLng: (latlng: L.LatLng | number[]) => void,
/**
* Resets heatmap data and redraws it
*/
setLatLngs: (latlng: L.LatLng[] | number[][]) => void,
/**
* Redraws the heatmap
*/
redraw: () => void,
_latlngs: L.LatLng[],
_map?: L.Map
}
export function heatLayer(latlngs?: L.LatLng[] | number[][], options?: heatLayerOptions): HeatLayer;
}
\ No newline at end of file
/// <reference path="OauthOsm.d.ts" />
/// <reference path="Geocropping.d.ts" />
/// <reference path="leaflet.heat.d.ts" />
declare function osmtogeojson(any): any
interface IDictionary<TValue> {
......
......@@ -7,7 +7,7 @@
"target": "es5",
"noImplicitAny": false,
"outDir": "../js",
"removeComments": false,
"removeComments": true,
"alwaysStrict": true,
"declaration": true,
"declarationDir": "./typings",
......
......@@ -2,320 +2,94 @@
/// <reference path="../myTypings/tsd.d.ts" />
/// <reference types="leaflet" />
/// <reference types="jquery" />
/**
*
*
* @class Geocropping
*/
declare class Geocropping {
_userNbValidated: number;
_userNbInvalidated: number;
/**
* Gestion de la connexion à osm
*
* @type {OauthOsm}
* @memberof Geocropping
*/
_osm: OauthOsm;
/**
* Leaflet map
*
* @type {L.Map}
* @memberof Geocropping
*/
_map?: L.Map;
/**
* Osm data user
*
* @type {Geocropping.USER}
* @memberof Geocropping
*/
_icon: {
red: L.Icon;
green: L.Icon;
blue: L.Icon;
};
_user: Geocropping.USER;
/**
* Marker indiquant la position de l'utilisateur sur la carte
*
* @type {L.Marker}
* @memberof Geocropping
*/
_userMarker: L.Marker;
/**
* Groupe de layer des élément affiché
*
* @type {L.GeoJSON}
* @memberof Geocropping
*/
_geoJSONLayers: L.GeoJSON;
_geoJSONLayersFar: L.GeoJSON;
/**
* Dernière position de l'utilisateur enregistré
*
* @type {L.LatLng}
* @memberof Geocropping
*/
_heatLayerFar: L.HeatLayer;
_app_heatLayer_options: {
minOpacity: number;
radius: number;
blur: number;
gradient: {
0.9: string;
0.95: string;
1: string;
};
};
_lastUserLocation?: L.LatLng;
/**
* Stoker le nécessaire lié a un élément dans un dictionnaire avec son id (ex: 'node/123456789') comme index
*
* @type {IDictionary<{ layer: L.Layer, note?: any }>}
* @memberof Geocropping
*/
_featureDisplayed: IDictionary<{
_featureDisplayedAround: IDictionary<{
layer: L.Layer;
}>;
/**
* Callback du clic sur la carte (stocké pour pouvoir arrêter l'event)
*
* @type {L.EventHandlerFn}
* @memberof Geocropping
*/
_featureDisplayedFar: IDictionary<{
latlng: L.LatLng;
}>;
__locationFoundClick: L.EventHandlerFn;
/**
* Zoom minimum de la carte
*
* @type {number}
* @memberof Geocropping
*/
_map_minZoom: number;
/**
* Zoom maximum de la carte
*
* @type {number}
* @memberof Geocropping
*/
_map_maxZoom: number;
/**
* Liste de serveur Overpass
*
* @type {IDictionary<string>}
* @memberof Geocropping
*/
_app_server_interpreter_list: IDictionary<string>;
/**
* Serveur Overpass utilisé
*
* @type {string}
* @memberof Geocropping
*/
_app_server_interpreter_index: string;
/**
* Distance of the search (meter)
*
* @type {number}
* @memberof Geocropping
*/
_app_distance_search: number;
/**
* Distance to hide feature (meter)
*
* @type {number}
* @memberof Geocropping
*/
_app_distance_hide: number;
_app_distance_search_far: number;
_app_distance_hide_far: number;
/**
* Distance need to search feature between the actual user location and the latest search location (meter)
*
* @type {number}
* @memberof Geocropping
*/
_app_display_far: boolean;
_app_distance_travel_to_search: number;
/**
* TODO:
* Number maximum of feature that can be displayed (-1 limitless)
*
* @type {number}
* @memberof Geocropping
*/
_app_limit_feature_displayed: number;
/**
* Time to locate user again (ms)
*
* @type {number}
* @memberof Geocropping
*/
_app_time_locate_interval: number;
/**
* True if position on clic is actived
*
* @memberof Geocropping
*/
_app_click_position_actived: boolean;
/**
* Gérer les notification affiché sur la carte
*
* @type {MyNotification}
* @memberof Geocropping
*/
notify: MyNotification;
_style_alert_far: L.PathOptions;
_style_warning_far: L.PathOptions;
_style_ok_far: L.PathOptions;
_style_invalid_far: L.PathOptions;
/**
* Style rouge pour un element sur la carte
*
* @type {L.PathOptions}
* @memberof Geocropping
*/
_style_alert_far: {
value: number;
color: string;
display: boolean;
};
_style_warning_far: {
value: number;
color: string;
display: boolean;
};
_style_ok_far: {
value: number;
color: string;
display: boolean;
};
_style_invalid_far: {
value: number;
color: string;
display: boolean;
};
_style_alert: L.PathOptions;
/**
* Style orange pour un element sur la carte
*
* @type {L.PathOptions}
* @memberof Geocropping
*/
_style_warning: L.PathOptions;
/**
* Style vert pour un element sur la carte
*
* @type {L.PathOptions}
* @memberof Geocropping
*/
_style_ok: L.PathOptions;
/**
* Style bleu pour un element sur la carte
*
* @type {L.PathOptions}
* @memberof Geocropping
*/
_style_selected: L.PathOptions;
/**
* Style noir pour un element sur la carte
*
* @type {L.PathOptions}
* @memberof Geocropping
*/
_style_invalid: L.PathOptions;
/**
* Format d'élément par défaut
*
* @readonly
* @static
* @type {Geocropping.DEFAULT}
* @memberof Geocropping
*/
static readonly DEFAULT: Geocropping.DEFAULT;
/**
* Creates an instance of Geocropping.
* @memberof Geocropping
*/
constructor();
/**
* Connect l'utilisateur a OSM
*
* @returns {JQueryPromise<{}>}
* @memberof Geocropping
*/
connect(): JQueryPromise<{}>;
/**
* Donnect l'utilisateur a OSM
*
* @returns {JQueryPromise<{}>}
* @memberof Geocropping
*/
userDisconnect(): JQueryPromise<{}>;
/**
* Savoir si l'utilisateur est connecté
*
* @readonly
* @type {boolean}
* @memberof Geocropping
*/
readonly isConnected: boolean;
/**
* Mettre a jour les informations de l'utilisateur a partir de OSM
*
* @returns {JQueryPromise<{}>}
* @memberof Geocropping
*/
updateUserDetails(): JQueryPromise<{}>;
/**
* Récupérer les information de l'utilisateur si existant
*
* @returns {(Geocropping.USER|null)}
* @memberof Geocropping
*/
getUserDetails(): Geocropping.USER | null;
/**
* Savoir si la map est crée
*
* @returns {boolean}
* @memberof Geocropping
*/
isMapCreated(): boolean;
/**
* Créer la carte leaflet
*
* @param {(string|HTMLElement)} map Element ou id de l'élément où doit être créer la carte
* @returns {boolean}
* @memberof Geocropping
*/
createMap(map: string | HTMLElement): boolean;
/**
* Activer/Désactiver la position au click
*
* @param {Boolean} active
* @memberof Geocropping
*/
setClickPosition(active: Boolean): void;
/**
* Créer ou récupérer la fonction de call back du clic (pour pouvoir arrêter l'event)
*
* @returns {L.EventHandlerFn}
* @memberof Geocropping
*/
_locationFoundClickFunction(): L.EventHandlerFn;
/**
* Démarrer la géolocalisation
*
* @returns {boolean}
* @memberof Geocropping
*/
startLocateUser(): boolean;
/**
* Arrêter la géoliocalisation
*
* @memberof Geocropping
*/
stopLocateUser(): void;
/**
* Définir la position du marker de l'utilisateur et faire la recherche des éléments autour
*
* @param {L.LocationEvent} data
* @param {any} [options] Options de la géolocalisation (pour la relancer)
* @memberof Geocropping
*/
_locationFound(data: L.LocationEvent, options?: any): void;
/**
* Afficher l'erreur de géolocalisation
*
* @param {L.ErrorEvent} e
* @param {any} [options] Options de la géolocalisation (pour la relancer)
* @memberof Geocropping
*/
_locationError(e: L.ErrorEvent, options?: any): void;
/**
* Rechercher des éléments autour d'une position
*
* @param {L.LatLng} pos Position de la recherche
* @memberof Geocropping
*/
_searchDataAround(pos: L.LatLng): void;
/**
* Récupérer les données des éléments affichés directement sur OSM
*
* @returns {JQueryPromise<{}>} pid
* @memberof Geocropping
*/
_searchInfoElementsOSM(): JQueryPromise<{}>;
/**
* Mettre a jour les données des éléments affichés
*
* @param {{ any?}} data Données récupérer sur OSM
* @memberof Geocropping
*/
_updateElementsDisplayed(data: {
_searchInfoElementsOSMAround(): JQueryPromise<{}>;
_updateElementsDisplayedAround(data: {
any?;
}): void;
_checkChanges(): void;
......@@ -324,8 +98,11 @@ declare class Geocropping {
_getStats(): void;
isFixmeFromUs(contenuDuFixme: string): boolean;
_searchDataFar(pos: L.LatLng): void;
_updateElementsDisplayedFar(data: {
any?;
}): void;
_getPositionColorFar(data: any): L.LatLng[];
_searchData(pos: L.LatLng): void;
setDisplayModeFar(type: string): boolean;
_getGradientFar(): {};
_resetStyleFar(): void;
_searchInfoElementsOSMFar(): JQueryPromise<{}>[];
_updateElementsDisplayedFar(data?: any): void;
}
......@@ -2,113 +2,24 @@
/// <reference path="../myTypings/tsd.d.ts" />
/// <reference path="../myTypings/OauthOsm.d.ts" />
/// <reference types="jquery" />
/**
* Gerer les requete pour OSM
*
* @class OauthOsm
*/
declare class OauthOsm {
/**
* Url pour effectuer les requetes
*
* @type {string}
* @memberof OauthOsm
*/
_baseUrl: string;
/**
* Utiliser le serveur OSM de dev
*
* @type {boolean}
* @memberof OauthOsm
*/
_devApi: boolean;
/**
* Savoir si l'utilisateur est connecté
*
* @type {boolean}
* @memberof OauthOsm
*/
_connected: boolean;
/**
* Savoir si l'utilisateur est connecté
*
* @readonly
* @memberof OauthOsm
*/
readonly isConnected: boolean;
/**
* Creates an instance of OauthOsm.
* @memberof OauthOsm
*/
constructor();
/**
* Template des requêtes qui peuvent être envoyées
*
* @readonly
* @static
* @type {IDictionary<OauthOsm.ApiRequest>}
* @memberof OauthOsm
*/
static readonly apiRequest: IDictionary<OauthOsm.ApiRequest>;
/**
* Envoyer une requete a OSM
*
* @param {OauthOsm.ApiRequest} apiRequest
* @returns
* @memberof OauthOsm
*/
_sendRequest(apiRequest: OauthOsm.ApiRequest): JQueryPromise<{}>;
/**
* Récupérer les details du serveur
* @public
*
* @return {Promise} Pour gérer les callbacks
*/
getServerDetails(): JQueryPromise<{}>;
/**
* Récupérer les information de l'utilisateur connecté
* @public
*
* @return {Promise} Pour gérer les callbacks
*/
getUserDetails(): JQueryPromise<{}>;
/**
* Ouvrir la fenetre de connection
* @public
*
* @return {JQueryPromise} Pour gérer les callbacks
*/
connect(): JQueryPromise<{}>;
/**
* Déconnecter l'utilisateur actuel
* @public
*/
disconnect(): JQueryPromise<{}>;
}
/**
* Get all cookies or
*
* @param {(string | string[])} [name=[]]
* @returns {{ key: string, value: string }[]}
*/
declare function getCookies(name?: string | string[]): {
key: string;
value: string;
}[];
/**
* Delete a cookie
*
* @param {string} name
* @param {string} [path=""]
*/
declare function deleteCookie(name: string, path?: string): void;
/**
* Save data on browser storage
*
* @param {string} name
* @param {string} value
* @param {{ useLocalStorageOrCookie?: boolean, useLocalStorage?: boolean, useCookie?: boolean, systemUsed?: any, cookie?: { expires?: string, path?: string } }} [options={}]
*/
declare function localSave(name: string, value: string, options?: {
useLocalStorageOrCookie?: boolean;
useLocalStorage?: boolean;
......@@ -119,13 +30,6 @@ declare function localSave(name: string, value: string, options?: {
path?: string;
};
}): void;
/**
* Load data from browser storage
*
* @param {string} name
* @param {{ useLocalStorageOrCookie?: boolean, useLocalStorage?: boolean, useCookie?: boolean, cookie?: {}, systemUsed?:any }} [options={}]
* @returns {string}
*/
declare function localLoad(name: string, options?: {
useLocalStorageOrCookie?: boolean;
useLocalStorage?: boolean;
......@@ -133,12 +37,6 @@ declare function localLoad(name: string, options?: {
cookie?: {};
systemUsed?: any;
}): string;
/**
* Delete data on browser storage
*
* @param {string} name
* @param {{ useLocalStorage?: boolean, useCookie?: boolean, cookie?: { path?: string } }} [options={}]
*/
declare function localDelete(name: string, options?: {
useLocalStorage?: boolean;
useCookie?: boolean;
......
/// <reference path="tsd.d.ts" />
/// <reference path="../myTypings/tsd.d.ts" />
/**
* Ouvre le menu de droite si le il est fermé et inversement
*
*/
declare function toggleRightMenu(): void;
/**
* Ouvre le menu de gauche si le il est fermé et inversement
*
*/
declare function toggleLeftMenu(): void;
/**
* Fermer le menu de gauche