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:
Serge Noiraud 2010-07-20 21:39:57 +00:00
parent 9e4fda990f
commit 35875a30c6
10 changed files with 10433 additions and 10333 deletions

View File

@ -1,17 +1,15 @@
# 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 \
mxn.openlayers.core.js \
README
mxn.core.js \
mxn.geocommons.core.js \
mxn.google.geocoder.js \
mxn.googlev3.core.js \
mxn.js \
mxn.openlayers.core.js \
README

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,342 +1,342 @@
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
mxn.register('geocommons', {
Mapstraction: {
// These methods can be called anytime but will only execute
// once the map has loaded.
deferrable: {
applyOptions: true,
resizeTo: true,
addControls: true,
addSmallControls: true,
addLargeControls: true,
addMapTypeControls: true,
dragging: true,
setCenterAndZoom: true,
getCenter: true,
setCenter: true,
setZoom: true,
getZoom: true,
getZoomLevelForBoundingBox: true,
setMapType: true,
getMapType: true,
getBounds: true,
setBounds: true,
addTileLayer: true,
toggleTileLayer: true,
getPixelRatio: true,
mousePosition: true
},
init: function(element, api) {
var me = this;
this.element = element;
this.loaded[this.api] = false; // Loading will take a little bit.
F1.Maker.core_host = f1_core_host;
F1.Maker.finder_host = f1_finder_host;
F1.Maker.maker_host = f1_maker_host;
// we don't use this object but assign it to dummy for JSLint
var dummy = new F1.Maker.Map({
dom_id: this.element.id,
flashvars: {},
onload: function(map){
me.maps[me.api] = map.swf; // Get the actual Flash object
me.loaded[me.api] = true;
for (var i = 0; i < me.onload[me.api].length; i++) {
me.onload[me.api][i]();
}
}
});
},
applyOptions: function(){
var map = this.maps[this.api];
// TODO: Add provider code
},
resizeTo: function(width, height){
var map = this.maps[this.api];
map.setSize(width,height);
},
addControls: function( args ) {
var map = this.maps[this.api];
map.showControl("Zoom", args.zoom || false);
map.showControl("Layers", args.layers || false);
map.showControl("Styles", args.styles || false);
map.showControl("Basemap", args.map_type || false);
map.showControl("Legend", args.legend || false, "open");
// showControl("Legend", true, "close");
},
addSmallControls: function() {
var map = this.maps[this.api];
this.addControls({
zoom: 'small',
legend: "open"
});
// showControl("Zoom", args.zoom);
// showControl("Legend", args.legend, "open");
},
addLargeControls: function() {
var map = this.maps[this.api];
this.addControls({
zoom: 'large',
layers: true,
legend: "open"
});
},
addMapTypeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
dragging: function(on) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setCenterAndZoom: function(point, zoom) {
var map = this.maps[this.api];
map.setCenterZoom(point.lat, point.lon,zoom);
},
getCenter: function() {
var map = this.maps[this.api];
var point = map.getCenterZoom()[0];
return new mxn.LatLonPoint(point.lat,point.lon);
},
setCenter: function(point, options) {
var map = this.maps[this.api];
map.setCenter(point.lat, point.lon);
},
setZoom: function(zoom) {
var map = this.maps[this.api];
map.setZoom(zoom);
},
getZoom: function() {
var map = this.maps[this.api];
return map.getZoom();
},
getZoomLevelForBoundingBox: function( bbox ) {
var map = this.maps[this.api];
// NE and SW points from the bounding box.
var ne = bbox.getNorthEast();
var sw = bbox.getSouthWest();
var zoom;
// TODO: Add provider code
return zoom;
},
setMapType: function(type) {
var map = this.maps[this.api];
switch(type) {
case mxn.Mapstraction.ROAD:
map.setMapProvider("OpenStreetMap (road)");
break;
case mxn.Mapstraction.SATELLITE:
map.setMapProvider("BlueMarble");
break;
case mxn.Mapstraction.HYBRID:
map.setMapProvider("Google Hybrid");
break;
default:
map.setMapProvider(type);
}
},
getMapType: function() {
var map = this.maps[this.api];
// TODO: I don't thick this is correct -Derek
switch(map.getMapProvider()) {
case "OpenStreetMap (road)":
return mxn.Mapstraction.ROAD;
case "BlueMarble":
return mxn.Mapstraction.SATELLITE;
case "Google Hybrid":
return mxn.Mapstraction.HYBRID;
default:
return null;
}
},
getBounds: function () {
var map = this.maps[this.api];
var extent = map.getExtent();
return new mxn.BoundingBox( extent.northWest.lat, extent.southEast.lon, extent.southEast.lat, extent.northWest.lon);
},
setBounds: function(bounds){
var map = this.maps[this.api];
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
map.setExtent(ne.lat,sw.lat,ne.lon,sw.lon);
},
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
var map = this.maps[this.api];
// TODO: Add provider code
},
// URL in this case is either a Maker map ID or the full URL to the Maker Map
addOverlay: function(url, autoCenterAndZoom) {
var map = this.maps[this.api];
var match;
if(typeof(url) === "number") {
map.loadMap(url);
return;
}
// Try if we've been given either a string of the ID or a URL
match = url.match(/^(\d+)$/);
if(match !== null){
match = url.match(/^.*?maps\/(\d+)(\?\(\[?(.*?)\]?\))?$/);
}
map.loadMap(match[1]);
},
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
toggleTileLayer: function(tile_url) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getPixelRatio: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
mousePosition: function(element) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addMarker: function(marker, old) {
var map = this.maps[this.api];
var pin = marker.toProprietary(this.api);
// TODO: Add provider code
// map.addOverlay(pin);
return pin;
},
removeMarker: function(marker) {
var map = this.maps[this.api];
// TODO: Add provider code
},
declutterMarkers: function(opts) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addPolyline: function(polyline, old) {
var map = this.maps[this.api];
var pl = polyline.toProprietary(this.api);
// TODO: Add provider code
// map.addOverlay(pl);
return pl;
},
removePolyline: function(polyline) {
var map = this.maps[this.api];
// TODO: Add provider code
}
},
LatLonPoint: {
toProprietary: function() {
// TODO: Add provider code
return {};
},
fromProprietary: function(googlePoint) {
// TODO: Add provider code
}
},
Marker: {
toProprietary: function() {
// TODO: Add provider code
return {};
},
openBubble: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
update: function() {
// TODO: Add provider code
}
},
Polyline: {
toProprietary: function() {
return {};
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
}
}
});
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
mxn.register('geocommons', {
Mapstraction: {
// These methods can be called anytime but will only execute
// once the map has loaded.
deferrable: {
applyOptions: true,
resizeTo: true,
addControls: true,
addSmallControls: true,
addLargeControls: true,
addMapTypeControls: true,
dragging: true,
setCenterAndZoom: true,
getCenter: true,
setCenter: true,
setZoom: true,
getZoom: true,
getZoomLevelForBoundingBox: true,
setMapType: true,
getMapType: true,
getBounds: true,
setBounds: true,
addTileLayer: true,
toggleTileLayer: true,
getPixelRatio: true,
mousePosition: true
},
init: function(element, api) {
var me = this;
this.element = element;
this.loaded[this.api] = false; // Loading will take a little bit.
F1.Maker.core_host = f1_core_host;
F1.Maker.finder_host = f1_finder_host;
F1.Maker.maker_host = f1_maker_host;
// we don't use this object but assign it to dummy for JSLint
var dummy = new F1.Maker.Map({
dom_id: this.element.id,
flashvars: {},
onload: function(map){
me.maps[me.api] = map.swf; // Get the actual Flash object
me.loaded[me.api] = true;
for (var i = 0; i < me.onload[me.api].length; i++) {
me.onload[me.api][i]();
}
}
});
},
applyOptions: function(){
var map = this.maps[this.api];
// TODO: Add provider code
},
resizeTo: function(width, height){
var map = this.maps[this.api];
map.setSize(width,height);
},
addControls: function( args ) {
var map = this.maps[this.api];
map.showControl("Zoom", args.zoom || false);
map.showControl("Layers", args.layers || false);
map.showControl("Styles", args.styles || false);
map.showControl("Basemap", args.map_type || false);
map.showControl("Legend", args.legend || false, "open");
// showControl("Legend", true, "close");
},
addSmallControls: function() {
var map = this.maps[this.api];
this.addControls({
zoom: 'small',
legend: "open"
});
// showControl("Zoom", args.zoom);
// showControl("Legend", args.legend, "open");
},
addLargeControls: function() {
var map = this.maps[this.api];
this.addControls({
zoom: 'large',
layers: true,
legend: "open"
});
},
addMapTypeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
dragging: function(on) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setCenterAndZoom: function(point, zoom) {
var map = this.maps[this.api];
map.setCenterZoom(point.lat, point.lon,zoom);
},
getCenter: function() {
var map = this.maps[this.api];
var point = map.getCenterZoom()[0];
return new mxn.LatLonPoint(point.lat,point.lon);
},
setCenter: function(point, options) {
var map = this.maps[this.api];
map.setCenter(point.lat, point.lon);
},
setZoom: function(zoom) {
var map = this.maps[this.api];
map.setZoom(zoom);
},
getZoom: function() {
var map = this.maps[this.api];
return map.getZoom();
},
getZoomLevelForBoundingBox: function( bbox ) {
var map = this.maps[this.api];
// NE and SW points from the bounding box.
var ne = bbox.getNorthEast();
var sw = bbox.getSouthWest();
var zoom;
// TODO: Add provider code
return zoom;
},
setMapType: function(type) {
var map = this.maps[this.api];
switch(type) {
case mxn.Mapstraction.ROAD:
map.setMapProvider("OpenStreetMap (road)");
break;
case mxn.Mapstraction.SATELLITE:
map.setMapProvider("BlueMarble");
break;
case mxn.Mapstraction.HYBRID:
map.setMapProvider("Google Hybrid");
break;
default:
map.setMapProvider(type);
}
},
getMapType: function() {
var map = this.maps[this.api];
// TODO: I don't thick this is correct -Derek
switch(map.getMapProvider()) {
case "OpenStreetMap (road)":
return mxn.Mapstraction.ROAD;
case "BlueMarble":
return mxn.Mapstraction.SATELLITE;
case "Google Hybrid":
return mxn.Mapstraction.HYBRID;
default:
return null;
}
},
getBounds: function () {
var map = this.maps[this.api];
var extent = map.getExtent();
return new mxn.BoundingBox( extent.northWest.lat, extent.southEast.lon, extent.southEast.lat, extent.northWest.lon);
},
setBounds: function(bounds){
var map = this.maps[this.api];
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
map.setExtent(ne.lat,sw.lat,ne.lon,sw.lon);
},
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
var map = this.maps[this.api];
// TODO: Add provider code
},
// URL in this case is either a Maker map ID or the full URL to the Maker Map
addOverlay: function(url, autoCenterAndZoom) {
var map = this.maps[this.api];
var match;
if(typeof(url) === "number") {
map.loadMap(url);
return;
}
// Try if we've been given either a string of the ID or a URL
match = url.match(/^(\d+)$/);
if(match !== null){
match = url.match(/^.*?maps\/(\d+)(\?\(\[?(.*?)\]?\))?$/);
}
map.loadMap(match[1]);
},
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
toggleTileLayer: function(tile_url) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getPixelRatio: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
mousePosition: function(element) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addMarker: function(marker, old) {
var map = this.maps[this.api];
var pin = marker.toProprietary(this.api);
// TODO: Add provider code
// map.addOverlay(pin);
return pin;
},
removeMarker: function(marker) {
var map = this.maps[this.api];
// TODO: Add provider code
},
declutterMarkers: function(opts) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addPolyline: function(polyline, old) {
var map = this.maps[this.api];
var pl = polyline.toProprietary(this.api);
// TODO: Add provider code
// map.addOverlay(pl);
return pl;
},
removePolyline: function(polyline) {
var map = this.maps[this.api];
// TODO: Add provider code
}
},
LatLonPoint: {
toProprietary: function() {
// TODO: Add provider code
return {};
},
fromProprietary: function(googlePoint) {
// TODO: Add provider code
}
},
Marker: {
toProprietary: function() {
// TODO: Add provider code
return {};
},
openBubble: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
update: function() {
// TODO: Add provider code
}
},
Polyline: {
toProprietary: function() {
return {};
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
}
}
});

