Changeset 4682 for trunk/postgis/lwgeom_gml.c
 Timestamp:
 Oct 27, 2009 2:39:35 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/postgis/lwgeom_gml.c
r4535 r4682 460 460 POINT2D pt; 461 461 getPoint2d_p(pa, i, &pt); 462 sprintf(x, "%.*f", precision, pt.x); 462 463 if (fabs(pt.x) < MAX_DOUBLE) 464 sprintf(x, "%.*f", precision, pt.x); 465 else 466 sprintf(x, "%g", pt.x); 463 467 trim_trailing_zeros(x); 464 sprintf(y, "%.*f", precision, pt.y); 468 469 if (fabs(pt.y) < MAX_DOUBLE) 470 sprintf(y, "%.*f", precision, pt.y); 471 else 472 sprintf(y, "%g", pt.y); 465 473 trim_trailing_zeros(y); 474 466 475 if ( i ) ptr += sprintf(ptr, " "); 467 476 ptr += sprintf(ptr, "%s,%s", x, y); … … 474 483 POINT4D pt; 475 484 getPoint4d_p(pa, i, &pt); 476 sprintf(x, "%.*f", precision, pt.x); 485 486 if (fabs(pt.x) < MAX_DOUBLE) 487 sprintf(x, "%.*f", precision, pt.x); 488 else 489 sprintf(x, "%g", pt.x); 477 490 trim_trailing_zeros(x); 478 sprintf(y, "%.*f", precision, pt.y); 491 492 if (fabs(pt.y) < MAX_DOUBLE) 493 sprintf(y, "%.*f", precision, pt.y); 494 else 495 sprintf(y, "%g", pt.y); 479 496 trim_trailing_zeros(y); 480 sprintf(z, "%.*f", precision, pt.z); 497 498 if (fabs(pt.z) < MAX_DOUBLE) 499 sprintf(z, "%.*f", precision, pt.z); 500 else 501 sprintf(z, "%g", pt.z); 481 502 trim_trailing_zeros(z); 503 482 504 if ( i ) ptr += sprintf(ptr, " "); 483 505 ptr += sprintf(ptr, "%s,%s,%s", x, y, z); … … 840 862 POINT2D pt; 841 863 getPoint2d_p(pa, i, &pt); 842 sprintf(x, "%.*f", precision, pt.x); 864 865 if (fabs(pt.x) < MAX_DOUBLE) 866 sprintf(x, "%.*f", precision, pt.x); 867 else 868 sprintf(x, "%g", pt.x); 843 869 trim_trailing_zeros(x); 844 sprintf(y, "%.*f", precision, pt.y); 870 871 if (fabs(pt.y) < MAX_DOUBLE) 872 sprintf(y, "%.*f", precision, pt.y); 873 else 874 sprintf(y, "%g", pt.y); 845 875 trim_trailing_zeros(y); 876 846 877 if ( i ) ptr += sprintf(ptr, " "); 847 878 if (is_deegree) … … 857 888 POINT4D pt; 858 889 getPoint4d_p(pa, i, &pt); 859 sprintf(x, "%.*f", precision, pt.x); 890 891 if (fabs(pt.x) < MAX_DOUBLE) 892 sprintf(x, "%.*f", precision, pt.x); 893 else 894 sprintf(x, "%g", pt.x); 860 895 trim_trailing_zeros(x); 861 sprintf(y, "%.*f", precision, pt.y); 896 897 if (fabs(pt.y) < MAX_DOUBLE) 898 sprintf(y, "%.*f", precision, pt.y); 899 else 900 sprintf(y, "%g", pt.y); 862 901 trim_trailing_zeros(y); 863 sprintf(z, "%.*f", precision, pt.z); 902 903 if (fabs(pt.z) < MAX_DOUBLE) 904 sprintf(z, "%.*f", precision, pt.z); 905 else 906 sprintf(z, "%g", pt.z); 864 907 trim_trailing_zeros(z); 908 865 909 if ( i ) ptr += sprintf(ptr, " "); 866 910 if (is_deegree)
Note: See TracChangeset
for help on using the changeset viewer.