|
Struts example source code file (GoogleMap.js)
The Struts GoogleMap.js source code/* Copyright (c) 2004-2006, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/community/licensing.shtml */ dojo.provide("dojo.widget.GoogleMap"); dojo.require("dojo.event.*"); dojo.require("dojo.math"); dojo.require("dojo.widget.*"); dojo.require("dojo.uri.Uri"); dojo.require("dojo.widget.HtmlWidget"); (function () { var gkey = djConfig["gMapKey"] || djConfig["googleMapKey"]; var uri = new dojo.uri.Uri(window.location.href); if (uri.host == "www.dojotoolkit.org") { gkey = "ABQIAAAACUNdgv_7FGOmUslbm9l6_hRqjp7ri2mNiOEYqetD3xnFHpt5rBSjszDd1sdufPyQKUTyCf_YxoIxvw"; } else { if (uri.host == "blog.dojotoolkit.org") { gkey = "ABQIAAAACUNdgv_7FGOmUslbm9l6_hSkep6Av1xaMhVn3yCLkorJeXeLARQ6fammI_P3qSGleTJhoI5_1JmP_Q"; } else { if (uri.host == "archive.dojotoolkit.org") { gkey = "ABQIAAAACUNdgv_7FGOmUslbm9l6_hTaQpDt0dyGLIHbXMPTzg1kWeAfwRTwZNyrUfbfxYE9yIvRivEjcXoDTg"; } else { if (uri.host == "dojotoolkit.org") { gkey = "ABQIAAAACUNdgv_7FGOmUslbm9l6_hSaOaO_TgJ5c3mtQFnk5JO2zD5dZBRZk-ieqVs7BORREYNzAERmcJoEjQ"; } } } } if (!dojo.hostenv.post_load_) { if (!gkey || gkey == "") { dojo.raise("dojo.widget.GoogleMap: The Google Map widget requires a proper API key in order to be used."); } var tag = "<scr" + "ipt src='http://maps.google.com/maps?file=api&v=2&key=" + gkey + "'>"; if (!dj_global["GMap2"]) { document.write(tag); } } else { dojo.debug("Cannot initialize Google Map system after the page has been loaded! Please either manually include the script block provided by Google in your page or require() the GoogleMap widget before onload has fired."); } })(); dojo.widget.defineWidget("dojo.widget.GoogleMap", dojo.widget.HtmlWidget, function () { this.map = null; this.geocoder = null; this.data = []; this.datasrc = ""; this.controls = ["largemap", "scale", "maptype"]; }, {templatePath:null, templateCssPath:null, isContainer:false, _defaultPoint:{lat:39.10662, lng:-94.578209}, setControls:function () { var methodmap = {largemap:GLargeMapControl, smallmap:GSmallMapControl, smallzoom:GSmallZoomControl, scale:GScaleControl, maptype:GMapTypeControl, overview:GOverviewMapControl}; for (var i = 0; i < this.controls.length; i++) { this.map.addControl(new (methodmap[this.controls[i].toLowerCase()])()); } }, findCenter:function (bounds) { if (this.data.length == 1) { return (new GLatLng(this.data[0].lat, this.data[0].lng)); } var clat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2; var clng = (bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2; return (new GLatLng(clat, clng)); }, createPinpoint:function (pt, overlay) { var m = new GMarker(pt); if (overlay) { GEvent.addListener(m, "click", function () { m.openInfoWindowHtml("<div>" + overlay + " Other Struts examples (source code examples)Here is a short list of links related to this Struts GoogleMap.js source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.