← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2207: (GIS) Fixed bug: Locate orgunits did not work for points.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2207 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-29 12:23:55 +0100
message:
  (GIS) Fixed bug: Locate orgunits did not work for points.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPolygon.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js


--
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-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm	2010-11-25 14:51:44 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPoint.vm	2010-11-29 11:21:06 +0000
@@ -1,2 +1,2 @@
 #set( $size = $object.size() )
-{"type":"FeatureCollection","features":[#foreach($unit in $object){"type":"Feature","id":"${unit.id}","geometry":{"type":"Point","coordinates":$!encoder.jsEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()},"type":"Facility"}}#if( $velocityCount < $size ),#end #end ],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+{"type":"FeatureCollection","features":[#foreach($unit in $object){"type":"Feature","id":"${unit.id}","geometry":{"type":"Point","coordinates":$!encoder.jsEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()},"featureType":"$!encoder.jsonEncode( ${unit.featureType} )","type":"Facility"}}#if( $velocityCount < $size ),#end #end ],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPolygon.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPolygon.vm	2010-11-25 15:08:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonPolygon.vm	2010-11-29 11:21:06 +0000
@@ -1,2 +1,2 @@
 #set( $size = $object.size() )
-{"type":"FeatureCollection","features":[#foreach($unit in $object){"type":"Feature","id":"districts.1","geometry":{"type":"MultiPolygon","coordinates":$!encoder.jsonEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()}}}#if( $velocityCount < $size ),#end #end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+{"type":"FeatureCollection","features":[#foreach($unit in $object){"type":"Feature","id":"districts.1","geometry":{"type":"MultiPolygon","coordinates":$!encoder.jsonEncode( $!{unit.validCoordinates} )},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode( ${unit.name} )","hasChildrenWithCoordinates":$!{unit.hasChildrenWithCoordinates()},"featureType":"$!encoder.jsonEncode( ${unit.featureType} )"}}#if( $velocityCount < $size ),#end #end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-11-26 17:56:40 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/globals.js	2010-11-29 11:21:06 +0000
@@ -59,6 +59,9 @@
     map_date_type_start_end: 'start-end',
     map_selection_type_parent: 'parent',
     map_selection_type_level: 'level',
+    map_feature_type_multipolygon: 'MultiPolygon',
+    map_feature_type_polygon: 'Polygon',
+    map_feature_type_point: 'Point',
     
 //  MapFish
 
@@ -352,4 +355,4 @@
     locateFeatureWindow: null,
     
     selectFeatureWindow: null
-};
\ No newline at end of file
+};

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-11-27 17:46:54 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-11-29 11:21:06 +0000
@@ -2117,10 +2117,24 @@
                                                     }
                                                 }
                                                 
-                                                if (feature) {
-                                                    var color = Ext.getCmp('highlightcolor_cf').getValue();
-                                                    layer.drawFeature(feature,{'fillColor':color, 'strokeColor':color});
-                                                }
+                                                var color = Ext.getCmp('highlightcolor_cf').getValue();
+                                                var symbolizer;
+                                                
+                                                if (feature.attributes.featureType == GLOBAL.conf.map_feature_type_multipolygon ||
+													feature.attributes.featureType == GLOBAL.conf.map_feature_type_polygon) {
+                                                    symbolizer = new OpenLayers.Symbolizer.Polygon({
+														'strokeColor': color,
+														'fillColor': color
+													});
+												}
+												else if (feature.attributes.featureType == GLOBAL.conf.map_feature_type_point) {
+                                                    symbolizer = new OpenLayers.Symbolizer.Point({
+														'pointRadius': 7,
+														'fillColor': color
+													});
+												}
+												
+												layer.drawFeature(feature,symbolizer);
                                             }
                                         }
                                     }