]> granicus.if.org Git - postgis/commitdiff
For buffer parameters: accept 'butt' as a synonim for 'flat', 'miter' for 'mitre...
authorSandro Santilli <strk@keybit.net>
Tue, 7 Jul 2009 15:03:50 +0000 (15:03 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 7 Jul 2009 15:03:50 +0000 (15:03 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4266 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference.xml
postgis/lwgeom_geos.c
regress/regress_buffer_params.sql
regress/regress_buffer_params_expected

index e0cc9ca47dc892c19a547832a48ff143e4d4cb33..ab9e7687c77fed63f5b06b308166433028ec7a70 100644 (file)
@@ -11598,13 +11598,13 @@ The optional third parameter can either specify number of segments used to appro
 'quad_segs=#' : number of segments used to approximate a quarter circle (defaults to 8).
 </listitem>
 <listitem>
-'endcap=round|flat|square' : endcap style (defaults to "round", needs GEOS-3.2 or higher for a different value).
+'endcap=round|flat|square' : endcap style (defaults to "round", needs GEOS-3.2 or higher for a different value). 'butt' is also accepted as a synonim for 'flat'.
 </listitem>
 <listitem>
-'join=round|mitre|bevel' : join style (defaults to "round", needs GEOS-3.2 or higher for a different value).
+'join=round|mitre|bevel' : join style (defaults to "round", needs GEOS-3.2 or higher for a different value). 'miter' is also accepted as a synonim for 'mitre'.
 </listitem>
 <listitem>
-'mitre_limit=#.#' : mitre ratio limit (only affects mitred join style).
+'mitre_limit=#.#' : mitre ratio limit (only affects mitred join style). 'miter_limit' is also accepted as a synonim for 'mitre_limit'.
 </listitem>
 </itemizedlist>
                                </para>
index eb785c31a0545a2e38dd97bb708002fb903f7247..bb5e9c6404566fe0a47f6acf0682af96b7ca54c9 100644 (file)
@@ -911,7 +911,8 @@ Datum buffer(PG_FUNCTION_ARGS)
                                {
                                        endCapStyle = ENDCAP_ROUND;
                                }
-                               else if ( !strcmp(val, "flat") )
+                               else if ( !strcmp(val, "flat") ||
+                                         !strcmp(val, "butt")    )
                                {
                                        endCapStyle = ENDCAP_FLAT;
                                }
@@ -923,7 +924,8 @@ Datum buffer(PG_FUNCTION_ARGS)
                                {
                                        lwerror("Invalid buffer end cap "
                                                "style: %s (accept: "
-                                               "'round', 'flat' or 'square'"
+                                               "'round', 'flat', 'butt' "
+                                               "or 'square'"
                                                ")", val);
                                        break;
                                }
@@ -935,7 +937,8 @@ Datum buffer(PG_FUNCTION_ARGS)
                                {
                                        joinStyle = JOIN_ROUND;
                                }
-                               else if ( !strcmp(val, "mitre") )
+                               else if ( !strcmp(val, "mitre") ||
+                                         !strcmp(val, "miter")    )
                                {
                                        joinStyle = JOIN_MITRE;
                                }
@@ -947,12 +950,14 @@ Datum buffer(PG_FUNCTION_ARGS)
                                {
                                        lwerror("Invalid buffer end cap "
                                                "style: %s (accept: "
-                                               "'round', 'mitre' or 'bevel'"
+                                               "'round', 'mitre', 'miter' "
+                                               " or 'bevel'"
                                                ")", val);
                                        break;
                                }
                        }
-                       else if ( !strcmp(key, "mitre_limit") )
+                       else if ( !strcmp(key, "mitre_limit") ||
+                                 !strcmp(key, "miter_limit")    ) 
                        {
                                /* mitreLimit is a float */
                                mitreLimit = atof(val);
@@ -965,7 +970,8 @@ Datum buffer(PG_FUNCTION_ARGS)
                        else
                        {
                                lwerror("Invalid buffer parameter: %s (accept: "
-                                       "'endcap', 'join', 'mitre_limit' and "
+                                       "'endcap', 'join', 'mitre_limit', "
+                                       "'miter_limit and "
                                        "'quad_segs')", key);
                                break;
                        }
index 211d2dba337041354610e12c71fed6f37b29ebbe..6f66e00e10ec8b58dc23e1d6be922ad7db068613 100644 (file)
@@ -8,9 +8,11 @@
 SELECT 'point quadsegs=2', astext(SnapToGrid(st_buffer('POINT(0 0)', 1, 'quad_segs=2'), 1.0e-6));
 SELECT 'line quadsegs=2', astext(SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2'), 1.0e-6));
 SELECT 'line quadsegs=2 endcap=flat', astext(SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=flat'), 1.0e-6));
+SELECT 'line quadsegs=2 endcap=butt', astext(SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=butt'), 1.0e-6));
 SELECT 'line quadsegs=2 endcap=square', astext(SnapToGrid(st_buffer('LINESTRING(0 0, 10 0)', 2, 'quad_segs=2 endcap=square'), 1.0e-6));
 SELECT 'poly quadsegs=2 join=round', astext(SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=round'), 1.0e-6));
 SELECT 'poly quadsegs=2 join=bevel', astext(SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=bevel'), 1.0e-6));
 SELECT 'poly quadsegs=2 join=mitre', astext(SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre'), 1.0e-6));
 SELECT 'poly quadsegs=2 join=mitre mitre_limit=1', astext(SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=mitre mitre_limit=1'), 1.0e-6));
+SELECT 'poly quadsegs=2 join=miter miter_limit=1', astext(SnapToGrid(st_buffer('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))', 2, 'quad_segs=2 join=miter miter_limit=1'), 1.0e-6));
 
index 12129110d5fc9fdd6184c3e03b523d2e17c121fd..0a8866308781babc6165e456429b3e3cadb58161 100644 (file)
@@ -1,8 +1,10 @@
 point quadsegs=2|POLYGON((1 0,0.707107 -0.707107,0 -1,-0.707107 -0.707107,-1 0,-0.707107 0.707107,0 1,0.707107 0.707107,1 0))
 line quadsegs=2|POLYGON((10 2,11.414214 1.414214,12 0,11.414214 -1.414214,10 -2,0 -2,-1.414214 -1.414214,-2 0,-1.414214 1.414214,0 2,10 2))
 line quadsegs=2 endcap=flat|POLYGON((10 2,10 -2,0 -2,0 2,10 2))
+line quadsegs=2 endcap=butt|POLYGON((10 2,10 -2,0 -2,0 2,10 2))
 line quadsegs=2 endcap=square|POLYGON((10 2,12 2,12 -2,0 -2,-2 -2,-2 2,10 2))
 poly quadsegs=2 join=round|POLYGON((-2 0,-2 10,-1.414214 11.414214,0 12,10 12,11.414214 11.414214,12 10,12 0,11.414214 -1.414214,10 -2,0 -2,-1.414214 -1.414214,-2 0))
 poly quadsegs=2 join=bevel|POLYGON((-2 0,-2 10,0 12,10 12,12 10,12 0,10 -2,0 -2,-2 0))
 poly quadsegs=2 join=mitre|POLYGON((-2 -2,-2 12,12 12,12 -2,-2 -2))
 poly quadsegs=2 join=mitre mitre_limit=1|POLYGON((-1.828427 -1,-1.828427 11,-1 11.828427,11 11.828427,11.828427 11,11.828427 -1,11 -1.828427,-1 -1.828427,-1.828427 -1))
+poly quadsegs=2 join=miter miter_limit=1|POLYGON((-1.828427 -1,-1.828427 11,-1 11.828427,11 11.828427,11.828427 11,11.828427 -1,11 -1.828427,-1 -1.828427,-1.828427 -1))