=== 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 2010-11-17 19:34:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2010-11-30 13:04:58 +0000 @@ -46,6 +46,8 @@ private String name; + private String featureType; + private String mapValueType; private IndicatorGroup indicatorGroup; @@ -84,6 +86,10 @@ private MapLegendSet mapLegendSet; + private Integer radiusLow; + + private Integer radiusHigh; + private String longitude; private String latitude; @@ -94,13 +100,15 @@ { } - public MapView( String name, 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, Integer method, Integer classes, String bounds, - String colorLow, String colorHigh, MapLegendSet mapLegendSet, String longitude, String latitude, int zoom ) + public MapView( String name, String featureType, 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, + Integer method, Integer classes, String bounds, String colorLow, String colorHigh, MapLegendSet mapLegendSet, + Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) { this.name = name; + this.featureType = featureType; this.mapValueType = mapValueType; this.indicatorGroup = indicatorGroup; this.indicator = indicator; @@ -120,6 +128,8 @@ this.colorLow = colorLow; this.colorHigh = colorHigh; this.mapLegendSet = mapLegendSet; + this.radiusLow = radiusLow; + this.radiusHigh = radiusHigh; this.longitude = longitude; this.latitude = latitude; this.zoom = zoom; @@ -191,6 +201,16 @@ this.name = name; } + public String getFeatureType() + { + return featureType; + } + + public void setFeatureType( String featureType ) + { + this.featureType = featureType; + } + public String getMapValueType() { return mapValueType; @@ -381,6 +401,26 @@ this.mapLegendSet = mapLegendSet; } + public Integer getRadiusLow() + { + return radiusLow; + } + + public void setRadiusLow( Integer radiusLow ) + { + this.radiusLow = radiusLow; + } + + public Integer getRadiusHigh() + { + return radiusHigh; + } + + public void setRadiusHigh( Integer radiusHigh ) + { + this.radiusHigh = radiusHigh; + } + public String getLongitude() { return longitude; === 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 2010-11-17 19:34:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2010-11-30 13:04:58 +0000 @@ -70,7 +70,8 @@ Collection getIndicatorMapValues( int indicatorId, Date startDate, Date endDate, int parentOrganisationUnitId ); - Collection getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, int level ); + Collection getIndicatorMapValues( int indicatorId, int periodId, int parentOrganisationUnitId, + int level ); Collection getIndicatorMapValues( int indicatorId, Date startDate, Date endDate, int parentOrganisationUnitId, int level ); @@ -150,10 +151,11 @@ void updateMapView( MapView mapView ); - void addOrUpdateMapView( String name, String mapValueType, Integer indicatorGroupId, Integer indicatorId, - Integer dataElementGroupId, Integer dataElementId, String periodTypeName, Integer periodId, String startDate, - String endDate, Integer parentOrganisationUnitId, Integer organisationUnitLevelId, String mapLegendType, - Integer method, Integer classes, String bounds, String colorLow, String colorHigh, Integer mapLegendSetId, + void addOrUpdateMapView( String name, String featureType, String mapValueType, Integer indicatorGroupId, + Integer indicatorId, Integer dataElementGroupId, Integer dataElementId, String periodTypeName, + Integer periodId, String startDate, String endDate, Integer parentOrganisationUnitId, + Integer organisationUnitLevelId, String mapLegendType, Integer method, Integer classes, String bounds, + String colorLow, String colorHigh, Integer mapLegendSetId, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ); void deleteMapView( MapView view ); @@ -164,6 +166,8 @@ Collection getAllMapViews(); + Collection getMapViewsByFeatureType( String featureType ); + // ------------------------------------------------------------------------- // MapLayer // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2010-11-15 16:26:51 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2010-11-29 15:44:01 +0000 @@ -87,6 +87,8 @@ Collection getAllMapViews(); + Collection getMapViewsByFeatureType( String featureType ); + // ------------------------------------------------------------------------- // MapLayer // ------------------------------------------------------------------------- === 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 2010-11-22 15:43:02 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2010-11-30 13:04:58 +0000 @@ -536,10 +536,11 @@ mappingStore.updateMapView( mapView ); } - public void addOrUpdateMapView( String name, 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, String colorLow, String colorHigh, Integer mapLegendSetId, + public void addOrUpdateMapView( String name, String featureType, 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, + String colorLow, String colorHigh, Integer mapLegendSetId, Integer radiusLow, Integer radiusHigh, String longitude, String latitude, int zoom ) { IndicatorGroup indicatorGroup = null; @@ -579,6 +580,7 @@ if ( mapView != null ) { mapView.setName( name ); + mapView.setFeatureType( featureType ); mapView.setMapValueType( mapValueType ); mapView.setIndicatorGroup( indicatorGroup ); mapView.setIndicator( indicator ); @@ -598,6 +600,8 @@ mapView.setColorLow( colorLow ); mapView.setColorHigh( colorHigh ); mapView.setMapLegendSet( mapLegendSet ); + mapView.setRadiusLow( radiusLow ); + mapView.setRadiusHigh( radiusHigh ); mapView.setLongitude( longitude ); mapView.setLatitude( latitude ); mapView.setZoom( zoom ); @@ -606,9 +610,9 @@ } else { - mapView = new MapView( name, mapValueType, indicatorGroup, indicator, dataElementGroup, dataElement, - mapDateType, periodType, period, startDate, endDate, parent, level, mapLegendType, method, classes, - bounds, colorLow, colorHigh, mapLegendSet, longitude, latitude, zoom ); + mapView = new MapView( name, featureType, mapValueType, indicatorGroup, indicator, dataElementGroup, + dataElement, mapDateType, periodType, period, startDate, endDate, parent, level, mapLegendType, method, + classes, bounds, colorLow, colorHigh, mapLegendSet, radiusLow, radiusHigh, longitude, latitude, zoom ); addMapView( mapView ); } @@ -622,7 +626,7 @@ public MapView getMapView( int id ) { MapView mapView = mappingStore.getMapView( id ); - + mapView.getParentOrganisationUnit().setLevel( organisationUnitService.getLevelOfOrganisationUnit( mapView.getParentOrganisationUnit() ) ); @@ -643,7 +647,20 @@ mapView.getParentOrganisationUnit().setLevel( organisationUnitService.getLevelOfOrganisationUnit( mapView.getParentOrganisationUnit() ) ); } - + + return mapViews; + } + + public Collection getMapViewsByFeatureType( String featureType ) + { + Collection mapViews = mappingStore.getMapViewsByFeatureType( featureType ); + + for ( MapView mapView : mapViews ) + { + mapView.getParentOrganisationUnit().setLevel( + organisationUnitService.getLevelOfOrganisationUnit( mapView.getParentOrganisationUnit() ) ); + } + return mapViews; } === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java' --- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2010-11-15 16:26:51 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2010-11-29 15:44:01 +0000 @@ -240,6 +240,18 @@ return criteria.list(); } + @SuppressWarnings( "unchecked" ) + public Collection getMapViewsByFeatureType( String featureType ) + { + Session session = sessionFactory.getCurrentSession(); + + Criteria criteria = session.createCriteria( MapView.class ); + + criteria.add( Restrictions.eq( "featureType", featureType ) ); + + return criteria.list(); + } + // ------------------------------------------------------------------------- // MapLayer // ------------------------------------------------------------------------- === 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 2010-11-15 16:26:51 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2010-11-30 13:04:58 +0000 @@ -13,6 +13,8 @@ + + + + + + === 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 2010-11-15 17:00:33 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2010-11-30 13:04:58 +0000 @@ -123,10 +123,11 @@ @Test public void testAddGetMapView() { - MapView mapView = new MapView( "MapViewA", 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, "1", "1", 1 ); + MapView mapView = new MapView( "MapViewA", 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 ); int idA = mappingService.addMapView( mapView ); === 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 2010-11-15 17:00:33 +0000 +++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingStoreTest.java 2010-11-30 13:04:58 +0000 @@ -115,10 +115,10 @@ @Test public void testAddGetMapView() { - MapView mapView = new MapView( "MapViewA", MappingService.MAP_VALUE_TYPE_INDICATOR, indicatorGroup, indicator, + MapView mapView = new MapView( "MapViewA", 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, "1", "1", 1 ); + 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/AddOrUpdateMapViewAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2010-11-17 19:34:18 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2010-11-30 13:04:58 +0000 @@ -60,6 +60,13 @@ this.name = name; } + private String featureType; + + public void setFeatureType( String featureType ) + { + this.featureType = featureType; + } + private String mapValueType; public void setMapValueType( String mapValueType ) @@ -186,6 +193,20 @@ this.mapLegendSetId = mapLegendSetId; } + private Integer radiusLow; + + public void setRadiusLow( Integer radiusLow ) + { + this.radiusLow = radiusLow; + } + + private Integer radiusHigh; + + public void setRadiusHigh( Integer radiusHigh ) + { + this.radiusHigh = radiusHigh; + } + private String longitude; public void setLongitude( String longitude ) @@ -214,9 +235,10 @@ public String execute() throws Exception { - mappingService.addOrUpdateMapView( name, mapValueType, indicatorGroupId, indicatorId, dataElementGroupId, - dataElementId, periodTypeId, periodId, startDate, endDate, parentOrganisationUnitId, organisationUnitLevel, - mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSetId, longitude, latitude, zoom ); + mappingService.addOrUpdateMapView( name, featureType, mapValueType, indicatorGroupId, indicatorId, + dataElementGroupId, dataElementId, periodTypeId, periodId, startDate, endDate, parentOrganisationUnitId, + organisationUnitLevel, mapLegendType, method, classes, bounds, colorLow, colorHigh, mapLegendSetId, + radiusLow, radiusHigh, longitude, latitude, zoom ); return SUCCESS; } === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewsByFeatureTypeAction.java 2010-11-29 16:36:25 +0000 @@ -0,0 +1,92 @@ +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.Collections; +import java.util.List; + +import org.hisp.dhis.mapping.MapView; +import org.hisp.dhis.mapping.MappingService; +import org.hisp.dhis.mapping.comparator.MapViewNameComparator; + +import com.opensymphony.xwork2.Action; + +/** + * @author Jan Henrik Overland + * @version $Id$ + */ +public class GetMapViewsByFeatureTypeAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private MappingService mappingService; + + public void setMappingService( MappingService mappingService ) + { + this.mappingService = mappingService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private String featureType; + + public void setFeatureType( String featureType ) + { + this.featureType = featureType; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List object; + + public List getObject() + { + return object; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + object = new ArrayList( mappingService.getMapViewsByFeatureType( featureType ) ); + + Collections.sort( object, new MapViewNameComparator() ); + + 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 2010-11-19 12:18:38 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2010-11-29 15:44:01 +0000 @@ -189,6 +189,11 @@ + + + + === 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 2010-11-25 11:40:11 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2010-11-29 15:44:01 +0000 @@ -216,6 +216,12 @@ /dhis-web-mapping/jsonminMapViews.vm + + /dhis-web-mapping/jsonMapViews.vm + + + /dhis-web-mapping/void.vm === 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-11-27 17:46:54 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-11-29 15:44:01 +0000 @@ -33,7 +33,6 @@ var i18n_thematic_map = '$encoder.jsEscape($i18n.getString( 'thematic_map' ) , "'")'; var i18n_polygon_layer = '$encoder.jsEscape($i18n.getString( 'polygon_layer' ) , "'")'; var i18n_point_layer = '$encoder.jsEscape($i18n.getString( 'point_layer' ) , "'")'; -var i18n_favorite = '$encoder.jsEscape($i18n.getString( 'favorite' ) , "'")'; var i18n_indicator_group = '$encoder.jsEscape($i18n.getString( 'indicator_group' ) , "'")'; var i18n_indicator = '$encoder.jsEscape($i18n.getString( 'indicator' ) , "'")'; var i18n_period_type = '$encoder.jsEscape($i18n.getString( 'period_type' ) , "'")'; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2010-11-26 17:56:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm 2010-11-30 13:04:58 +0000 @@ -2,6 +2,7 @@ "mapView": { "id": "$!{mapView.id}", "name": "$!encoder.jsonEncode( ${mapView.name} )", + "featureType": "$!encoder.jsonEncode( ${mapView.featureType} )", "mapValueType": "$!encoder.jsonEncode( ${mapView.mapValueType} )", "indicatorGroupId": "$!{mapView.indicatorGroup.id}", "indicatorId": "$!{mapView.indicator.id}", @@ -24,6 +25,8 @@ "colorLow": "$!encoder.jsonEncode( ${mapView.colorLow} )", "colorHigh": "$!encoder.jsonEncode( ${mapView.colorHigh} )", "mapLegendSetId": "$!{mapView.mapLegendSet.id}", + "radiusLow": "$!{mapView.radiusLow}", + "radiusHigh": "$!{mapView.radiusHigh}", "longitude": "$!encoder.jsonEncode( ${mapView.longitude} )", "latitude": "$!encoder.jsonEncode( ${mapView.latitude} )", "zoom": "$!{mapView.zoom}" === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2010-11-25 15:08:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm 2010-11-29 15:44:01 +0000 @@ -2,6 +2,7 @@ [{ "id": "$!{object.id}", "name": "$!encoder.jsonEncode( ${object.name} )", + "featureType": "$!encoder.jsonEncode( ${object.featureType} )", "mapValueType": "$!encoder.jsonEncode( ${object.mapValueType} )", "indicatorGroupId": "$!{object.indicatorGroup.id}", "indicatorId": "$!{object.indicator.id}", @@ -24,6 +25,8 @@ "colorLow": "$!encoder.jsonEncode( ${object.colorLow} )", "colorHigh": "$!encoder.jsonEncode( ${object.colorHigh} )", "mapLegendSetId": "$!{object.mapLegendSet.id}", + "radiusLow": "$!{object.radiusLow}", + "radiusHigh": "$!{object.radiusHigh}", "longitude": "$!encoder.jsonEncode( ${object.longitude} )", "latitude": "$!encoder.jsonEncode( ${object.latitude} )", "zoom": "$!{object.zoom}" === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2010-11-25 15:08:07 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapViews.vm 2010-11-29 15:44:01 +0000 @@ -4,6 +4,7 @@ { "id": "$!{mapView.id}", "name": "$!encoder.jsonEncode( ${mapView.name} )", + "featureType": "$!encoder.jsonEncode( ${mapView.featureType} )", "mapValueType": "$!encoder.jsonEncode( ${mapView.mapValueType} )", "indicatorGroupId": "$!{mapView.indicatorGroup.id}", "indicatorId": "$!{mapView.indicator.id}", @@ -26,6 +27,8 @@ "colorLow": "$!encoder.jsonEncode( ${mapView.colorLow} )", "colorHigh": "$!encoder.jsonEncode( ${mapView.colorHigh} )", "mapLegendSetId": "$!{mapView.mapLegendSet.id}", + "radiusLow": "$!{mapView.radiusLow}", + "radiusHigh": "$!{mapView.radiusHigh}", "longitude": "$!encoder.jsonEncode( ${mapView.longitude} )", "latitude": "$!encoder.jsonEncode( ${mapView.latitude} )", "zoom": "$!{mapView.zoom}" === 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-11-24 14:26:55 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-11-29 16:11:36 +0000 @@ -12,19 +12,19 @@ padding-left: 8px; } .x-form-field { - font:10px lucida sans unicode,arial,tahoma,helvetica,sans-serif; + font:10px lucida sans unicode,ubuntu,arial,tahoma,helvetica,sans-serif; } .x-form-item label.x-form-item-label { padding:3px 3px 3px 4px; } .x-combo-list { - font:10px lucida sans unicode,arial,tahoma,helvetica,sans-serif; + font:10px lucida sans unicode,ubuntu,arial,tahoma,helvetica,sans-serif; } .x-tree-node { - font:10px lucida sans unicode,arial,tahoma,helvetica,sans-serif; + font:10px lucida sans unicode,ubuntu,arial,tahoma,helvetica,sans-serif; } .x-panel-mc { - font:10px lucida sans unicode,arial,tahoma,helvetica,sans-serif; + font:10px lucida sans unicode,ubuntu,arial,tahoma,helvetica,sans-serif; } .x-tree-node a span, .x-dd-drag-ghost a span { padding:1px 3px 1px 4px; @@ -50,11 +50,11 @@ padding:0; } .ux-mselect-item { - font:10px lucida sans unicode,tahoma,arial,helvetica,sans-serif; + font:10px lucida sans unicode,ubuntu,tahoma,arial,helvetica,sans-serif; padding:1px; } .x-box-mc { - font-family:arial,tahoma,helvetica; + font-family:ubuntu,arial,tahoma,helvetica; font-weight:normal; } .loading-indicator { @@ -93,7 +93,7 @@ /* Ext Label */ .x-form-item-label { - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#777; } @@ -175,11 +175,11 @@ color:#333; } .x-grid3-cell-inner, .x-grid3-hd-inner { - font:normal 10px lucida sans unicode,arial; + font:normal 10px lucida sans unicode,ubuntu,arial; color:#777; } .x-grid3-hd-inner, .x-grid3-hd-organisationUnitId { - font-family:normal 11px lucida sans unicode,arial; + font-family:normal 11px lucida sans unicode,ubuntu,arial; color:#333; } @@ -189,7 +189,7 @@ width:14px; } .x-btn button { - font:normal 10px lucida sans unicode,arial; + font:normal 10px lucida sans unicode,ubuntu,arial; } .x-btn .icon-zoomin { background-image:url(../../../images/zoom_in.png); @@ -267,29 +267,29 @@ padding:5px 11px 6px 32px; background:#fbfbfb url('../../../images/loader.gif') no-repeat 5px 2px; line-height:20px; - font:normal 10px lucida sans unicode, arial; + font:normal 10px lucida sans unicode,ubuntu,arial; } /* Ext Window */ .window-info { padding:0 0 8px 0; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#333; } .window-info-grey { padding:5px 0px 0px 8px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#333; background-color:#f8f8f8; } .window-field-label-first { padding:0 0 3px 3px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#888; } .window-field-label { padding:6px 0 2px 3px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#888; } .window-field-nolabel { @@ -300,7 +300,7 @@ } .window-orgunit-text { padding:6px 6px 6px 8px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#333; } #window-favorites-title { @@ -352,16 +352,16 @@ } .panel-fieldlabel { padding:5px 0 2px 2px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#777; } .panel-fieldlabel-first { padding:0px 0 2px 2px; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#777; } .panel-tab-title { - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#333; } @@ -383,11 +383,11 @@ } #help p { padding:4px 0 4px 0; - font:normal 11px lucida sans unicode,arial; + font:normal 11px lucida sans unicode,ubuntu,arial; color:#333; } /* GIS */ .thematic-br { - padding:9px 0 0 0; -} \ No newline at end of file + padding:8px 0 0 0; +} === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-11-29 11:21:06 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js 2010-11-30 18:26:00 +0000 @@ -35,6 +35,7 @@ combo_width_fieldset: 112, combo_list_width_fieldset: 112 + 17, combo_number_width: 65, + combo_number_width_small: 30, emptytext: '', labelseparator: '', @@ -332,17 +333,11 @@ setPoint: function() { this.value = GLOBAL.conf.thematicMap2; }, - setAssignment: function() { - this.value = GLOBAL.conf.organisationUnitAssignment; - }, isPolygon: function() { return this.value == GLOBAL.conf.thematicMap; }, isPoint: function() { return this.value == GLOBAL.conf.thematicMap2; - }, - isAssignment: function() { - return this.value == GLOBAL.conf.organisationUnitAssignment; } }, === 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-11-29 11:21:06 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-11-30 14:48:52 +0000 @@ -23,7 +23,26 @@ var mapViewStore = new Ext.data.JsonStore({ url: GLOBAL.conf.path_mapping + 'getAllMapViews' + GLOBAL.conf.type, root: 'mapViews', - fields: [ 'id', 'name', 'mapValueType', 'indicatorGroupId', 'indicatorId', 'dataElementGroupId', 'dataElementId', + fields: [ 'id', 'name', '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: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': function(store) { + store.isLoaded = true; + } + } + }); + + var polygonMapViewStore = new Ext.data.JsonStore({ + url: GLOBAL.conf.path_mapping + 'getMapViewsByFeatureType' + GLOBAL.conf.type, + baseParams: {featureType: GLOBAL.conf.map_feature_type_multipolygon}, + root: 'mapViews', + fields: [ 'id', 'name', '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' @@ -37,6 +56,25 @@ } } }); + + var pointMapViewStore = new Ext.data.JsonStore({ + url: GLOBAL.conf.path_mapping + 'getMapViewsByFeatureType' + GLOBAL.conf.type, + baseParams: {featureType: GLOBAL.conf.map_feature_type_point}, + root: 'mapViews', + fields: [ 'id', 'name', '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: 'name', direction: 'ASC'}, + autoLoad: false, + isLoaded: false, + listeners: { + 'load': function(store) { + store.isLoaded = true; + } + } + }); var indicatorGroupStore = new Ext.data.JsonStore({ url: GLOBAL.conf.path_mapping + 'getAllIndicatorGroups' + GLOBAL.conf.type, @@ -162,20 +200,6 @@ store.isLoaded = true; } } - }); - - var mapStore = new Ext.data.JsonStore({ - url: GLOBAL.conf.path_mapping + 'getAllMaps' + GLOBAL.conf.type, - root: 'maps', - fields: ['id', 'name', 'mapLayerPath', 'organisationUnitLevel', 'nameColumn'], - idProperty: 'mapLayerPath', - autoLoad: false, - isLoaded: false, - listeners: { - 'load': function(store) { - store.isLoaded = true; - } - } }); var predefinedMapLegendStore = new Ext.data.JsonStore({ @@ -215,6 +239,14 @@ listeners: { 'load': function(store) { store.isLoaded = true; + + if (!symbol.form.findField('level').getValue()) { + if (this.isLoaded) { + var data = this.getAt(this.getTotalCount()-1).data; + symbol.organisationUnitSelection.setValues(null, null, null, data.level, data.name); + symbol.form.findField('level').setValue(data.name); + } + } // Ext.getCmp('level_cb').mode = 'local'; } } @@ -302,7 +334,9 @@ }); GLOBAL.stores = { - mapView: mapViewStore, + mapView: mapViewStore, + polygonMapView: polygonMapViewStore, + pointMapView: pointMapViewStore, indicatorGroup: indicatorGroupStore, indicatorsByGroup: indicatorsByGroupStore, indicator: indicatorStore, @@ -311,7 +345,6 @@ dataElement: dataElementStore, periodType: periodTypeStore, periodsByTypeStore: periodsByTypeStore, - map: mapStore, predefinedMapLegend: predefinedMapLegendStore, predefinedMapLegendSet: predefinedMapLegendSetStore, organisationUnitLevel: organisationUnitLevelStore, @@ -436,6 +469,7 @@ method: 'POST', params: { name: vn, + featureType: formValues.featureType, mapValueType: formValues.mapValueType, indicatorGroupId: formValues.indicatorGroupId, indicatorId: formValues.indicatorId, @@ -454,6 +488,8 @@ colorLow: formValues.colorLow, colorHigh: formValues.colorHigh, mapLegendSetId: formValues.mapLegendSetId, + radiusLow: formValues.radiusLow, + radiusHigh: formValues.radiusHigh, longitude: formValues.longitude, latitude: formValues.latitude, zoom: formValues.zoom @@ -461,6 +497,12 @@ success: function(r) { Ext.message.msg(true, i18n_favorite + ' ' + vn + ' ' + i18n_registered); GLOBAL.stores.mapView.load(); + if (formValues.featureType == GLOBAL.conf.map_feature_type_multipolygon) { + GLOBAL.stores.polygonMapView.load(); + } + else if (formValues.featureType == GLOBAL.conf.map_feature_type_multipolygon) { + GLOBAL.stores.pointMapView.load(); + } Ext.getCmp('viewname_tf').reset(); } }); @@ -500,6 +542,8 @@ success: function(r) { Ext.message.msg(true, i18n_favorite + ' ' + name + ' ' + i18n_deleted); GLOBAL.stores.mapView.load(); + Ext.getCmp('view_cb').clearValue(); + Ext.getCmp('view2_cb').clearValue(); if (v == choropleth.form.findField('mapview').getValue()) { choropleth.form.findField('mapview').clearValue(); } @@ -1840,7 +1884,7 @@ mode: 'local', value: GLOBAL.conf.map_date_type_fixed, triggerAction: 'all', - width: GLOBAL.conf.combo_width_fieldset, + width: GLOBAL.vars.mapDateType.value, minListWidth: GLOBAL.conf.combo_width_fieldset, store: new Ext.data.ArrayStore({ fields: ['value', 'text'], @@ -2384,6 +2428,12 @@ listeners: { 'expand': function() { GLOBAL.vars.activePanel.setPoint(); + + if (!this.form.findField('level').getValue()) { + if (!GLOBAL.stores.organisationUnitLevel.isLoaded) { + GLOBAL.stores.organisationUnitLevel.load(); + } + } } } }); @@ -2659,8 +2709,6 @@ ] }); - GLOBAL.vars.activePanel.setPolygon(); - GLOBAL.vars.map.addControl(new OpenLayers.Control.MousePosition({ displayClass: 'void', div: $('mouseposition'), === 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 2010-11-26 17:56:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat.js 2010-11-30 18:26:00 +0000 @@ -347,7 +347,7 @@ } } - method = GLOBAL.vars.activePanel.isAssignment() ? mapfish.GeoStat.Distribution.CLASSIFY_BY_EQUAL_INTERVALS : mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS; + method = mapfish.GeoStat.Distribution.CLASSIFY_WITH_BOUNDS; } var classification = null; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-11-26 17:56:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/core/GeoStat/Symbol.js 2010-11-30 11:46:27 +0000 @@ -34,7 +34,7 @@ minSize: 3, - maxSize: 15, + maxSize: 20, minVal: null, @@ -79,9 +79,7 @@ setClassification: function() { var values = []; - for (var i = 0; i < this.layer.features.length; i++) { - // values.push(this.layer.features[i].attributes[this.colorIndicator]); values.push(this.layer.features[i].attributes.value); } @@ -90,34 +88,32 @@ }; var dist = new mapfish.GeoStat.Distribution(values, distOptions); - // this.minVal = dist.minVal; - // this.maxVal = dist.maxVal; + this.minVal = dist.minVal; + this.maxVal = dist.maxVal; this.classification = dist.classify( this.method, this.numClasses, null ); + this.createColorInterpolation(); }, applyClassification: function(options) { this.updateOptions(options); - - // var calculateRadius = OpenLayers.Function.bind( - // function(feature) { - // var value = feature.attributes[this.sizeIndicator]; - // var size = (value - this.minVal) / (this.maxVal - this.minVal) * - // (this.maxSize - this.minSize) + this.minSize; - // return size; - // }, this - // ); - // this.extendStyle(null, - // {'pointRadius': '${calculateRadius}'}, - // {'calculateRadius': calculateRadius} - // ); + + 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 + ); + this.extendStyle(null, {'pointRadius': '${calculateRadius}'}, {'calculateRadius': calculateRadius}); - var boundsArray = this.classification.getBoundsArray(); + var boundsArray = this.classification.getBoundsArray(); var rules = new Array(boundsArray.length-1); for (var i = 0; i < boundsArray.length-1; i++) { var rule = new OpenLayers.Rule({ @@ -131,6 +127,7 @@ }); rules[i] = rule; } + this.extendStyle(rules); mapfish.GeoStat.prototype.applyClassification.apply(this, arguments); }, === 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-11-26 17:56:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2010-11-30 18:26:00 +0000 @@ -85,35 +85,36 @@ this.createItems(); this.createSelectFeatures(); - + if (GLOBAL.vars.parameter) { - this.mapView = GLOBAL.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 - }; - - GLOBAL.vars.parameter = false; - GLOBAL.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); - Ext.getCmp('mapdatetype_cb').setValue(GLOBAL.vars.mapDateType.value); - - 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 (GLOBAL.stores.mapView.isLoaded) { - mapViewStoreCallback.call(this); - } - else { - GLOBAL.stores.mapView.load({scope: this, callback: function() { - mapViewStoreCallback.call(this); - }}); - } + if (GLOBAL.vars.parameter.mapView.featureType == GLOBAL.conf.map_feature_type_multipolygon) { + this.mapView = GLOBAL.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 + }; + + GLOBAL.vars.parameter = false; + GLOBAL.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 (GLOBAL.stores.polygonMapView.isLoaded) { + mapViewStoreCallback.call(this); + } + else { + GLOBAL.stores.polygonMapView.load({scope: this, callback: function() { + mapViewStoreCallback.call(this); + }}); + } + } } mapfish.widgets.geostat.Choropleth.superclass.initComponent.apply(this); @@ -227,12 +228,12 @@ selectOnFocus: true, labelSeparator: GLOBAL.conf.labelseparator, width: GLOBAL.conf.combo_width, - store: GLOBAL.stores.mapView, + store: GLOBAL.stores.polygonMapView, listeners: { 'select': { scope: this, fn: function(cb) { - this.mapView = GLOBAL.stores.mapView.getAt(GLOBAL.stores.mapView.find('id', cb.getValue())).data; + this.mapView = GLOBAL.stores.polygonMapView.getAt(GLOBAL.stores.polygonMapView.find('id', cb.getValue())).data; this.updateValues = true; this.legend.value = this.mapView.mapLegendType; @@ -315,7 +316,7 @@ { xtype: 'combo', name: 'indicator', - fieldLabel: i18n_indicator , + fieldLabel: i18n_indicator, typeAhead: true, editable: false, valueField: 'id', @@ -895,7 +896,6 @@ fieldLabel: i18n_bounds, labelSeparator: GLOBAL.conf.labelseparator, emptyText: i18n_comma_separated_values, - isFormField: true, width: GLOBAL.conf.combo_width, hidden: true }, @@ -937,7 +937,6 @@ fieldLabel: i18n_low_color, labelSeparator: GLOBAL.conf.labelseparator, allowBlank: false, - isFormField: true, width: GLOBAL.conf.combo_width, value: "#FFFF00" }, @@ -948,7 +947,6 @@ fieldLabel: i18n_high_color, labelSeparator: GLOBAL.conf.labelseparator, allowBlank: false, - isFormField: true, width: GLOBAL.conf.combo_width, value: "#FF0000" }, @@ -959,8 +957,8 @@ xtype: 'button', text: i18n_refresh, isFormField: true, - fieldLabel: '', - labelSeparator: '', + fieldLabel: GLOBAL.conf.emptytext, + labelSeparator: GLOBAL.conf.labelseparator, scope: this, handler: function() { if (this.formValidation.validateForm(true)) { @@ -1041,6 +1039,7 @@ prepareMapViewValueType: function() { var obj = {}; + if (this.valueType.isIndicator()) { this.form.findField('indicatorgroup').showField(); this.form.findField('indicator').showField(); @@ -1240,6 +1239,8 @@ GLOBAL.stores.organisationUnitLevel.load(); this.form.findField('boundary').setValue(this.mapView.parentOrganisationUnitName); this.form.findField('level').setValue(this.mapView.organisationUnitLevelName); + + GLOBAL.vars.activePanel.setPolygon(); this.loadGeoJson(); }, @@ -1372,15 +1373,16 @@ getFormValues: function() { return { + featureType: GLOBAL.conf.map_feature_type_multipolygon, mapValueType: this.form.findField('mapvaluetype').getValue(), - indicatorGroupId: this.form.findField('indicatorgroup').getValue() || null, - indicatorId: this.form.findField('indicator').getValue() || null, - dataElementGroupId: this.form.findField('dataelementgroup').getValue() || null, - dataElementId: this.form.findField('dataelement').getValue() || null, - periodTypeId: this.form.findField('periodtype').getValue() || null, - periodId: this.form.findField('period').getValue() || null, - startDate: this.form.findField('startdate').getValue() || null, - endDate: this.form.findField('enddate').getValue() || null, + indicatorGroupId: this.form.findField('indicatorgroup').getValue(), + indicatorId: this.form.findField('indicator').getValue(), + dataElementGroupId: this.form.findField('dataelementgroup').getValue(), + dataElementId: this.form.findField('dataelement').getValue(), + periodTypeId: this.form.findField('periodtype').getValue(), + periodId: this.form.findField('period').getValue(), + startDate: this.form.findField('startdate').getValue(), + endDate: this.form.findField('enddate').getValue(), parentOrganisationUnitId: this.organisationUnitSelection.parent.id, organisationUnitLevel: this.organisationUnitSelection.level.level, mapLegendType: this.form.findField('maplegendtype').getValue(), @@ -1389,10 +1391,12 @@ bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null, colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null, - mapLegendSetId: this.form.findField('maplegendset').getValue() || null, + mapLegendSetId: this.form.findField('maplegendset').getValue(), + radiusLow: null, + radiusHigh: null, longitude: GLOBAL.vars.map.getCenter().lon, latitude: GLOBAL.vars.map.getCenter().lat, - zoom: parseInt(GLOBAL.vars.map.getZoom()) + zoom: parseFloat(GLOBAL.vars.map.getZoom()) }; }, @@ -1480,9 +1484,9 @@ } } }, - + applyValues: function() { - var options = { + var options = { indicator: 'value', method: this.form.findField('method').getValue(), numClasses: this.form.findField('classes').getValue(), @@ -1518,4 +1522,4 @@ } }); -Ext.reg('choropleth', mapfish.widgets.geostat.Choropleth); \ No newline at end of file +Ext.reg('choropleth', mapfish.widgets.geostat.Choropleth); === 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-11-26 17:56:40 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2010-11-30 18:26:00 +0000 @@ -87,34 +87,33 @@ this.createSelectFeatures(); if (GLOBAL.vars.parameter) { - this.mapView = GLOBAL.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 - }; - - GLOBAL.vars.parameter = false; - GLOBAL.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); + if (GLOBAL.vars.parameter.mapView.featureType == GLOBAL.conf.map_feature_type_point) { + this.mapView = GLOBAL.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 + }; - Ext.getCmp('mapdatetype_cb').setValue(GLOBAL.vars.mapDateType.value); - - 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 (GLOBAL.stores.mapView.isLoaded) { - mapViewStoreCallback.call(this); - } - else { - GLOBAL.stores.mapView.load({scope: this, callback: function() { - mapViewStoreCallback.call(this); - }}); - } + GLOBAL.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 (GLOBAL.stores.pointMapView.isLoaded) { + mapViewStoreCallback.call(this); + } + else { + GLOBAL.stores.pointMapView.load({scope: this, callback: function() { + mapViewStoreCallback.call(this); + }}); + } + } } mapfish.widgets.geostat.Symbol.superclass.initComponent.apply(this); @@ -228,12 +227,12 @@ selectOnFocus: true, labelSeparator: GLOBAL.conf.labelseparator, width: GLOBAL.conf.combo_width, - store: GLOBAL.stores.mapView, + store: GLOBAL.stores.pointMapView, listeners: { 'select': { scope: this, fn: function(cb) { - this.mapView = GLOBAL.stores.mapView.getAt(GLOBAL.stores.mapView.find('id', cb.getValue())).data; + this.mapView = GLOBAL.stores.pointMapView.getAt(GLOBAL.stores.pointMapView.find('id', cb.getValue())).data; this.updateValues = true; this.legend.value = this.mapView.mapLegendType; @@ -241,8 +240,9 @@ this.legend.classes = this.mapView.classes || this.legend.classes; GLOBAL.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); - + GLOBAL.vars.mapDateType.value = this.mapView.mapDateType; Ext.getCmp('mapdatetype_cb').setValue(GLOBAL.vars.mapDateType.value); + this.valueType.value = this.mapView.mapValueType; this.form.findField('mapvaluetype').setValue(this.valueType.value); this.setMapView(); @@ -601,7 +601,7 @@ var value, rawvalue; var w = new Ext.Window({ id: 'tree_w2', - title: 'Boundary and level', + title: 'Boundary', closeAction: 'hide', autoScroll: true, height: 'auto', @@ -609,87 +609,32 @@ width: 280, boxMaxWidth: 280, items: [ - { - xtype: 'panel', - layout: 'fit', - bodyStyle: 'padding:4px 4px 0px 4px; background-color:#f8f8f8', - items: [ - { - xtype: 'fieldset', - title: '  Boundary  ', - bodyStyle: 'margin-bottom:3px', - autoHeight: true, - items: [ - { - xtype: 'treepanel', - height: screen.height / 3, - autoScroll: true, - loader: new Ext.tree.TreeLoader({ - dataUrl: GLOBAL.conf.path_mapping + 'getOrganisationUnitChildren' + GLOBAL.conf.type - }), - root: { - id: GLOBAL.vars.topLevelUnit.id, - text: GLOBAL.vars.topLevelUnit.name, - hasChildrenWithCoordinates: GLOBAL.vars.topLevelUnit.hasChildrenWithCoordinates, - nodeType: 'async', - draggable: false, - expanded: true - }, - clickedNode: null, - listeners: { - 'click': { - scope: this, - fn: function(n) { - this.form.findField('boundary').selectedNode = n; - } - } - } - } - ] - } - ] - }, - { - xtype: 'panel', - layout: 'fit', - bodyStyle: 'padding:4px 4px 0px 4px; background-color:#f8f8f8', - items: [ - { - xtype: 'fieldset', - title: '  Level  ', - autoHeight: true, - layout: 'anchor', - items: [ - { - xtype: 'combo', - id: 'level_cb2', - fieldLabel: i18n_level, - typeAhead: true, - editable: false, - valueField: 'level', - displayField: 'name', - mode: 'remote', - forceSelection: true, - triggerAction: 'all', - emptyText: GLOBAL.conf.emptytext, - labelSeparator: GLOBAL.conf.labelseparator, - selectOnFocus: true, - width: GLOBAL.conf.combo_width, - store: GLOBAL.stores.organisationUnitLevel, - listeners: { - 'select': { - scope: this, - fn: function(cb) { - this.form.findField('level').level = cb.getValue(); - this.form.findField('level').levelName = cb.getRawValue(); - } - } - } - } - ] - } - ] - }, + { + xtype: 'treepanel', + height: screen.height / 3, + bodyStyle: 'padding: 8px', + autoScroll: true, + loader: new Ext.tree.TreeLoader({ + dataUrl: GLOBAL.conf.path_mapping + 'getOrganisationUnitChildren' + GLOBAL.conf.type + }), + root: { + id: GLOBAL.vars.topLevelUnit.id, + text: GLOBAL.vars.topLevelUnit.name, + hasChildrenWithCoordinates: GLOBAL.vars.topLevelUnit.hasChildrenWithCoordinates, + nodeType: 'async', + draggable: false, + expanded: true + }, + clickedNode: null, + listeners: { + 'click': { + scope: this, + fn: function(n) { + this.form.findField('boundary').selectedNode = n; + } + } + } + }, { xtype: 'panel', layout: 'table', @@ -701,21 +646,15 @@ scope: this, handler: function() { var node = this.form.findField('boundary').selectedNode; - if (!node || !Ext.getCmp('level_cb2').getValue()) { - return; - } - if (node.attributes.level > this.form.findField('level').level) { - Ext.message.msg(false, 'Level is higher than boundary level'); + if (!node) { return; } this.form.findField('mapview').clearValue(); this.updateValues = true; - this.organisationUnitSelection.setValues(node.attributes.id, node.attributes.text, node.attributes.level, - this.form.findField('level').level, this.form.findField('level').levelName); + this.organisationUnitSelection.setValues(node.attributes.id, node.attributes.text, node.attributes.level, null, null); this.form.findField('boundary').setValue(node.attributes.text); - this.form.findField('level').setValue(this.form.findField('level').levelName); Ext.getCmp('tree_w2').hide(); this.loadGeoJson(); @@ -895,7 +834,6 @@ fieldLabel: i18n_bounds, labelSeparator: GLOBAL.conf.labelseparator, emptyText: i18n_comma_separated_values, - isFormField: true, width: GLOBAL.conf.combo_width, hidden: true }, @@ -937,7 +875,6 @@ fieldLabel: i18n_low_color, labelSeparator: GLOBAL.conf.labelseparator, allowBlank: false, - isFormField: true, width: GLOBAL.conf.combo_width, value: "#FFFF00" }, @@ -948,19 +885,38 @@ fieldLabel: i18n_high_color, labelSeparator: GLOBAL.conf.labelseparator, allowBlank: false, - isFormField: true, width: GLOBAL.conf.combo_width, value: "#FF0000" }, { html: '
' }, + + { + xtype: 'numberfield', + name: 'radiuslow', + fieldLabel: 'Low radius', + labelSeparator: GLOBAL.conf.labelseparator, + width: GLOBAL.conf.combo_number_width_small, + value: 5 + }, + + { + xtype: 'numberfield', + name: 'radiushigh', + fieldLabel: 'High radius', + labelSeparator: GLOBAL.conf.labelseparator, + width: GLOBAL.conf.combo_number_width_small, + value: 20 + }, + + { html: '
' }, { xtype: 'button', text: i18n_refresh, isFormField: true, - fieldLabel: '', - labelSeparator: '', + fieldLabel: GLOBAL.conf.emptytext, + labelSeparator: GLOBAL.conf.labelseparator, scope: this, handler: function() { if (this.formValidation.validateForm(true)) { @@ -1207,6 +1163,9 @@ this.form.findField('maplegendset').setValue(this.mapView.mapLegendSetId); this.applyPredefinedLegend(true); } + + this.form.findField('radiuslow').setValue(this.mapView.radiusLow); + this.form.findField('radiushigh').setValue(this.mapView.radiusHigh); if (this.legend.value == GLOBAL.conf.map_legend_type_automatic) { this.form.findField('method').setValue(this.mapView.method); @@ -1240,6 +1199,8 @@ this.form.findField('boundary').setValue(this.mapView.parentOrganisationUnitName); this.form.findField('level').setValue(this.mapView.organisationUnitLevelName); + + GLOBAL.vars.activePanel.setPoint(); this.loadGeoJson(); }, @@ -1344,6 +1305,13 @@ } } + if (!scope.form.findField('radiuslow').getValue() || !scope.form.findField('radiushigh').getValue()) { + if (exception) { + Ext.message.msg(false, i18n_form_is_not_complete); + } + return false; + } + return true; }, @@ -1372,15 +1340,16 @@ getFormValues: function() { return { + featureType: GLOBAL.conf.map_feature_type_point, mapValueType: this.form.findField('mapvaluetype').getValue(), - indicatorGroupId: this.form.findField('indicatorgroup').getValue() || null, - indicatorId: this.form.findField('indicator').getValue() || null, - dataElementGroupId: this.form.findField('dataelementgroup').getValue() || null, - dataElementId: this.form.findField('dataelement').getValue() || null, - periodTypeId: this.form.findField('periodtype').getValue() || null, - periodId: this.form.findField('period').getValue() || null, - startDate: this.form.findField('startdate').getValue() || null, - endDate: this.form.findField('enddate').getValue() || null, + indicatorGroupId: this.form.findField('indicatorgroup').getValue(), + indicatorId: this.form.findField('indicator').getValue(), + dataElementGroupId: this.form.findField('dataelementgroup').getValue(), + dataElementId: this.form.findField('dataelement').getValue(), + periodTypeId: this.form.findField('periodtype').getValue(), + periodId: this.form.findField('period').getValue(), + startDate: this.form.findField('startdate').getValue(), + endDate: this.form.findField('enddate').getValue(), parentOrganisationUnitId: this.organisationUnitSelection.parent.id, organisationUnitLevel: this.organisationUnitSelection.level.level, mapLegendType: this.form.findField('maplegendtype').getValue(), @@ -1389,10 +1358,12 @@ bounds: this.legend.value == GLOBAL.conf.map_legend_type_automatic && this.legend.method == GLOBAL.conf.classify_with_bounds ? this.form.findField('bounds').getValue() : null, colorLow: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('startcolor').getValue() : null, colorHigh: this.legend.value == GLOBAL.conf.map_legend_type_automatic ? this.form.findField('endcolor').getValue() : null, - mapLegendSetId: this.form.findField('maplegendset').getValue() || null, + mapLegendSetId: this.form.findField('maplegendset').getValue(), + radiusLow: this.form.findField('radiuslow').getValue(), + radiusHigh: this.form.findField('radiushigh').getValue(), longitude: GLOBAL.vars.map.getCenter().lon, latitude: GLOBAL.vars.map.getCenter().lat, - zoom: parseInt(GLOBAL.vars.map.getZoom()) + zoom: parseFloat(GLOBAL.vars.map.getZoom()) }; }, @@ -1480,16 +1451,19 @@ } } }, - + applyValues: function() { - var options = { + var options = { indicator: 'value', method: this.form.findField('method').getValue(), numClasses: this.form.findField('classes').getValue(), - colors: this.getColors() - }; - - this.coreComp.applyClassification(options); + colors: this.getColors(), + minSize: parseInt(this.form.findField('radiuslow').getValue()), + maxSize: parseInt(this.form.findField('radiushigh').getValue()) + }; + + this.coreComp.updateOptions(options); + this.coreComp.applyClassification(); this.classificationApplied = true; GLOBAL.vars.mask.hide(); @@ -1515,7 +1489,13 @@ }; this.coreComp = new mapfish.GeoStat.Symbol(this.map, coreOptions); + + if (GLOBAL.vars.parameter) { + choropleth.collapse(); + this.expand(); + GLOBAL.vars.parameter = false; + } } }); -Ext.reg('symbol', mapfish.widgets.geostat.Symbol); \ No newline at end of file +Ext.reg('symbol', mapfish.widgets.geostat.Symbol);