dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07394
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2102: (GIS) Implemented functionality for locating orgunits in the map.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2102 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-09-13 17:22:24 +0200
message:
(GIS) Implemented functionality for locating orgunits in the map.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css
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/widgets/geostat/Choropleth.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/resources/org/hisp/dhis/mapping/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2010-09-13 10:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2010-09-13 14:13:44 +0000
@@ -201,4 +201,8 @@
end_date = End date
fixed_periods = Fixed periods
start_end_dates = Start-end dates
-please_expand_layer_panel = Please expand the layer panel you want to print.
\ No newline at end of file
+please_expand_layer_panel = Please expand the layer panel you want to print.
+has_no_orgunits = has no organisation units.
+highlight_color = Highlight color
+feature_filter = Feature filter
+locate_features = Locate features
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-09-13 10:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-09-13 14:13:44 +0000
@@ -200,4 +200,8 @@
var i18n_end_date = '$encoder.jsEscape($i18n.getString( 'end_date' ) , "'")';
var i18n_fixed_periods = '$encoder.jsEscape($i18n.getString( 'fixed_periods' ) , "'")';
var i18n_start_end_dates = '$encoder.jsEscape($i18n.getString( 'start_end_dates' ) , "'")';
-var i18n_please_expand_layer_panel = '$encoder.jsEscape($i18n.getString( 'please_expand_layer_panel' ) , "'")';
\ No newline at end of file
+var i18n_please_expand_layer_panel = '$encoder.jsEscape($i18n.getString( 'please_expand_layer_panel' ) , "'")';
+var i18n_has_no_orgunits = '$encoder.jsEscape($i18n.getString( 'has_no_orgunits' ) , "'")';
+var i18n_highlight_color = '$encoder.jsEscape($i18n.getString( 'highlight_color' ) , "'")';
+var i18n_feature_filter = '$encoder.jsEscape($i18n.getString( 'feature_filter' ) , "'")';
+var i18n_locate_features = '$encoder.jsEscape($i18n.getString( 'locate_features' ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-08-30 13:58:52 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-09-13 14:13:44 +0000
@@ -194,6 +194,9 @@
font:normal 11px lucida sans unicode,arial;
color:#888;
}
+.window-field-nolabel {
+ padding:14px 0 0 0;
+}
.window-button {
padding:8px 0 0 0;
}
=== 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-13 10:16:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-09-13 15:19:48 +0000
@@ -3089,28 +3089,27 @@
Ext.getCmp('vectorlayeroptions_w').destroy();
}
- var data = [];
- var layer = MAP.getLayersByName(layer.name)[0];
-
+ var data = [];
for (var i = 0; i < layer.features.length; i++) {
- data.push([i, layer.features[i].data.name]);
+ data.push([layer.features[i].data.id || i, layer.features[i].data.name]);
}
var featureStore = new Ext.data.ArrayStore({
mode: 'local',
autoDestroy: true,
- idProperty: 'i',
- fields: ['i', 'name'],
- data: [data]
+ idProperty: 'id',
+ fields: ['id','name'],
+ sortInfo: {field: 'name', direction: 'ASC'},
+ data: data
});
var locateFeatureWindow = new Ext.Window({
id: 'locatefeature_w',
title: 'Locate features',
layout: 'fit',
- closeAction: 'hide',
defaults: {layout: 'fit', bodyStyle:'padding:8px; border:0px'},
- width: 200,
+ width: 250,
+ height: getMultiSelectHeight() + 145,
items: [
{
xtype: 'panel',
@@ -3118,37 +3117,78 @@
{
xtype: 'panel',
items: [
- { html: '<div class="window-field-label-first">Feature name</div>' },
+ { html: '<div class="window-field-label-first">' + i18n_highlight_color + '</div>' },
+ {
+ xtype: 'colorfield',
+ labelSeparator: labelseparator,
+ id: 'highlightcolor_cf',
+ allowBlank: false,
+ isFormField: true,
+ width: combo_width,
+ value: "#0000FF"
+ },
+ { html: '<div class="window-field-label">' + i18n_feature_filter + '</div>' },
{
xtype: 'textfield',
- id: 'locatefeature_tf'
+ id: 'locatefeature_tf',
+ enableKeyEvents: true,
+ listeners: {
+ 'keyup': {
+ fn: function() {
+ var p = Ext.getCmp('locatefeature_tf').getValue();
+ featureStore.filter('name', p, true, false);
+ }
+ }
+ }
},
- { html: '<div class="window-field-label"></div>' },
+ { html: '<div class="window-field-nolabel"></div>' },
{
xtype: 'grid',
id: 'featuregrid_gp',
- autoHeight: true,
+ height: getMultiSelectHeight(),
store: featureStore,
cm: new Ext.grid.ColumnModel({
- columns: [
- {
- id: 'name',
- header: 'Features',
- dataIndex: 'name',
- width: 200
- }
- ]
+ columns: [{id: 'name', header: 'Features', dataIndex: 'name', width: 250}]
}),
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
viewConfig: {forceFit: true},
sortable: true,
- // autoExpandColumn: 'name'
+ autoExpandColumn: 'name',
+ listeners: {
+ 'cellclick': {
+ fn: function(g, ri, ci) {
+ layer.redraw();
+
+ var id, feature;
+ id = g.getStore().getAt(ri).data.id;
+
+ for (var i = 0; i < layer.features.length; i++) {
+ if (layer.features[i].data.id == id) {
+ feature = layer.features[i];
+ break;
+ }
+ }
+
+ if (feature) {
+ var color = Ext.getCmp('highlightcolor_cf').getValue();
+ layer.drawFeature(feature,{'fillColor':color});
+ }
+ }
+ }
+ }
}
]
}
]
}
- ]
+ ],
+ listeners: {
+ 'close': {
+ fn: function() {
+ layer.redraw();
+ }
+ }
+ }
});
var vectorLayerOptionsWindow = new Ext.Window({
@@ -3226,20 +3266,24 @@
}
}
}
- }
- // ,
- // {
- // html: 'Locate feature',
- // listeners: {
- // 'click': {
- // fn: function() {
- // locateFeatureWindow.setPagePosition(Ext.getCmp('east').x - 173, Ext.getCmp('center').y + 50);
- // locateFeatureWindow.show();
- // vectorLayerOptionsWindow.hide();
- // }
- // }
- // }
- // }
+ },
+ {
+ html: 'Locate feature',
+ listeners: {
+ 'click': {
+ fn: function() {
+ if (layer.features.length > 0) {
+ locateFeatureWindow.setPagePosition(Ext.getCmp('east').x - 272, Ext.getCmp('center').y + 50);
+ locateFeatureWindow.show();
+ vectorLayerOptionsWindow.hide();
+ }
+ else {
+ Ext.message.msg(false, '<span class="x-msg-hl">' + layer.name + '</span>' + i18n_has_no_orgunits);
+ }
+ }
+ }
+ }
+ }
]
}
]
@@ -4073,6 +4117,8 @@
var y = east_panel.y + 41;
if (ACTIVEPANEL == thematicMap && MAPSOURCE == map_source_type_database) {
+ Ext.getCmp('locatefeature_w').destroy();
+
Ext.getCmp('map_tf').setValue(feature.data.name);
for (var i = 0; i < feature.layer.features.length; i++) {
=== 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-09 19:19:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-09-13 15:19:48 +0000
@@ -1663,7 +1663,10 @@
for (var j = 0; j < FEATURE[thematicMap].length; j++) {
var value = mv[mour[FEATURE[thematicMap][j].attributes[nameColumn]]];
+ var name = FEATURE[thematicMap][j].attributes[nameColumn];
FEATURE[thematicMap][j].attributes.value = value ? parseFloat(value) : '';
+ FEATURE[thematicMap][j].data.id = FEATURE[thematicMap][j].attributes[nameColumn];
+ FEATURE[thematicMap][j].data.name = FEATURE[thematicMap][j].attributes[nameColumn];
if (!FEATURE[thematicMap][j].attributes.labelString) {
FEATURE[thematicMap][j].attributes.labelString = FEATURE[thematicMap][j].attributes[nameColumn];
if (Ext.isNumber(FEATURE[thematicMap][j].attributes.value)) {
=== 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-09 19:19:51 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-09-13 15:19:48 +0000
@@ -1661,6 +1661,8 @@
for (var j = 0; j < FEATURE[thematicMap2].length; j++) {
var value = mv[mour[FEATURE[thematicMap2][j].attributes[nameColumn]]];
FEATURE[thematicMap2][j].attributes.value = value ? parseFloat(value) : '';
+ FEATURE[thematicMap2][j].data.id = FEATURE[thematicMap2][j].attributes[nameColumn];
+ FEATURE[thematicMap2][j].data.name = FEATURE[thematicMap2][j].attributes[nameColumn];
if (!FEATURE[thematicMap2][j].attributes.labelString) {
FEATURE[thematicMap2][j].attributes.labelString = FEATURE[thematicMap2][j].attributes[nameColumn];
if (Ext.isNumber(FEATURE[thematicMap2][j].attributes.value)) {