(function ($) { $.fn.handiToitCarto = function (config) { var apiURL = config.serverUrl + "/api/repartitionLogements"; var carto = this; $.getJSON(apiURL, function (data, status, xhr) { carto.each(function () { var map = new google.maps.Map(this, mapOptions); var bounds = new google.maps.LatLngBounds(); for (var dept in config.departements) { var limiteCommunesUrl = config.serverUrl + "/api/map-shapes/" + dept; map.data.loadGeoJson(limiteCommunesUrl, null, function (features) { for (var j = 0; j < features.length; j++) { var feature = features[j]; var insee_com = feature.getProperty("insee_com"); var d = data[insee_com]; feature.setProperty("data", d); feature.getGeometry().forEachLatLng(function (latlng) { bounds.extend(latlng); }); } fitToBounds(); }); } function fitToBounds() { map.fitBounds(bounds, 2); } map.data.setStyle(function (feature) { var dept = feature.getProperty("code_dept"); var code = feature.getProperty("insee_com"); var d = feature.getProperty("data"); var strokeColor = config.departements[dept].color; var fillColor = "gray"; if (d != null) { fillColor = strokeColor; } var s = { fillColor: fillColor, strokeColor: strokeColor, strokeWeight: 0.3, clickable: false }; if (d != null) { s.fillOpacity = 0.5; s.clickable = true; } return s; }); map.data.addListener('mouseover', function (event) { map.data.revertStyle(); map.data.overrideStyle(event.feature, { strokeWeight: 2 }); }); map.data.addListener('mouseout', function (event) { map.data.revertStyle(); }); var infowindow = new google.maps.InfoWindow({ content: $(config.infoWindowTemplate)[0] }); map.data.addListener('click', function (event) { infowindow.setPosition(event.latLng); var feature = event.feature; var values = {}; var total = 0; var d = feature.getProperty("data"); $(d.types).each(function (i, item) { var type = null; switch (item.type) { case "NonPrecise": type = "NonPrecise"; break; case "Studio": case "T1": case "T2": type = "T2"; break; case "T3": type = "T3"; break; case "T4": type = "T4"; break; case "T5": case "T6": type = "T5"; break; default: throw new Error("Type de logement inconnu"); } var v = values[type] || 0; values[type] = v + item.count; total += item.count; }); $(".nomCommune .value", infowindow.content).text(feature.getProperty("nom_com")); $(".total .value", infowindow.content).text(total); $(".labelQualite .value", infowindow.content).text(d.labelQualite); //if (d.labelQualite == 0) { // $(".labelQualite", infowindow.content).hide(); //} else { // $(".labelQualite", infowindow.content).show(); //} $(".repartition li.type", infowindow.content).each(function (i, li) { var t = $(li).data('type'); var v = values[t] || 0; $(".value", li).text(v); }); infowindow.open(map); }); }); }); }; var mapOptions = { center: { lat: 44.04, lng: 5.90 }, zoom: 8, mapTypeControl: false, streetViewControl: false, // style obtenu via https://mapstyle.withgoogle.com/ (Silver) styles: [ { "elementType": "geometry", "stylers": [ { "color": "#f5f5f5" } ] }, { "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "elementType": "labels.text.fill", "stylers": [ { "color": "#616161" } ] }, { "elementType": "labels.text.stroke", "stylers": [ { "color": "#f5f5f5" } ] }, { "featureType": "administrative.land_parcel", "elementType": "labels.text.fill", "stylers": [ { "color": "#bdbdbd", } ] }, { "featureType": "poi", "elementType": "geometry", "stylers": [ { "color": "#eeeeee" } ] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [ { "color": "#757575", } ] }, // cacher "Parcs naturels"" { "featureType": "poi", "elementType": "labels.text", "stylers": [ { "visibility": "off", } ] }, // --- { "featureType": "poi.park", "elementType": "geometry", "stylers": [ { "color": "#e5e5e5" } ] }, { "featureType": "poi.park", "elementType": "labels.text.fill", "stylers": [ { "color": "#9e9e9e", } ] }, { "featureType": "road", "elementType": "geometry", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": "road.arterial", "elementType": "labels.text.fill", "stylers": [ { "color": "#757575" } ] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "color": "#dadada" } ] }, { "featureType": "road.highway", "elementType": "labels.text.fill", "stylers": [ { "color": "#616161" } ] }, { "featureType": "road.local", "elementType": "labels.text.fill", "stylers": [ { "color": "#9e9e9e" } ] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "color": "#e5e5e5" } ] }, { "featureType": "transit.station", "elementType": "geometry", "stylers": [ { "color": "#eeeeee" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#c9c9c9" } ] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [ { "color": "#9e9e9e" } ] } ] }; }(jQuery));
Contactez-nous !

Besoin d'informations ?

Merci de compléter le formulaire ci-dessous.

    [recaptcha]


    Rejoignez-nous
    sur Facebook !

    Contactez-nous

    Partenaires institutionnels

    Adresse

    26 Boulevard Burel 13014 Marseille

    Tél.

    04 91 26 56 27

    Email

    contact@handitoit.org

    Site internet

    www.handitoit.org

    Adresse

    26 Boulevard Burel 13014 Marseille

    Tél.

    04 91 26 56 27

    Email

    contact@handitoit.org

    Site internet

    www.handitoit.org

    Tous droits réservés ® HandiToit Provence 2018  |   Mentions légales – CGU  |   Politique de confidentialité  |  Designed by The Creative Lab