Merge authors: Jan Henrik Ă˜verland (janhenrik-overland) ------------------------------------------------------------ revno: 2284 [merge] committer: Jan Henrik Overland <janhenrik.overl...@gmail.com> branch nick: trunk timestamp: Thu 2010-09-30 13:08:35 +0200 message: (GIS) Improved code. modified: 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/util.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/Mapping.js dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.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/script/index.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-09-30 10:09:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-09-30 11:07:08 +0000 @@ -103,7 +103,7 @@ Ext.Ajax.request({ url: path_mapping + 'getMapView' + type, method: 'GET', - params: {id: PARAMETER}, + params: {id: PARAMETER || 0}, success: function(r) { var mst = Ext.util.JSON.decode(r.responseText).mapView[0].mapSourceType; var mdt = Ext.util.JSON.decode(r.responseText).mapView[0].mapDateType; @@ -3964,6 +3964,8 @@ // items: CHART // }); +var popup; + /* Section: select features polygon */ function onHoverSelectPolygon(feature) { FEATURE[thematicMap] = feature; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 2010-09-30 10:09:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js 2010-09-30 11:07:08 +0000 @@ -162,16 +162,16 @@ if (classify) { if (LABELS[organisationUnitAssignment]) { - deactivateLabels(); + deactivateLabels(this); } else { - activateLabels(); + activateLabels(this); } mapping.classify(false,true); } else { if (LABELS[organisationUnitAssignment]) { - activateLabels(); + activateLabels(this); } } }, === 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 2010-09-30 10:09:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-09-30 11:07:08 +0000 @@ -1501,10 +1501,7 @@ this.mapData.zoom = 7; if (!position) { - if (this.mapData.zoom != MAP.getZoom()) { - MAP.zoomTo(this.mapData.zoom); - } - MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude)); + MAP.zoomToExtent(this.layer.getDataExtent()); } if (this.mapView) { === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-09-28 22:06:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Mapping.js 2010-09-30 11:07:08 +0000 @@ -72,8 +72,12 @@ newUrl: false, relation: false, + + mapData: false, initComponent : function() { + + mapData = {}; mapStore = new Ext.data.JsonStore({ url: path_mapping + 'getAllMaps' + type, @@ -420,7 +424,7 @@ MASK.msg = i18n_loading ; MASK.show(); - var level = MAPDATA[organisationUnitAssignment].organisationUnitLevel; + var level = this.mapData.organisationUnitLevel; Ext.Ajax.request({ url: path_mapping + 'getOrganisationUnitsAtLevel' + type, @@ -429,8 +433,8 @@ success: function(r) { FEATURE[thematicMap] = MAP.getLayersByName('Polygon layer')[0].features; var organisationUnits = Ext.util.JSON.decode(r.responseText).organisationUnits; - var nameColumn = MAPDATA[organisationUnitAssignment].nameColumn; - var mlp = MAPDATA[organisationUnitAssignment].mapLayerPath; + var nameColumn = this.mapData.nameColumn; + var mlp = this.mapData.mapLayerPath; var count_match = 0; var relations = ''; @@ -464,8 +468,7 @@ MASK.show(); Ext.message.msg(true, '<span class="x-msg-hl">' + count_match + '</span> '+ i18n_organisation_units_assigned + ' (map <span class="x-msg-hl">' + FEATURE[thematicMap].length + '</span>, db <span class="x-msg-hl">' + organisationUnits.length + '</span>).'); - // Ext.message.msg(true, '<span class="x-msg-hl">' + count_match + '</span> '+ i18n_organisation_units_assigned + '.<br><br>Database: <span class="x-msg-hl">' + organisationUnits.length + '</span><br>Shapefile: <span class="x-msg-hl">' + FEATURE[thematicMap].length + '</span>'); - + Ext.getCmp('grid_gp').getStore().load(); mapping.classify(false, position); }, @@ -489,32 +492,29 @@ Ext.Ajax.request({ url: path_mapping + 'getMapByMapLayerPath' + type, method: 'POST', - params: { mapLayerPath: mapping.newUrl }, + params: {mapLayerPath: mapping.newUrl}, + scope: this, success: function(r) { - MAPDATA[ACTIVEPANEL] = Ext.util.JSON.decode(r.responseText).map[0]; - - MAPDATA[ACTIVEPANEL].organisationUnitLevel = parseFloat(MAPDATA[ACTIVEPANEL].organisationUnitLevel); - MAPDATA[ACTIVEPANEL].longitude = parseFloat(MAPDATA[ACTIVEPANEL].longitude); - MAPDATA[ACTIVEPANEL].latitude = parseFloat(MAPDATA[ACTIVEPANEL].latitude); - MAPDATA[ACTIVEPANEL].zoom = parseFloat(MAPDATA[ACTIVEPANEL].zoom); - + this.mapData = Ext.util.JSON.decode(r.responseText).map[0]; + + this.mapData.organisationUnitLevel = parseFloat(this.mapData.organisationUnitLevel); + this.mapData.longitude = parseFloat(this.mapData.longitude); + this.mapData.latitude = parseFloat(this.mapData.latitude); + this.mapData.zoom = parseFloat(this.mapData.zoom); + if (!position) { - if (MAPDATA[ACTIVEPANEL].zoom != MAP.getZoom()) { - MAP.zoomTo(MAPDATA[ACTIVEPANEL].zoom); - } - MAP.setCenter(new OpenLayers.LonLat(MAPDATA[ACTIVEPANEL].longitude, MAPDATA[ACTIVEPANEL].latitude)); + MAP.zoomToExtent(this.layer.getDataExtent()); } - var polygonLayer = MAP.getLayersByName('Polygon layer')[0]; - FEATURE[thematicMap] = polygonLayer.features; + FEATURE[thematicMap] = this.layer.features; if (LABELS[thematicMap]) { - toggleFeatureLabelsPolygons(false, polygonLayer); + toggleFeatureLabelsPolygons(false, this.layer); } - var mlp = MAPDATA[organisationUnitAssignment].mapLayerPath; + var mlp = this.mapData.mapLayerPath; var relations = Ext.getCmp('grid_gp').getStore(); - var nameColumn = MAPDATA[organisationUnitAssignment].nameColumn; + var nameColumn = this.mapData.nameColumn; var noCls = 1; var noAssigned = 0; @@ -523,7 +523,8 @@ for (var j = 0; j < relations.getTotalCount(); j++) { if (relations.getAt(j).data.featureId == FEATURE[thematicMap][i].attributes[nameColumn]) { - FEATURE[thematicMap][i].attributes['value'] = 1; + FEATURE[thematicMap][i].attributes.value = 1; + FEATURE[thematicMap][i].attributes.labelString = FEATURE[thematicMap][i].attributes[nameColumn]; noAssigned++; noCls = noCls < 2 ? 2 : noCls; break; === 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 2010-09-30 10:09:26 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-09-30 11:07:08 +0000 @@ -1387,10 +1387,7 @@ this.mapData.zoom = 7; if (!position) { - if (this.mapData.zoom != MAP.getZoom()) { - MAP.zoomTo(this.mapData.zoom); - } - MAP.setCenter(new OpenLayers.LonLat(this.mapData.longitude, this.mapData.latitude)); + MAP.zoomToExtent(this.layer.getDataExtent()); } if (this.mapView) {
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp