← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5376: Map generation: proper handling for org units without coordinates

 

------------------------------------------------------------
revno: 5376
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-12-12 22:17:15 +0100
message:
  Map generation: proper handling for org units without coordinates
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	2011-12-09 10:29:57 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java	2011-12-12 21:17:15 +0000
@@ -201,19 +201,21 @@
         // Build internal map objects for each map value
         for ( AggregatedMapValue mapValue : mapValues )
         {
-            mapObjects.add( buildSingleGeoToolsMapObjectForMapLayer( mapLayer, mapValue ) );
+            // Get the org unit for this map value
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( mapValue.getOrganisationUnitId() );
+
+            if ( orgUnit != null && orgUnit.hasCoordinates() )
+            {
+                mapObjects.add( buildSingleGeoToolsMapObjectForMapLayer( mapLayer, mapValue, orgUnit ) );
+            }
         }
 
         return mapObjects;
     }
 
     private GeoToolsMapObject buildSingleGeoToolsMapObjectForMapLayer( InternalMapLayer mapLayer,
-        AggregatedMapValue mapValue )
+        AggregatedMapValue mapValue, OrganisationUnit orgUnit )
     {
-
-        // Get the org unit for this map value
-        OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( mapValue.getOrganisationUnitId() );
-
         // Create and setup an internal map object
         GeoToolsMapObject mapObject = new GeoToolsMapObject();
         mapObject.setName( orgUnit.getName() );