[Cartoweb-dev] Patch Outline ServerOutline.php ( areaPrecision )

Bruno Friedmann bruno at ioda-net.ch
Wed Mar 26 08:47:21 EDT 2008


Hi c2c,

Here's a patch to be able to use the areaPrecision (number of decimal in areasurface ) in outline
There's a lot of possiblity to extend it with a decimal seperator and thousand separator.



### Eclipse Workspace Patch 1.0
#P cartoweb3
Index: plugins/outline/server/ServerOutline.php
===================================================================
RCS file: /var/lib/cvs/public/cartoweb3/plugins/outline/server/ServerOutline.php,v
retrieving revision 1.56
diff -u -r1.56 ServerOutline.php
--- plugins/outline/server/ServerOutline.php	11 Feb 2008 09:02:27 -0000	1.56
+++ plugins/outline/server/ServerOutline.php	26 Mar 2008 12:43:30 -0000
@@ -18,7 +18,7 @@
  *
  * @copyright 2005 Camptocamp SA
  * @package Plugins
- * @version $Id: ServerOutline.php,v 1.56 2008-02-11 09:02:27 ochriste Exp $
+ * @version $Id: ServerOutline.php,v 1.57 2008-03-26 11:22:27 bfriedmann Exp $
  */

 /**
@@ -305,8 +305,17 @@
         } else {
             $areaFactor = (double)$areaFactor;
         }
-
-        return $area * $areaFactor;
+//        return $area * $areaFactor;
+        $areaPrecision = $this->getConfig()->areaPrecision;
+        if (is_null($areaPrecision)) {
+            return $area * $areaFactor;
+        } else {
+            $areaPrecision = (int)$areaPrecision;
+            return number_format($area * $areaFactor, $areaPrecision, ".", "");
+        }
     }


-- 

     Bruno Friedmann  bruno at ioda-net.ch

Ioda-Net Sàrl   - www.ioda-net.ch
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760

C'est Facile et Cool d'Évoluer en ligne : www.cfcel.com




More information about the Cartoweb-dev mailing list