dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01203
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 352: New method (fixed bounds) added. Set your own bounds, as many as you like.
------------------------------------------------------------
revno: 352
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-06-02 19:10:54 +0200
message:
New method (fixed bounds) added. Set your own bounds, as many as you like.
modified:
gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/core/GeoStat.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js 2009-05-29 15:39:03 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js 2009-06-02 17:10:54 +0000
@@ -4,6 +4,41 @@
Ext.onReady(function()
{
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+
+ Ext.override(Ext.layout.FormLayout, {
+ renderItem : function(c, position, target){
+ if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){
+ var args = [
+ c.id, c.fieldLabel,
+ c.labelStyle||this.labelStyle||'',
+ this.elementStyle||'',
+ typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,
+ (c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),
+ c.clearCls || 'x-form-clear-left'
+ ];
+ if(typeof position == 'number'){
+ position = target.dom.childNodes[position] || null;
+ }
+ if(position){
+ c.formItem = this.fieldTpl.insertBefore(position, args, true);
+ }else{
+ c.formItem = this.fieldTpl.append(target, args, true);
+ }
+ c.actionMode = 'formItem';
+ c.render('x-form-el-'+c.id);
+ c.container = c.formItem;
+ c.actionMode = 'container';
+ }else {
+ Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
+ }
+ }
+ });
+
+ Ext.override(Ext.form.TriggerField, {
+ actionMode: 'wrap',
+ onShow: Ext.form.TriggerField.superclass.onShow,
+ onHide: Ext.form.TriggerField.superclass.onHide
+ });
myMap: null;
@@ -21,6 +56,7 @@
MAPVIEWACTIVE = false;
URLACTIVE = false;
PARAMETER = null;
+ BOUNDS = 0;
function getUrlParam(strParamName)
{
@@ -59,8 +95,8 @@
{layers: 'satellite', format: 'image/png'});
var vmap0 = new OpenLayers.Layer.WMS("OpenLayers WMS",
- "../../../geoserver/wms?",
- {layers: 'who:WorldCountries2006'});
+ "http://labs.metacarta.com/wms/vmap0",
+ {layers: 'basic'});
var choroplethLayer = new OpenLayers.Layer.Vector(choroplethLayerName, {
'visibility': false,
@@ -92,7 +128,7 @@
})
});
- map.addLayers([jpl_wms, vmap0, choroplethLayer]);
+ map.addLayers([vmap0, jpl_wms, choroplethLayer]);
var selectFeatureChoropleth = new OpenLayers.Control.newSelectFeature(
choroplethLayer,
@@ -1389,8 +1425,8 @@
layer: propSymbolLayer,
title: 'Proportional symbol',
nameAttribute: "ouname",
- indicators: [['value', 'Value']],
- url: 'geojson/sl_clincs',
+ indicators: [['value', 'Indicator']],
+ url: 'geojson/sl_facilities',
featureSelection: false,
loadMask : {msg: 'Loading Data...', msgCls: 'x-mask-loading'},
defaults: {width: 130},
@@ -1409,7 +1445,6 @@
}
});
*/
-
viewport = new Ext.Viewport({
layout: 'border',
items:
@@ -1838,8 +1873,16 @@
}
}
-// proportionalsymbol.coreComp.applyClassification();
-// proportionalsymbol.classificationApplied = true;
+ var minSize = Ext.getCmp('minSize').getValue();
+ var maxSize = Ext.getCmp('maxSize').getValue();
+ proportionalsymbol.coreComp.updateOptions({
+ 'indicator': this.indicator,
+ 'minSize': minSize,
+ 'maxSize': maxSize
+ });
+
+ proportionalsymbol.coreComp.applyClassification();
+ proportionalsymbol.classificationApplied = true;
},
failure: function()
{
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/core/GeoStat.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/core/GeoStat.js 2009-05-19 13:57:43 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/core/GeoStat.js 2009-06-02 17:10:54 +0000
@@ -193,7 +193,6 @@
*/
onSuccess: function(request) {
-// alert("onSuccess i GeoStat.js");
var doc = request.responseXML;
if (!doc || !doc.documentElement) {
doc = request.responseText;
@@ -363,7 +362,7 @@
* nBins - {Integer} Total number of bins
*/
defaultLabelGenerator: function(bin, binIndex, nbBins) {
- return bin.lowerBound.toFixed(1) + ' - ' + bin.upperBound.toFixed(1) + ' ( ' + bin.nbVal + ' )'
+ return bin.lowerBound.toFixed(1) + ' - ' + bin.upperBound.toFixed(1) + ' ( ' + bin.nbVal + ' )';
},
classifyWithBounds: function(bounds) {
@@ -453,8 +452,42 @@
*/
classify: function(method, nbBins, bounds) {
-// bounds = [this.minVal,100,this.maxVal];
-
+ if (method == 0)
+ {
+ var str = Ext.getCmp('bounds').getValue();
+
+ for (var i = 0; i < str.length; i++){
+ str = str.replace(' ','');
+ }
+
+ if (str.charAt(str.length-1) == ','){
+ str = str.substring(0, str.length-1);
+ }
+
+ bounds = new Array();
+ bounds = str.split(',');
+
+ for (var i = 0; i < bounds.length; i++)
+ {
+ bounds[i] = parseInt(bounds[i]);
+
+ if (bounds[i] < this.minVal || bounds[i] > this.maxVal)
+ {
+ Ext.Msg.show({
+ title:'Bounds',
+ msg: '<p style="padding-top:8px">Bounds should be within ' + this.minVal + ' - ' + this.maxVal + '</p>',
+ buttons: Ext.Msg.OK,
+ animEl: 'elId',
+ width: 250,
+ icon: Ext.MessageBox.WARNING
+ });
+ }
+ }
+
+ bounds.unshift(this.minVal);
+ bounds.push(this.maxVal);
+ }
+
var classification = null;
if (!nbBins) {
nbBins = this.sturgesRule();
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-06-02 12:13:35 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-06-02 17:10:54 +0000
@@ -277,17 +277,6 @@
autoLoad: false
});
- function getPeriodTypeIdByName(name)
- {
- if (name == 'Daily') { return 6 }
- else if (name == 'Weekly') { return 7 }
- else if (name == 'Monthly') { return 8 }
- else if (name == 'Quarterly') { return 9 }
- else if (name == 'SixMonthly') { return 10 }
- else if (name == 'Yearly') { return 11 }
- else { return 12 }
- }
-
this.items = [
{
@@ -544,19 +533,40 @@
width: combo_width,
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
- data: [[2, 'Distributed values'], [1, 'Equal intervals']]
+ data: [[2, 'Distributed values'], [1, 'Equal intervals'], [0, 'Fixed bounds']]
}),
listeners: {
'select': {
fn: function()
{
- this.classify(false);
+ if (Ext.getCmp('method').getValue() == 0)
+ {
+ Ext.getCmp('bounds').show();
+ Ext.getCmp('numClasses').hide();
+ }
+ else
+ {
+ Ext.getCmp('bounds').hide();
+ Ext.getCmp('numClasses').show();
+
+ this.classify(false);
+ }
},
scope: this
}
}
},
-
+
+ {
+ xtype: 'textfield',
+ id: 'bounds',
+ fieldLabel: 'Bounds',
+ emptyText: 'Comma separated values',
+ isFormField: true,
+ width: combo_width,
+ hidden: true
+ },
+
{
xtype: 'combo',
fieldLabel: 'Classes',
@@ -664,7 +674,7 @@
isFormField: true,
fieldLabel: '',
labelStyle: 'color:#dfe8f6;',
- text: 'Refresh colors',
+ text: 'Refresh',
handler: function()
{
this.layer.setVisibility(true);
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js 2009-05-19 13:24:46 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js 2009-06-02 17:10:54 +0000
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (C) 2007-2008 Camptocamp
*
* This file is part of MapFish Client
@@ -224,26 +224,15 @@
return;
}
- this.indicator = this.form.findField('indicator').getValue();
- this.indicatorText = this.form.findField('indicator').getRawValue();
+ this.indicator = 'value';
+ this.indicatorText = 'Indicator';
if (!this.indicator) {
Ext.MessageBox.alert('Error', 'You must choose an indicator');
return;
}
- var minSize = this.form.findField('minSize').getValue();
- var maxSize = this.form.findField('maxSize').getValue();
- this.coreComp.updateOptions({
- 'indicator': this.indicator,
- 'minSize': minSize,
- 'maxSize': maxSize
- });
-
loadMapData('point');
-
- this.coreComp.applyClassification();
- this.classificationApplied = true;
},
/**
--
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.