← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 2676: OpenStreetMap.

 

Removing this one, intended for dhis2-devs-core/dhis2/gis-tmp.

On Thu, Jan 20, 2011 at 16:58, <noreply@xxxxxxxxxxxxx> wrote:

> ------------------------------------------------------------
> revno: 2676
> committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
> branch nick: dhis2
> timestamp: Thu 2011-01-20 16:56:46 +0100
> message:
>  OpenStreetMap.
> added:
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script/
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script/OpenStreetMap.js
> modified:
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/OpenLayers.js
>
>
> --
> lp:dhis2
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
>
> Your team DHIS 2 developers is subscribed to branch lp:dhis2.
> To unsubscribe from this branch go to
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>        2011-01-05 09:53:11 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>        2011-01-20 15:56:46 +0000
> @@ -79,6 +79,7 @@
>
>         <!-- OpenLayers -->
>         <script type="text/javascript"
> src="../resources/openlayers-2.10/OpenLayers.js"></script>
> +        <script type="text/javascript"
> src="../resources/openlayers-2.10/script/OpenStreetMap.js"></script>
>
>             <!-- UX -->
>             <script type="text/javascript"
> src="../resources/openlayers-ux/newSelectFeature.js"></script>
> @@ -88,6 +89,9 @@
>
>         <!-- MapFish -->
>         <script type="text/javascript"
> src="../resources/mapfish/MapFish.js"></script>
> +
> +        <!-- Google API -->
> +        <script src="
> http://maps.google.com/maps?file=api&amp;v=3&amp;sensor=false&amp;key=ABQIAAAAut6AhySExnYIXm5s2OFIkxRKNzJ-_9njnryRTbvC6CtrS4sRvRREWnxwlZUa630pLuPf3nD9i4fq9w";
> type="text/javascript"></script>
>
>                <!-- DHIS -->
>         <script type="text/javascript"
> src="i18nJavaScript.action"></script>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js
>  2011-01-11 10:41:42 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/global.js
>  2011-01-20 15:56:46 +0000
> @@ -286,6 +286,18 @@
>         if (!cb.keepPosition) {
>             cb.keepPosition = true;
>         }
> +    },
> +
> +    getTransformedPointByXY: function(x, y) {
> +        var p = new OpenLayers.Geometry.Point(parseFloat(x),
> parseFloat(y));
> +        return p.transform(new OpenLayers.Projection("EPSG:4326"), new
> OpenLayers.Projection("EPSG:900913"));
> +    },
> +
> +    getTransformedFeatureArray: function(features) {
> +        for (var i = 0; i < features.length; i++) {
> +            features[i].geometry.transform(new
> OpenLayers.Projection("EPSG:4326"), new
> OpenLayers.Projection("EPSG:900913"));
> +        }
> +        return features;
>     }
>  };
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
>   2011-01-19 18:05:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
>   2011-01-20 15:56:46 +0000
> @@ -2,9 +2,9 @@
>     Ext.BLANK_IMAGE_URL =
> '../resources/ext-ux/theme/gray-extend/gray-extend/s.gif';
>
>  Ext.override(Ext.form.Field,{showField:function(){this.show();this.container.up('div.x-form-item').setDisplayed(true);},hideField:function(){this.hide();this.container.up('div.x-form-item').setDisplayed(false);}});
>        Ext.QuickTips.init();
> -       document.body.oncontextmenu = function(){return false;};
> +       document.body.oncontextmenu = function(){return false;};
>
> -       G.vars.map = new OpenLayers.Map({controls:[new
> OpenLayers.Control.Navigation(),new OpenLayers.Control.ArgParser(),new
> OpenLayers.Control.Attribution()]});
> +       G.vars.map = new OpenLayers.Map({controls: [new
> OpenLayers.Control.MouseToolbar()]});
>        G.vars.mask = new
> Ext.LoadMask(Ext.getBody(),{msg:G.i18n.loading,msgCls:'x-mask-loading2'});
>     G.vars.parameter = G.util.getUrlParam('view') ? {id:
> G.util.getUrlParam('view')} : {id: null};
>
> @@ -338,8 +338,14 @@
>
>        /* Add base layers */
>        function addBaseLayersToMap(init) {
> -               G.vars.map.addLayers([new OpenLayers.Layer.WMS('World', '
> http://labs.metacarta.com/wms/vmap0', {layers: 'basic'})]);
> -               G.vars.map.layers[0].setVisibility(false);
> +
> +    G.vars.map.addLayer(new OpenLayers.Layer.OSM.Osmarender("OSM
> Osmarender"));
> +    G.vars.map.addLayer(new OpenLayers.Layer.OSM.Mapnik("OSM Mapnik"));
> +    G.vars.map.addLayer(new OpenLayers.Layer.OSM.CycleMap("OSM
> CycleMap"));
> +
> +
> +
> +
>
>         if (init) {
>             var layers = G.vars.parameter.baseLayers || [];
> @@ -396,6 +402,8 @@
>                         })
>                     });
>
> +                    overlay.features =
> G.util.getTransformedFeatureArray(overlay.features);
> +
>                     overlay.events.register('loadstart', null, loadStart);
>                     overlay.events.register('loadend', null, loadEnd);
>                     overlay.isOverlay = true;
> @@ -545,7 +553,7 @@
>                 id: 'deleteview_b',
>                 iconCls: 'icon-remove',
>                                hideLabel: true,
> -                               text: G.i18n.delete_,
> +                               text: G.i18n.delete,
>                                handler: function() {
>                                        var v =
> Ext.getCmp('favorite_cb').getValue();
>                                        var rw =
> Ext.getCmp('favorite_cb').getRawValue();
> @@ -702,7 +710,7 @@
>                 id: 'exportimage_b',
>                                labelSeparator: G.conf.labelseparator,
>                 iconCls: 'icon-export',
> -                               text: G.i18n.export_,
> +                               text: G.i18n.export,
>                                handler: function() {
>                     var values, svgElement, svg;
>                     if (Ext.getCmp('exportimagelayers_cb').getValue() == 1)
> {
> @@ -801,6 +809,7 @@
>                layout: 'accordion',
>         closeAction: 'hide',
>                width: G.conf.window_width,
> +        height: Ext.isChrome ? 348:346,
>         items: [
>             {
>                 id: 'newpredefinedmaplegend_p',
> @@ -890,7 +899,7 @@
>                                                 return;
>                                             }
>
> -                                            if (!mln || !mlc) {
> +                                            if (!mln || !mlsv || !mlev ||
> !mlc) {
>                                                 Ext.message.msg(false,
> G.i18n.form_is_not_complete);
>                                                 return;
>                                             }
> @@ -923,7 +932,7 @@
>                                     {
>                                         xtype: 'button',
>                                         id: 'deletepredefinedmaplegend_b',
> -                                        text: G.i18n.delete_,
> +                                        text: G.i18n.delete,
>                                         iconCls: 'icon-remove',
>                                         handler: function() {
>                                             var mlv =
> Ext.getCmp('predefinedmaplegend_cb').getValue();
> @@ -1084,7 +1093,7 @@
>                                     {
>                                         xtype: 'button',
>                                         id:
> 'deletepredefinedmaplegendset_b',
> -                                        text: G.i18n.delete_,
> +                                        text: G.i18n.delete,
>                                         iconCls: 'icon-remove',
>                                         handler: function() {
>                                             var mlsv =
> Ext.getCmp('predefinedmaplegendsetindicator_cb').getValue();
> @@ -1654,7 +1663,7 @@
>             {
>                 xtype: 'button',
>                 id: 'deletemaplayer_b',
> -                text: G.i18n.delete_,
> +                text: G.i18n.delete,
>                 iconCls: 'icon-remove',
>                 handler: function() {
>                     var ml = Ext.getCmp('maplayer_cb').getValue();
> @@ -1784,7 +1793,7 @@
>             {
>                 xtype: 'button',
>                 id: 'deletemaplayerbaselayers_b',
> -                text: G.i18n.delete_,
> +                text: G.i18n.delete,
>                 iconCls: 'icon-remove',
>                 handler: function() {
>                     var ml =
> Ext.getCmp('maplayerbaselayers_cb').getValue();
> @@ -1896,6 +1905,22 @@
>         })
>     });
>
> +    var choroplethLayer = new OpenLayers.Layer.Vector('Polygon layer', {
> +        'visibility': false,
> +        'displayInLayerSwitcher': false,
> +        'styleMap': new OpenLayers.StyleMap({
> +            'default': new OpenLayers.Style(
> +                OpenLayers.Util.applyDefaults(
> +                    {'fillOpacity': 1, 'strokeColor': '#222222',
> 'strokeWidth': 1, 'pointRadius': 5},
> +                    OpenLayers.Feature.Vector.style['default']
> +                )
> +            ),
> +            'select': new OpenLayers.Style(
> +                {'strokeColor': '#000000', 'strokeWidth': 2, 'cursor':
> 'pointer'}
> +            )
> +        })
> +    });
> +
>     var symbolLayer = new OpenLayers.Layer.Vector('Point layer', {
>         'visibility': false,
>         'displayInLayerSwitcher': false,
> @@ -2320,11 +2345,6 @@
>                iconCls: 'icon-image',
>                tooltip: G.i18n.export_map_as_image,
>                handler: function() {
> -                       if (Ext.isIE) {
> -                               Ext.message.msg(false, 'SVG not supported
> by browser');
> -                               return;
> -                       }
> -
>                        var x = Ext.getCmp('center').x + 15;
>                        var y = Ext.getCmp('center').y + 41;
>
> @@ -2361,7 +2381,7 @@
>                iconCls: 'icon-predefinedlegendset',
>                tooltip: G.i18n.create_predefined_legend_sets,
>                disabled: !G.user.isAdmin,
> -               handler: function() {
> +               handler: function() {
>                        var x = Ext.getCmp('center').x + 15;
>                        var y = Ext.getCmp('center').y + 41;
>                        predefinedMapLegendSetWindow.setPosition(x,y);
> @@ -2382,7 +2402,7 @@
>                iconCls: 'icon-admin',
>                tooltip: 'Administrator settings',
>                disabled: !G.user.isAdmin,
> -               handler: function() {
> +               handler: function() {
>                        var x = Ext.getCmp('center').x + 15;
>                        var y = Ext.getCmp('center').y + 41;
>                        adminWindow.setPosition(x,y);
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
> 2011-01-07 10:58:35 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js
> 2011-01-20 15:56:46 +0000
> @@ -91,6 +91,7 @@
>         var format = this.format || new OpenLayers.Format.GeoJSON();
>         this.layer.removeFeatures(this.layer.features);
>         this.layer.addFeatures(format.read(doc));
> +        this.layer.features =
> G.util.getTransformedFeatureArray(this.layer.features);
>         this.requestSuccess(request);
>
>         if (G.vars.activePanel.isPolygon()) {
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
>   2011-01-12 08:49:02 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js
>   2011-01-20 15:56:46 +0000
> @@ -1423,7 +1423,8 @@
>
>             if (this.mapView) {
>                 if (this.mapView.longitude && this.mapView.latitude &&
> this.mapView.zoom) {
> -                    G.vars.map.setCenter(new
> OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude),
> this.mapView.zoom);
> +                    var p =
> G.util.getTransformedPointByXY(this.mapView.longitude,
> this.mapView.latitude);
> +                    G.vars.map.setCenter(new OpenLayers.LonLat(p.x, p.y),
> this.mapView.zoom);
>                 }
>                 else {
>                     G.vars.map.zoomToExtent(this.layer.getDataExtent());
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js
>       2011-01-12 08:49:02 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js
>       2011-01-20 15:56:46 +0000
> @@ -1405,7 +1405,8 @@
>
>             if (this.mapView) {
>                 if (this.mapView.longitude && this.mapView.latitude &&
> this.mapView.zoom) {
> -                    G.vars.map.setCenter(new
> OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude),
> this.mapView.zoom);
> +                    var point =
> G.util.getTransformedPointByXY(this.mapView.longitude,
> this.mapView.latitude);
> +                    G.vars.map.setCenter(new OpenLayers.LonLat(point.x,
> point.y), this.mapView.zoom);
>                 }
>                 else {
>                     G.vars.map.zoomToExtent(this.layer.getDataExtent());
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/OpenLayers.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/OpenLayers.js
>   2010-09-14 17:14:48 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/OpenLayers.js
>   2011-01-20 15:56:46 +0000
> @@ -691,10 +691,13 @@
>  cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return
> cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();
> this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new
> OpenLayers.Events(this,null,this.EVENT_TYPES);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new
> OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);}
>  OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var
> maxExtent=this.layer.maxExtent;var
> withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return
> this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;}
>  this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var
> msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var
> topLeft=this.layer.map.getLonLatFromLayerPx(position);var
> bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var
> bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}}
> -var bounds=new
> OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return
> bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.MouseToolbar=OpenLayers.Class(OpenLayers.Control.MouseDefaults,{mode:null,buttons:null,direction:"vertical",buttonClicked:null,initialize:function(position,direction){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new
> OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,OpenLayers.Control.MouseToolbar.Y);if(position){this.position=position;}
> +var bounds=new
> OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return
> bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});
> +
> +
> +OpenLayers.Control.MouseToolbar=OpenLayers.Class(OpenLayers.Control.MouseDefaults,{mode:null,buttons:null,direction:"vertical",buttonClicked:null,initialize:function(position,direction){OpenLayers.Control.prototype.initialize.apply(this,arguments);this.position=new
> OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,OpenLayers.Control.MouseToolbar.Y);if(position){this.position=position;}
>  if(direction){this.direction=direction;}
>  this.measureDivs=[];},destroy:function(){for(var btnId in
> this.buttons){var
> btn=this.buttons[btnId];btn.map=null;btn.events.destroy();}
> -OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons={};var
> sz=new OpenLayers.Size(28,28);var centered=new
> OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);this._addButton("zoombox","drag-rectangle-off.png","drag-rectangle-on.png",centered,sz,"Shift->Drag
> to zoom to
> area");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this._addButton("pan","panning-hand-off.png","panning-hand-on.png",centered,sz,"Drag
> the map to
> pan.");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this.switchModeTo("pan");return
> this.div;},_addButton:function(id,img,activeImg,xy,sz,title){var
> imgLocation=OpenLayers.Util.getImagesLocation()+img;var
> activeImgLocation=OpenLayers.Util.getImagesLocation()+activeImg;var
> btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MouseToolbar_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.imgLocation=imgLocation;btn.activeImgLocation=activeImgLocation;btn.events=new
> OpenLayers.Events(this,btn,null,true);btn.events.on({"mousedown":this.buttonDown,"mouseup":this.buttonUp,"dblclick":OpenLayers.Event.stop,scope:this});btn.action=id;btn.title=title;btn.alt=title;btn.map=this.map;this.buttons[id]=btn;return
> btn;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}
> +OpenLayers.Control.MouseDefaults.prototype.destroy.apply(this,arguments);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);OpenLayers.Control.MouseDefaults.prototype.draw.apply(this,arguments);this.buttons={};var
> sz=new OpenLayers.Size(0,0);var centered=new
> OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,0);this._addButton("zoombox","drag-rectangle-off.png","drag-rectangle-on.png",centered,sz,"Shift->Drag
> to zoom to
> area");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this._addButton("pan","panning-hand-off.png","panning-hand-on.png",centered,sz,"Drag
> the map to
> pan.");centered=centered.add((this.direction=="vertical"?0:sz.w),(this.direction=="vertical"?sz.h:0));this.switchModeTo("pan");return
> this.div;},_addButton:function(id,img,activeImg,xy,sz,title){var
> imgLocation=OpenLayers.Util.getImagesLocation()+img;var
> activeImgLocation=OpenLayers.Util.getImagesLocation()+activeImg;var
> btn=OpenLayers.Util.createAlphaImageDiv("OpenLayers_Control_MouseToolbar_"+id,xy,sz,imgLocation,"absolute");this.div.appendChild(btn);btn.imgLocation=imgLocation;btn.activeImgLocation=activeImgLocation;btn.events=new
> OpenLayers.Events(this,btn,null,true);btn.events.on({"mousedown":this.buttonDown,"mouseup":this.buttonUp,"dblclick":OpenLayers.Event.stop,scope:this});btn.action=id;btn.title=title;btn.alt=title;btn.map=this.map;this.buttons[id]=btn;return
> btn;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}
>
>  this.buttonClicked=evt.element.action;OpenLayers.Event.stop(evt);},buttonUp:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}
>
>  if(this.buttonClicked!=null){if(this.buttonClicked==evt.element.action){this.switchModeTo(evt.element.action);}
>  OpenLayers.Event.stop(evt);this.buttonClicked=null;}},defaultDblClick:function(evt){this.switchModeTo("pan");this.performedDrag=false;var
> newCenter=this.map.getLonLatFromViewPortPx(evt.xy);this.map.setCenter(newCenter,this.map.zoom+1);OpenLayers.Event.stop(evt);return
> false;},defaultMouseDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;}
> @@ -713,7 +716,9 @@
>
>  switch(this.mode){case"zoombox":this.zoomBoxEnd(evt);if(this.startViaKeyboard){this.leaveMode();}
>
>  break;case"pan":if(this.performedDrag){this.map.setCenter(this.map.center);}}
>
>  document.onselectstart=null;this.mouseDragStart=null;this.map.div.style.cursor="default";},defaultMouseOut:function(evt){if(this.mouseDragStart!=null&&OpenLayers.Util.mouseLeft(evt,this.map.div)){if(this.zoomBox){this.removeZoomBox();if(this.startViaKeyboard){this.leaveMode();}}
> -this.mouseDragStart=null;this.map.div.style.cursor="default";}},defaultClick:function(evt){if(this.performedDrag){this.performedDrag=false;return
> false;}},CLASS_NAME:"OpenLayers.Control.MouseToolbar"});OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=300;OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:true,clearOnDeactivate:false,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.registry=OpenLayers.Util.extend({"moveend":this.getState},this.registry);var
> previousOptions={trigger:OpenLayers.Function.bind(this.previousTrigger,this),displayClass:this.displayClass+"
> "+this.displayClass+"Previous"};OpenLayers.Util.extend(previousOptions,this.previousOptions);this.previous=new
> OpenLayers.Control.Button(previousOptions);var
> nextOptions={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+"
> "+this.displayClass+"Next"};OpenLayers.Util.extend(nextOptions,this.nextOptions);this.next=new
> OpenLayers.Control.Button(nextOptions);this.clear();},onPreviousChange:function(state,length){if(state&&!this.previous.active){this.previous.activate();}else
> if(!state&&this.previous.active){this.previous.deactivate();}},onNextChange:function(state,length){if(state&&!this.next.active){this.next.activate();}else
> if(!state&&this.next.active){this.next.deactivate();}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var
> prop in
> this){this[prop]=null;}},setMap:function(map){this.map=map;this.next.setMap(map);this.previous.setMap(map);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw();},previousTrigger:function(){var
> current=this.previousStack.shift();var
> state=this.previousStack.shift();if(state!=undefined){this.nextStack.unshift(current);this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}else{this.previousStack.unshift(current);}
> +this.mouseDragStart=null;this.map.div.style.cursor="default";}},defaultClick:function(evt){if(this.performedDrag){this.performedDrag=false;return
> false;}},CLASS_NAME:"OpenLayers.Control.MouseToolbar"});
> +
> +OpenLayers.Control.MouseToolbar.X=6;OpenLayers.Control.MouseToolbar.Y=100;OpenLayers.Control.NavigationHistory=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOGGLE,previous:null,previousOptions:null,next:null,nextOptions:null,limit:50,autoActivate:true,clearOnDeactivate:false,registry:null,nextStack:null,previousStack:null,listeners:null,restoring:false,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.registry=OpenLayers.Util.extend({"moveend":this.getState},this.registry);var
> previousOptions={trigger:OpenLayers.Function.bind(this.previousTrigger,this),displayClass:this.displayClass+"
> "+this.displayClass+"Previous"};OpenLayers.Util.extend(previousOptions,this.previousOptions);this.previous=new
> OpenLayers.Control.Button(previousOptions);var
> nextOptions={trigger:OpenLayers.Function.bind(this.nextTrigger,this),displayClass:this.displayClass+"
> "+this.displayClass+"Next"};OpenLayers.Util.extend(nextOptions,this.nextOptions);this.next=new
> OpenLayers.Control.Button(nextOptions);this.clear();},onPreviousChange:function(state,length){if(state&&!this.previous.active){this.previous.activate();}else
> if(!state&&this.previous.active){this.previous.deactivate();}},onNextChange:function(state,length){if(state&&!this.next.active){this.next.activate();}else
> if(!state&&this.next.active){this.next.deactivate();}},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this);this.previous.destroy();this.next.destroy();this.deactivate();for(var
> prop in
> this){this[prop]=null;}},setMap:function(map){this.map=map;this.next.setMap(map);this.previous.setMap(map);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.next.draw();this.previous.draw();},previousTrigger:function(){var
> current=this.previousStack.shift();var
> state=this.previousStack.shift();if(state!=undefined){this.nextStack.unshift(current);this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}else{this.previousStack.unshift(current);}
>  return state;},nextTrigger:function(){var
> state=this.nextStack.shift();if(state!=undefined){this.previousStack.unshift(state);this.restoring=true;this.restore(state);this.restoring=false;this.onNextChange(this.nextStack[0],this.nextStack.length);this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}
>  return
> state;},clear:function(){this.previousStack=[];this.previous.deactivate();this.nextStack=[];this.next.deactivate();},getState:function(){return{center:this.map.getCenter(),resolution:this.map.getResolution(),projection:this.map.getProjectionObject(),units:this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units};},restore:function(state){var
> center,zoom;if(this.map.getProjectionObject()==state.projection){zoom=this.map.getZoomForResolution(state.resolution);center=state.center;}else{center=state.center.clone();center.transform(state.projection,this.map.getProjectionObject());var
> sourceUnits=state.units;var
> targetUnits=this.map.getProjectionObject().getUnits()||this.map.units||this.map.baseLayer.units;var
> resolutionFactor=sourceUnits&&targetUnits?OpenLayers.INCHES_PER_UNIT[sourceUnits]/OpenLayers.INCHES_PER_UNIT[targetUnits]:1;zoom=this.map.getZoomForResolution(resolutionFactor*state.resolution);}
>  this.map.setCenter(center,zoom);},setListeners:function(){this.listeners={};for(var
> type in
> this.registry){this.listeners[type]=OpenLayers.Function.bind(function(){if(!this.restoring){var
> state=this.registry[type].apply(this,arguments);this.previousStack.unshift(state);if(this.previousStack.length>1){this.onPreviousChange(this.previousStack[1],this.previousStack.length-1);}
> @@ -2550,4 +2555,4 @@
>  options.subPaths.shift();this.writeNode("_Layer",options,node);return
> node;}else{if(layer instanceof
> OpenLayers.Layer.WMS){node=this.writeNode("_WMS",layer);}else if(layer
> instanceof OpenLayers.Layer.Vector){if(layer.protocol instanceof
> OpenLayers.Protocol.WFS.v1){node=this.writeNode("_WFS",layer);}else
> if(layer.protocol instanceof
> OpenLayers.Protocol.HTTP){if(layer.protocol.format instanceof
> OpenLayers.Format.GML){layer.protocol.format.version="2.1.2";node=this.writeNode("_GML",layer);}else
> if(layer.protocol.format instanceof
> OpenLayers.Format.KML){layer.protocol.format.version="2.2";node=this.writeNode("_KML",layer);}}else{this.setNamespace("feature",this.featureNS);node=this.writeNode("_InlineGeometry",layer);}}
>
>  if(layer.options.maxScale){this.writeNode("sld:MinScaleDenominator",layer.options.maxScale,node);}
>
>  if(layer.options.minScale){this.writeNode("sld:MaxScaleDenominator",layer.options.minScale,node);}
> -this.nestingLayerLookup[layer.name]=node;return
> node;}},"_WFS":function(layer){var
> node=this.createElementNSPlus("Layer",{attributes:{name:layer.protocol.featurePrefix+":"+layer.protocol.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WFS,version:layer.protocol.version,url:layer.protocol.url},node);return
> node;},"_InlineGeometry":function(layer){var
> node=this.createElementNSPlus("Layer",{attributes:{name:this.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",
> layer.name,node);this.writeNode("InlineGeometry",layer,node);return
> node;},"_GML":function(layer){var
> node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.GML,url:layer.protocol.url,version:layer.protocol.format.version},node);return
> node;},"_KML":function(layer){var
> node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.KML,version:layer.protocol.format.version,url:layer.protocol.url},node);return
> node;}},"gml":OpenLayers.Util.applyDefaults({"boundedBy":function(bounds){var
> node=this.createElementNSPlus("gml:boundedBy");this.writeNode("gml:Box",bounds,node);return
> node;}},OpenLayers.Format.GML.v2.prototype.writers.gml),"ows":OpenLayers.Format.OWSCommon.v1_0_0.prototype.writers.ows,"sld":OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,"feature":OpenLayers.Format.GML.v2.prototype.writers.feature},CLASS_NAME:"OpenLayers.Format.OWSContext.v0_3_1"});
> \ No newline at end of file
> +this.nestingLayerLookup[layer.name]=node;return
> node;}},"_WFS":function(layer){var
> node=this.createElementNSPlus("Layer",{attributes:{name:layer.protocol.featurePrefix+":"+layer.protocol.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.WFS,version:layer.protocol.version,url:layer.protocol.url},node);return
> node;},"_InlineGeometry":function(layer){var
> node=this.createElementNSPlus("Layer",{attributes:{name:this.featureType,hidden:layer.visibility?"0":"1"}});this.writeNode("ows:Title",
> layer.name,node);this.writeNode("InlineGeometry",layer,node);return
> node;},"_GML":function(layer){var
> node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.GML,url:layer.protocol.url,version:layer.protocol.format.version},node);return
> node;},"_KML":function(layer){var
> node=this.createElementNSPlus("Layer");this.writeNode("ows:Title",
> layer.name,node);this.writeNode("Server",{service:OpenLayers.Format.Context.serviceTypes.KML,version:layer.protocol.format.version,url:layer.protocol.url},node);return
> node;}},"gml":OpenLayers.Util.applyDefaults({"boundedBy":function(bounds){var
> node=this.createElementNSPlus("gml:boundedBy");this.writeNode("gml:Box",bounds,node);return
> node;}},OpenLayers.Format.GML.v2.prototype.writers.gml),"ows":OpenLayers.Format.OWSCommon.v1_0_0.prototype.writers.ows,"sld":OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,"feature":OpenLayers.Format.GML.v2.prototype.writers.feature},CLASS_NAME:"OpenLayers.Format.OWSContext.v0_3_1"});
>
> === added directory
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script'
> === added file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script/OpenStreetMap.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script/OpenStreetMap.js
> 1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/openlayers-2.10/script/OpenStreetMap.js
> 2011-01-20 15:56:46 +0000
> @@ -0,0 +1,126 @@
> +/**
> + * Namespace: Util.OSM
> + */
> +OpenLayers.Util.OSM = {};
> +
> +/**
> + * Constant: MISSING_TILE_URL
> + * {String} URL of image to display for missing tiles
> + */
> +OpenLayers.Util.OSM.MISSING_TILE_URL = "
> http://www.openstreetmap.org/openlayers/img/404.png";;
> +
> +/**
> + * Property: originalOnImageLoadError
> + * {Function} Original onImageLoadError function.
> + */
> +OpenLayers.Util.OSM.originalOnImageLoadError =
> OpenLayers.Util.onImageLoadError;
> +
> +/**
> + * Function: onImageLoadError
> + */
> +OpenLayers.Util.onImageLoadError = function() {
> +    if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
> +        this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
> +    } else if
> (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
> +        // do nothing - this layer is transparent
> +    } else {
> +        OpenLayers.Util.OSM.originalOnImageLoadError;
> +    }
> +};
> +
> +/**
> + * Class: OpenLayers.Layer.OSM.Mapnik
> + *
> + * Inherits from:
> + *  - <OpenLayers.Layer.OSM>
> + */
> +OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
> +    /**
> +     * Constructor: OpenLayers.Layer.OSM.Mapnik
> +     *
> +     * Parameters:
> +     * name - {String}
> +     * options - {Object} Hashtable of extra options to tag onto the layer
> +     */
> +    initialize: function(name, options) {
> +        var url = [
> +            "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png";,
> +            "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png";,
> +            "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png";
> +        ];
> +        options = OpenLayers.Util.extend({
> +            numZoomLevels: 19,
> +            buffer: 0,
> +            transitionEffect: "resize"
> +        }, options);
> +        var newArguments = [name, url, options];
> +        OpenLayers.Layer.OSM.prototype.initialize.apply(this,
> newArguments);
> +    },
> +
> +    CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
> +});
> +
> +/**
> + * Class: OpenLayers.Layer.OSM.Osmarender
> + *
> + * Inherits from:
> + *  - <OpenLayers.Layer.OSM>
> + */
> +OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
> +    /**
> +     * Constructor: OpenLayers.Layer.OSM.Osmarender
> +     *
> +     * Parameters:
> +     * name - {String}
> +     * options - {Object} Hashtable of extra options to tag onto the layer
> +     */
> +    initialize: function(name, options) {
> +        var url = [
> +            "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png
> ",
> +            "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png
> ",
> +            "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png
> "
> +        ];
> +        options = OpenLayers.Util.extend({
> +            numZoomLevels: 18,
> +            buffer: 0,
> +            transitionEffect: "resize"
> +        }, options);
> +        var newArguments = [name, url, options];
> +        OpenLayers.Layer.OSM.prototype.initialize.apply(this,
> newArguments);
> +    },
> +
> +    CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
> +});
> +
> +/**
> + * Class: OpenLayers.Layer.OSM.CycleMap
> + *
> + * Inherits from:
> + *  - <OpenLayers.Layer.OSM>
> + */
> +OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
> +    /**
> +     * Constructor: OpenLayers.Layer.OSM.CycleMap
> +     *
> +     * Parameters:
> +     * name - {String}
> +     * options - {Object} Hashtable of extra options to tag onto the layer
> +     */
> +    initialize: function(name, options) {
> +        var url = [
> +            "http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png";,
> +            "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png";,
> +            "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png";
> +        ];
> +        options = OpenLayers.Util.extend({
> +            numZoomLevels: 19,
> +            buffer: 0,
> +            transitionEffect: "resize"
> +        }, options);
> +        var newArguments = [name, url, options];
> +        OpenLayers.Layer.OSM.prototype.initialize.apply(this,
> newArguments);
> +    },
> +
> +    CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
> +});
> +
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

References