← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5916: Simplification

 

------------------------------------------------------------
revno: 5916
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-02-11 15:22:20 +0100
message:
  Simplification
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	2012-02-07 16:03:05 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2012-02-11 14:22:20 +0000
@@ -31,8 +31,6 @@
 import java.awt.Graphics;
 import java.awt.image.BufferedImage;
 import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.aggregation.AggregatedMapValue;
@@ -189,7 +187,17 @@
         mapLayer.setStrokeWidth( strokeWidth );
 
         // Build and set the internal GeoTools map objects for the layer
-        buildGeoToolsMapObjectsForMapLayer( mapLayer, mapValues );
+        
+        for ( AggregatedMapValue mapValue : mapValues )
+        {
+            // Get the org unit for this map value
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( mapValue.getOrganisationUnitId() );
+            
+            if ( orgUnit != null && orgUnit.hasCoordinates() && orgUnit.hasFeatureType() )
+            {
+                buildSingleGeoToolsMapObjectForMapLayer( mapLayer, mapValue, orgUnit );
+            }
+        }
 
         // Create an interval set for this map layer that distributes its map
         // objects into their respective intervals
@@ -206,27 +214,6 @@
         return mapLayer;
     }
 
-    private List<GeoToolsMapObject> buildGeoToolsMapObjectsForMapLayer( InternalMapLayer mapLayer,
-        Collection<AggregatedMapValue> mapValues )
-    {
-        // Create a list of map objects
-        List<GeoToolsMapObject> mapObjects = new LinkedList<GeoToolsMapObject>();
-
-        // Build internal map objects for each map value
-        for ( AggregatedMapValue mapValue : mapValues )
-        {
-            // Get the org unit for this map value
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( mapValue.getOrganisationUnitId() );
-            
-            if ( orgUnit != null && orgUnit.hasCoordinates() && orgUnit.hasFeatureType() )
-            {
-                mapObjects.add( buildSingleGeoToolsMapObjectForMapLayer( mapLayer, mapValue, orgUnit ) );
-            }
-        }
-
-        return mapObjects;
-    }
-
     private GeoToolsMapObject buildSingleGeoToolsMapObjectForMapLayer( InternalMapLayer mapLayer,
         AggregatedMapValue mapValue, OrganisationUnit orgUnit )
     {