Source: customIconMarker.js



    /**
     * Module permettant l'utilisation d'icons personnalisés.
     * @constructor
     */
    function CustomIconMarker(){
        var _this = this;
        /**
         * Liste des icons disponibles, ajouter ici de nouveau icon à la librairie et dans le dossier assets du module CustomIconMarker
         */
        this._iconDisponibles = {
            "marker-icon-2x-black" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-black.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},    
            "marker-icon-2x-blue" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-blue.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-green" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-green.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-grey" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-grey.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-orange" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-orange.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-red" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-red.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-violet" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-violet.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
            "marker-icon-2x-yellow" : {
                iconUrl: "map_arob.customIconMarker/assets/marker-icon-2x-yellow.png",shadowUrl: "leaflet/images/marker-shadow.png",iconSize: [25, 41],iconAnchor: [12, 41],popupAnchor: [1, -34],shadowSize: [41, 41]},
        }
        
        /**
         * Retourne l'icone demandé, ou celui par défaut
         * @param {string} nameMarker 
         */
        this.getStyle = function(nameMarker){
            var style = _this._iconDisponibles[nameMarker];
            if(typeof style != "undefined"){
                return style;
            }else{
                return _this._iconDisponibles["marker-icon-2x-blue"];
            }
        }

        /**
         * Liste les icons disponibles, utilisé pour la selection
         */
        this.getList = function(){
            var t = [];
            for (var k in _this._iconDisponibles){
                if (typeof _this._iconDisponibles[k] !== 'function') {
                     t.push({"name" : k,"url" : _this._iconDisponibles[k]["iconUrl"]});
                }
            }
            return t;
        }
    }

    map_arob.CustomIconMarker = new CustomIconMarker();