|
|
@@ -16,13 +16,13 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
$scope.title = "Manche Numerique";
|
|
|
|
|
|
var getGeoCodeInProgress = false,
|
|
|
- nbJoursFTTH = 300,
|
|
|
+ nbJoursFTTH = 244,
|
|
|
siteName = 'Eligibilité Manche Numérique',
|
|
|
siteUrl = 'http://eligibilite.manchenumerique.fr',
|
|
|
siteEmail = 'ftth@manchenumerique.fr',
|
|
|
siteAddresse = '235, rue Joseph Cugnot Zone Delta, 50000 SAINT LÔ',
|
|
|
layer = {},
|
|
|
- currentMarker;
|
|
|
+ currentMarker, searchExtent;
|
|
|
|
|
|
var catTypeVoie = [
|
|
|
{
|
|
|
@@ -401,7 +401,10 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
if(currentMarker) {
|
|
|
map.removeLayer(currentMarker);
|
|
|
}
|
|
|
- currentMarker = L.marker([$scope.geoCode.y, $scope.geoCode.x], {draggable: true}).addTo(map); //.bindPopup(data.locations[0].name).openPopup();
|
|
|
+
|
|
|
+ currentMarker = L.marker([$scope.geoCode.y, $scope.geoCode.x], {draggable: true, title: "texst"}).addTo(map); //.bindPopup(data.locations[0].name).openPopup();
|
|
|
+
|
|
|
+ currentMarker.bindPopup("L'adresse que vous nous avez fournie est localisée sur la carte. Il se peut que la position réelle de votre logement soit un peu différente. Dans ce cas, merci de déplacer le pointeur sur la carte pour le positionner à l'emplacement de votre logement.").openPopup();
|
|
|
|
|
|
reverseLocation($scope.geoCode, null, function(address) {
|
|
|
$scope.address = address;
|
|
|
@@ -560,7 +563,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
"satellite" : 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'
|
|
|
};
|
|
|
|
|
|
- var cLayer = L.tileLayer(maps.carte, {
|
|
|
+ var cLayer = L.tileLayer(maps.satellite, {
|
|
|
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
|
|
|
maxZoom: 18
|
|
|
}).addTo(map);
|
|
|
@@ -609,7 +612,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
// Debug: show manche limits
|
|
|
//L.polygon(mancheCoordinates, {color: 'blue', fillColor: 'blue',weight: 8}).addTo(map);
|
|
|
|
|
|
- var searchExtent = {
|
|
|
+ searchExtent = {
|
|
|
"xmin" : _.max(_.map(mancheCoordinates, function(c) {return c[1];})),
|
|
|
"ymin" : _.max(_.map(mancheCoordinates, function(c) {return c[0];})),
|
|
|
"xmax" : _.min(_.map(mancheCoordinates, function(c) {return c[1];})),
|
|
|
@@ -618,7 +621,6 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
};
|
|
|
|
|
|
var suggestURL = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?f=pjson&searchExtent=' + JSON.stringify(searchExtent);
|
|
|
- var findURL = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&searchExtent=' + JSON.stringify(searchExtent);
|
|
|
|
|
|
$('.address-bar input').typeahead({
|
|
|
onSelect: function(item) {
|
|
|
@@ -653,36 +655,6 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- $scope.getGeoCode = function(address, magicKey, callback) {
|
|
|
- //console.log('address, magicKey', address, magicKey);
|
|
|
-
|
|
|
- getGeoCodeInProgress = true;
|
|
|
- var url = findURL + "&text=" + address + ((magicKey) ? ("&magicKey=" + magicKey) : ', Basse-Normandie, France');
|
|
|
- //console.log('url', url);
|
|
|
- $.get(
|
|
|
- url,
|
|
|
- function(data, status) {
|
|
|
- data = JSON.parse(data);
|
|
|
-
|
|
|
- if (status === 'success' && data.locations[0]) {
|
|
|
-
|
|
|
- if(data.locations[0].extent.xmax < searchExtent.xmin &&
|
|
|
- data.locations[0].extent.xmax > searchExtent.xmax &&
|
|
|
- data.locations[0].extent.xmin > searchExtent.xmax&&
|
|
|
- data.locations[0].extent.xmin > searchExtent.xmax) {
|
|
|
-
|
|
|
- getGeoCodeInProgress = false;
|
|
|
- return callback(null, data);
|
|
|
- }
|
|
|
- getGeoCodeInProgress = false;
|
|
|
- callback('No result for ' + address);
|
|
|
- } else {
|
|
|
- getGeoCodeInProgress = false;
|
|
|
- callback(status !== 'success' ? status : 'No result for ' + address);
|
|
|
- }
|
|
|
- });
|
|
|
- };
|
|
|
});
|
|
|
|
|
|
//console.time('FTTH data');
|
|
|
@@ -754,7 +726,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
|
|
|
window.map = map;
|
|
|
|
|
|
- $scope.mapType = 'Carte';
|
|
|
+ $scope.mapType = 'Satellite';
|
|
|
$scope.view = {};
|
|
|
$scope.isShown = {};
|
|
|
};
|
|
|
@@ -902,6 +874,40 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
return $sce.trustAsHtml($scope.getHtmlContent(identifier, results));
|
|
|
};
|
|
|
|
|
|
+ $scope.getGeoCode = function(address, magicKey, callback) {
|
|
|
+ console.debug('address, magicKey', address, magicKey);
|
|
|
+
|
|
|
+ var findURL = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?f=pjson&searchExtent=' + JSON.stringify(searchExtent);
|
|
|
+
|
|
|
+ getGeoCodeInProgress = true;
|
|
|
+ var url = findURL + "&text=" + address + ((magicKey) ? ("&magicKey=" + magicKey) : ', Basse-Normandie, France');
|
|
|
+ //console.log('url', url);
|
|
|
+ $.get(
|
|
|
+ url,
|
|
|
+ function(data, status) {
|
|
|
+ data = JSON.parse(data);
|
|
|
+
|
|
|
+ console.debug('address, magicKey', address, magicKey, data);
|
|
|
+
|
|
|
+ if (status === 'success' && data.locations[0]) {
|
|
|
+
|
|
|
+ if(data.locations[0].extent.xmax < searchExtent.xmin &&
|
|
|
+ data.locations[0].extent.xmax > searchExtent.xmax &&
|
|
|
+ data.locations[0].extent.xmin > searchExtent.xmax&&
|
|
|
+ data.locations[0].extent.xmin > searchExtent.xmax) {
|
|
|
+
|
|
|
+ getGeoCodeInProgress = false;
|
|
|
+ return callback(null, data);
|
|
|
+ }
|
|
|
+ getGeoCodeInProgress = false;
|
|
|
+ callback('No result for ' + address);
|
|
|
+ } else {
|
|
|
+ getGeoCodeInProgress = false;
|
|
|
+ callback(status !== 'success' ? status : 'No result for ' + address);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
$scope.getHtmlContent = function(identifier, record) {
|
|
|
|
|
|
var title = record._properties.name.string ? record._properties.name.string : record[record._properties.name.key];
|