dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25236
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12462: PNG maps, support for supporting date as query param as basis for relative periods
------------------------------------------------------------
revno: 12462
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-07 12:01:43 +0200
message:
PNG maps, support for supporting date as query param as basis for relative periods
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapgeneration/MapGenerationService.java
dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm
--
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/mapgeneration/MapGenerationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapgeneration/MapGenerationService.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapgeneration/MapGenerationService.java 2013-10-07 10:01:43 +0000
@@ -29,6 +29,7 @@
*/
import java.awt.image.BufferedImage;
+import java.util.Date;
import org.hisp.dhis.mapping.Map;
import org.hisp.dhis.mapping.MapView;
@@ -68,10 +69,11 @@
/**
* Generate an image that represents this map.
*
- * @param map the map that will be rendered,
+ * @param map the map that will be rendered.
+ * @param date the date for relative periods.
* @param width the maximum width of the map image.
* @param height the maxium height of the map image.
* @return the rendered map image or null if there is no data for the map view.
*/
- BufferedImage generateMapImage( Map map, Integer width, Integer height );
+ BufferedImage generateMapImage( Map map, Date date, Integer width, Integer height );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java 2013-10-07 09:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java 2013-10-07 10:01:43 +0000
@@ -34,6 +34,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -96,10 +97,10 @@
public BufferedImage generateMapImage( Map map )
{
- return generateMapImage( map, 512, null );
+ return generateMapImage( map, new Date(), 512, null );
}
- public BufferedImage generateMapImage( Map map, Integer width, Integer height )
+ public BufferedImage generateMapImage( Map map, Date date, Integer width, Integer height )
{
Assert.isTrue( map != null );
@@ -115,7 +116,7 @@
for ( MapView mapView : mapViews )
{
- InternalMapLayer mapLayer = getSingleInternalMapLayer( mapView );
+ InternalMapLayer mapLayer = getSingleInternalMapLayer( mapView, date );
if ( mapLayer != null )
{
@@ -162,7 +163,7 @@
private static final Integer DEFAULT_RADIUS_HIGH = 35;
private static final Integer DEFAULT_RADIUS_LOW = 15;
- private InternalMapLayer getSingleInternalMapLayer( MapView mapView )
+ private InternalMapLayer getSingleInternalMapLayer( MapView mapView, Date date )
{
if ( mapView == null )
{
@@ -184,7 +185,9 @@
inGroups.addAll( organisationUnitService.getOrganisationUnits( mapView.getItemOrganisationUnitGroups(), mapView.getOrganisationUnits() ) );
}
- mapView.init( null, null, null, atLevels, inGroups, null );
+ date = date != null ? date : new Date();
+
+ mapView.init( null, date, null, atLevels, inGroups, null );
List<OrganisationUnit> organisationUnits = mapView.getAllOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-09-24 09:43:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java 2013-10-07 10:01:43 +0000
@@ -30,6 +30,7 @@
import java.awt.image.BufferedImage;
import java.io.InputStream;
+import java.util.Date;
import java.util.Iterator;
import javax.imageio.ImageIO;
@@ -58,6 +59,7 @@
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@@ -226,13 +228,14 @@
@RequestMapping(value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET)
public void getMapData(
@PathVariable String uid,
+ @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date date,
@RequestParam( required = false ) Integer width,
@RequestParam( required = false ) Integer height,
HttpServletResponse response ) throws Exception
{
Map map = mappingService.getMap( uid );
- renderMapViewPng( map, width, height, response );
+ renderMapViewPng( map, date, width, height, response );
}
//--------------------------------------------------------------------------
@@ -266,10 +269,10 @@
}
}
- private void renderMapViewPng( Map map, Integer width, Integer height, HttpServletResponse response )
+ private void renderMapViewPng( Map map, Date date, Integer width, Integer height, HttpServletResponse response )
throws Exception
{
- BufferedImage image = mapGenerationService.generateMapImage( map, width, height );
+ BufferedImage image = mapGenerationService.generateMapImage( map, date, width, height );
if ( image != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-10-07 09:54:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-10-07 10:01:43 +0000
@@ -698,7 +698,6 @@
both = Both
column = Column
row = Row
-<<<<<<< TREE
show = Show
the_following_persons_found_in = The following persons found in
for_infor = for
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm 2013-09-17 17:15:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm 2013-10-07 10:01:43 +0000
@@ -33,7 +33,7 @@
#if( $ip.chartInterpretation )
<a href="../dhis-web-visualizer/app/index.html?id=${ip.chart.uid}&date=${format.formatDate( $ip.created )}">
<img style="cursor:pointer"
- src="../api/charts/${ip.chart.uid}/data?date=${format.formatDate( $ip.created )}&width=560&height=300${ou}"
+ src="../api/charts/${ip.chart.uid}/data?date=${format.formatDate( $ip.created )}&width=560&height=300${ou}"
title="$i18n.getString( 'click_to_view_in_data_visualizer' )"></a>
#elseif( $ip.mapInterpretation )
<a class="bold"