File diff suppressed because it is too large Load Diff

View File

@ -1,191 +1,191 @@
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2007, Andrew Turner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Use http://jsdoc.sourceforge.net/ to generate documentation
// TODO: add reverse geocoding support
/**
* MapstractionGeocoder instantiates a geocoder with some API choice
* @param {Function} callback The function to call when a geocode request returns (function(waypoint))
* @param {String} api The API to use, currently only 'mapquest' is supported
* @param {Function} error_callback The optional function to call when a geocode request fails
* @constructor
*/
function MapstractionGeocoder(callback, api, error_callback) {
this.api = api;
this.callback = callback;
this.geocoders = {};
if(error_callback === null) {
this.error_callback = this.geocode_error;
} else {
this.error_callback = error_callback;
}
// This is so that it is easy to tell which revision of this file
// has been copied into other projects.
this.svn_revision_string = '$Revision: 107 $';
this.addAPI(api);
}
/**
* Internal function to actually set the router specific parameters
*/
MapstractionGeocoder.prototype.addAPI = function(api) {
me = this;
switch (api) {
case 'google':
this.geocoders[api] = new GClientGeocoder();
break;
case 'mapquest':
//set up the connection to the geocode server
var proxyServerName = "";
var proxyServerPort = "";
var ProxyServerPath = "mapquest_proxy/JSReqHandler.php";
var serverName = "geocode.access.mapquest.com";
var serverPort = "80";
var serverPath = "mq";
this.geocoders[api] = new MQExec(serverName, serverPath, serverPort, proxyServerName, ProxyServerPath, proxyServerPort );
break;
default:
alert(api + ' not supported by mapstraction-geocoder');
}
};
/**
* Change the Routing API to use
* @param {String} api The API to swap to
*/
MapstractionGeocoder.prototype.swap = function(api) {
if (this.api == api) { return; }
this.api = api;
if (!this.geocoders.hasOwnProperty(this.api)) {
this.addAPI($(element),api);
}
};
/**
* Default Geocode error function
*/
MapstractionGeocoder.prototype.geocode_error = function(response) {
alert("Sorry, we were unable to geocode that address");
};
/**
* Default handler for geocode request completion
*/
MapstractionGeocoder.prototype.geocode_callback = function(response, mapstraction_geocoder) {
var return_location = {};
// TODO: what if the api is switched during a geocode request?
// TODO: provide an option error callback
switch (mapstraction_geocoder.api) {
case 'google':
if (!response || response.Status.code != 200) {
mapstraction_geocoder.error_callback(response);
} else {
return_location.street = "";
return_location.locality = "";
return_location.region = "";
return_location.country = "";
var place = response.Placemark[0];
if(place.AddressDetails.Country.AdministrativeArea !== null) {
return_location.region = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea !== null) {
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality !== null) {
return_location.locality = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare !== null) {
return_location.street = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
}
}
}
}
return_location.country = place.AddressDetails.Country.CountryNameCode;
return_location.address = place.address;
return_location.point = new mxn.LatLonPoint(place.Point.coordinates[1], place.Point.coordinates[0]);
mapstraction_geocoder.callback(return_location);
}
break;
case 'mapquest':
break;
}
};
/**
* Performs a geocoding and then calls the specified callback function with the location
* @param {Object} address The address object to geocode
*/
MapstractionGeocoder.prototype.geocode = function(address) {
var return_location = {};
// temporary variable for later using in function closure
var mapstraction_geocoder = this;
switch (this.api) {
case 'google':
if (address.address === null || address.address === "") {
address.address = address.street + ", " + address.locality + ", " + address.region + ", " + address.country;
}
this.geocoders[this.api].getLocations(address.address, function(response) { mapstraction_geocoder.geocode_callback(response, mapstraction_geocoder); });
break;
case 'mapquest':
var mqaddress = new MQAddress();
var gaCollection = new MQLocationCollection("MQGeoAddress");
//populate the address object with the information from the form
mqaddress.setStreet(address.street);
mqaddress.setCity(address.locality);
mqaddress.setState(address.region);
mqaddress.setPostalCode(address.postalcode);
mqaddress.setCountry(address.country);
this.geocoders[this.api].geocode(mqaddress, gaCollection);
var geoAddr = gaCollection.get(0);
var mqpoint = geoAddr.getMQLatLng();
return_location.street = geoAddr.getStreet();
return_location.locality = geoAddr.getCity();
return_location.region = geoAddr.getState();
return_location.country = geoAddr.getCountry();
return_location.point = new mxn.LatLonPoint(mqpoint.getLatitude(), mqpoint.getLongitude());
this.callback(return_location, this);
break;
default:
alert(api + ' not supported by mapstraction-geocoder');
break;
}
};
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2007, Andrew Turner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Use http://jsdoc.sourceforge.net/ to generate documentation
// TODO: add reverse geocoding support
/**
* MapstractionGeocoder instantiates a geocoder with some API choice
* @param {Function} callback The function to call when a geocode request returns (function(waypoint))
* @param {String} api The API to use, currently only 'mapquest' is supported
* @param {Function} error_callback The optional function to call when a geocode request fails
* @constructor
*/
function MapstractionGeocoder(callback, api, error_callback) {
this.api = api;
this.callback = callback;
this.geocoders = {};
if(error_callback === null) {
this.error_callback = this.geocode_error;
} else {
this.error_callback = error_callback;
}
// This is so that it is easy to tell which revision of this file
// has been copied into other projects.
this.svn_revision_string = '$Revision: 107 $';
this.addAPI(api);
}
/**
* Internal function to actually set the router specific parameters
*/
MapstractionGeocoder.prototype.addAPI = function(api) {
me = this;
switch (api) {
case 'google':
this.geocoders[api] = new GClientGeocoder();
break;
case 'mapquest':
//set up the connection to the geocode server
var proxyServerName = "";
var proxyServerPort = "";
var ProxyServerPath = "mapquest_proxy/JSReqHandler.php";
var serverName = "geocode.access.mapquest.com";
var serverPort = "80";
var serverPath = "mq";
this.geocoders[api] = new MQExec(serverName, serverPath, serverPort, proxyServerName, ProxyServerPath, proxyServerPort );
break;
default:
alert(api + ' not supported by mapstraction-geocoder');
}
};
/**
* Change the Routing API to use
* @param {String} api The API to swap to
*/
MapstractionGeocoder.prototype.swap = function(api) {
if (this.api == api) { return; }
this.api = api;
if (!this.geocoders.hasOwnProperty(this.api)) {
this.addAPI($(element),api);
}
};
/**
* Default Geocode error function
*/
MapstractionGeocoder.prototype.geocode_error = function(response) {
alert("Sorry, we were unable to geocode that address");
};
/**
* Default handler for geocode request completion
*/
MapstractionGeocoder.prototype.geocode_callback = function(response, mapstraction_geocoder) {
var return_location = {};
// TODO: what if the api is switched during a geocode request?
// TODO: provide an option error callback
switch (mapstraction_geocoder.api) {
case 'google':
if (!response || response.Status.code != 200) {
mapstraction_geocoder.error_callback(response);
} else {
return_location.street = "";
return_location.locality = "";
return_location.region = "";
return_location.country = "";
var place = response.Placemark[0];
if(place.AddressDetails.Country.AdministrativeArea !== null) {
return_location.region = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea !== null) {
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality !== null) {
return_location.locality = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare !== null) {
return_location.street = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
}
}
}
}
return_location.country = place.AddressDetails.Country.CountryNameCode;
return_location.address = place.address;
return_location.point = new mxn.LatLonPoint(place.Point.coordinates[1], place.Point.coordinates[0]);
mapstraction_geocoder.callback(return_location);
}
break;
case 'mapquest':
break;
}
};
/**
* Performs a geocoding and then calls the specified callback function with the location
* @param {Object} address The address object to geocode
*/
MapstractionGeocoder.prototype.geocode = function(address) {
var return_location = {};
// temporary variable for later using in function closure
var mapstraction_geocoder = this;
switch (this.api) {
case 'google':
if (address.address === null || address.address === "") {
address.address = address.street + ", " + address.locality + ", " + address.region + ", " + address.country;
}
this.geocoders[this.api].getLocations(address.address, function(response) { mapstraction_geocoder.geocode_callback(response, mapstraction_geocoder); });
break;
case 'mapquest':
var mqaddress = new MQAddress();
var gaCollection = new MQLocationCollection("MQGeoAddress");
//populate the address object with the information from the form
mqaddress.setStreet(address.street);
mqaddress.setCity(address.locality);
mqaddress.setState(address.region);
mqaddress.setPostalCode(address.postalcode);
mqaddress.setCountry(address.country);
this.geocoders[this.api].geocode(mqaddress, gaCollection);
var geoAddr = gaCollection.get(0);
var mqpoint = geoAddr.getMQLatLng();
return_location.street = geoAddr.getStreet();
return_location.locality = geoAddr.getCity();
return_location.region = geoAddr.getState();
return_location.country = geoAddr.getCountry();
return_location.point = new mxn.LatLonPoint(mqpoint.getLatitude(), mqpoint.getLongitude());
this.callback(return_location, this);
break;
default:
alert(api + ' not supported by mapstraction-geocoder');
break;
}
};

