dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15064
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5291: (GIS) More significant performance improvements.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5291 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-05 18:03:50 +0100
message:
(GIS) More significant performance improvements.
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonWithValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.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/Point.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-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2011-12-05 16:53:11 +0000
@@ -76,14 +76,13 @@
public static final String SIZE_NORMAL = "normal";
public static final String SIZE_WIDE = "wide";
public static final String SIZE_TALL = "tall";
-
- public static final String TYPE = "tall";
- public static final String TYPE_COLUMN = "column";
- public static final String TYPE_STACKED_COLUMN = "stackedColumn";
- public static final String TYPE_BAR = "bar";
- public static final String TYPE_STACKED_BAR = "stackedBar";
- public static final String TYPE_LINE = "line";
- public static final String TYPE_AREA = "area";
+
+ public static final String TYPE_COLUMN = "column";
+ public static final String TYPE_STACKED_COLUMN = "stackedColumn";
+ public static final String TYPE_BAR = "bar";
+ public static final String TYPE_STACKED_BAR = "stackedBar";
+ public static final String TYPE_LINE = "line";
+ public static final String TYPE_AREA = "area";
public static final String TYPE_PIE = "pie";
public static final String DIMENSION_DATA = "data";
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-12-05 12:21:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-12-05 16:53:11 +0000
@@ -31,6 +31,7 @@
import java.util.Set;
import org.hisp.dhis.aggregation.AggregatedMapValue;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Jan Henrik Overland
@@ -75,6 +76,8 @@
Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId,
Integer level );
+ Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, Collection<OrganisationUnit> units );
+
// -------------------------------------------------------------------------
// DataMapValue
// -------------------------------------------------------------------------
@@ -82,6 +85,8 @@
Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId,
int parentOrganisationUnitId, Integer level );
+ Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId, Collection<OrganisationUnit> units );
+
Collection<AggregatedMapValue> getInfrastructuralDataElementMapValues( Integer periodId, Integer organisationUnitId );
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-03 10:35:41 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2011-12-05 16:53:11 +0000
@@ -30,6 +30,7 @@
import org.apache.commons.lang.StringUtils;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.hisp.dhis.aggregation.AggregatedMapValue;
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.Dxf2Namespace;
@@ -118,6 +119,8 @@
private transient String type;
private transient String[] groupNames;
+
+ private transient Double value;
/**
* Set of the dynamic attributes values that belong to this
@@ -772,4 +775,14 @@
{
this.groupNames = groupNames;
}
+
+ public Double getValue()
+ {
+ return value;
+ }
+
+ public void setValue( Double value )
+ {
+ this.value = value;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-12-05 12:21:38 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-12-05 16:53:11 +0000
@@ -187,7 +187,12 @@
int parentOrganisationUnitId, Integer level )
{
Collection<OrganisationUnit> units = getOrganisationUnits( parentOrganisationUnitId, level );
-
+
+ return getIndicatorMapValues( indicatorId, periodId, units );
+ }
+
+ public Collection<AggregatedMapValue> getIndicatorMapValues( int indicatorId, int periodId, Collection<OrganisationUnit> units )
+ {
Collection<AggregatedMapValue> values = aggregatedDataValueService.getAggregatedIndicatorMapValues(
indicatorId, periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) );
@@ -195,7 +200,7 @@
{
value.setValue( MathUtils.getRounded( value.getValue(), 2 ) );
}
-
+
return values;
}
@@ -223,7 +228,12 @@
int parentOrganisationUnitId, Integer level )
{
Collection<OrganisationUnit> units = getOrganisationUnits( parentOrganisationUnitId, level );
-
+
+ return getDataElementMapValues( dataElementId, periodId, units );
+ }
+
+ public Collection<AggregatedMapValue> getDataElementMapValues( int dataElementId, int periodId, Collection<OrganisationUnit> units )
+ {
Collection<AggregatedMapValue> values = aggregatedDataValueService.getAggregatedDataMapValues( dataElementId,
periodId, ConversionUtils.getIdentifiers( OrganisationUnit.class, units ) );
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonWithValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonWithValuesAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonWithValuesAction.java 2011-12-05 13:32:32 +0000
@@ -0,0 +1,182 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * 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 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 HISP project 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.aggregation.AggregatedMapValue;
+import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.filter.OrganisationUnitWithCoordinatesFilter;
+import org.hisp.dhis.system.filter.OrganisationUnitWithValidPointCoordinateFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ * @version $Id$
+ */
+public class GetGeoJsonWithValuesAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer indicatorId;
+
+ public void setIndicatorId( Integer indicatorId )
+ {
+ this.indicatorId = indicatorId;
+ }
+
+ private Integer dataElementId;
+
+ public void setDataElementId( Integer dataElementId )
+ {
+ this.dataElementId = dataElementId;
+ }
+
+ private Integer periodId;
+
+ public void setPeriodId( Integer periodId )
+ {
+ this.periodId = periodId;
+ }
+
+ private Integer parentId;
+
+ public void setParentId( Integer id )
+ {
+ this.parentId = id;
+ }
+
+ private Integer level;
+
+ public void setLevel( Integer level )
+ {
+ this.level = level;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<OrganisationUnit> object;
+
+ public Collection<OrganisationUnit> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ OrganisationUnit parent = organisationUnitService.getOrganisationUnit( parentId );
+
+ level = level == null ? organisationUnitService.getLevelOfOrganisationUnit( parent ) : level;
+
+ Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( level,
+ parent );
+
+ FilterUtils.filter( organisationUnits, new OrganisationUnitWithCoordinatesFilter() );
+
+ FilterUtils.filter( organisationUnits, new OrganisationUnitWithValidPointCoordinateFilter() );
+
+ object = new ArrayList<OrganisationUnit>();
+
+ for ( OrganisationUnit unit : organisationUnits )
+ {
+ if ( !unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
+ {
+ object.add( unit );
+ }
+ }
+
+ for ( OrganisationUnit unit : organisationUnits )
+ {
+ if ( unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
+ {
+ object.add( unit );
+ }
+ }
+
+ Collection<AggregatedMapValue> values = new ArrayList<AggregatedMapValue>();
+
+ if ( indicatorId != null )
+ {
+ values = mappingService.getIndicatorMapValues( indicatorId, periodId, object );
+ }
+
+ else if ( dataElementId != null )
+ {
+ values = mappingService.getDataElementMapValues( dataElementId, periodId, object );
+ }
+
+ if ( values != null )
+ {
+ for ( OrganisationUnit unit : object )
+ {
+ for ( AggregatedMapValue value : values )
+ {
+ if ( unit.getId() == value.getOrganisationUnitId() )
+ {
+ unit.setValue( value.getValue() );
+ }
+ }
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-12-01 15:43:25 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetIndicatorMapValuesAction.java 2011-12-05 13:32:32 +0000
@@ -103,7 +103,7 @@
throws Exception
{
object = mappingService.getIndicatorMapValues( id, periodId, parentId, level );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-02 13:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-05 13:32:32 +0000
@@ -311,6 +311,15 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+ <bean id="org.hisp.dhis.mapping.action.GetGeoJsonWithValuesAction"
+ class="org.hisp.dhis.mapping.action.GetGeoJsonWithValuesAction"
+ scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="mappingService"
+ ref="org.hisp.dhis.mapping.MappingService" />
+ </bean>
+
<bean id="org.hisp.dhis.mapping.action.GetGeoJsonFacilitiesAction"
class="org.hisp.dhis.mapping.action.GetGeoJsonFacilitiesAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-12-02 13:24:16 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-12-05 13:32:32 +0000
@@ -337,6 +337,11 @@
<result name="success" type="velocity-json">/dhis-web-mapping/geojson.vm</result>
</action>
+ <action name="getGeoJsonWithValues"
+ class="org.hisp.dhis.mapping.action.GetGeoJsonWithValuesAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/geojsonmin.vm</result>
+ </action>
+
<action name="getGeoJsonFacilities"
class="org.hisp.dhis.mapping.action.GetGeoJsonFacilitiesAction">
<result name="success" type="velocity-json">/dhis-web-mapping/geojsonFacilities.vm</result>
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonmin.vm 2011-12-05 16:06:25 +0000
@@ -0,0 +1,1 @@
+#set($size=$object.size())[#foreach($unit in $object){"t":#if(${unit.featureType}=="Point")"2"#else"1"#end,"c":$!encoder.jsonEncode($!{unit.validCoordinates}),"i":"$!{unit.id}","n":"$!encoder.jsonEncode(${unit.name})","v":"$!{unit.value}"#if($!{unit.featureType}!="Point"),"h":$!{unit.hasChildrenWithCoordinates()}#end}#if($velocityCount<$size),#end#end]
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-12-01 15:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-12-05 16:06:25 +0000
@@ -570,6 +570,43 @@
return str;
},
+ getOrganisationUnitIdStringFromFeatures: function(features) {
+ var str = '';
+ for (var i = 0; i < features.length; i++) {
+ str += features[i].attributes.id;
+ str += i < (features.length - 1) ? ',' : '';
+ }
+ return str;
+ },
+
+ geoJsonDecode: function(doc) {
+ doc = Ext.util.JSON.decode(doc);
+ var geojson = {};
+ geojson.type = 'FeatureCollection';
+ geojson.crs = {
+ type: 'EPSG',
+ properties: {
+ code: '4326'
+ }
+ };
+ geojson.features = [];
+ for (var i = 0; i < doc.length; i++) {
+ geojson.features.push({
+ geometry: {
+ type: doc[i].t == 1 ? 'MultiPolygon' : 'Point',
+ coordinates: doc[i].c
+ },
+ properties: {
+ id: doc[i].i,
+ name: doc[i].n,
+ value: doc[i].v,
+ hcwc: doc[i].h
+ }
+ });
+ }
+ return geojson;
+ },
+
mapView: {
layer: function(id) {
var w = new Ext.Window({
@@ -736,7 +773,7 @@
};
G.cls = {
- vectorLayerButton: function(iconCls, tooltip, widget) {
+ vectorLayerButton: function(iconCls, tooltip, widget) {
return new Ext.Button({
iconCls: iconCls,
tooltip: tooltip,
=== 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-10-10 14:37:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2011-12-05 16:53:11 +0000
@@ -89,6 +89,11 @@
if (!doc || !doc.documentElement) {
doc = request.responseText;
}
+
+ if (doc.length && G.vars.activeWidget != symbol) {
+ doc = G.util.geoJsonDecode(doc);
+ }
+
var format = this.format || new OpenLayers.Format.GeoJSON();
this.layer.removeFeatures(this.layer.features);
this.layer.addFeatures(format.read(doc));
=== 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-12-02 13:26:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-12-05 13:49:31 +0000
@@ -1648,20 +1648,22 @@
},
loadGeoJson: function() {
- G.vars.mask.msg = G.i18n.loading_geojson;
+ G.vars.mask.msg = G.i18n.loading;
G.vars.mask.show();
G.vars.activeWidget = this;
- this.updateValues = true;
+ this.updateValues = false;
- this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' +
- 'parentId=' + this.organisationUnitSelection.parent.id +
- '&level=' + this.organisationUnitSelection.level.level
- );
+ var url = G.conf.path_mapping + 'getGeoJsonWithValues.action?' +
+ 'periodId=' + this.cmp.period.getValue() +
+ '&parentId=' + this.organisationUnitSelection.parent.id +
+ '&level=' + this.organisationUnitSelection.level.level;
+ url += this.valueType.isIndicator() ? '&indicatorId=' + this.cmp.indicator.getValue() : '&dataElementId=' + this.cmp.dataElement.getValue();
+ this.setUrl(url);
},
classify: function(exception, lockPosition) {
if (this.formValidation.validateForm.apply(this, [exception])) {
- G.vars.mask.msg = G.i18n.aggregating_map_values;
+ G.vars.mask.msg = G.i18n.loading;
G.vars.mask.show();
G.vars.lockPosition = lockPosition;
@@ -1708,15 +1710,11 @@
for (var i = 0; i < mapvalues.length; i++) {
if (this.layer.features[j].attributes.id == mapvalues[i].oi) {
this.layer.features[j].attributes.value = parseFloat(mapvalues[i].v);
- this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')';
- this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30);
break;
}
}
if (!this.layer.features[j].attributes.value) {
this.layer.features[j].attributes.value = 0;
- this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (0)';
- this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30);
}
}
@@ -1730,8 +1728,14 @@
}
}
},
-
+
applyValues: function() {
+ for (var i = 0, f; i < this.layer.features.length; i++) {
+ f = this.layer.features[i];
+ f.attributes.labelString = f.attributes.name + ' (' + f.attributes.value + ')';
+ f.attributes.fixedName = G.util.cutString(f.attributes.name, 30);
+ }
+
this.button.menu.find('name','history')[0].addItem(this);
var options = {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-12-02 13:26:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-12-05 16:06:25 +0000
@@ -1648,20 +1648,22 @@
},
loadGeoJson: function() {
- G.vars.mask.msg = G.i18n.loading_geojson;
+ G.vars.mask.msg = G.i18n.loading;
G.vars.mask.show();
G.vars.activeWidget = this;
- this.updateValues = true;
+ this.updateValues = false;
- this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' +
- 'parentId=' + this.organisationUnitSelection.parent.id +
- '&level=' + this.organisationUnitSelection.level.level
- );
+ var url = G.conf.path_mapping + 'getGeoJsonWithValues.action?' +
+ 'periodId=' + this.cmp.period.getValue() +
+ '&parentId=' + this.organisationUnitSelection.parent.id +
+ '&level=' + this.organisationUnitSelection.level.level;
+ url += this.valueType.isIndicator() ? '&indicatorId=' + this.cmp.indicator.getValue() : '&dataElementId=' + this.cmp.dataElement.getValue();
+ this.setUrl(url);
},
classify: function(exception, lockPosition) {
if (this.formValidation.validateForm.apply(this, [exception])) {
- G.vars.mask.msg = G.i18n.aggregating_map_values;
+ G.vars.mask.msg = G.i18n.loading;
G.vars.mask.show();
G.vars.lockPosition = lockPosition;
@@ -1708,15 +1710,11 @@
for (var i = 0; i < mapvalues.length; i++) {
if (this.layer.features[j].attributes.id == mapvalues[i].oi) {
this.layer.features[j].attributes.value = parseFloat(mapvalues[i].v);
- this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (' + this.layer.features[j].attributes.value + ')';
- this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30);
break;
}
}
if (!this.layer.features[j].attributes.value) {
this.layer.features[j].attributes.value = 0;
- this.layer.features[j].attributes.labelString = this.layer.features[j].attributes.name + ' (0)';
- this.layer.features[j].attributes.fixedName = G.util.cutString(this.layer.features[j].attributes.name, 30);
}
}
@@ -1732,6 +1730,12 @@
},
applyValues: function() {
+ for (var i = 0, f; i < this.layer.features.length; i++) {
+ f = this.layer.features[i];
+ f.attributes.labelString = f.attributes.name + ' (' + f.attributes.value + ')';
+ f.attributes.fixedName = G.util.cutString(f.attributes.name, 30);
+ }
+
this.button.menu.find('name','history')[0].addItem(this);
var options = {