Author: frankie
Date: 2009-07-13 11:37:38 +0000 (Mon, 13 Jul 2009)
New Revision: 2340

Added:
   packages/grass/trunk/debian/patches/newlocation.dpatch
Modified:
   packages/grass/trunk/debian/changelog
   packages/grass/trunk/debian/patches/00list
Log:
Useful patch


Modified: packages/grass/trunk/debian/changelog
===================================================================
--- packages/grass/trunk/debian/changelog       2009-07-13 09:27:24 UTC (rev 
2339)
+++ packages/grass/trunk/debian/changelog       2009-07-13 11:37:38 UTC (rev 
2340)
@@ -5,8 +5,10 @@
   * Added a simple x-grass wrapper to allow running grass without a pre-running
     controlling terminal. At least it works within ordinary WMs launchers.
     (closes: #503371)
+  * Added newlocation.dpatch patch to manage correctly new locations.
+    (closes: #533738)
 
- -- Francesco Paolo Lovergine <fran...@debian.org>  Fri, 12 Jun 2009 10:32:40 
+0200
+ -- Francesco Paolo Lovergine <fran...@debian.org>  Mon, 13 Jul 2009 13:34:03 
+0200
 
 grass (6.4.0~rc5-1) unstable; urgency=low
 

Modified: packages/grass/trunk/debian/patches/00list
===================================================================
--- packages/grass/trunk/debian/patches/00list  2009-07-13 09:27:24 UTC (rev 
2339)
+++ packages/grass/trunk/debian/patches/00list  2009-07-13 11:37:38 UTC (rev 
2340)
@@ -3,3 +3,4 @@
 pager
 xterm
 instdir
+newlocation

Added: packages/grass/trunk/debian/patches/newlocation.dpatch
===================================================================
--- packages/grass/trunk/debian/patches/newlocation.dpatch                      
        (rev 0)
+++ packages/grass/trunk/debian/patches/newlocation.dpatch      2009-07-13 
11:37:38 UTC (rev 2340)
@@ -0,0 +1,90 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## newlocation.dpatch by Francesco Paolo Lovergine <fran...@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+...@dpatch@
+diff -urNad grass-6.4.0~rc5~/general/g.region/printwindow.c 
grass-6.4.0~rc5/general/g.region/printwindow.c
+--- grass-6.4.0~rc5~/general/g.region/printwindow.c    2008-12-19 
21:30:09.000000000 +0100
++++ grass-6.4.0~rc5/general/g.region/printwindow.c     2009-07-13 
13:32:55.000000000 +0200
+@@ -23,7 +23,7 @@
+     double longitude, latitude;
+ 
+     if (print_flag & PRINT_SH)
+-      x = -1;
++      x = G_projection() == PROJECTION_LL ? -1 : 0;   
+     else
+       x = window->proj;
+ 
+diff -urNad grass-6.4.0~rc5~/lib/gis/wind_format.c 
grass-6.4.0~rc5/lib/gis/wind_format.c
+--- grass-6.4.0~rc5~/lib/gis/wind_format.c     2009-06-06 07:16:37.000000000 
+0200
++++ grass-6.4.0~rc5/lib/gis/wind_format.c      2009-07-13 13:32:00.000000000 
+0200
+@@ -37,9 +37,10 @@
+ {
+     if (projection == PROJECTION_LL)
+       G_lat_format(north, buf);
++    else if (projection == -1)
++      format_double(north, buf, TRUE);
+     else
+-      format_double(north, buf);
+-
++      format_double(north, buf, FALSE);
+     return 0;
+ }
+ 
+@@ -59,10 +60,12 @@
+ int G_format_easting(double east, char *buf, int projection)
+ {
+     if (projection == PROJECTION_LL)
+-      G_lon_format(east, buf);
++      G_lon_format(east, buf);
++    else if (projection == -1)
++      format_double(east, buf, TRUE);
+     else
+-      format_double(east, buf);
+-
++      format_double(east, buf, FALSE);
++ 
+     return 0;
+ }
+ 
+@@ -82,24 +85,32 @@
+ int G_format_resolution(double res, char *buf, int projection)
+ {
+     if (projection == PROJECTION_LL)
+-      G_llres_format(res, buf);
++      G_llres_format(res, buf);
++    else if (projection == -1)
++      format_double(res, buf, TRUE);
+     else
+-      format_double(res, buf);
+-
++      format_double(res, buf, FALSE);
++ 
+     return 0;
+ }
+ 
+-static int format_double(double value, char *buf)
++/*
++ * 'full_prec' is boolean, FALSE uses %.8f,  TRUE uses %.15g
++ * The reason to have this is that for lat/lon "%.8f" is not
++ * enough to preserve fidelity once converted back into D:M:S,
++ * which leads to rounding errors, especially for resolution.
++ */
++static void format_double(double value, char *buf, int full_prec)
+ {
+     /* if the programmer has lied to G_format_resolution() about the
+         projection type in order to get FP values for lat/lon coords,
+         "%.8f" is not enough to preserve fidelity once converted
+         back into D:M:S, which leads to rounding errors. */
+-    if (G_projection() == PROJECTION_LL)
++    if (full_prec)
+       sprintf(buf, "%.15g", value);
+     else
+       sprintf(buf, "%.8f", value);
+     G_trim_decimal(buf);
+ 
+-    return 0;
++    return; 
+ }


Property changes on: packages/grass/trunk/debian/patches/newlocation.dpatch
___________________________________________________________________
Added: svn:executable
   + *


_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-grass-devel

Reply via email to