dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23498
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11443: PNG maps cleanup
------------------------------------------------------------
revno: 11443
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-18 18:02:00 +0200
message:
PNG maps cleanup
removed:
dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMap.java
modified:
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/InternalMapLayer.java
dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/IntervalSet.java
dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.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 2013-07-06 20:17:27 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/GeoToolsMapGenerationService.java 2013-07-18 16:02:00 +0000
@@ -97,10 +97,8 @@
return null;
}
- // Build internal representation of a map using GeoTools, then render it
- // to an image
- InternalMap map = new InternalMap( mapLayer );
- BufferedImage mapImage = MapUtils.render( map, height );
+ // Build representation of a map using GeoTools, then render as image
+ BufferedImage mapImage = MapUtils.render( mapLayer, height );
// Build the legend set, then render it to an image
LegendSet legendSet = new LegendSet( mapLayer );
=== removed file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMap.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMap.java 2013-07-18 15:55:16 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMap.java 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-package org.hisp.dhis.mapgeneration;
-
-/*
- * Copyright (c) 2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * An internal representation of a map.
- *
- * It encapsulates all the information of a map built by adding layers to it. It
- * may then create an image representing the map by a call to render.
- *
- * Finally, one should extend this class with an implementation that uses a
- * specific platform, e.g. GeoTools to draw the map.
- *
- * @author Kjetil Andresen <kjetand@xxxxxxxxxx>
- * @author Olai Solheim <olais@xxxxxxxxxx>
- */
-public class InternalMap
-{
- private List<InternalMapObject> mapObjects = new ArrayList<InternalMapObject>();
-
- public InternalMap()
- {
- }
-
- public List<InternalMapObject> getMapObjects()
- {
- return mapObjects;
- }
-
- public void setMapObjects( List<InternalMapObject> mapObjects )
- {
- this.mapObjects = mapObjects;
- }
-
- //TODO remove
-
- public InternalMap( InternalMapLayer layer )
- {
- this.mapObjects = new LinkedList<InternalMapObject>();
- this.addMapLayer( layer );
- }
-
- public void addMapLayer( InternalMapLayer layer )
- {
- for ( InternalMapObject mapObject : layer.getAllMapObjects() )
- {
- this.mapObjects.add( mapObject );
- }
- }
-}
=== 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 2013-07-06 15:18:10 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java 2013-07-18 16:02:00 +0000
@@ -29,7 +29,7 @@
import java.awt.Color;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.List;
import org.hisp.dhis.period.Period;
import org.springframework.util.Assert;
@@ -72,7 +72,7 @@
protected IntervalSet intervalSet;
- protected Collection<InternalMapObject> mapObjects;
+ protected List<InternalMapObject> mapObjects;
/**
* Constructs a map layer with no initial map objects.
@@ -133,7 +133,7 @@
*
* @return the list of map objects
*/
- public Collection<InternalMapObject> getAllMapObjects()
+ public List<InternalMapObject> getMapObjects()
{
return this.mapObjects;
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/IntervalSet.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/IntervalSet.java 2013-07-06 15:18:10 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/IntervalSet.java 2013-07-18 16:02:00 +0000
@@ -125,8 +125,8 @@
{
Assert.isTrue( mapLayer != null );
Assert.isTrue( length > 0 );
- Assert.isTrue( mapLayer.getAllMapObjects() != null );
- Assert.isTrue( mapLayer.getAllMapObjects().size() > 0 );
+ Assert.isTrue( mapLayer.getMapObjects() != null );
+ Assert.isTrue( mapLayer.getMapObjects().size() > 0 );
IntervalSet set = new IntervalSet();
set.intervals = new LinkedList<Interval>();
@@ -135,7 +135,7 @@
set.objectHigh = null;
// Determine the objects with the min and max values
- for ( InternalMapObject mapObject : mapLayer.getAllMapObjects() )
+ for ( InternalMapObject mapObject : mapLayer.getMapObjects() )
{
if ( set.objectLow == null || mapObject.getValue() < set.objectLow.getValue() )
{
@@ -189,8 +189,8 @@
{
Assert.isTrue( mapLayer != null );
Assert.isTrue( length > 0 );
- Assert.isTrue( mapLayer.getAllMapObjects() != null );
- Assert.isTrue( mapLayer.getAllMapObjects().size() > 0 );
+ Assert.isTrue( mapLayer.getMapObjects() != null );
+ Assert.isTrue( mapLayer.getMapObjects().size() > 0 );
throw new RuntimeException( "This distribution strategy is not implemented yet!" );
}
@@ -205,7 +205,7 @@
private static void distributeAndUpdateMapObjectsForMapLayer( InternalMapLayer mapLayer, IntervalSet set )
{
// For each map object, determine in which interval it belongs
- for ( InternalMapObject obj : mapLayer.getAllMapObjects() )
+ for ( InternalMapObject obj : mapLayer.getMapObjects() )
{
for ( Interval in : set.intervals )
{
=== modified file 'dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java'
--- dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java 2013-07-18 15:55:16 +0000
+++ dhis-2/dhis-services/dhis-service-mapgeneration/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java 2013-07-18 16:02:00 +0000
@@ -154,12 +154,12 @@
// Map
// -------------------------------------------------------------------------
- public static BufferedImage render( InternalMap map )
+ public static BufferedImage render( InternalMapLayer map )
{
return render( map, DEFAULT_MAP_WIDTH );
}
- public static BufferedImage render( InternalMap map, int imageWidth )
+ public static BufferedImage render( InternalMapLayer map, int imageWidth )
{
MapContent mapContent = new MapContent();