View File

@ -1,348 +1,348 @@
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
mxn.register('googleearth', {
Mapstraction: {
init: function(element, api) {
var me = this;
this.maps[api] = null;
google.earth.createInstance(
element,
function initCallback(object) {
me.maps[api] = object;
me.maps[api].getWindow().setVisibility(true);
initMap();
},
function failureCallback(object) {
throw 'Failed to create Google Earth map';
}
);
},
applyOptions: function(){
var map = this.maps[this.api];
// TODO: Add provider code
},
resizeTo: function(width, height){
// TODO: Add provider code
},
addControls: function( args ) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addSmallControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
addLargeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
addMapTypeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
dragging: function(on) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setCenterAndZoom: function(point, zoom) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
// Set new latitude and longitude values
lookAt.setLatitude(point.lat);
lookAt.setLongitude(point.lon);
lookAt.setRange(lookAt.getRange() / 7.0);
// Update the view in Google Earth
map.getView().setAbstractView(lookAt);
},
addMarker: function(marker, old) {
var map = this.maps[this.api];
var pin = marker.toProprietary(this.api);
// TODO: Add provider code
return pin;
},
removeMarker: function(marker) {
var map = this.maps[this.api];
// TODO: Add provider code
},
removeAllMarkers: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
declutterMarkers: function(opts) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addPolyline: function(polyline, old) {
var map = this.maps[this.api];
var pl = polyline.toProprietary(this.api);
// TODO: Add provider code
return pl;
},
removePolyline: function(polyline) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getCenter: function() {
var point;
var map = this.maps[this.api];
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
point = new mxn.LatLonPoint(lookAt.getLatitude(),lookAt.getLongitude());
return point;
},
setCenter: function(point, options) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
if(options && options.pan) {
// TODO: Add provider code
}
else {
// TODO: Add provider code
}
},
setZoom: function(zoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getZoom: function() {
var map = this.maps[this.api];
var zoom = 5;
// TODO: Add provider code
return zoom;
},
getZoomLevelForBoundingBox: function( bbox ) {
var map = this.maps[this.api];
// NE and SW points from the bounding box.
var ne = bbox.getNorthEast();
var sw = bbox.getSouthWest();
var zoom;
// TODO: Add provider code
return zoom;
},
setMapType: function(type) {
var map = this.maps[this.api];
switch(type) {
case mxn.Mapstraction.ROAD:
// TODO: Add provider code
break;
case mxn.Mapstraction.SATELLITE:
// TODO: Add provider code
break;
case mxn.Mapstraction.HYBRID:
// TODO: Add provider code
break;
default:
// TODO: Add provider code
}
},
getMapType: function() {
var map = this.maps[this.api];
// TODO: Add provider code
//return mxn.Mapstraction.ROAD;
//return mxn.Mapstraction.SATELLITE;
//return mxn.Mapstraction.HYBRID;
},
getBounds: function () {
var map = this.maps[this.api];
// TODO: Add provider code
//return new mxn.BoundingBox( , , , );
},
setBounds: function(bounds){
var map = this.maps[this.api];
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
// TODO: Add provider code
},
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setImagePosition: function(id, oContext) {
var map = this.maps[this.api];
var topLeftPoint; var bottomRightPoint;
// TODO: Add provider code
//oContext.pixels.top = ...;
//oContext.pixels.left = ...;
//oContext.pixels.bottom = ...;
//oContext.pixels.right = ...;
},
addOverlay: function(url, autoCenterAndZoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
var map = this.maps[this.api];
var me = this;
google.earth.fetchKml(map, tile_url, function(kmlObject) {
if (kmlObject) {
map.getFeatures().appendChild(kmlObject);
me.tileLayers.push( [tile_url, kmlObject, true] );
}
else {
throw 'Invalid KML file';
}
});
},
toggleTileLayer: function(tile_url) {
var map = this.maps[this.api];
for (var f=0; f<this.tileLayers.length; f++) {
if(this.tileLayers[f][0] == tile_url) {
if(this.tileLayers[f][2]) {
map.getFeatures().removeChild(this.tileLayers[f][1]);
this.tileLayers[f][2] = false;
}
else {
map.getFeatures().appendChild(this.tileLayers[f][1]);
this.tileLayers[f][2] = true;
}
}
}
},
getPixelRatio: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
mousePosition: function(element) {
var map = this.maps[this.api];
// TODO: Add provider code
}
},
LatLonPoint: {
toProprietary: function() {
// TODO: Add provider code
},
fromProprietary: function(googlePoint) {
// TODO: Add provider code
}
},
Marker: {
toProprietary: function() {
// TODO: Add provider code
},
openBubble: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
update: function() {
// TODO: Add provider code
}
},
Polyline: {
toProprietary: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
}
}
});
/*
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
mxn.register('googleearth', {
Mapstraction: {
init: function(element, api) {
var me = this;
this.maps[api] = null;
google.earth.createInstance(
element,
function initCallback(object) {
me.maps[api] = object;
me.maps[api].getWindow().setVisibility(true);
initMap();
},
function failureCallback(object) {
throw 'Failed to create Google Earth map';
}
);
},
applyOptions: function(){
var map = this.maps[this.api];
// TODO: Add provider code
},
resizeTo: function(width, height){
// TODO: Add provider code
},
addControls: function( args ) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addSmallControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
addLargeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
addMapTypeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
dragging: function(on) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setCenterAndZoom: function(point, zoom) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
// Set new latitude and longitude values
lookAt.setLatitude(point.lat);
lookAt.setLongitude(point.lon);
lookAt.setRange(lookAt.getRange() / 7.0);
// Update the view in Google Earth
map.getView().setAbstractView(lookAt);
},
addMarker: function(marker, old) {
var map = this.maps[this.api];
var pin = marker.toProprietary(this.api);
// TODO: Add provider code
return pin;
},
removeMarker: function(marker) {
var map = this.maps[this.api];
// TODO: Add provider code
},
removeAllMarkers: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
declutterMarkers: function(opts) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addPolyline: function(polyline, old) {
var map = this.maps[this.api];
var pl = polyline.toProprietary(this.api);
// TODO: Add provider code
return pl;
},
removePolyline: function(polyline) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getCenter: function() {
var point;
var map = this.maps[this.api];
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
point = new mxn.LatLonPoint(lookAt.getLatitude(),lookAt.getLongitude());
return point;
},
setCenter: function(point, options) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
if(options && options.pan) {
// TODO: Add provider code
}
else {
// TODO: Add provider code
}
},
setZoom: function(zoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getZoom: function() {
var map = this.maps[this.api];
var zoom = 5;
// TODO: Add provider code
return zoom;
},
getZoomLevelForBoundingBox: function( bbox ) {
var map = this.maps[this.api];
// NE and SW points from the bounding box.
var ne = bbox.getNorthEast();
var sw = bbox.getSouthWest();
var zoom;
// TODO: Add provider code
return zoom;
},
setMapType: function(type) {
var map = this.maps[this.api];
switch(type) {
case mxn.Mapstraction.ROAD:
// TODO: Add provider code
break;
case mxn.Mapstraction.SATELLITE:
// TODO: Add provider code
break;
case mxn.Mapstraction.HYBRID:
// TODO: Add provider code
break;
default:
// TODO: Add provider code
}
},
getMapType: function() {
var map = this.maps[this.api];
// TODO: Add provider code
//return mxn.Mapstraction.ROAD;
//return mxn.Mapstraction.SATELLITE;
//return mxn.Mapstraction.HYBRID;
},
getBounds: function () {
var map = this.maps[this.api];
// TODO: Add provider code
//return new mxn.BoundingBox( , , , );
},
setBounds: function(bounds){
var map = this.maps[this.api];
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
// TODO: Add provider code
},
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setImagePosition: function(id, oContext) {
var map = this.maps[this.api];
var topLeftPoint; var bottomRightPoint;
// TODO: Add provider code
//oContext.pixels.top = ...;
//oContext.pixels.left = ...;
//oContext.pixels.bottom = ...;
//oContext.pixels.right = ...;
},
addOverlay: function(url, autoCenterAndZoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
var map = this.maps[this.api];
var me = this;
google.earth.fetchKml(map, tile_url, function(kmlObject) {
if (kmlObject) {
map.getFeatures().appendChild(kmlObject);
me.tileLayers.push( [tile_url, kmlObject, true] );
}
else {
throw 'Invalid KML file';
}
});
},
toggleTileLayer: function(tile_url) {
var map = this.maps[this.api];
for (var f=0; f<this.tileLayers.length; f++) {
if(this.tileLayers[f][0] == tile_url) {
if(this.tileLayers[f][2]) {
map.getFeatures().removeChild(this.tileLayers[f][1]);
this.tileLayers[f][2] = false;
}
else {
map.getFeatures().appendChild(this.tileLayers[f][1]);
this.tileLayers[f][2] = true;
}
}
}
},
getPixelRatio: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
mousePosition: function(element) {
var map = this.maps[this.api];
// TODO: Add provider code
}
},
LatLonPoint: {
toProprietary: function() {
// TODO: Add provider code
},
fromProprietary: function(googlePoint) {
// TODO: Add provider code
}
},
Marker: {
toProprietary: function() {
// TODO: Add provider code
},
openBubble: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
update: function() {
// TODO: Add provider code
}
},
Polyline: {
toProprietary: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
}
}
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff