dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12193
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3694: (GIS) Polygon and point layer now = Thematic layer 1 and 2. Both offer adjustable radius for points.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3694 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-05-20 18:07:09 +0200
message:
(GIS) Polygon and point layer now = Thematic layer 1 and 2. Both offer adjustable radius for points.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.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/MapView.hbm.xml
dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java
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/index.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.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/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2011-01-26 00:07:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2011-05-20 15:23:50 +0000
@@ -49,8 +49,6 @@
private User user;
- private String featureType;
-
private String mapValueType;
private IndicatorGroup indicatorGroup;
@@ -103,7 +101,7 @@
{
}
- public MapView( String name, User user, String featureType, String mapValueType, IndicatorGroup indicatorGroup,
+ public MapView( String name, User user, String mapValueType, IndicatorGroup indicatorGroup,
Indicator indicator, DataElementGroup dataElementGroup, DataElement dataElement, String mapDateType,
PeriodType periodType, Period period, String startDate, String endDate,
OrganisationUnit parentOrganisationUnit, OrganisationUnitLevel organisationUnitLevel, String mapLegendType,
@@ -112,7 +110,6 @@
{
this.name = name;
this.user = user;
- this.featureType = featureType;
this.mapValueType = mapValueType;
this.indicatorGroup = indicatorGroup;
this.indicator = indicator;
@@ -215,16 +212,6 @@
this.user = user;
}
- public String getFeatureType()
- {
- return featureType;
- }
-
- public void setFeatureType( String featureType )
- {
- this.featureType = featureType;
- }
-
public String getMapValueType()
{
return mapValueType;
=== 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-03-08 14:55:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2011-05-20 15:23:50 +0000
@@ -127,7 +127,7 @@
int addMapView( MapView mapView );
- void addMapView( String name, boolean system, String featureType, String mapValueType, Integer indicatorGroupId,
+ void addMapView( String name, boolean system, String mapValueType, Integer indicatorGroupId,
Integer indicatorId, Integer dataElementGroupId, Integer dataElementId, String periodTypeName,
Integer periodId, String startDate, String endDate, Integer parentOrganisationUnitId,
Integer organisationUnitLevel, String mapLegendType, Integer method, Integer classes, String bounds,
=== 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-01-26 11:42:12 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2011-05-20 15:23:50 +0000
@@ -468,7 +468,7 @@
return mappingStore.addMapView( mapView );
}
- public void addMapView( String name, boolean system, String featureType, String mapValueType, Integer indicatorGroupId,
+ public void addMapView( String name, boolean system, String mapValueType, Integer indicatorGroupId,
Integer indicatorId, Integer dataElementGroupId, Integer dataElementId, String periodTypeName,
Integer periodId, String startDate, String endDate, Integer parentOrganisationUnitId,
Integer organisationUnitLevel, String mapLegendType, Integer method, Integer classes, String bounds,
@@ -509,7 +509,7 @@
MapLegendSet mapLegendSet = mapLegendSetId != null ? getMapLegendSet( mapLegendSetId ) : null;
- addMapView( new MapView( name, user, featureType, mapValueType, indicatorGroup, indicator, dataElementGroup,
+ addMapView( new MapView( name, user, mapValueType, indicatorGroup, indicator, dataElementGroup,
dataElement, mapDateType, periodType, period, startDate, endDate, parent, level, mapLegendType, method,
classes, bounds, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ) );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2011-04-12 13:38:03 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2011-05-20 15:23:50 +0000
@@ -14,8 +14,6 @@
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_mapview_userid" />
- <property name="featureType" />
-
<property name="mapValueType" />
<many-to-one name="indicatorGroup" class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid"
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-01-27 18:30:34 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2011-05-20 15:38:01 +0000
@@ -257,16 +257,16 @@
List<MapLegendSet> predefinedTypes = new ArrayList<MapLegendSet>( mappingService
.getMapLegendSetsByType( MappingService.MAPLEGENDSET_TYPE_PREDEFINED ) );
-
- assertTrue( autoTypes.contains( mappingService.getMapLegendSet( idA ) ) );
- assertTrue( !autoTypes.contains( mappingService.getMapLegendSet( idB ) ) );
- assertTrue( !autoTypes.contains( mappingService.getMapLegendSet( idC ) ) );
- assertTrue( predefinedTypes.contains( mappingService.getMapLegendSet( idB ) ) );
- assertTrue( predefinedTypes.contains( mappingService.getMapLegendSet( idC ) ) );
- assertTrue( !predefinedTypes.contains( mappingService.getMapLegendSet( idA ) ) );
+
+ assertTrue( autoTypes.contains( mappingService.getMapLegendSet( idA ) ) );
+ assertTrue( !autoTypes.contains( mappingService.getMapLegendSet( idB ) ) );
+ assertTrue( !autoTypes.contains( mappingService.getMapLegendSet( idC ) ) );
+ assertTrue( predefinedTypes.contains( mappingService.getMapLegendSet( idB ) ) );
+ assertTrue( predefinedTypes.contains( mappingService.getMapLegendSet( idC ) ) );
+ assertTrue( !predefinedTypes.contains( mappingService.getMapLegendSet( idA ) ) );
}
-
+
@Test
public void testGetMapLegendSetByIndicatorOrDataElement()
{
@@ -276,18 +276,19 @@
int idB = mappingService.addMapLegendSet( legendSet1 );
int idC = mappingService.addMapLegendSet( legendSet2 );
- assertEquals("1", mapLegendSet, mappingService.getMapLegendSetByIndicator( indicator.getId() ) );
-
+ assertEquals( "1", mapLegendSet, mappingService.getMapLegendSetByIndicator( indicator.getId() ) );
+
legendSet1 = mappingService.getMapLegendSet( idB );
legendSet2 = mappingService.getMapLegendSet( idC );
-
+
legendSet1.getDataElements().add( dataElement );
legendSet2.getDataElements().add( dataElement );
-
+
mappingService.updateMapLegendSet( legendSet1 );
mappingService.updateMapLegendSet( legendSet2 );
-
- assertEquals("2", mappingService.getMapLegendSet( idB ), mappingService.getMapLegendSetByDataElement( dataElement.getId() ) );
+
+ assertEquals( "2", mappingService.getMapLegendSet( idB ), mappingService
+ .getMapLegendSetByDataElement( dataElement.getId() ) );
}
@@ -299,34 +300,34 @@
MapLegendSet legendSet3 = createMapLegendSet( 'D', indicator );
Collection<MapLegendSet> mapLegendSets = new HashSet<MapLegendSet>();
-
+
mapLegendSets.add( mapLegendSet );
mapLegendSets.add( legendSet1 );
mapLegendSets.add( legendSet2 );
mapLegendSets.add( legendSet3 );
-
+
mappingService.addMapLegendSet( legendSet1 );
mappingService.addMapLegendSet( legendSet2 );
mappingService.addMapLegendSet( legendSet3 );
-
+
assertTrue( mappingService.getAllMapLegendSets().containsAll( mapLegendSets ) );
}
-
+
@Test
public void testIndicatorHasMapLegendSet()
{
MapLegendSet legendSet1 = createMapLegendSet( 'B', indicator );
MapLegendSet legendSet2 = createMapLegendSet( 'C', indicator );
MapLegendSet legendSet3 = createMapLegendSet( 'D', indicator );
-
+
mappingService.addMapLegendSet( legendSet1 );
mappingService.addMapLegendSet( legendSet2 );
mappingService.addMapLegendSet( legendSet3 );
-
+
assertTrue( mappingService.indicatorHasMapLegendSet( indicator.getId() ) );
}
-
+
// -------------------------------------------------------------------------
// MapView tests
// -------------------------------------------------------------------------
@@ -334,10 +335,10 @@
@Test
public void testAddGetMapView()
{
- MapView mapView = new MapView( "MapViewA", null, OrganisationUnit.FEATURETYPE_MULTIPOLYGON,
- MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", organisationUnit, organisationUnitLevel,
- MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 );
+ MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "",
+ organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
+ mapLegendSet, 5, 20, "1", "1", 1 );
int idA = mappingService.addMapView( mapView );
@@ -351,10 +352,10 @@
@Test
public void testGetDeleteMapViewByName()
{
- MapView mapView = new MapView( "MapViewA", null, OrganisationUnit.FEATURETYPE_MULTIPOLYGON,
- MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", organisationUnit, organisationUnitLevel,
- MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 );
+ MapView mapView = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "",
+ organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
+ mapLegendSet, 5, 20, "1", "1", 1 );
int id = mappingService.addMapView( mapView );
@@ -368,16 +369,15 @@
@Test
public void testGetAllMapViews()
{
- MapView mapView1 = new MapView( "MapViewA", null, OrganisationUnit.FEATURETYPE_MULTIPOLYGON,
- MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", organisationUnit, organisationUnitLevel,
- MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 );
+ MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "",
+ organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
+ mapLegendSet, 5, 20, "1", "1", 1 );
- MapView mapView2 = new MapView( "MapViewB", null, OrganisationUnit.FEATURETYPE_POLYGON,
- MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", "", organisationUnit,
- organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20,
- "2", "2", 1 );
+ MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "",
+ "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A",
+ "B", mapLegendSet, 5, 20, "2", "2", 1 );
mappingService.addMapView( mapView1 );
mappingService.addMapView( mapView2 );
@@ -388,22 +388,20 @@
@Test
public void testGetMapViewsByFeatureType()
{
- MapView mapView1 = new MapView( "MapViewA", null, OrganisationUnit.FEATURETYPE_MULTIPOLYGON,
- MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "", organisationUnit, organisationUnitLevel,
- MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 );
-
- MapView mapView2 = new MapView( "MapViewB", null, OrganisationUnit.FEATURETYPE_POLYGON,
- MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", "", organisationUnit,
- organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20,
- "2", "2", 1 );
-
- MapView mapView3 = new MapView( "MapViewC", null, OrganisationUnit.FEATURETYPE_MULTIPOLYGON,
- MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup, indicator, dataElementGroup, dataElement,
- MappingService.MAP_DATE_TYPE_START_END, periodType, period, "", "", organisationUnit,
- organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B", mapLegendSet, 5, 20,
- "3", "3", 1 );
+ MapView mapView1 = new MapView( "MapViewA", null, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "",
+ organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
+ mapLegendSet, 5, 20, "1", "1", 1 );
+
+ MapView mapView2 = new MapView( "MapViewB", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "",
+ "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A",
+ "B", mapLegendSet, 5, 20, "2", "2", 1 );
+
+ MapView mapView3 = new MapView( "MapViewC", null, MappingService.MAP_VALUE_TYPE_DATAELEMENT, indicatorGroup,
+ indicator, dataElementGroup, dataElement, MappingService.MAP_DATE_TYPE_START_END, periodType, period, "",
+ "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A",
+ "B", mapLegendSet, 5, 20, "3", "3", 1 );
mappingService.addMapView( mapView1 );
mappingService.addMapView( mapView2 );
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2011-01-26 00:07:38 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2011-05-20 15:38:01 +0000
@@ -116,10 +116,10 @@
@Test
public void testAddGetMapView()
{
- MapView mapView = new MapView( "MapViewA", new User(), OrganisationUnit.FEATURETYPE_MULTIPOLYGON, MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator,
- new DataElementGroup(), new DataElement(), MappingService.MAP_DATE_TYPE_FIXED, periodType, period, "", "",
- organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1, "", "A", "B",
- mapLegendSet, 5, 20, "1", "1", 1 );
+ MapView mapView = new MapView( "MapViewA", new User(), MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup,
+ indicator, new DataElementGroup(), new DataElement(), MappingService.MAP_DATE_TYPE_FIXED, periodType,
+ period, "", "", organisationUnit, organisationUnitLevel, MappingService.MAPLEGENDSET_TYPE_AUTOMATIC, 1, 1,
+ "", "A", "B", mapLegendSet, 5, 20, "1", "1", 1 );
int idA = mappingStore.addMapView( mapView );
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java 2011-01-26 11:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapViewAction.java 2011-05-20 15:23:50 +0000
@@ -67,13 +67,6 @@
this.system = system;
}
- private String featureType;
-
- public void setFeatureType( String featureType )
- {
- this.featureType = featureType;
- }
-
private String mapValueType;
public void setMapValueType( String mapValueType )
@@ -242,7 +235,7 @@
public String execute()
throws Exception
{
- mappingService.addMapView( name, system, featureType, mapValueType, indicatorGroupId, indicatorId,
+ mappingService.addMapView( name, system, mapValueType, indicatorGroupId, indicatorId,
dataElementGroupId, dataElementId, periodTypeId, periodId, startDate, endDate, parentOrganisationUnitId,
organisationUnitLevel, mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSetId,
radiusLow, radiusHigh, longitude, latitude, zoom );
=== 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-05-19 13:25:14 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-05-20 15:46:34 +0000
@@ -5,6 +5,11 @@
path_mapping: '../',
path_commons: '../../dhis-web-commons-ajax-json/',
type: '.action',
+
+// Layer names
+
+ thematic_layer_1: 'Thematic layer 1',
+ thematic_layer_2: 'Thematic layer 2',
// Help strings
@@ -87,6 +92,10 @@
defaultLayerZIndex: 10000,
+ defaultLowRadius: 5,
+
+ defaultHighRadius: 20,
+
// Measure
sketchSymbolizers: {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-05-20 11:27:09 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-05-20 15:46:34 +0000
@@ -29,48 +29,14 @@
var mapViewStore = new Ext.data.JsonStore({
url: G.conf.path_mapping + 'getAllMapViews' + G.conf.type,
root: 'mapViews',
- fields: [ 'id', 'name', 'userId', 'featureType', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId',
- 'mapDateType', 'periodTypeId', 'periodId', 'startDate', 'endDate', 'parentOrganisationUnitId', 'parentOrganisationUnitName',
- 'parentOrganisationUnitLevel', 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes',
- 'bounds', 'colorLow', 'colorHigh', 'mapLegendSetId', 'radiusLow', 'radiusHigh', 'longitude', 'latitude', 'zoom'
- ],
- autoLoad: false,
- isLoaded: false,
- sortInfo: {field: 'userId', direction: 'ASC'},
- listeners: {
- 'load': G.func.storeLoadListener
- }
- });
-
- var polygonMapViewStore = new Ext.data.JsonStore({
- url: G.conf.path_mapping + 'getMapViewsByFeatureType' + G.conf.type,
- baseParams: {featureType: G.conf.map_feature_type_multipolygon},
- root: 'mapViews',
- fields: [ 'id', 'name', 'userId', 'featureType', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId',
- 'mapDateType', 'periodTypeId', 'periodId', 'startDate', 'endDate', 'parentOrganisationUnitId', 'parentOrganisationUnitName',
- 'parentOrganisationUnitLevel', 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes',
- 'bounds', 'colorLow', 'colorHigh', 'mapLegendSetId', 'longitude', 'latitude', 'zoom'
- ],
- sortInfo: {field: 'userId', direction: 'ASC'},
- autoLoad: false,
- isLoaded: false,
- listeners: {
- 'load': G.func.storeLoadListener
- }
- });
-
- var pointMapViewStore = new Ext.data.JsonStore({
- url: G.conf.path_mapping + 'getMapViewsByFeatureType' + G.conf.type,
- baseParams: {featureType: G.conf.map_feature_type_point},
- root: 'mapViews',
- fields: [ 'id', 'name', 'userId', 'featureType', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId',
- 'mapDateType', 'periodTypeId', 'periodId', 'startDate', 'endDate', 'parentOrganisationUnitId', 'parentOrganisationUnitName',
- 'parentOrganisationUnitLevel', 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes',
- 'bounds', 'colorLow', 'colorHigh', 'mapLegendSetId', 'radiusLow', 'radiusHigh', 'longitude', 'latitude', 'zoom'
- ],
- sortInfo: {field: 'userId', direction: 'ASC'},
- autoLoad: false,
- isLoaded: false,
+ fields: [ 'id', 'name', 'userId', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId',
+ 'mapDateType', 'periodTypeId', 'periodId', 'startDate', 'endDate', 'parentOrganisationUnitId', 'parentOrganisationUnitName',
+ 'parentOrganisationUnitLevel', 'organisationUnitLevel', 'organisationUnitLevelName', 'mapLegendType', 'method', 'classes',
+ 'bounds', 'colorLow', 'colorHigh', 'mapLegendSetId', 'radiusLow', 'radiusHigh', 'longitude', 'latitude', 'zoom'
+ ],
+ autoLoad: false,
+ isLoaded: false,
+ sortInfo: {field: 'userId', direction: 'ASC'},
listeners: {
'load': G.func.storeLoadListener
}
@@ -288,8 +254,6 @@
G.stores = {
mapView: mapViewStore,
- polygonMapView: polygonMapViewStore,
- pointMapView: pointMapViewStore,
indicatorGroup: indicatorGroupStore,
indicatorsByGroup: indicatorsByGroupStore,
indicator: indicatorStore,
@@ -309,7 +273,7 @@
};
/* Thematic layers */
- polygonLayer = new OpenLayers.Layer.Vector('Polygon layer', {
+ polygonLayer = new OpenLayers.Layer.Vector(G.conf.thematic_layer_1, {
'visibility': false,
'displayInLayerSwitcher': false,
'styleMap': new OpenLayers.StyleMap({
@@ -328,7 +292,7 @@
polygonLayer.layerType = G.conf.map_layer_type_thematic;
G.vars.map.addLayer(polygonLayer);
- pointLayer = new OpenLayers.Layer.Vector('Point layer', {
+ pointLayer = new OpenLayers.Layer.Vector(G.conf.thematic_layer_2, {
'visibility': false,
'displayInLayerSwitcher': false,
'styleMap': new OpenLayers.StyleMap({
@@ -490,13 +454,13 @@
text: G.i18n.register,
handler: function() {
var vn = Ext.getCmp('favoritename_tf').getValue();
- var params;
-
if (!vn) {
Ext.message.msg(false, G.i18n.form_is_not_complete);
return;
}
+ var params;
+
if (G.vars.activePanel.isPolygon()) {
if (!choropleth.formValidation.validateForm.apply(choropleth, [true])) {
return;
@@ -1991,11 +1955,11 @@
},
{
nodeType: 'gx_layer',
- layer: 'Polygon layer'
+ layer: G.conf.thematic_layer_1
},
{
nodeType: 'gx_layer',
- layer: 'Point layer'
+ layer: G.conf.thematic_layer_2
},
{
nodeType: 'gx_layer',
@@ -2365,7 +2329,7 @@
/* Section: widgets */
choropleth = new mapfish.widgets.geostat.Choropleth({
id: 'choropleth',
- title: '<span class="panel-title">' + G.i18n.polygon_layer + '</span>',
+ title: '<span class="panel-title">Thematic layer 1</span>',
map: G.vars.map,
layer: polygonLayer,
featureSelection: false,
@@ -2402,7 +2366,7 @@
id: 'point',
map: G.vars.map,
layer: pointLayer,
- title: '<span class="panel-title">' + G.i18n.point_layer + '</span>',
+ title: '<span class="panel-title">Thematic layer 2</span>',
featureSelection: false,
legendDiv: 'pointlegend',
defaults: {width: 130},
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2011-05-10 08:06:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Choropleth.js 2011-05-20 14:47:57 +0000
@@ -31,12 +31,22 @@
method: mapfish.GeoStat.Distribution.CLASSIFY_BY_QUANTILS,
numClasses: 5,
+
+ minSize: 3,
+
+ maxSize: 20,
+
+ minVal: null,
+
+ maxVal: null,
defaultSymbolizer: {'fillOpacity': 1},
classification: null,
colorInterpolation: null,
+
+ widget: null,
initialize: function(map, options) {
mapfish.GeoStat.prototype.initialize.apply(this, arguments);
@@ -49,65 +59,77 @@
this.setClassification();
}
},
-
+
createColorInterpolation: function() {
- var initialColors = this.colors;
var numColors = this.classification.bins.length;
- var mapLegendType = choropleth.form.findField('maplegendtype').getValue();
-
- if (mapLegendType == G.conf.map_legend_type_automatic) {
- this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
- for (var i = 0; i < choropleth.imageLegend.length && i < this.colorInterpolation.length; i++) {
- choropleth.imageLegend[i].color = this.colorInterpolation[i].toHexString();
- }
+ var mapLegendType = this.widget.form.findField('maplegendtype').getValue();
+
+ if (mapLegendType == G.conf.map_legend_type_automatic) {
+ this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors);
+ for (var i = 0; i < this.widget.imageLegend.length && i < this.colorInterpolation.length; i++) {
+ this.widget.imageLegend[i].color = this.colorInterpolation[i].toHexString();
+ }
}
else if (mapLegendType == G.conf.map_legend_type_predefined) {
- this.colorInterpolation = choropleth.colorInterpolation;
- for (var j = 0; j < choropleth.imageLegend.length && j < this.colorInterpolation.length; j++) {
- choropleth.imageLegend[j].color = this.colorInterpolation[j].toHexString();
- }
+ this.colorInterpolation = this.widget.colorInterpolation;
+ for (var j = 0; j < this.widget.imageLegend.length && j < this.colorInterpolation.length; j++) {
+ this.widget.imageLegend[j].color = this.colorInterpolation[j].toHexString();
+ }
}
},
-
+
setClassification: function() {
var values = [];
- var features = this.layer.features;
+ for (var i = 0; i < this.layer.features.length; i++) {
+ values.push(this.layer.features[i].attributes[this.indicator]);
+ }
- for (var i = 0; i < features.length; i++) {
- values.push(features[i].attributes[this.indicator]);
- }
-
var distOptions = {
'labelGenerator': this.options.labelGenerator
};
var dist = new mapfish.GeoStat.Distribution(values, distOptions);
+
+ this.minVal = dist.minVal;
+ this.maxVal = dist.maxVal;
+
this.classification = dist.classify(
this.method,
this.numClasses,
null
);
+
this.createColorInterpolation();
},
- applyClassification: function(options) {
+ applyClassification: function(options, widget) {
+ this.widget = widget;
this.updateOptions(options);
+
+ var calculateRadius = OpenLayers.Function.bind(
+ function(feature) {
+ var value = feature.attributes[this.indicator];
+ var size = (value - this.minVal) / (this.maxVal - this.minVal) *
+ (this.maxSize - this.minSize) + this.minSize;
+ return size || this.minSize;
+ }, this
+ );
+ this.extendStyle(null, {'pointRadius': '${calculateRadius}'}, {'calculateRadius': calculateRadius});
+
var boundsArray = this.classification.getBoundsArray();
- var rules = [];
-
+ var rules = new Array(boundsArray.length-1);
for (var i = 0; i < boundsArray.length-1; i++) {
- if (this.colorInterpolation.length > i) {
- var rule = new OpenLayers.Rule({
- symbolizer: {fillColor: this.colorInterpolation[i].toHexString()},
- filter: new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.BETWEEN,
- property: this.indicator,
- lowerBoundary: boundsArray[i],
- upperBoundary: boundsArray[i + 1]
- })
- });
- rules.push(rule);
- }
+ var rule = new OpenLayers.Rule({
+ symbolizer: {fillColor: this.colorInterpolation[i].toHexString()},
+ filter: new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.BETWEEN,
+ property: this.indicator,
+ lowerBoundary: boundsArray[i],
+ upperBoundary: boundsArray[i + 1]
+ })
+ });
+ rules[i] = rule;
}
+
this.extendStyle(rules);
mapfish.GeoStat.prototype.applyClassification.apply(this, arguments);
},
@@ -117,26 +139,23 @@
return;
}
- // TODO use css classes instead
this.legendDiv.update("");
for (var i = 0; i < this.classification.bins.length; i++) {
- if (this.colorInterpolation.length > i) {
- var element = document.createElement("div");
- element.style.backgroundColor = this.colorInterpolation[i].toHexString();
- element.style.width = "30px";
- element.style.height = "15px";
- element.style.cssFloat = "left";
- element.style.marginRight = "10px";
- this.legendDiv.appendChild(element);
-
- element = document.createElement("div");
- element.innerHTML = this.classification.bins[i].label;
- this.legendDiv.appendChild(element);
-
- element = document.createElement("div");
- element.style.clear = "left";
- this.legendDiv.appendChild(element);
- }
+ var element = document.createElement("div");
+ element.style.backgroundColor = this.colorInterpolation[i].toHexString();
+ element.style.width = "30px";
+ element.style.height = "15px";
+ element.style.cssFloat = "left";
+ element.style.marginRight = "10px";
+ this.legendDiv.appendChild(element);
+
+ element = document.createElement("div");
+ element.innerHTML = this.classification.bins[i].label;
+ this.legendDiv.appendChild(element);
+
+ element = document.createElement("div");
+ element.style.clear = "left";
+ this.legendDiv.appendChild(element);
}
},
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js 2011-04-11 10:29:58 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Point.js 2011-05-20 14:47:57 +0000
@@ -24,7 +24,7 @@
mapfish.GeoStat.Point = OpenLayers.Class(mapfish.GeoStat, {
colors: [
- new mapfish.ColorRgb(255, 255, 0),
+ new mapfish.ColorRgb(120, 120, 0),
new mapfish.ColorRgb(255, 0, 0)
],
@@ -45,6 +45,8 @@
classification: null,
colorInterpolation: null,
+
+ widget: null,
initialize: function(map, options) {
mapfish.GeoStat.prototype.initialize.apply(this, arguments);
@@ -59,20 +61,19 @@
},
createColorInterpolation: function() {
- var initialColors = this.colors;
var numColors = this.classification.bins.length;
- var mapLegendType = point.form.findField('maplegendtype').getValue();
+ var mapLegendType = this.widget.form.findField('maplegendtype').getValue();
if (mapLegendType == G.conf.map_legend_type_automatic) {
- this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(initialColors[0], initialColors[1], numColors);
- for (var i = 0; i < point.imageLegend.length && i < this.colorInterpolation.length; i++) {
- point.imageLegend[i].color = this.colorInterpolation[i].toHexString();
+ this.colorInterpolation = mapfish.ColorRgb.getColorsArrayByRgbInterpolation(this.colors[0], this.colors[1], numColors);
+ for (var i = 0; i < this.widget.imageLegend.length && i < this.colorInterpolation.length; i++) {
+ this.widget.imageLegend[i].color = this.colorInterpolation[i].toHexString();
}
}
else if (mapLegendType == G.conf.map_legend_type_predefined) {
- this.colorInterpolation = point.colorInterpolation;
- for (var j = 0; j < point.imageLegend.length && j < this.colorInterpolation.length; j++) {
- point.imageLegend[j].color = this.colorInterpolation[j].toHexString();
+ this.colorInterpolation = this.widget.colorInterpolation;
+ for (var j = 0; j < this.widget.imageLegend.length && j < this.colorInterpolation.length; j++) {
+ this.widget.imageLegend[j].color = this.colorInterpolation[j].toHexString();
}
}
},
@@ -80,11 +81,11 @@
setClassification: function() {
var values = [];
for (var i = 0; i < this.layer.features.length; i++) {
- values.push(this.layer.features[i].attributes.value);
+ values.push(this.layer.features[i].attributes[this.indicator]);
}
var distOptions = {
- 'labelGenerator' : this.options.labelGenerator
+ 'labelGenerator': this.options.labelGenerator
};
var dist = new mapfish.GeoStat.Distribution(values, distOptions);
@@ -100,7 +101,8 @@
this.createColorInterpolation();
},
- applyClassification: function(options) {
+ applyClassification: function(options, widget) {
+ this.widget = widget;
this.updateOptions(options);
var calculateRadius = OpenLayers.Function.bind(
=== 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-05-20 14:39:37 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-05-20 16:00:08 +0000
@@ -87,34 +87,32 @@
this.createSelectFeatures();
if (G.vars.parameter.id) {
- if (G.vars.parameter.mapView.featureType == G.conf.map_feature_type_multipolygon) {
- this.mapView = G.vars.parameter.mapView;
- this.updateValues = true;
- this.legend = {
- value: this.mapView.mapLegendType,
- method: this.mapView.method || this.legend.method,
- classes: this.mapView.classes || this.legend.classes
- };
-
- G.vars.parameter.id = false;
- G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
-
- function mapViewStoreCallback() {
- this.form.findField('mapview').setValue(this.mapView.id);
- this.valueType.value = this.mapView.mapValueType;
- this.form.findField('mapvaluetype').setValue(this.valueType.value);
- this.setMapView();
- }
-
- if (G.stores.polygonMapView.isLoaded) {
- mapViewStoreCallback.call(this);
- }
- else {
- G.stores.polygonMapView.load({scope: this, callback: function() {
- mapViewStoreCallback.call(this);
- }});
- }
- }
+ this.mapView = G.vars.parameter.mapView;
+ this.updateValues = true;
+ this.legend = {
+ value: this.mapView.mapLegendType,
+ method: this.mapView.method || this.legend.method,
+ classes: this.mapView.classes || this.legend.classes
+ };
+
+ G.vars.parameter.id = false;
+ G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
+
+ function mapViewStoreCallback() {
+ this.form.findField('mapview').setValue(this.mapView.id);
+ this.valueType.value = this.mapView.mapValueType;
+ this.form.findField('mapvaluetype').setValue(this.valueType.value);
+ this.setMapView();
+ }
+
+ if (G.stores.mapView.isLoaded) {
+ mapViewStoreCallback.call(this);
+ }
+ else {
+ G.stores.mapView.load({scope: this, callback: function() {
+ mapViewStoreCallback.call(this);
+ }});
+ }
}
mapfish.widgets.geostat.Choropleth.superclass.initComponent.apply(this);
@@ -238,12 +236,12 @@
emptyText: G.i18n.optional,
selectOnFocus: true,
width: G.conf.combo_width,
- store: G.stores.polygonMapView,
+ store: G.stores.mapView,
listeners: {
'select': {
scope: this,
fn: function(cb) {
- this.mapView = G.stores.polygonMapView.getAt(G.stores.polygonMapView.find('id', cb.getValue())).data;
+ this.mapView = G.stores.mapView.getAt(G.stores.mapView.find('id', cb.getValue())).data;
this.updateValues = true;
this.legend.value = this.mapView.mapLegendType;
@@ -798,12 +796,52 @@
}
}
}
+ },
+
+ { html: '<div class="thematic-br">' },
+
+ {
+ xtype: 'numberfield',
+ name: 'radiuslow',
+ fieldLabel: 'Low point size',
+ width: G.conf.combo_number_width_small,
+ allowDecimals: false,
+ allowNegative: false,
+ minValue: 1,
+ value: 5,
+ listeners: {
+ 'change': {
+ scope: this,
+ fn: function() {
+ this.classify(false, true);
+ }
+ }
+ }
+ },
+
+ {
+ xtype: 'numberfield',
+ name: 'radiushigh',
+ fieldLabel: 'High point size',
+ width: G.conf.combo_number_width_small,
+ allowDecimals: false,
+ allowNegative: false,
+ minValue: 1,
+ value: 20,
+ listeners: {
+ 'change': {
+ scope: this,
+ fn: function() {
+ this.classify(false, true);
+ }
+ }
+ }
}
];
},
- createSingletonCmp: {
+ createSingletonCmp: {
treeWindow: function() {
Ext.Ajax.request({
url: G.conf.path_commons + 'getOrganisationUnits' + G.conf.type,
@@ -885,6 +923,8 @@
forceSelection: true,
triggerAction: 'all',
selectOnFocus: true,
+ emptyText: G.conf.emptytext,
+ labelSeparator: G.conf.labelseparator,
fieldLabel: 'Level',
width: G.conf.combo_width_fieldset,
minListWidth: G.conf.combo_width_fieldset,
@@ -917,8 +957,8 @@
Ext.message.msg(false, 'Level is higher than boundary level');
return;
}
-
- if (Ext.getCmp('locatefeature_w')) {
+
+ if (Ext.getCmp('locatefeature_w')) {
Ext.getCmp('locatefeature_w').destroy();
}
@@ -1176,7 +1216,10 @@
this.form.findField('maplegendset').setValue(this.mapView.mapLegendSetId);
this.applyPredefinedLegend(true);
}
-
+
+ this.form.findField('radiuslow').setValue(this.mapView.radiusLow || G.conf.defaultLowRadius);
+ this.form.findField('radiushigh').setValue(this.mapView.radiusHigh || G.conf.defaultHighRadius);
+
if (this.legend.value == G.conf.map_legend_type_automatic) {
this.form.findField('method').setValue(this.mapView.method);
this.form.findField('startcolor').setValue(this.mapView.colorLow);
@@ -1315,6 +1358,13 @@
}
}
+ if (!this.form.findField('radiuslow').getValue() || !this.form.findField('radiushigh').getValue()) {
+ if (exception) {
+ Ext.message.msg(false, G.i18n.form_is_not_complete);
+ }
+ return false;
+ }
+
return true;
}
},
@@ -1322,7 +1372,6 @@
formValues: {
getAllValues: function() {
return {
- featureType: G.conf.map_feature_type_multipolygon,
mapValueType: this.form.findField('mapvaluetype').getValue(),
indicatorGroupId: this.valueType.isIndicator() ? this.form.findField('indicatorgroup').getValue() : null,
indicatorId: this.valueType.isIndicator() ? this.form.findField('indicator').getValue() : null,
@@ -1348,8 +1397,8 @@
colorLow: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null,
colorHigh: this.legend.value == G.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null,
mapLegendSetId: this.legend.value == G.conf.map_legend_type_predefined ? this.form.findField('maplegendset').getValue() : null,
- radiusLow: null,
- radiusHigh: null,
+ radiusLow: this.form.findField('radiuslow').getValue(),
+ radiusHigh: this.form.findField('radiushigh').getValue(),
longitude: G.vars.map.getCenter().lon,
latitude: G.vars.map.getCenter().lat,
zoom: parseFloat(G.vars.map.getZoom())
@@ -1398,6 +1447,12 @@
this.form.findField('classes').setValue(this.legend.classes);
this.form.findField('bounds').reset();
+ this.form.findField('startcolor').setValue('#FF0000');
+ this.form.findField('endcolor').setValue('#FFFF00');
+
+ this.form.findField('radiuslow').reset();
+ this.form.findField('radiushigh').reset();
+
document.getElementById(this.legendDiv).innerHTML = '';
this.layer.destroyFeatures();
@@ -1494,10 +1549,12 @@
indicator: 'value',
method: this.form.findField('method').getValue(),
numClasses: this.form.findField('classes').getValue(),
- colors: this.getColors()
+ colors: this.getColors(),
+ minSize: parseInt(this.form.findField('radiuslow').getValue()),
+ maxSize: parseInt(this.form.findField('radiushigh').getValue())
};
-
- this.coreComp.applyClassification(options);
+
+ this.coreComp.applyClassification(options, this);
this.classificationApplied = true;
G.vars.mask.hide();
@@ -1505,10 +1562,6 @@
onRender: function(ct, position) {
mapfish.widgets.geostat.Choropleth.superclass.onRender.apply(this, arguments);
- if (this.loadMask) {
- this.loadMask = new Ext.LoadMask(this.bwrap, this.loadMask);
- this.loadMask.show();
- }
var coreOptions = {
'layer': this.layer,
=== 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-05-19 08:48:09 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-05-20 15:38:01 +0000
@@ -85,36 +85,6 @@
this.createItems();
this.createSelectFeatures();
-
- if (G.vars.parameter.id) {
- if (G.vars.parameter.mapView.featureType == G.conf.map_feature_type_point) {
- this.mapView = G.vars.parameter.mapView;
- this.updateValues = true;
- this.legend = {
- value: this.mapView.mapLegendType,
- method: this.mapView.method || this.legend.method,
- classes: this.mapView.classes || this.legend.classes
- };
-
- G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom);
-
- function mapViewStoreCallback() {
- this.form.findField('mapview').setValue(this.mapView.id);
- this.valueType.value = this.mapView.mapValueType;
- this.form.findField('mapvaluetype').setValue(this.valueType.value);
- this.setMapView();
- }
-
- if (G.stores.pointMapView.isLoaded) {
- mapViewStoreCallback.call(this);
- }
- else {
- G.stores.pointMapView.load({scope: this, callback: function() {
- mapViewStoreCallback.call(this);
- }});
- }
- }
- }
mapfish.widgets.geostat.Point.superclass.initComponent.apply(this);
},
@@ -216,6 +186,12 @@
},
createItems: function() {
+
+ this.defaults = {
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ };
+
this.items = [
{
xtype: 'combo',
@@ -230,14 +206,13 @@
triggerAction: 'all',
emptyText: G.i18n.optional,
selectOnFocus: true,
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_width,
- store: G.stores.pointMapView,
+ store: G.stores.mapView,
listeners: {
'select': {
scope: this,
fn: function(cb) {
- this.mapView = G.stores.pointMapView.getAt(G.stores.pointMapView.find('id', cb.getValue())).data;
+ this.mapView = G.stores.mapView.getAt(G.stores.mapView.find('id', cb.getValue())).data;
this.updateValues = true;
this.legend.value = this.mapView.mapLegendType;
@@ -262,7 +237,6 @@
xtype: 'combo',
name: 'mapvaluetype',
fieldLabel: G.i18n.mapvaluetype,
- labelSeparator: G.conf.labelseparator,
editable: false,
valueField: 'id',
displayField: 'name',
@@ -300,8 +274,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.indicatorGroup,
@@ -328,8 +300,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.indicatorsByGroup,
@@ -393,8 +363,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.dataElementGroup,
@@ -421,8 +389,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.dataElementsByGroup,
@@ -485,8 +451,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.periodType,
@@ -513,8 +477,6 @@
mode: 'remote',
forceSelection: true,
triggerAction: 'all',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
selectOnFocus: true,
width: G.conf.combo_width,
store: G.stores.periodsByTypeStore,
@@ -541,8 +503,6 @@
fieldLabel: G.i18n.start_date,
format: 'Y-m-d',
hidden: true,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_width,
listeners: {
'select': {
@@ -563,8 +523,6 @@
fieldLabel: G.i18n.end_date,
format: 'Y-m-d',
hidden: true,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_width,
listeners: {
'select': {
@@ -585,8 +543,6 @@
xtype: 'textfield',
name: 'boundary',
fieldLabel: G.i18n.boundary,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_width,
style: 'cursor:pointer',
node: {attributes: {hasChildrenWithCoordinates: false}},
@@ -612,8 +568,6 @@
xtype: 'textfield',
name: 'level',
fieldLabel: G.i18n.level,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_width,
style: 'cursor:pointer',
levelComboBox: null,
@@ -642,8 +596,6 @@
displayField: 'text',
mode: 'local',
fieldLabel: G.i18n.legend_type,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
value: this.legend.value,
triggerAction: 'all',
width: G.conf.combo_width,
@@ -684,8 +636,6 @@
displayField: 'name',
mode: 'remote',
fieldLabel: G.i18n.legendset,
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
triggerAction: 'all',
width: G.conf.combo_width,
hidden: true,
@@ -709,8 +659,6 @@
valueField: 'value',
displayField: 'text',
mode: 'local',
- emptyText: G.conf.emptytext,
- labelSeparator: G.conf.labelseparator,
value: this.legend.method,
triggerAction: 'all',
width: G.conf.combo_width,
@@ -745,8 +693,6 @@
xtype: 'textfield',
name: 'bounds',
fieldLabel: G.i18n.bounds,
- labelSeparator: G.conf.labelseparator,
- emptyText: G.i18n.comma_separated_values,
width: G.conf.combo_width,
hidden: true,
listeners: {
@@ -763,7 +709,6 @@
xtype: 'combo',
name: 'classes',
fieldLabel: G.i18n.classes,
- labelSeparator: G.conf.labelseparator,
editable: false,
valueField: 'value',
displayField: 'value',
@@ -794,7 +739,6 @@
xtype: 'colorfield',
name: 'startcolor',
fieldLabel: G.i18n.low_color,
- labelSeparator: G.conf.labelseparator,
allowBlank: false,
width: G.conf.combo_width,
value: "#FF0000",
@@ -812,7 +756,6 @@
xtype: 'colorfield',
name: 'endcolor',
fieldLabel: G.i18n.high_color,
- labelSeparator: G.conf.labelseparator,
allowBlank: false,
width: G.conf.combo_width,
value: "#FFFF00",
@@ -832,7 +775,6 @@
xtype: 'numberfield',
name: 'radiuslow',
fieldLabel: 'Low point size',
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_number_width_small,
allowDecimals: false,
allowNegative: false,
@@ -852,7 +794,6 @@
xtype: 'numberfield',
name: 'radiushigh',
fieldLabel: 'High point size',
- labelSeparator: G.conf.labelseparator,
width: G.conf.combo_number_width_small,
allowDecimals: false,
allowNegative: false,
@@ -987,14 +928,14 @@
Ext.message.msg(false, 'Level is higher than boundary level');
return;
}
-
- if (Ext.getCmp('locatefeature_w')) {
+
+ if (Ext.getCmp('locatefeature_w')) {
Ext.getCmp('locatefeature_w').destroy();
}
this.form.findField('mapview').clearValue();
this.updateValues = true;
- this.organisationUnitSelection.setValues(node.attributes.id, node.attributes.text, node.attributes.level,
+ this.organisationUnitSelection.setValues(node.attributes.id, node.attributes.text, node.attributes.level,
this.form.findField('level').levelComboBox.getValue(), this.form.findField('level').levelComboBox.getRawValue());
this.form.findField('boundary').setValue(node.attributes.text);
@@ -1247,9 +1188,9 @@
this.applyPredefinedLegend(true);
}
- this.form.findField('radiuslow').setValue(this.mapView.radiusLow);
- this.form.findField('radiushigh').setValue(this.mapView.radiusHigh);
-
+ this.form.findField('radiuslow').setValue(this.mapView.radiusLow || G.conf.defaultLowRadius);
+ this.form.findField('radiushigh').setValue(this.mapView.radiusHigh || G.conf.defaultHighRadius);
+
if (this.legend.value == G.conf.map_legend_type_automatic) {
this.form.findField('method').setValue(this.mapView.method);
this.form.findField('startcolor').setValue(this.mapView.colorLow);
@@ -1402,7 +1343,6 @@
formValues: {
getAllValues: function() {
return {
- featureType: G.conf.map_feature_type_point,
mapValueType: this.form.findField('mapvaluetype').getValue(),
indicatorGroupId: this.valueType.isIndicator() ? this.form.findField('indicatorgroup').getValue() : null,
indicatorId: this.valueType.isIndicator() ? this.form.findField('indicator').getValue() : null,
@@ -1478,6 +1418,9 @@
this.form.findField('classes').setValue(this.legend.classes);
this.form.findField('bounds').reset();
+ this.form.findField('startcolor').setValue('#FF0000');
+ this.form.findField('endcolor').setValue('#FFFF00');
+
this.form.findField('radiuslow').reset();
this.form.findField('radiushigh').reset();
@@ -1494,8 +1437,7 @@
this.setUrl(G.conf.path_mapping + 'getGeoJson.action?' +
'parentId=' + this.organisationUnitSelection.parent.id +
- '&level=' + this.organisationUnitSelection.level.level +
- '&type=true'
+ '&level=' + this.organisationUnitSelection.level.level
);
},
@@ -1520,7 +1462,7 @@
}
if (this.updateValues) {
- var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues';
+ var dataUrl = this.valueType.isIndicator() ? 'getIndicatorMapValues' : 'getDataElementMapValues';
var params = {
id: this.valueType.isIndicator() ? this.form.findField('indicator').getValue() : this.form.findField('dataelement').getValue(),
periodId: G.system.mapDateType.isFixed() ? this.form.findField('period').getValue() : null,
@@ -1582,9 +1524,8 @@
minSize: parseInt(this.form.findField('radiuslow').getValue()),
maxSize: parseInt(this.form.findField('radiushigh').getValue())
};
-
- this.coreComp.updateOptions(options);
- this.coreComp.applyClassification();
+
+ this.coreComp.applyClassification(options, this);
this.classificationApplied = true;
G.vars.mask.hide();
@@ -1592,11 +1533,7 @@
onRender: function(ct, position) {
mapfish.widgets.geostat.Point.superclass.onRender.apply(this, arguments);
- if (this.loadMask) {
- this.loadMask = new Ext.LoadMask(this.bwrap, this.loadMask);
- this.loadMask.show();
- }
-
+
var coreOptions = {
'layer': this.layer,
'format': this.format,
@@ -1610,11 +1547,6 @@
};
this.coreComp = new mapfish.GeoStat.Point(this.map, coreOptions);
-
- if (G.vars.parameter.id) {
- G.util.expandWidget(this);
- G.vars.parameter = false;
- }
}
});