codesite-noreply at google.com
2009-Dec-13 19:10 UTC
[Mapstraction] [mapstraction] r60 committed - Fixed OpenLayers controls to work with Small/Large zoom and pan. Exten...
Revision: 60 Author: ajturner Date: Sun Dec 13 11:09:44 2009 Log: Fixed OpenLayers controls to work with Small/Large zoom and pan. Extended Google tile support for Map type or just base tiles option http://code.google.com/p/mapstraction/source/detail?r=60 Modified: /trunk/source/mxn.core.js /trunk/tests/index.htm ======================================--- /trunk/source/mxn.core.js Sun Oct 4 02:16:15 2009 +++ /trunk/source/mxn.core.js Sun Dec 13 11:09:44 2009 @@ -36,7 +36,7 @@ this.layers = []; this.polylines = []; this.images = []; - this.controls = []; + this.controls = []; this.loaded = {}; this.onload = {}; this.element = element; @@ -961,7 +961,7 @@ * @param {copyright_text} copyright text to use for the tile layer. (default=Mapstraction) * @param {min_zoom} Minimum (furtherest out) zoom level that tiles are available (default=1) * @param {max_zoom} Maximum (closest) zoom level that the tiles are available (default=18) - * @param {map_type} Should the tile layer be a selectable map type in the layers palette (default=false) + * @param {map_type} Should the tile layer be a selectable map type in the layers palette (default=true) */ Mapstraction.prototype.addTileLayer = function(tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type) { if(!tile_url) { @@ -973,7 +973,7 @@ copyright_text = copyright_text || "Mapstraction"; min_zoom = min_zoom || 1; max_zoom = max_zoom || 18; - map_type = map_type || false; + map_type = map_type || true; return this.invoker.go(''addTileLayer'', [ tile_url, opacity, copyright_text, min_zoom, max_zoom, map_type] ); }; @@ -1701,58 +1701,4 @@ this.points = reduced; }; -/////////////// -// Radius // -/////////////// - -/** - * Creates a new radius object for drawing circles around a point, does a lot of initial calculation to increase load time - * @returns a new Radius - * @type Radius - * @constructor - * @classDescription Radius - * @param {Object} Center LatLonPoint of the radius - * @param {quality} Number of points that comprise the approximated circle (20 is a good starting point) - */ -var Radius = mxn.Radius = function(center, quality) { - this.center = center; - var latConv = center.latConv(); - var lonConv = center.lonConv(); - - // Create Radian conversion constant - var rad = Math.PI / 180; - this.calcs = []; - - for(var i = 0; i < 360; i += quality){ - this.calcs.push([Math.cos(i * rad) / latConv, Math.sin(i * rad) / lonConv]); - } -}; - -/** - * Returns polyline of a circle around the point based on new radius - * @param {Radius} radius - * @param {Colour} colour - * @returns {Polyline} Polyline - */ -Radius.prototype.getPolyline = function(radius, colour) { - var points = []; - - for(var i = 0; i < this.calcs.length; i++){ - var point = new LatLonPoint( - this.center.lat + (radius * this.calcs[i][0]), - this.center.lon + (radius * this.calcs[i][1]) - ); - points.push(point); - } - - // Add first point - points.push(points[0]); - - var line = new Polyline(points); - line.setColor(colour); - - return line; -}; - - })(); ======================================--- /trunk/tests/index.htm Sat Nov 14 11:32:58 2009 +++ /trunk/tests/index.htm Sun Dec 13 11:09:44 2009 @@ -31,13 +31,15 @@ } } + //WhenDomReady(function(){ + var m; window.onload = function() { var actionElm = document.getElementById(''actions''); var infoElm = document.getElementById(''info''); var eventsElm = document.getElementById(''events''); - var m = new mxn.Mapstraction(''map'', ''google''); - + m = new mxn.Mapstraction(''map'', ''google''); + m.endPan.addHandler(function(sEvtName, oEvtSource, oEvtArgs){ var center = oEvtSource.getCenter(); eventsElm.innerHTML += ''Map pan: ('' + center.lat.toFixed(5) + '',''+ center.lon.toFixed(5) +'')<br/>'';