[postgis-users] AsSvg bug fixes

TECHER Jean David davidtecher at yahoo.fr
Mon Oct 25 06:50:04 PDT 2004


que les Y soient retournés c'est normal puisque le système de coordonnées en
SVG est de la forme

----------------------> X
|
|
|
\/
X
----------------------------------------------------------------
TECHER Jean David
Responsable Informatique 01MAP
e-mail: davidtecher at yahoo.fr
site: http://techer.pascal.free.fr/postgis/
------------------------------------------------------------
----- Original Message -----
From: "Olivier Courtin" <pnine at free.fr>
To: <postgis-users at postgis.refractions.net>
Sent: Monday, October 25, 2004 3:46 PM
Subject: [postgis-users] AsSvg bug fixes


> Hi,
>
> Some little fixes for AsSvg function (from postgis cvs) :
>
> 1) Y axe in SVG is reverse (i.e 0,0 point in upper left)
> 2) Relative path correction in print_svg_path_rel
>
>
>
>
> --- lwgeom_svg.c 2004-10-15 13:48:48.000000000 +0200
> +++ patched_lwgeom_svg.c 2004-10-25 15:37:47.000000000 +0200
> @@ -192,7 +192,7 @@
>
>   sprintf(x, "%.*f", precision, pt->x);
>   trim_trailing_zeros(x);
> - sprintf(y, "%.*f", precision, pt->y);
> + sprintf(y, "%.*f", precision, pt->y * -1);
>   trim_trailing_zeros(y);
>
>   sprintf(temp, "x=\"%s\" y=\"%s\"", x, y);
> @@ -211,7 +211,7 @@
>
>   sprintf(x, "%.*f", precision, pt->x);
>   trim_trailing_zeros(x);
> - sprintf(y, "%.*f", precision, pt->y);
> + sprintf(y, "%.*f", precision, pt->y * -1);
>   trim_trailing_zeros(y);
>
>   sprintf(temp, "cx=\"%s\" cy=\"%s\"", x, y);
> @@ -238,7 +238,7 @@
>   }
>   sprintf(x, "%.*f", precision, pt->x);
>   trim_trailing_zeros(x);
> - sprintf(y, "%.*f", precision, pt->y);
> + sprintf(y, "%.*f", precision, pt->y * -1);
>   trim_trailing_zeros(y);
>   result+= sprintf(result,"%s %s", x, y);
>   }
> @@ -259,7 +259,7 @@
>
>   sprintf(x, "%.*f", precision, pt->x);
>   trim_trailing_zeros(x);
> - sprintf(y, "%.*f", precision, pt->y);
> + sprintf(y, "%.*f", precision, pt->y * -1);
>   trim_trailing_zeros(y);
>
>   result += sprintf(result,"%s %s l", x, y);
> @@ -268,9 +268,9 @@
>   for (u=1; u<pa->npoints; u++)
>   {
>   pt = (POINT2D *)getPoint(pa, u);
> - sprintf(x, "%.*f", precision, pt->x);
> + sprintf(x, "%.*f", precision, pt->x - lpt->x);
>   trim_trailing_zeros(x);
> - sprintf(y, "%.*f", precision, pt->y);
> + sprintf(y, "%.*f", precision, (pt->y - lpt->y) * -1);
>   trim_trailing_zeros(y);
>   result+= sprintf(result," %s %s", x, y);
>   lpt = pt;
>
>
>
> HTH :)
>
> --
> Ol
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list