← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4604: Minor refactor to rounding in gml2dxf transform

 

------------------------------------------------------------
revno: 4604
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: dhis2
timestamp: Fri 2011-09-16 12:07:56 +0100
message:
  Minor refactor to rounding in gml2dxf transform
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl


--
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-importexport/src/main/resources/transform/gml2dxf.xsl'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl	2011-04-29 11:04:43 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/transform/gml2dxf.xsl	2011-09-16 11:07:56 +0000
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:gml="http://www.opengis.net/gml";>
 
+<xsl:param name="roundingFactor">10000</xsl:param>
+  
 <xsl:template match="gml:coordinates">
   <coordinatesTuple>
   <xsl:call-template name="coordinates-delimiter">
@@ -16,7 +18,7 @@
   <xsl:variable name="xcoord" select="substring-before($first, ',')"/>
   <xsl:variable name="ycoord" select="substring-after($first, ',')"/>
   <xsl:variable name="remaining" select="substring-after($newlist, ' ')"/>
-  <coord><xsl:value-of select="round(10000*$xcoord) div 10000"/>,<xsl:value-of select="round(10000*$ycoord) div 10000"/></coord>
+  <coord><xsl:value-of select="round($roundingFactor*$xcoord) div $roundingFactor"/>,<xsl:value-of select="round($roundingFactor*$ycoord) div $roundingFactor"/></coord>
   <xsl:if test="$remaining">
     <xsl:call-template name="coordinates-delimiter">
       <xsl:with-param name="coordinates" select="$remaining"/>