← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15721: PNG maps, fixed bug, triggered by fewer map features than legend set classes

 

------------------------------------------------------------
revno: 15721
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-06-17 14:03:00 +0200
message:
  PNG maps, fixed bug, triggered by fewer map features than legend set classes
modified:
  dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.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/InternalMapLayer.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2014-03-26 22:18:35 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2014-06-17 12:03:00 +0000
@@ -362,14 +362,17 @@
 
         List<Double> values = getSortedMapObjectValues();
         
+        Assert.isTrue( values.size() > 0 );
+        
         int range = values.size() / length;
         
         for ( int i = 0; i < length; i++ )
         {
             int lowIndex = range * i;
-            int highIndex = lowIndex + range - 1;
+            int highIndex = Math.max( lowIndex + range - 1, 0 );
             
             double low = values.get( lowIndex );
+
             double high = values.get( highIndex );
             
             if ( length == i + 1 ) // At last position