← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 508: (GIS, med) MapLayer object can now store layer type and vector layer styling properties such as f...

 

------------------------------------------------------------
revno: 508
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-08-26 03:56:03 +0200
message:
  (GIS, med) MapLayer object can now store layer type and vector layer styling properties such as fill color, fill opacity, stroke color and stroke width.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml
  gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java
  gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm


--
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-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java	2009-08-20 18:52:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java	2009-08-26 01:56:03 +0000
@@ -37,16 +37,31 @@
 
     private String name;
     
+    private String type;
+    
     private String mapSource;
     
+    private String fillColor;
+    
+    private int fillOpacity;
+    
+    private String strokeColor;
+    
+    private int strokeWidth;
+    
     public MapLayer()
     {
     }
 
-    public MapLayer( String name, String mapSource )
+    public MapLayer( String name, String type, String mapSource, String fillColor, int fillOpacity, String strokeColor, int strokeWidth )
     {
         this.name = name;
+        this.type = type;
         this.mapSource = mapSource;
+        this.fillColor = fillColor;
+        this.fillOpacity = fillOpacity;
+        this.strokeColor = strokeColor;
+        this.strokeWidth = strokeWidth;
     }
     
     // -------------------------------------------------------------------------
@@ -106,6 +121,16 @@
         this.name = name;
     }
 
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
     public String getMapSource()
     {
         return mapSource;
@@ -115,4 +140,44 @@
     {
         this.mapSource = mapSource;
     }
+
+    public String getFillColor()
+    {
+        return fillColor;
+    }
+
+    public void setFillColor( String fillColor )
+    {
+        this.fillColor = fillColor;
+    }
+
+    public int getFillOpacity()
+    {
+        return fillOpacity;
+    }
+
+    public void setFillOpacity( int fillOpacity )
+    {
+        this.fillOpacity = fillOpacity;
+    }
+
+    public String getStrokeColor()
+    {
+        return strokeColor;
+    }
+
+    public void setStrokeColor( String strokeColor )
+    {
+        this.strokeColor = strokeColor;
+    }
+
+    public int getStrokeWidth()
+    {
+        return strokeWidth;
+    }
+
+    public void setStrokeWidth( int strokeWidth )
+    {
+        this.strokeWidth = strokeWidth;
+    }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2009-08-20 18:52:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2009-08-26 01:56:03 +0000
@@ -346,7 +346,7 @@
     
     void updateMapLayer( MapLayer mapLayer );
     
-    void addOrUpdateMapLayer( String name, String mapSource );
+    void addOrUpdateMapLayer( String name, String type, String mapSource, String fillColor, int fillOpacity, String strokeColor, int strokeWidth );
     
     void deleteMapLayer( MapLayer mapLayer );
     

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-08-20 18:52:55 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-08-26 01:56:03 +0000
@@ -557,20 +557,25 @@
         mappingStore.updateMapLayer( mapLayer );
     }
 
-    public void addOrUpdateMapLayer( String name, String mapSource )
+    public void addOrUpdateMapLayer( String name, String type, String mapSource, String fillColor, int fillOpacity, String strokeColor, int strokeWidth )
     {
         MapLayer mapLayer = mappingStore.getMapLayerByName( name );
 
         if ( mapLayer != null )
         {
             mapLayer.setName( name );
+            mapLayer.setType( type );
             mapLayer.setMapSource( mapSource );
+            mapLayer.setFillColor( fillColor );
+            mapLayer.setFillOpacity( fillOpacity );
+            mapLayer.setStrokeColor( strokeColor );
+            mapLayer.setStrokeWidth( strokeWidth );
             
             updateMapLayer( mapLayer );
         }
         else
         {
-            addMapLayer( new MapLayer( name, mapSource ) );
+            addMapLayer( new MapLayer( name, type, mapSource, fillColor, fillOpacity, strokeColor, strokeWidth ) );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml	2009-08-20 18:52:55 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml	2009-08-26 01:56:03 +0000
@@ -12,9 +12,19 @@
 		</id>
 	
 		<property name="name" column="name" unique="true"/>
+		
+		<property name="type" column="type"/>
 	
 		<property name="mapSource" column="mapsource" unique="true"/>
 		
+		<property name="fillColor" column="fillcolor"/>
+		
+		<property name="fillOpacity" column="fillopacity"/>
+		
+		<property name="strokeColor" column="strokecolor"/>
+		
+		<property name="strokeWidth" column="strokewidth"/>
+		
 	</class>
 	
 </hibernate-mapping>
\ No newline at end of file

=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java	2009-08-21 08:34:37 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java	2009-08-26 01:56:03 +0000
@@ -60,6 +60,13 @@
         this.name = name;
     }
     
+    private String type;
+    
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+    
     private String mapSource;
     
     public void setMapSource( String mapSource )
@@ -67,13 +74,41 @@
         this.mapSource = mapSource;
     }
     
+    private String fillColor;
+
+    public void setFillColor( String fillColor )
+    {
+        this.fillColor = fillColor;
+    }
+
+    private int fillOpacity;
+
+    public void setFillOpacity( int fillOpacity )
+    {
+        this.fillOpacity = fillOpacity;
+    }
+    
+    private String strokeColor;
+
+    public void setStrokeColor( String strokeColor )
+    {
+        this.strokeColor = strokeColor;
+    }
+    
+    private int strokeWidth;
+
+    public void setStrokeWidth( int strokeWidth )
+    {
+        this.strokeWidth = strokeWidth;
+    }    
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        mappingService.addOrUpdateMapLayer( name, mapSource );
+        mappingService.addOrUpdateMapLayer( name, type, mapSource, fillColor, fillOpacity, strokeColor, strokeWidth );
         
         return SUCCESS;
     }

=== modified file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm	2009-08-20 18:52:55 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm	2009-08-26 01:56:03 +0000
@@ -4,7 +4,12 @@
   {
     "id": "$!{mapLayer.id}",
     "name": "$!encoder.jsEncode( ${mapLayer.name} )",
-    "mapSource": "$!encoder.jsEncode( ${mapLayer.mapSource} )"
+    "type": "$!encoder.jsEncode( ${mapLayer.type} )",
+    "mapSource": "$!encoder.jsEncode( ${mapLayer.mapSource} )",
+    "fillColor": "$!encoder.jsEncode( ${mapLayer.fillColor} )",
+    "fillOpacity": "$!{mapLayer.fillOpacity}",
+    "strokeColor": "$!encoder.jsEncode( ${mapLayer.strokeColor} )",
+    "strokeWidth": "$!{mapLayer.strokeWidth}"
   }#if( $velocityCount < $size ),#end
 #end
 ] }
\ No newline at end of file