dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00861
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 261: Type property added to Map object (polygon/point). Legend bugs fixed. Legendsets now work properly.
------------------------------------------------------------
revno: 261
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-04-28 16:23:39 +0200
message:
Type property added to Map object (polygon/point). Legend bugs fixed. Legendsets now work properly.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Map.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
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/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapAction.java
gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMap.vm
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Map.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Map.java 2009-04-23 11:51:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/Map.java 2009-04-28 14:23:39 +0000
@@ -44,6 +44,8 @@
private String mapLayerPath;
+ private String type;
+
private OrganisationUnit organisationUnit;
private OrganisationUnitLevel organisationUnitLevel;
@@ -64,11 +66,12 @@
{
}
- public Map( String name, String mapLayerPath, OrganisationUnit organisationUnit, OrganisationUnitLevel organisationUnitLevel,
+ public Map( String name, String mapLayerPath, String type, OrganisationUnit organisationUnit, OrganisationUnitLevel organisationUnitLevel,
String uniqueColumn, String nameColumn, String longitude, String latitude, int zoom, Set<String> staticMapLayerPaths )
{
this.name = name;
this.mapLayerPath = mapLayerPath;
+ this.type = type;
this.organisationUnit = organisationUnit;
this.organisationUnitLevel = organisationUnitLevel;
this.uniqueColumn = uniqueColumn;
@@ -146,6 +149,16 @@
this.mapLayerPath = mapLayerPath;
}
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
public OrganisationUnit getOrganisationUnit()
{
return organisationUnit;
=== 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 2009-04-24 10:20:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-04-28 14:23:39 +0000
@@ -57,6 +57,7 @@
*
* @param name, Map description.
* @param mapLayerPath, the link to Geoserver.
+ * @param type, "polygon" or "point"
* @param organisationUnitId, the id of the organisation unit.
* @param organisationUnitLevelId, the level of the organisation units into
* which the map is devided.
@@ -69,7 +70,7 @@
* @param zoom
* @return a generated unique id of the added Map.
*/
- int addMap( String name, String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
+ int addMap( String name, String mapLayerPath, String type, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
String nameColumn, String longitude, String latitude, int zoom );
/**
@@ -78,6 +79,7 @@
*
* @param name, Map description.
* @param mapLayerPath, the link to Geoserver.
+ * @param type, "polygon" or "point"
* @param organisationUnitId, the id of the organisation unit.
* @param organisationUnitLevelId, the level of the organisation units into
* which the map is devided.
@@ -89,7 +91,7 @@
* @param latitude
* @param zoom
*/
- void addOrUpdateMap( String name, String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
+ void addOrUpdateMap( String name, String mapLayerPath, String type, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
String nameColumn, String longitude, String latitude, int zoom );
/**
=== 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 2009-04-24 10:20:52 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-04-28 14:23:39 +0000
@@ -82,7 +82,7 @@
return mappingStore.addMap( map );
}
- public int addMap( String name, String mapLayerPath, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
+ public int addMap( String name, String mapLayerPath, String type, int organisationUnitId, int organisationUnitLevelId, String uniqueColumn,
String nameColumn, String longitude, String latitude, int zoom )
{
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
@@ -92,13 +92,13 @@
Set<String> staticMapLayerPaths = null;
- Map map = new Map( name, mapLayerPath, organisationUnit, organisationUnitLevel, uniqueColumn, nameColumn, longitude,
+ Map map = new Map( name, mapLayerPath, type, organisationUnit, organisationUnitLevel, uniqueColumn, nameColumn, longitude,
latitude, zoom, staticMapLayerPaths );
return addMap( map );
}
- public void addOrUpdateMap( String name, String mapLayerPath, int organisationUnitId, int organisationUnitLevelId,
+ public void addOrUpdateMap( String name, String mapLayerPath, String type, int organisationUnitId, int organisationUnitLevelId,
String uniqueColumn, String nameColumn, String longitude, String latitude, int zoom )
{
Map map = getMapByMapLayerPath( mapLayerPath );
@@ -121,7 +121,7 @@
OrganisationUnitLevel organisationUnitLevel = organisationUnitService
.getOrganisationUnitLevel( organisationUnitLevelId );
- map = new Map( name, mapLayerPath, organisationUnit, organisationUnitLevel, uniqueColumn, nameColumn, longitude,
+ map = new Map( name, mapLayerPath, type, organisationUnit, organisationUnitLevel, uniqueColumn, nameColumn, longitude,
latitude, zoom, null );
addMap( map );
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml 2009-04-23 12:08:22 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/Map.hbm.xml 2009-04-28 14:23:39 +0000
@@ -14,6 +14,8 @@
<property name="name" column="name" unique="true"/>
<property name="mapLayerPath" column="maplayerpath"/>
+
+ <property name="type" column="type"/>
<many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit"
column="organisationunitid" not-null="true" foreign-key="fk_map_organisationunitid"/>
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapAction.java 2009-04-23 13:08:41 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapAction.java 2009-04-28 14:23:39 +0000
@@ -66,6 +66,13 @@
{
this.mapLayerPath = mapLayerPath;
}
+
+ private String type;
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
private int organisationUnitId;
@@ -123,7 +130,7 @@
public String execute()
throws Exception
{
- mappingService.addOrUpdateMap( name, mapLayerPath, organisationUnitId,
+ mappingService.addOrUpdateMap( name, mapLayerPath, type, organisationUnitId,
organisationUnitLevelId, uniqueColumn, nameColumn, longitude, latitude, zoom );
return SUCCESS;
=== modified file 'gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js 2009-04-24 12:01:53 +0000
+++ gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js 2009-04-28 14:23:39 +0000
@@ -21,7 +21,8 @@
{layers: 'satellite', format: 'image/png'});
var vmap0 = new OpenLayers.Layer.WMS("OpenLayers WMS",
- "pageload_geojson.txt");
+ "../../../geoserver/wms?",
+ {layers: 'who:WorldCountries2006'});
var choroplethLayer = new OpenLayers.Layer.Vector(choroplethLayerName, {
'visibility': false,
@@ -178,6 +179,22 @@
width: combo_width
});
+ var typeComboBox = new Ext.form.ComboBox({
+ id: 'type_cb',
+ editable: false,
+ displayField: 'name',
+ valueField: 'name',
+ width: combo_width,
+ minListWidth: combo_width + 26,
+ triggerAction: 'all',
+ mode: 'local',
+ value: 'Polygon',
+ store: new Ext.data.SimpleStore({
+ fields: ['name'],
+ data: [['Polygon'], ['Point']]
+ })
+ });
+
var newUniqueColumnTextField = new Ext.form.TextField({
id: 'newuniquecolumn_tf',
emptyText: 'Required',
@@ -270,6 +287,7 @@
var ouli = Ext.getCmp('organisationunitlevel_cb').getValue();
var nn = Ext.getCmp('newname_tf').getValue();
var mlp = Ext.getCmp('maplayerpath_tf').getValue();
+ var t = Ext.getCmp('type_cb').getValue();
var uc = Ext.getCmp('newuniquecolumn_tf').getValue();
var nc = Ext.getCmp('newnamecolumn_tf').getValue();
var lon = Ext.getCmp('newlongitude_tf').getValue();
@@ -286,7 +304,7 @@
{
url: path + 'addOrUpdateMap' + type,
method: 'GET',
- params: { name: nn, mapLayerPath: mlp, organisationUnitId: oui, organisationUnitLevelId: ouli, uniqueColumn: uc, nameColumn: nc,
+ params: { name: nn, mapLayerPath: mlp, type: t, organisationUnitId: oui, organisationUnitLevelId: ouli, uniqueColumn: uc, nameColumn: nc,
longitude: lon, latitude: lat, zoom: zoom},
success: function( responseObject )
@@ -467,7 +485,7 @@
success: function( responseObject )
{
- var map = Ext.util.JSON.decode( responseObject.responseText ).map;
+ var map = Ext.util.JSON.decode( responseObject.responseText ).map[0];
Ext.getCmp('editname_tf').setValue(map.name);
Ext.getCmp('edituniquecolumn_tf').setValue(map.uniqueColumn);
@@ -511,6 +529,7 @@
id: 'newmap_p',
items:
[
+ { html: '<p style="padding-bottom:4px">Map type:</p>' }, typeComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px">Organisation unit level:</p>' }, newMapComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px">Organisation unit:</p>' }, organisationUnitComboBox, { html: '<br>' },
{ html: '<p style="padding-bottom:4px">Divided into level:</p>' }, organisationUnitLevelComboBox, { html: '<br>' },
@@ -904,21 +923,7 @@
]
});
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
// create choropleth widget
choropleth = new mapfish.widgets.geostat.Choropleth({
@@ -1141,8 +1146,8 @@
be = '</b>';
lf = '<br>';
pe = '</p>';
-
- var html = style + feature.attributes[mapData.map.nameColumn] + pe;
+
+ var html = style + feature.attributes[mapData.nameColumn] + pe;
html += style + bs + 'Value:' + be + space + feature.attributes['value'] + pe;
popup_feature.html = html;
@@ -1168,9 +1173,9 @@
var organisationUnitId = selected.data['organisationUnitId'];
var organisationUnit = selected.data['organisationUnit'];
- var uniqueColumn = mapData.map.uniqueColumn;
- var nameColumn = mapData.map.nameColumn;
- var mlp = mapData.map.mapLayerPath;
+ var uniqueColumn = mapData.uniqueColumn;
+ var nameColumn = mapData.nameColumn;
+ var mlp = mapData.mapLayerPath;
var featureId = feature.attributes[uniqueColumn];
var name = feature.attributes[nameColumn];
@@ -1269,9 +1274,9 @@
success: function( responseObject )
{
- mapData = Ext.util.JSON.decode(responseObject.responseText);
+ mapData = Ext.util.JSON.decode(responseObject.responseText).map[0];
- map.setCenter(new OpenLayers.LonLat(mapData.map.longitude, mapData.map.latitude), mapData.map.zoom);
+ map.setCenter(new OpenLayers.LonLat(mapData.longitude, mapData.latitude), mapData.zoom);
if (redirect == 'choropleth') {
getChoroplethData(); }
@@ -1291,7 +1296,7 @@
{
var indicatorId = Ext.getCmp('indicator_cb').getValue();
var periodId = Ext.getCmp('period_cb').getValue();
- var level = mapData.map.organisationUnitLevel;
+ var level = mapData.organisationUnitLevel;
Ext.Ajax.request(
{
@@ -1338,7 +1343,7 @@
function getAssignOrganisationUnitData()
{
- var mlp = mapData.map.mapLayerPath;
+ var mlp = mapData.mapLayerPath;
Ext.Ajax.request(
{
@@ -1364,10 +1369,10 @@
var mapvalues = Ext.util.JSON.decode(responseText).mapvalues;
- var mlp = mapData.map.mapLayerPath;
- var uniqueColumn = mapData.map.uniqueColumn;
+ var mlp = mapData.mapLayerPath;
+ var uniqueColumn = mapData.uniqueColumn;
- Ext.Ajax.request(
+ Ext.Ajax.request(
{
url: path + 'getAvailableMapOrganisationUnitRelations' + type,
method: 'GET',
@@ -1441,7 +1446,7 @@
var relations = Ext.util.JSON.decode(responseText).mapOrganisationUnitRelations;
- var uniqueColumn = mapData.map.uniqueColumn;
+ var uniqueColumn = mapData.uniqueColumn;
for (var i=0; i < features.length; i++)
{
=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMap.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMap.vm 2009-04-23 13:08:41 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMap.vm 2009-04-28 14:23:39 +0000
@@ -1,5 +1,5 @@
{ "map":
- {
+ [{
"id": $!{object.id},
"name": "$!encoder.jsEncode( ${object.name} )",
"mapLayerPath": "$!encoder.jsEncode( ${object.mapLayerPath} )",
@@ -10,5 +10,5 @@
"longitude": "$!encoder.jsEncode( ${object.longitude} )",
"latitude": "$!encoder.jsEncode( ${object.latitude} )",
"zoom": $!{object.zoom}
- }
+ }]
}
\ No newline at end of file
=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm 2009-04-22 20:29:09 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLegendSet.vm 2009-04-28 14:23:39 +0000
@@ -1,8 +1,8 @@
{ "mapLegendSet":
- {
+ [{
"id": $!{object.id},
"name": "$!encoder.jsEncode( ${object.name} )",
"colorLow": "$!encoder.jsEncode( ${object.colorLow} )",
"colorHigh": "$!encoder.jsEncode( ${object.colorHigh} )"
- }
+ }]
}
\ No newline at end of file
=== 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-04-24 12:01:53 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-04-28 14:23:39 +0000
@@ -172,7 +172,7 @@
url: path + 'getPeriodsByPeriodType' + type,
root: 'periods',
fields: ['id', 'name'],
- autoLoad: true
+ autoLoad: false
});
mapStore = new Ext.data.JsonStore({
@@ -194,10 +194,10 @@
legendStore = new Ext.data.JsonStore({
url: path + 'getMapLegendSet' + type,
- baseParams: { indicatorId: 52487 },
+ baseParams: { format: 'json' },
root: 'mapLegendSet',
fields: ['id', 'name'],
- autoLoad: true
+ autoLoad: false
});
this.items = [
@@ -250,14 +250,12 @@
'select': {
fn: function()
{
-/*
- var legend_cb = Ext.getCmp('legend_cb');
+ var legend_cb = Ext.getCmp('maplegend_cb');
var iId = Ext.getCmp('indicator_cb').getValue();
-// legend_cb.reset();
+ legend_cb.reset();
legend_cb.getStore().baseParams = { indicatorId: iId, format: 'json' };
legend_cb.getStore().reload();
-*/
}
}
}
@@ -357,7 +355,7 @@
{
xtype: 'combo',
- id: 'legend_cb',
+ id: 'maplegend_cb',
fieldLabel: 'Legend set',
typeAhead: true,
editable: false,
@@ -374,7 +372,6 @@
'select': {
fn: function()
{
-/*
var iId = Ext.getCmp('indicator_cb').getValue();
Ext.Ajax.request(
@@ -397,7 +394,6 @@
alert( 'Status', 'Error while retrieving data' );
}
});
-*/
},
scope: this
}
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js 2009-04-24 12:01:53 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js 2009-04-28 14:23:39 +0000
@@ -153,6 +153,7 @@
url: path + 'getAvailableMapOrganisationUnitRelations' + type,
root: 'mapOrganisationUnitRelations',
fields: ['id', 'organisationUnit', 'organisationUnitId', 'featureId'],
+ sortInfo: { field: 'organisationUnit', direction: 'ASC' },
autoLoad: false
});
=== 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-04-17 23:00:32 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/ProportionalSymbol.js 2009-04-28 14:23:39 +0000
@@ -140,7 +140,7 @@
mode: 'local',
emptyText: 'Select indicator',
selectOnFocus: true,
-// triggerAction: 'all',
+ triggerAction: 'all',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data : this.indicators
--
Trunk
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.