dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30934
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15726: PNG maps, making sure that map image height is never less than legend
------------------------------------------------------------
revno: 15726
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-17 15:14:04 +0200
message:
PNG maps, making sure that map image height is never less than legend
modified:
dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java
--
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-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 2014-06-17 12:51:39 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java 2014-06-17 13:14:04 +0000
@@ -366,9 +366,12 @@
Assert.isTrue( mapImage != null );
Assert.isTrue( legendImage.getType() == mapImage.getType() );
- // Create a new image with dimension (legend.width + map.width,
- // max(legend.height, map.height))
- BufferedImage finalImage = new BufferedImage( legendImage.getWidth() + mapImage.getWidth(), titleImage.getHeight() + mapImage.getHeight(), mapImage.getType() );
+ // Create image, note that image height cannot be less than legend
+
+ int width = legendImage.getWidth() + mapImage.getWidth();
+ int height = Math.max( titleImage.getHeight() + mapImage.getHeight(), ( legendImage.getHeight() + 1 ) );
+
+ BufferedImage finalImage = new BufferedImage( width, height, mapImage.getType() );
// Draw the two images onto the final image with the legend to the left
// and the map to the right