2010-03-01 Pablo de la Concepción <pablo.concepcion@artica.es>
* include/javascript/openlayers.pandora.js: Modified js_printMap to support Gmap type of maps. * include/functions_gis.php: Modified printMap to support Gmap type of maps * godmode/setup/gis_step_2.php: Modified to load on demand the Gmaps api TODO: Use the key from the gmap_key input box. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2440 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
d5a369870d
commit
44746d514c
|
@ -1,3 +1,13 @@
|
||||||
|
2010-03-01 Pablo de la Concepción <pablo.concepcion@artica.es>
|
||||||
|
|
||||||
|
* include/javascript/openlayers.pandora.js: Modified js_printMap to support
|
||||||
|
Gmap type of maps.
|
||||||
|
|
||||||
|
* include/functions_gis.php: Modified printMap to support Gmap type of maps
|
||||||
|
|
||||||
|
* godmode/setup/gis_step_2.php: Modified to load on demand the Gmaps api
|
||||||
|
TODO: Use the key from the gmap_key input box.
|
||||||
|
|
||||||
2010-03-01 Sancho Lerena <slerena@artica.es>
|
2010-03-01 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* include/styles/menu.css,
|
* include/styles/menu.css,
|
||||||
|
|
|
@ -98,7 +98,6 @@ switch ($action) {
|
||||||
'url' => $mapConnection_OSM_url);
|
'url' => $mapConnection_OSM_url);
|
||||||
break;
|
break;
|
||||||
case 'Gmap':
|
case 'Gmap':
|
||||||
$mapConnection_Gmap_url= get_parameter('url');
|
|
||||||
$gmap_type= get_parameter('gmap_type');
|
$gmap_type= get_parameter('gmap_type');
|
||||||
$gmap_key= get_parameter('gmap_key');
|
$gmap_key= get_parameter('gmap_key');
|
||||||
$mapConnectionData = array('type' => 'Gmap',
|
$mapConnectionData = array('type' => 'Gmap',
|
||||||
|
@ -173,6 +172,7 @@ print_table ($table);
|
||||||
$optionsConnectionTypeTable = '';
|
$optionsConnectionTypeTable = '';
|
||||||
$mapConnectionDataUrl = '';
|
$mapConnectionDataUrl = '';
|
||||||
$gmap_type = '';
|
$gmap_type = '';
|
||||||
|
$gmap_key= '';
|
||||||
$bb_left = '';
|
$bb_left = '';
|
||||||
$bb_right = '';
|
$bb_right = '';
|
||||||
$bb_bottom = '';
|
$bb_bottom = '';
|
||||||
|
@ -392,12 +392,14 @@ function refreshMapView() {
|
||||||
center_altitude = $('input[name=center_altitude]').val();
|
center_altitude = $('input[name=center_altitude]').val();
|
||||||
|
|
||||||
var objBaseLayers = Array();
|
var objBaseLayers = Array();
|
||||||
objBaseLayers[0] = Array();
|
objBaseLayers[0] = {};
|
||||||
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
objBaseLayers[0]['type'] = $('select[name=sel_type] :selected').val();
|
||||||
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
objBaseLayers[0]['name'] = $('input[name=name]').val();
|
||||||
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
objBaseLayers[0]['url'] = $('input[name=url]').val();
|
||||||
|
// type Gmap
|
||||||
//objBaseLayers[0]['gmap_type = '';
|
objBaseLayers[0]['gmap_type'] = $('select[name=gmap_type] option:selected').val();
|
||||||
|
objBaseLayers[0]['gmap_key'] = $('input[name=gmap_key]').val();
|
||||||
|
// type Static Image
|
||||||
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
objBaseLayers[0]['bb_left'] = $('input[name=bb_left]').val();
|
||||||
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
objBaseLayers[0]['bb_right'] = $('input[name=bb_right]').val();
|
||||||
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
objBaseLayers[0]['bb_bottom'] = $('input[name=bb_bottom]').val();
|
||||||
|
@ -417,6 +419,15 @@ function refreshMapView() {
|
||||||
|
|
||||||
js_activateEvents(changePoints);
|
js_activateEvents(changePoints);
|
||||||
}
|
}
|
||||||
|
function validateGmapsParamtres () {
|
||||||
|
gmap_key = $('input[name=gmap_key]').val();
|
||||||
|
if (gmap_key == "") {
|
||||||
|
$('input[name=gmap_key]').css('background-color:red;');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function loadGoogleMap() {
|
||||||
|
google.load("maps", "2", {"callback" : validateGmapsParamtres});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dinamic write the fields in form when select a type of connection.
|
* Dinamic write the fields in form when select a type of connection.
|
||||||
|
@ -428,15 +439,12 @@ function selMapConnectionType() {
|
||||||
$('#form_map_connection_type').html('<?php echo $optionsConnectionOSMTable; ?>').hide();
|
$('#form_map_connection_type').html('<?php echo $optionsConnectionOSMTable; ?>').hide();
|
||||||
break;
|
break;
|
||||||
case 'Gmap':
|
case 'Gmap':
|
||||||
/* TODO: still testing this part... still need to use the provided key
|
// TODO: Validate there is a key, and use it
|
||||||
var script = document.createElement("script");
|
var script = document.createElement("script");
|
||||||
script.type = "text/javascript";
|
script.type = "text/javascript";
|
||||||
script.src = 'http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ';
|
//script.src = 'http://www.google.com/jsapi?key='+gmap_key+'&callback=loadGoogleMap';
|
||||||
//script.src = 'http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg';
|
script.src = 'http://www.google.com/jsapi?key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg&callback=loadGoogleMap';
|
||||||
//document.body.appendChild(script);
|
document.getElementsByTagName("head")[0].appendChild(script);
|
||||||
//document.getElementsByTagName("head")[0].appendChild(script);
|
|
||||||
$('head').append(script);
|
|
||||||
*/
|
|
||||||
$('#form_map_connection_type').html('<?php echo $optionsConnectionGmapTable; ?>').hide();
|
$('#form_map_connection_type').html('<?php echo $optionsConnectionGmapTable; ?>').hide();
|
||||||
break;
|
break;
|
||||||
case 'Static_Image':
|
case 'Static_Image':
|
||||||
|
|
|
@ -94,6 +94,51 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $bas
|
||||||
map.addLayer(baseLayer);
|
map.addLayer(baseLayer);
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'Gmap':
|
||||||
|
switch ($baselayer['gmap_type']) {
|
||||||
|
case 'G_PHYSICAL_MAP':
|
||||||
|
?>
|
||||||
|
//var baseLayer = new OpenLayers.Layer.Google();
|
||||||
|
var gphy = new OpenLayers.Layer.Google(
|
||||||
|
"Google Physical",
|
||||||
|
{type: G_PHYSICAL_MAP}
|
||||||
|
);
|
||||||
|
map.addLayer(gphy);
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
case 'G_HYBRID_MAP':
|
||||||
|
?>
|
||||||
|
alert("hibrid");
|
||||||
|
var ghyb = new OpenLayers.Layer.Google(
|
||||||
|
"Google Hybrid",
|
||||||
|
{type: G_HYBRID_MAP, numZoomLevels: 20}
|
||||||
|
);
|
||||||
|
map.addLayer(ghyb);
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
case 'G_SATELLITE_MAP':
|
||||||
|
?>
|
||||||
|
alert("satelite");
|
||||||
|
var gsat = new OpenLayers.Layer.Google(
|
||||||
|
"Google Satellite",
|
||||||
|
{type: G_SATELLITE_MAP, numZoomLevels: 22}
|
||||||
|
);
|
||||||
|
map.addLayer(gsat);
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
?>
|
||||||
|
alert("default");
|
||||||
|
var gmap = new OpenLayers.Layer.Google(
|
||||||
|
"Google Streets", // the default
|
||||||
|
{numZoomLevels: 20}
|
||||||
|
);
|
||||||
|
map.addLayer(gmap);
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'Static_Image':
|
case 'Static_Image':
|
||||||
?>
|
?>
|
||||||
var baseLayer = new OpenLayers.Layer.Image(
|
var baseLayer = new OpenLayers.Layer.Image(
|
||||||
|
|
|
@ -82,8 +82,40 @@ function js_printMap(id_div, initial_zoom, num_levels_zoom, center_latitude, cen
|
||||||
objBaseLayers[baselayerIndex]['url'], {numZoomLevels: num_levels_zoom});
|
objBaseLayers[baselayerIndex]['url'], {numZoomLevels: num_levels_zoom});
|
||||||
map.addLayer(baseLayer);
|
map.addLayer(baseLayer);
|
||||||
break;
|
break;
|
||||||
|
case 'Gmap':
|
||||||
|
tipito = objBaseLayers[baselayerIndex]['gmap_type'];
|
||||||
|
switch (tipito) {
|
||||||
|
case 'G_PHYSICAL_MAP':
|
||||||
|
//var baseLayer = new OpenLayers.Layer.Google();
|
||||||
|
var gphy = new OpenLayers.Layer.Google(
|
||||||
|
"Google Physical",
|
||||||
|
{type: G_PHYSICAL_MAP, maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)});
|
||||||
|
map.addLayer(gphy);
|
||||||
|
break;
|
||||||
|
case 'G_HYBRID_MAP':
|
||||||
|
var ghyb = new OpenLayers.Layer.Google(
|
||||||
|
"Google Hybrid",
|
||||||
|
{type: G_HYBRID_MAP, numZoomLevels: 20}
|
||||||
|
);
|
||||||
|
map.addLayer(ghyb);
|
||||||
|
break;
|
||||||
|
case 'G_SATELLITE_MAP':
|
||||||
|
var gsat = new OpenLayers.Layer.Google(
|
||||||
|
"Google Satellite",
|
||||||
|
{type: G_SATELLITE_MAP, numZoomLevels: 22}
|
||||||
|
);
|
||||||
|
map.addLayer(gsat);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
var gmap = new OpenLayers.Layer.Google(
|
||||||
|
"Google Streets", // the default
|
||||||
|
{numZoomLevels: 20}
|
||||||
|
);
|
||||||
|
map.addLayer(gmap);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'Static_Image':
|
case 'Static_Image':
|
||||||
console.log(objBaseLayers);
|
|
||||||
|
|
||||||
var baseLayer = new OpenLayers.Layer.Image(
|
var baseLayer = new OpenLayers.Layer.Image(
|
||||||
objBaseLayers[baselayerIndex]['name'],
|
objBaseLayers[baselayerIndex]['name'],
|
||||||
|
@ -96,6 +128,8 @@ function js_printMap(id_div, initial_zoom, num_levels_zoom, center_latitude, cen
|
||||||
{numZoomLevels: num_levels_zoom});
|
{numZoomLevels: num_levels_zoom});
|
||||||
map.addLayer(baseLayer);
|
map.addLayer(baseLayer);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
alert('connection type invalid');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue