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:
@@ -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 $
|
# $$Id: Makefile.am 15542 2010-06-07 16:47:00Z robhealey1 $
|
||||||
#
|
#
|
||||||
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@/mapstraction
|
pkgdatadir = $(datadir)/@PACKAGE@/mapstraction
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
dist_pkgdata_DATA = \
|
||||||
mapstraction.js \
|
|
||||||
crosshairs.png \
|
crosshairs.png \
|
||||||
mxn.core.js \
|
mxn.core.js \
|
||||||
mxn.geocommons.core.js \
|
mxn.geocommons.core.js \
|
||||||
mxn.google.core.js \
|
mxn.google.geocoder.js \
|
||||||
mxn.google.geocoder.js \
|
mxn.googlev3.core.js \
|
||||||
mxn.googlev3.core.js \
|
mxn.js \
|
||||||
mxn.js \
|
mxn.openlayers.core.js \
|
||||||
mxn.openlayers.core.js \
|
README
|
||||||
README
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,342 +1,342 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
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 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.
|
* 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.
|
* 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.
|
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', {
|
mxn.register('geocommons', {
|
||||||
|
|
||||||
Mapstraction: {
|
Mapstraction: {
|
||||||
|
|
||||||
// These methods can be called anytime but will only execute
|
// These methods can be called anytime but will only execute
|
||||||
// once the map has loaded.
|
// once the map has loaded.
|
||||||
deferrable: {
|
deferrable: {
|
||||||
applyOptions: true,
|
applyOptions: true,
|
||||||
resizeTo: true,
|
resizeTo: true,
|
||||||
addControls: true,
|
addControls: true,
|
||||||
addSmallControls: true,
|
addSmallControls: true,
|
||||||
addLargeControls: true,
|
addLargeControls: true,
|
||||||
addMapTypeControls: true,
|
addMapTypeControls: true,
|
||||||
dragging: true,
|
dragging: true,
|
||||||
setCenterAndZoom: true,
|
setCenterAndZoom: true,
|
||||||
getCenter: true,
|
getCenter: true,
|
||||||
setCenter: true,
|
setCenter: true,
|
||||||
setZoom: true,
|
setZoom: true,
|
||||||
getZoom: true,
|
getZoom: true,
|
||||||
getZoomLevelForBoundingBox: true,
|
getZoomLevelForBoundingBox: true,
|
||||||
setMapType: true,
|
setMapType: true,
|
||||||
getMapType: true,
|
getMapType: true,
|
||||||
getBounds: true,
|
getBounds: true,
|
||||||
setBounds: true,
|
setBounds: true,
|
||||||
addTileLayer: true,
|
addTileLayer: true,
|
||||||
toggleTileLayer: true,
|
toggleTileLayer: true,
|
||||||
getPixelRatio: true,
|
getPixelRatio: true,
|
||||||
mousePosition: true
|
mousePosition: true
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function(element, api) {
|
init: function(element, api) {
|
||||||
var me = this;
|
var me = this;
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.loaded[this.api] = false; // Loading will take a little bit.
|
this.loaded[this.api] = false; // Loading will take a little bit.
|
||||||
F1.Maker.core_host = f1_core_host;
|
F1.Maker.core_host = f1_core_host;
|
||||||
F1.Maker.finder_host = f1_finder_host;
|
F1.Maker.finder_host = f1_finder_host;
|
||||||
F1.Maker.maker_host = f1_maker_host;
|
F1.Maker.maker_host = f1_maker_host;
|
||||||
|
|
||||||
// we don't use this object but assign it to dummy for JSLint
|
// we don't use this object but assign it to dummy for JSLint
|
||||||
var dummy = new F1.Maker.Map({
|
var dummy = new F1.Maker.Map({
|
||||||
dom_id: this.element.id,
|
dom_id: this.element.id,
|
||||||
flashvars: {},
|
flashvars: {},
|
||||||
onload: function(map){
|
onload: function(map){
|
||||||
me.maps[me.api] = map.swf; // Get the actual Flash object
|
me.maps[me.api] = map.swf; // Get the actual Flash object
|
||||||
me.loaded[me.api] = true;
|
me.loaded[me.api] = true;
|
||||||
for (var i = 0; i < me.onload[me.api].length; i++) {
|
for (var i = 0; i < me.onload[me.api].length; i++) {
|
||||||
me.onload[me.api][i]();
|
me.onload[me.api][i]();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
applyOptions: function(){
|
applyOptions: function(){
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
resizeTo: function(width, height){
|
resizeTo: function(width, height){
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
map.setSize(width,height);
|
map.setSize(width,height);
|
||||||
},
|
},
|
||||||
|
|
||||||
addControls: function( args ) {
|
addControls: function( args ) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
map.showControl("Zoom", args.zoom || false);
|
map.showControl("Zoom", args.zoom || false);
|
||||||
map.showControl("Layers", args.layers || false);
|
map.showControl("Layers", args.layers || false);
|
||||||
map.showControl("Styles", args.styles || false);
|
map.showControl("Styles", args.styles || false);
|
||||||
map.showControl("Basemap", args.map_type || false);
|
map.showControl("Basemap", args.map_type || false);
|
||||||
map.showControl("Legend", args.legend || false, "open");
|
map.showControl("Legend", args.legend || false, "open");
|
||||||
// showControl("Legend", true, "close");
|
// showControl("Legend", true, "close");
|
||||||
},
|
},
|
||||||
|
|
||||||
addSmallControls: function() {
|
addSmallControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
this.addControls({
|
this.addControls({
|
||||||
zoom: 'small',
|
zoom: 'small',
|
||||||
legend: "open"
|
legend: "open"
|
||||||
});
|
});
|
||||||
// showControl("Zoom", args.zoom);
|
// showControl("Zoom", args.zoom);
|
||||||
// showControl("Legend", args.legend, "open");
|
// showControl("Legend", args.legend, "open");
|
||||||
},
|
},
|
||||||
|
|
||||||
addLargeControls: function() {
|
addLargeControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
this.addControls({
|
this.addControls({
|
||||||
zoom: 'large',
|
zoom: 'large',
|
||||||
layers: true,
|
layers: true,
|
||||||
legend: "open"
|
legend: "open"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addMapTypeControls: function() {
|
addMapTypeControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
dragging: function(on) {
|
dragging: function(on) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
setCenterAndZoom: function(point, zoom) {
|
setCenterAndZoom: function(point, zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
map.setCenterZoom(point.lat, point.lon,zoom);
|
map.setCenterZoom(point.lat, point.lon,zoom);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCenter: function() {
|
getCenter: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var point = map.getCenterZoom()[0];
|
var point = map.getCenterZoom()[0];
|
||||||
return new mxn.LatLonPoint(point.lat,point.lon);
|
return new mxn.LatLonPoint(point.lat,point.lon);
|
||||||
},
|
},
|
||||||
|
|
||||||
setCenter: function(point, options) {
|
setCenter: function(point, options) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
map.setCenter(point.lat, point.lon);
|
map.setCenter(point.lat, point.lon);
|
||||||
},
|
},
|
||||||
|
|
||||||
setZoom: function(zoom) {
|
setZoom: function(zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
map.setZoom(zoom);
|
map.setZoom(zoom);
|
||||||
},
|
},
|
||||||
|
|
||||||
getZoom: function() {
|
getZoom: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
return map.getZoom();
|
return map.getZoom();
|
||||||
},
|
},
|
||||||
|
|
||||||
getZoomLevelForBoundingBox: function( bbox ) {
|
getZoomLevelForBoundingBox: function( bbox ) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
// NE and SW points from the bounding box.
|
// NE and SW points from the bounding box.
|
||||||
var ne = bbox.getNorthEast();
|
var ne = bbox.getNorthEast();
|
||||||
var sw = bbox.getSouthWest();
|
var sw = bbox.getSouthWest();
|
||||||
var zoom;
|
var zoom;
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
return zoom;
|
return zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
setMapType: function(type) {
|
setMapType: function(type) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case mxn.Mapstraction.ROAD:
|
case mxn.Mapstraction.ROAD:
|
||||||
map.setMapProvider("OpenStreetMap (road)");
|
map.setMapProvider("OpenStreetMap (road)");
|
||||||
break;
|
break;
|
||||||
case mxn.Mapstraction.SATELLITE:
|
case mxn.Mapstraction.SATELLITE:
|
||||||
map.setMapProvider("BlueMarble");
|
map.setMapProvider("BlueMarble");
|
||||||
break;
|
break;
|
||||||
case mxn.Mapstraction.HYBRID:
|
case mxn.Mapstraction.HYBRID:
|
||||||
map.setMapProvider("Google Hybrid");
|
map.setMapProvider("Google Hybrid");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
map.setMapProvider(type);
|
map.setMapProvider(type);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getMapType: function() {
|
getMapType: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: I don't thick this is correct -Derek
|
// TODO: I don't thick this is correct -Derek
|
||||||
switch(map.getMapProvider()) {
|
switch(map.getMapProvider()) {
|
||||||
case "OpenStreetMap (road)":
|
case "OpenStreetMap (road)":
|
||||||
return mxn.Mapstraction.ROAD;
|
return mxn.Mapstraction.ROAD;
|
||||||
case "BlueMarble":
|
case "BlueMarble":
|
||||||
return mxn.Mapstraction.SATELLITE;
|
return mxn.Mapstraction.SATELLITE;
|
||||||
case "Google Hybrid":
|
case "Google Hybrid":
|
||||||
return mxn.Mapstraction.HYBRID;
|
return mxn.Mapstraction.HYBRID;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getBounds: function () {
|
getBounds: function () {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var extent = map.getExtent();
|
var extent = map.getExtent();
|
||||||
return new mxn.BoundingBox( extent.northWest.lat, extent.southEast.lon, extent.southEast.lat, extent.northWest.lon);
|
return new mxn.BoundingBox( extent.northWest.lat, extent.southEast.lon, extent.southEast.lat, extent.northWest.lon);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBounds: function(bounds){
|
setBounds: function(bounds){
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var sw = bounds.getSouthWest();
|
var sw = bounds.getSouthWest();
|
||||||
var ne = bounds.getNorthEast();
|
var ne = bounds.getNorthEast();
|
||||||
map.setExtent(ne.lat,sw.lat,ne.lon,sw.lon);
|
map.setExtent(ne.lat,sw.lat,ne.lon,sw.lon);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
|
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
// URL in this case is either a Maker map ID or the full URL to the Maker Map
|
// URL in this case is either a Maker map ID or the full URL to the Maker Map
|
||||||
addOverlay: function(url, autoCenterAndZoom) {
|
addOverlay: function(url, autoCenterAndZoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var match;
|
var match;
|
||||||
|
|
||||||
if(typeof(url) === "number") {
|
if(typeof(url) === "number") {
|
||||||
map.loadMap(url);
|
map.loadMap(url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Try if we've been given either a string of the ID or a URL
|
// Try if we've been given either a string of the ID or a URL
|
||||||
match = url.match(/^(\d+)$/);
|
match = url.match(/^(\d+)$/);
|
||||||
if(match !== null){
|
if(match !== null){
|
||||||
match = url.match(/^.*?maps\/(\d+)(\?\(\[?(.*?)\]?\))?$/);
|
match = url.match(/^.*?maps\/(\d+)(\?\(\[?(.*?)\]?\))?$/);
|
||||||
}
|
}
|
||||||
|
|
||||||
map.loadMap(match[1]);
|
map.loadMap(match[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
|
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTileLayer: function(tile_url) {
|
toggleTileLayer: function(tile_url) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
getPixelRatio: function() {
|
getPixelRatio: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
mousePosition: function(element) {
|
mousePosition: function(element) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
addMarker: function(marker, old) {
|
addMarker: function(marker, old) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pin = marker.toProprietary(this.api);
|
var pin = marker.toProprietary(this.api);
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
// map.addOverlay(pin);
|
// map.addOverlay(pin);
|
||||||
return pin;
|
return pin;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeMarker: function(marker) {
|
removeMarker: function(marker) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
declutterMarkers: function(opts) {
|
declutterMarkers: function(opts) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addPolyline: function(polyline, old) {
|
addPolyline: function(polyline, old) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pl = polyline.toProprietary(this.api);
|
var pl = polyline.toProprietary(this.api);
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
// map.addOverlay(pl);
|
// map.addOverlay(pl);
|
||||||
return pl;
|
return pl;
|
||||||
},
|
},
|
||||||
|
|
||||||
removePolyline: function(polyline) {
|
removePolyline: function(polyline) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
LatLonPoint: {
|
LatLonPoint: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
fromProprietary: function(googlePoint) {
|
fromProprietary: function(googlePoint) {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Marker: {
|
Marker: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
openBubble: function() {
|
openBubble: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Polyline: {
|
Polyline: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
return {};
|
return {};
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,191 +1,191 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
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 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.
|
* 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.
|
* 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.
|
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
|
Copyright (c) 2007, Andrew Turner
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
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 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.
|
* 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.
|
* 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.
|
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
|
// Use http://jsdoc.sourceforge.net/ to generate documentation
|
||||||
|
|
||||||
// TODO: add reverse geocoding support
|
// TODO: add reverse geocoding support
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MapstractionGeocoder instantiates a geocoder with some API choice
|
* MapstractionGeocoder instantiates a geocoder with some API choice
|
||||||
* @param {Function} callback The function to call when a geocode request returns (function(waypoint))
|
* @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 {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
|
* @param {Function} error_callback The optional function to call when a geocode request fails
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MapstractionGeocoder(callback, api, error_callback) {
|
function MapstractionGeocoder(callback, api, error_callback) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.geocoders = {};
|
this.geocoders = {};
|
||||||
if(error_callback === null) {
|
if(error_callback === null) {
|
||||||
this.error_callback = this.geocode_error;
|
this.error_callback = this.geocode_error;
|
||||||
} else {
|
} else {
|
||||||
this.error_callback = error_callback;
|
this.error_callback = error_callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is so that it is easy to tell which revision of this file
|
// This is so that it is easy to tell which revision of this file
|
||||||
// has been copied into other projects.
|
// has been copied into other projects.
|
||||||
this.svn_revision_string = '$Revision: 107 $';
|
this.svn_revision_string = '$Revision: 107 $';
|
||||||
|
|
||||||
this.addAPI(api);
|
this.addAPI(api);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to actually set the router specific parameters
|
* Internal function to actually set the router specific parameters
|
||||||
*/
|
*/
|
||||||
MapstractionGeocoder.prototype.addAPI = function(api) {
|
MapstractionGeocoder.prototype.addAPI = function(api) {
|
||||||
|
|
||||||
me = this;
|
me = this;
|
||||||
switch (api) {
|
switch (api) {
|
||||||
case 'google':
|
case 'google':
|
||||||
this.geocoders[api] = new GClientGeocoder();
|
this.geocoders[api] = new GClientGeocoder();
|
||||||
break;
|
break;
|
||||||
case 'mapquest':
|
case 'mapquest':
|
||||||
//set up the connection to the geocode server
|
//set up the connection to the geocode server
|
||||||
var proxyServerName = "";
|
var proxyServerName = "";
|
||||||
var proxyServerPort = "";
|
var proxyServerPort = "";
|
||||||
var ProxyServerPath = "mapquest_proxy/JSReqHandler.php";
|
var ProxyServerPath = "mapquest_proxy/JSReqHandler.php";
|
||||||
|
|
||||||
var serverName = "geocode.access.mapquest.com";
|
var serverName = "geocode.access.mapquest.com";
|
||||||
var serverPort = "80";
|
var serverPort = "80";
|
||||||
var serverPath = "mq";
|
var serverPath = "mq";
|
||||||
this.geocoders[api] = new MQExec(serverName, serverPath, serverPort, proxyServerName, ProxyServerPath, proxyServerPort );
|
this.geocoders[api] = new MQExec(serverName, serverPath, serverPort, proxyServerName, ProxyServerPath, proxyServerPort );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
alert(api + ' not supported by mapstraction-geocoder');
|
alert(api + ' not supported by mapstraction-geocoder');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Change the Routing API to use
|
* Change the Routing API to use
|
||||||
* @param {String} api The API to swap to
|
* @param {String} api The API to swap to
|
||||||
*/
|
*/
|
||||||
MapstractionGeocoder.prototype.swap = function(api) {
|
MapstractionGeocoder.prototype.swap = function(api) {
|
||||||
if (this.api == api) { return; }
|
if (this.api == api) { return; }
|
||||||
|
|
||||||
this.api = api;
|
this.api = api;
|
||||||
if (!this.geocoders.hasOwnProperty(this.api)) {
|
if (!this.geocoders.hasOwnProperty(this.api)) {
|
||||||
this.addAPI($(element),api);
|
this.addAPI($(element),api);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Geocode error function
|
* Default Geocode error function
|
||||||
*/
|
*/
|
||||||
MapstractionGeocoder.prototype.geocode_error = function(response) {
|
MapstractionGeocoder.prototype.geocode_error = function(response) {
|
||||||
alert("Sorry, we were unable to geocode that address");
|
alert("Sorry, we were unable to geocode that address");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default handler for geocode request completion
|
* Default handler for geocode request completion
|
||||||
*/
|
*/
|
||||||
MapstractionGeocoder.prototype.geocode_callback = function(response, mapstraction_geocoder) {
|
MapstractionGeocoder.prototype.geocode_callback = function(response, mapstraction_geocoder) {
|
||||||
var return_location = {};
|
var return_location = {};
|
||||||
|
|
||||||
// TODO: what if the api is switched during a geocode request?
|
// TODO: what if the api is switched during a geocode request?
|
||||||
// TODO: provide an option error callback
|
// TODO: provide an option error callback
|
||||||
switch (mapstraction_geocoder.api) {
|
switch (mapstraction_geocoder.api) {
|
||||||
case 'google':
|
case 'google':
|
||||||
if (!response || response.Status.code != 200) {
|
if (!response || response.Status.code != 200) {
|
||||||
mapstraction_geocoder.error_callback(response);
|
mapstraction_geocoder.error_callback(response);
|
||||||
} else {
|
} else {
|
||||||
return_location.street = "";
|
return_location.street = "";
|
||||||
return_location.locality = "";
|
return_location.locality = "";
|
||||||
return_location.region = "";
|
return_location.region = "";
|
||||||
return_location.country = "";
|
return_location.country = "";
|
||||||
|
|
||||||
var place = response.Placemark[0];
|
var place = response.Placemark[0];
|
||||||
if(place.AddressDetails.Country.AdministrativeArea !== null) {
|
if(place.AddressDetails.Country.AdministrativeArea !== null) {
|
||||||
return_location.region = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
|
return_location.region = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
|
||||||
|
|
||||||
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea !== null) {
|
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea !== null) {
|
||||||
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality !== null) {
|
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality !== null) {
|
||||||
return_location.locality = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;
|
return_location.locality = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName;
|
||||||
|
|
||||||
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare !== null) {
|
if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare !== null) {
|
||||||
return_location.street = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
|
return_location.street = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return_location.country = place.AddressDetails.Country.CountryNameCode;
|
return_location.country = place.AddressDetails.Country.CountryNameCode;
|
||||||
return_location.address = place.address;
|
return_location.address = place.address;
|
||||||
|
|
||||||
return_location.point = new mxn.LatLonPoint(place.Point.coordinates[1], place.Point.coordinates[0]);
|
return_location.point = new mxn.LatLonPoint(place.Point.coordinates[1], place.Point.coordinates[0]);
|
||||||
mapstraction_geocoder.callback(return_location);
|
mapstraction_geocoder.callback(return_location);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'mapquest':
|
case 'mapquest':
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a geocoding and then calls the specified callback function with the location
|
* Performs a geocoding and then calls the specified callback function with the location
|
||||||
* @param {Object} address The address object to geocode
|
* @param {Object} address The address object to geocode
|
||||||
*/
|
*/
|
||||||
MapstractionGeocoder.prototype.geocode = function(address) {
|
MapstractionGeocoder.prototype.geocode = function(address) {
|
||||||
var return_location = {};
|
var return_location = {};
|
||||||
|
|
||||||
// temporary variable for later using in function closure
|
// temporary variable for later using in function closure
|
||||||
var mapstraction_geocoder = this;
|
var mapstraction_geocoder = this;
|
||||||
|
|
||||||
switch (this.api) {
|
switch (this.api) {
|
||||||
case 'google':
|
case 'google':
|
||||||
if (address.address === null || address.address === "") {
|
if (address.address === null || address.address === "") {
|
||||||
address.address = address.street + ", " + address.locality + ", " + address.region + ", " + address.country;
|
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); });
|
this.geocoders[this.api].getLocations(address.address, function(response) { mapstraction_geocoder.geocode_callback(response, mapstraction_geocoder); });
|
||||||
break;
|
break;
|
||||||
case 'mapquest':
|
case 'mapquest':
|
||||||
var mqaddress = new MQAddress();
|
var mqaddress = new MQAddress();
|
||||||
var gaCollection = new MQLocationCollection("MQGeoAddress");
|
var gaCollection = new MQLocationCollection("MQGeoAddress");
|
||||||
//populate the address object with the information from the form
|
//populate the address object with the information from the form
|
||||||
mqaddress.setStreet(address.street);
|
mqaddress.setStreet(address.street);
|
||||||
mqaddress.setCity(address.locality);
|
mqaddress.setCity(address.locality);
|
||||||
mqaddress.setState(address.region);
|
mqaddress.setState(address.region);
|
||||||
mqaddress.setPostalCode(address.postalcode);
|
mqaddress.setPostalCode(address.postalcode);
|
||||||
mqaddress.setCountry(address.country);
|
mqaddress.setCountry(address.country);
|
||||||
|
|
||||||
this.geocoders[this.api].geocode(mqaddress, gaCollection);
|
this.geocoders[this.api].geocode(mqaddress, gaCollection);
|
||||||
var geoAddr = gaCollection.get(0);
|
var geoAddr = gaCollection.get(0);
|
||||||
var mqpoint = geoAddr.getMQLatLng();
|
var mqpoint = geoAddr.getMQLatLng();
|
||||||
return_location.street = geoAddr.getStreet();
|
return_location.street = geoAddr.getStreet();
|
||||||
return_location.locality = geoAddr.getCity();
|
return_location.locality = geoAddr.getCity();
|
||||||
return_location.region = geoAddr.getState();
|
return_location.region = geoAddr.getState();
|
||||||
return_location.country = geoAddr.getCountry();
|
return_location.country = geoAddr.getCountry();
|
||||||
return_location.point = new mxn.LatLonPoint(mqpoint.getLatitude(), mqpoint.getLongitude());
|
return_location.point = new mxn.LatLonPoint(mqpoint.getLatitude(), mqpoint.getLongitude());
|
||||||
this.callback(return_location, this);
|
this.callback(return_location, this);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
alert(api + ' not supported by mapstraction-geocoder');
|
alert(api + ' not supported by mapstraction-geocoder');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,348 +1,348 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
Copyright (c) 2010 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
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 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.
|
* 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.
|
* 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.
|
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', {
|
mxn.register('googleearth', {
|
||||||
|
|
||||||
Mapstraction: {
|
Mapstraction: {
|
||||||
|
|
||||||
init: function(element, api) {
|
init: function(element, api) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
this.maps[api] = null;
|
this.maps[api] = null;
|
||||||
|
|
||||||
google.earth.createInstance(
|
google.earth.createInstance(
|
||||||
element,
|
element,
|
||||||
function initCallback(object) {
|
function initCallback(object) {
|
||||||
me.maps[api] = object;
|
me.maps[api] = object;
|
||||||
me.maps[api].getWindow().setVisibility(true);
|
me.maps[api].getWindow().setVisibility(true);
|
||||||
initMap();
|
initMap();
|
||||||
},
|
},
|
||||||
function failureCallback(object) {
|
function failureCallback(object) {
|
||||||
throw 'Failed to create Google Earth map';
|
throw 'Failed to create Google Earth map';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
applyOptions: function(){
|
applyOptions: function(){
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
resizeTo: function(width, height){
|
resizeTo: function(width, height){
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addControls: function( args ) {
|
addControls: function( args ) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addSmallControls: function() {
|
addSmallControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addLargeControls: function() {
|
addLargeControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addMapTypeControls: function() {
|
addMapTypeControls: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
dragging: function(on) {
|
dragging: function(on) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
setCenterAndZoom: function(point, zoom) {
|
setCenterAndZoom: function(point, zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pt = point.toProprietary(this.api);
|
var pt = point.toProprietary(this.api);
|
||||||
|
|
||||||
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
|
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
|
||||||
|
|
||||||
// Set new latitude and longitude values
|
// Set new latitude and longitude values
|
||||||
lookAt.setLatitude(point.lat);
|
lookAt.setLatitude(point.lat);
|
||||||
lookAt.setLongitude(point.lon);
|
lookAt.setLongitude(point.lon);
|
||||||
lookAt.setRange(lookAt.getRange() / 7.0);
|
lookAt.setRange(lookAt.getRange() / 7.0);
|
||||||
|
|
||||||
// Update the view in Google Earth
|
// Update the view in Google Earth
|
||||||
map.getView().setAbstractView(lookAt);
|
map.getView().setAbstractView(lookAt);
|
||||||
},
|
},
|
||||||
|
|
||||||
addMarker: function(marker, old) {
|
addMarker: function(marker, old) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pin = marker.toProprietary(this.api);
|
var pin = marker.toProprietary(this.api);
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
return pin;
|
return pin;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeMarker: function(marker) {
|
removeMarker: function(marker) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAllMarkers: function() {
|
removeAllMarkers: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
declutterMarkers: function(opts) {
|
declutterMarkers: function(opts) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
addPolyline: function(polyline, old) {
|
addPolyline: function(polyline, old) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pl = polyline.toProprietary(this.api);
|
var pl = polyline.toProprietary(this.api);
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
return pl;
|
return pl;
|
||||||
},
|
},
|
||||||
|
|
||||||
removePolyline: function(polyline) {
|
removePolyline: function(polyline) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
getCenter: function() {
|
getCenter: function() {
|
||||||
var point;
|
var point;
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
|
var lookAt = map.getView().copyAsLookAt(map.ALTITUDE_RELATIVE_TO_GROUND);
|
||||||
point = new mxn.LatLonPoint(lookAt.getLatitude(),lookAt.getLongitude());
|
point = new mxn.LatLonPoint(lookAt.getLatitude(),lookAt.getLongitude());
|
||||||
return point;
|
return point;
|
||||||
},
|
},
|
||||||
|
|
||||||
setCenter: function(point, options) {
|
setCenter: function(point, options) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var pt = point.toProprietary(this.api);
|
var pt = point.toProprietary(this.api);
|
||||||
if(options && options.pan) {
|
if(options && options.pan) {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setZoom: function(zoom) {
|
setZoom: function(zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getZoom: function() {
|
getZoom: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var zoom = 5;
|
var zoom = 5;
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
return zoom;
|
return zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
getZoomLevelForBoundingBox: function( bbox ) {
|
getZoomLevelForBoundingBox: function( bbox ) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
// NE and SW points from the bounding box.
|
// NE and SW points from the bounding box.
|
||||||
var ne = bbox.getNorthEast();
|
var ne = bbox.getNorthEast();
|
||||||
var sw = bbox.getSouthWest();
|
var sw = bbox.getSouthWest();
|
||||||
var zoom;
|
var zoom;
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
return zoom;
|
return zoom;
|
||||||
},
|
},
|
||||||
|
|
||||||
setMapType: function(type) {
|
setMapType: function(type) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case mxn.Mapstraction.ROAD:
|
case mxn.Mapstraction.ROAD:
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
break;
|
break;
|
||||||
case mxn.Mapstraction.SATELLITE:
|
case mxn.Mapstraction.SATELLITE:
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
break;
|
break;
|
||||||
case mxn.Mapstraction.HYBRID:
|
case mxn.Mapstraction.HYBRID:
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getMapType: function() {
|
getMapType: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
//return mxn.Mapstraction.ROAD;
|
//return mxn.Mapstraction.ROAD;
|
||||||
//return mxn.Mapstraction.SATELLITE;
|
//return mxn.Mapstraction.SATELLITE;
|
||||||
//return mxn.Mapstraction.HYBRID;
|
//return mxn.Mapstraction.HYBRID;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getBounds: function () {
|
getBounds: function () {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
//return new mxn.BoundingBox( , , , );
|
//return new mxn.BoundingBox( , , , );
|
||||||
},
|
},
|
||||||
|
|
||||||
setBounds: function(bounds){
|
setBounds: function(bounds){
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var sw = bounds.getSouthWest();
|
var sw = bounds.getSouthWest();
|
||||||
var ne = bounds.getNorthEast();
|
var ne = bounds.getNorthEast();
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
|
addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
setImagePosition: function(id, oContext) {
|
setImagePosition: function(id, oContext) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var topLeftPoint; var bottomRightPoint;
|
var topLeftPoint; var bottomRightPoint;
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
//oContext.pixels.top = ...;
|
//oContext.pixels.top = ...;
|
||||||
//oContext.pixels.left = ...;
|
//oContext.pixels.left = ...;
|
||||||
//oContext.pixels.bottom = ...;
|
//oContext.pixels.bottom = ...;
|
||||||
//oContext.pixels.right = ...;
|
//oContext.pixels.right = ...;
|
||||||
},
|
},
|
||||||
|
|
||||||
addOverlay: function(url, autoCenterAndZoom) {
|
addOverlay: function(url, autoCenterAndZoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
|
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
google.earth.fetchKml(map, tile_url, function(kmlObject) {
|
google.earth.fetchKml(map, tile_url, function(kmlObject) {
|
||||||
if (kmlObject) {
|
if (kmlObject) {
|
||||||
map.getFeatures().appendChild(kmlObject);
|
map.getFeatures().appendChild(kmlObject);
|
||||||
me.tileLayers.push( [tile_url, kmlObject, true] );
|
me.tileLayers.push( [tile_url, kmlObject, true] );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw 'Invalid KML file';
|
throw 'Invalid KML file';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleTileLayer: function(tile_url) {
|
toggleTileLayer: function(tile_url) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
for (var f=0; f<this.tileLayers.length; f++) {
|
for (var f=0; f<this.tileLayers.length; f++) {
|
||||||
if(this.tileLayers[f][0] == tile_url) {
|
if(this.tileLayers[f][0] == tile_url) {
|
||||||
if(this.tileLayers[f][2]) {
|
if(this.tileLayers[f][2]) {
|
||||||
map.getFeatures().removeChild(this.tileLayers[f][1]);
|
map.getFeatures().removeChild(this.tileLayers[f][1]);
|
||||||
this.tileLayers[f][2] = false;
|
this.tileLayers[f][2] = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
map.getFeatures().appendChild(this.tileLayers[f][1]);
|
map.getFeatures().appendChild(this.tileLayers[f][1]);
|
||||||
this.tileLayers[f][2] = true;
|
this.tileLayers[f][2] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getPixelRatio: function() {
|
getPixelRatio: function() {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
mousePosition: function(element) {
|
mousePosition: function(element) {
|
||||||
var map = this.maps[this.api];
|
var map = this.maps[this.api];
|
||||||
|
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
LatLonPoint: {
|
LatLonPoint: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
fromProprietary: function(googlePoint) {
|
fromProprietary: function(googlePoint) {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Marker: {
|
Marker: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
openBubble: function() {
|
openBubble: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Polyline: {
|
Polyline: {
|
||||||
|
|
||||||
toProprietary: function() {
|
toProprietary: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
// TODO: Add provider code
|
// TODO: Add provider code
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
// TODO: Add provider code
|
// 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
Reference in New Issue
Block a user