GeoView : new mapstraction V2. added crosshair implementation for googlev3 and openlayers.
resize is now fully integrated with crosshair even with filters. possibility to select the html toolkit when webkit and gecko are available. javascript simplification inside the html page. add LOG functionality for debugging. svn: r15641
This commit is contained in:
parent
9e4fda990f
commit
35875a30c6
@ -1,15 +1,13 @@
|
||||
# This is the src/mapstraction level Makefile for Gramps
|
||||
/bin/bash: :x : commande introuvable
|
||||
# $$Id: Makefile.am 15542 2010-06-07 16:47:00Z robhealey1 $
|
||||
#
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/mapstraction
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
mapstraction.js \
|
||||
crosshairs.png \
|
||||
mxn.core.js \
|
||||
mxn.geocommons.core.js \
|
||||
mxn.google.core.js \
|
||||
mxn.google.geocoder.js \
|
||||
mxn.googlev3.core.js \
|
||||
mxn.js \
|
||||
|
@ -344,7 +344,25 @@ mxn.addProxyMethods(Mapstraction, [
|
||||
* @function
|
||||
* @param {tile_url} url of the tile layer that was created.
|
||||
*/
|
||||
'toggleTileLayer'
|
||||
'toggleTileLayer',
|
||||
|
||||
/**
|
||||
* Add a Crosshair in the center of the map
|
||||
* @name mxn.Mapstraction#addCrosshair
|
||||
* @function
|
||||
* @param {img_url} url of the crosshair image.
|
||||
* @param {size} size of the crosshair
|
||||
* @returns {object} return the crosshair object
|
||||
*/
|
||||
'addCrosshair',
|
||||
|
||||
/**
|
||||
* Remove the Crosshair in the center of the map
|
||||
* @name mxn.Mapstraction#removeCrosshair
|
||||
* @function
|
||||
* @param {object} crosshair object to remove
|
||||
*/
|
||||
'removeCrosshair'
|
||||
]);
|
||||
|
||||
/**
|
||||
|
@ -318,6 +318,40 @@ Mapstraction: {
|
||||
// TODO: Add provider code
|
||||
},
|
||||
|
||||
addCrosshair: function(Cross, crosshairSize, divid) {
|
||||
var map = this.maps[this.api];
|
||||
if ( map.init == true ) {
|
||||
cross=document.getElementById("Googlev3_Control_CrossHair");
|
||||
cross.style.visibility = 'visible';
|
||||
return map.crosshair;
|
||||
};
|
||||
var container = map.getDiv();
|
||||
var crosshair=document.createElement("img");
|
||||
crosshair.id = "Googlev3_Control_CrossHair";
|
||||
crosshair.src=Cross;
|
||||
crosshair.style.width=crosshairSize+'px';
|
||||
crosshair.style.height=crosshairSize+'px';
|
||||
crosshair.style.border='0';
|
||||
crosshair.style.position='fixed';
|
||||
this.X = (parseInt(container.offsetWidth) / 2)+8-(crosshairSize / 2) + 'px';
|
||||
this.Y = (parseInt(container.offsetHeight) / 2)+8-(crosshairSize / 2) + 'px';
|
||||
crosshair.style.top=this.Y;
|
||||
crosshair.style.left=this.X;
|
||||
crosshair.style.zIndex='1500';
|
||||
container.appendChild(crosshair);
|
||||
map.crosshair=crosshair;
|
||||
map.init = true;
|
||||
return crosshair;
|
||||
},
|
||||
|
||||
removeCrosshair: function(element) {
|
||||
var map = this.maps[this.api];
|
||||
if ( map.init == true ) {
|
||||
cross=document.getElementById('Googlev3_Control_CrossHair');
|
||||
cross.style.visibility = 'hidden';
|
||||
};
|
||||
},
|
||||
|
||||
mousePosition: function(element) {
|
||||
var map = this.maps[this.api];
|
||||
|
||||
|
@ -90,7 +90,7 @@ mxn.register('openlayers', {
|
||||
);
|
||||
|
||||
this.maps[api].addLayer(this.layers.osmmapnik);
|
||||
this.maps[api].addLayer(this.layers.osm);
|
||||
//this.maps[api].addLayer(this.layers.osm);
|
||||
this.loaded[api] = true;
|
||||
},
|
||||
|
||||
@ -360,6 +360,56 @@ mxn.register('openlayers', {
|
||||
// TODO: Add provider code
|
||||
},
|
||||
|
||||
addCrosshair: function(Cross, crosshairSize, divid) {
|
||||
var map = this.maps[this.api];
|
||||
if ( map.init == true ) {
|
||||
cross=document.getElementById('OpenLayers_Control_CrossHair');
|
||||
cross.style.visibility = 'visible';
|
||||
return map.centerIcon
|
||||
};
|
||||
var centerIcon = document.createElement('div');
|
||||
centerIcon.style.width='100%';
|
||||
centerIcon.style.height='100%';
|
||||
centerIcon.style.zIndex ='1500';
|
||||
var imgLocation=OpenLayers.Util.getImagesLocation();
|
||||
var sz=new OpenLayers.Size(crosshairSize,crosshairSize);
|
||||
var img=Cross;
|
||||
function crosshairResize() {
|
||||
//var olbox = document.getElementById("geo-map");
|
||||
var olbox = document.getElementById(divid);
|
||||
this.X = (parseInt(olbox.offsetWidth) / 2)-(crosshairSize / 2) + 'px';
|
||||
this.Y = (parseInt(olbox.offsetHeight) / 2)-(crosshairSize / 2) + 'px';
|
||||
cross=document.getElementById('OpenLayers_Control_CrossHair');
|
||||
cross.style.top=this.Y;
|
||||
cross.style.left=this.X;
|
||||
};
|
||||
var olbox = document.getElementById("geo-map");
|
||||
var olbox = document.getElementById(divid);
|
||||
map.CrossHair=OpenLayers.Util.createAlphaImageDiv(
|
||||
"OpenLayers_Control_CrossHair",null,sz,img,"absolute");
|
||||
map.CrossHair.style.zIndex ='1500';
|
||||
olbox.addEventListener("load",crosshairResize,true);
|
||||
OpenLayers.Element.addClass(map.CrossHair,"CrossHair");
|
||||
OpenLayers.Control.Crosshair = OpenLayers.Class.create();
|
||||
centerIcon.id = "mapCenter";
|
||||
viewport=document.getElementById('OpenLayers.Map_2_OpenLayers_ViewPort')
|
||||
viewport.appendChild(centerIcon);
|
||||
centerIcon.appendChild(map.CrossHair);
|
||||
crosshairResize();
|
||||
map.init=true;
|
||||
map.centerIcon=centerIcon
|
||||
return centerIcon
|
||||
},
|
||||
|
||||
removeCrosshair: function(crosshair) {
|
||||
var map = this.maps[this.api];
|
||||
if ( map.init == true ) {
|
||||
cross=document.getElementById('OpenLayers_Control_CrossHair');
|
||||
cross.style.visibility = 'hidden';
|
||||
};
|
||||
return 0;
|
||||
},
|
||||
|
||||
mousePosition: function(element) {
|
||||
var map = this.maps[this.api];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user