Skip to content
Permalink
Browse files

[processing] Buffer algorithm should always export multipolygon layers

We can never predict when a buffer will create a multipolygon output
(e.g. for negative buffer sizes), so ALWAYS export multipolygons

Fixes #21191
  • Loading branch information
nyalldawson committed Feb 8, 2019
1 parent 09407c1 commit f22f182bcfd7b7f5b5d8f782f3df08ee9d705115
Showing with 256 additions and 184 deletions.
  1. +0 −15 python/plugins/processing/tests/testdata/expected/buffer_lines.gfs
  2. +7 −7 python/plugins/processing/tests/testdata/expected/buffer_lines.gml
  3. +23 −0 python/plugins/processing/tests/testdata/expected/buffer_lines.xsd
  4. +0 −15 python/plugins/processing/tests/testdata/expected/buffer_lines_flat.gfs
  5. +7 −7 python/plugins/processing/tests/testdata/expected/buffer_lines_flat.gml
  6. +23 −0 python/plugins/processing/tests/testdata/expected/buffer_lines_flat.xsd
  7. +0 −15 python/plugins/processing/tests/testdata/expected/buffer_lines_square.gfs
  8. +7 −7 python/plugins/processing/tests/testdata/expected/buffer_lines_square.gml
  9. +23 −0 python/plugins/processing/tests/testdata/expected/buffer_lines_square.xsd
  10. +0 −32 python/plugins/processing/tests/testdata/expected/buffer_polys.gfs
  11. +9 −6 python/plugins/processing/tests/testdata/expected/buffer_polys.gml
  12. +43 −0 python/plugins/processing/tests/testdata/expected/buffer_polys.xsd
  13. +0 −31 python/plugins/processing/tests/testdata/expected/buffer_polys_bevel.gfs
  14. +9 −6 python/plugins/processing/tests/testdata/expected/buffer_polys_bevel.gml
  15. +43 −0 python/plugins/processing/tests/testdata/expected/buffer_polys_bevel.xsd
  16. +4 −4 python/plugins/processing/tests/testdata/expected/buffer_polys_dissolve.gml
  17. +1 −1 python/plugins/processing/tests/testdata/expected/buffer_polys_dissolve.xsd
  18. +0 −31 python/plugins/processing/tests/testdata/expected/buffer_polys_miter.gfs
  19. +9 −6 python/plugins/processing/tests/testdata/expected/buffer_polys_miter.gml
  20. +43 −0 python/plugins/processing/tests/testdata/expected/buffer_polys_miter.xsd
  21. +5 −1 src/analysis/processing/qgsalgorithmbuffer.cpp

This file was deleted.

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xsi:schemaLocation="http://ogr.maptools.org/ buffer_lines.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
@@ -13,32 +13,32 @@

<gml:featureMember>
<ogr:buffer_lines fid="lines.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,3 8.034074173710932,3.258819045102521 8.133974596215561,3.5 8.292893218813452,3.707106781186547 10.292893218813452,5.707106781186548 10.546009500260455,5.891006524188368 10.843565534959771,5.987688340595138 11.156434465040231,5.987688340595137 11.453990499739547,5.891006524188367 11.707106781186548,5.707106781186548 11.891006524188368,5.453990499739547 11.987688340595138,5.156434465040232 11.987688340595138,4.843565534959771 11.891006524188368,4.546009500260455 11.70710678118655,4.292893218813454 10.0,2.585786437626905 10,2 9.951056516295154,1.690983005625053 9.809016994374947,1.412214747707527 9.587785252292473,1.190983005625053 9.309016994374947,1.048943483704846 9,1 6,1 5.690983005625051,1.048943483704847 5.412214747707526,1.190983005625053 5.190983005625052,1.412214747707528 5.048943483704846,1.690983005625053 5,2 5.048943483704846,2.309016994374947 5.190983005625052,2.587785252292472 5.412214747707526,2.809016994374947 5.690983005625051,2.951056516295153 6.0,3.0 8,3</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,3 8.03407417371093,3.25881904510252 8.13397459621556,3.5 8.29289321881345,3.70710678118655 10.2928932188135,5.70710678118655 10.5460095002605,5.89100652418837 10.8435655349598,5.98768834059514 11.1564344650402,5.98768834059514 11.4539904997395,5.89100652418837 11.7071067811865,5.70710678118655 11.8910065241884,5.45399049973955 11.9876883405951,5.15643446504023 11.9876883405951,4.84356553495977 11.8910065241884,4.54600950026046 11.7071067811865,4.29289321881345 10.0,2.5857864376269 10,2 9.95105651629515,1.69098300562505 9.80901699437495,1.41221474770753 9.58778525229247,1.19098300562505 9.30901699437495,1.04894348370485 9,1 6,1 5.69098300562505,1.04894348370485 5.41221474770753,1.19098300562505 5.19098300562505,1.41221474770753 5.04894348370485,1.69098300562505 5,2 5.04894348370485,2.30901699437495 5.19098300562505,2.58778525229247 5.41221474770753,2.80901699437495 5.69098300562505,2.95105651629515 6.0,3.0 8,3</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_lines fid="lines.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,0 1.309016994374949,-0.048943483704847 1.587785252292474,-0.190983005625053 1.809016994374948,-0.412214747707527 1.951056516295154,-0.690983005625053 2.0,-1.0 1.951056516295154,-1.309016994374947 1.809016994374948,-1.587785252292472 1.587785252292474,-1.809016994374947 1.309016994374949,-1.951056516295153 1.0,-2.0 -1,-2 -1.309016994374949,-1.951056516295153 -1.587785252292474,-1.809016994374947 -1.809016994374948,-1.587785252292472 -1.951056516295154,-1.309016994374947 -2.0,-1.0 -1.951056516295154,-0.690983005625053 -1.809016994374948,-0.412214747707528 -1.587785252292474,-0.190983005625053 -1.309016994374949,-0.048943483704847 -1.0,0.0 1,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,0 1.30901699437495,-0.048943483704847 1.58778525229247,-0.190983005625053 1.80901699437495,-0.412214747707527 1.95105651629515,-0.690983005625053 2.0,-1.0 1.95105651629515,-1.30901699437495 1.80901699437495,-1.58778525229247 1.58778525229247,-1.80901699437495 1.30901699437495,-1.95105651629515 1.0,-2.0 -1,-2 -1.30901699437495,-1.95105651629515 -1.58778525229247,-1.80901699437495 -1.80901699437495,-1.58778525229247 -1.95105651629515,-1.30901699437495 -2.0,-1.0 -1.95105651629515,-0.690983005625053 -1.80901699437495,-0.412214747707528 -1.58778525229247,-0.190983005625053 -1.30901699437495,-0.048943483704847 -1.0,0.0 1,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_lines fid="lines.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 1.048943483704846,2.309016994374947 1.190983005625053,2.587785252292473 1.412214747707527,2.809016994374947 1.690983005625053,2.951056516295154 2,3 2.048943483704847,3.309016994374949 2.190983005625053,3.587785252292474 2.412214747707528,3.809016994374948 2.690983005625053,3.951056516295154 3,4 3.309016994374947,3.951056516295154 3.587785252292472,3.809016994374948 3.809016994374947,3.587785252292474 3.951056516295153,3.309016994374949 4.0,3.0 4,2 3.951056516295154,1.690983005625053 3.809016994374947,1.412214747707527 3.587785252292473,1.190983005625053 3.309016994374947,1.048943483704846 3,1 3,0 2.951056516295153,-0.309016994374949 2.809016994374947,-0.587785252292474 2.587785252292472,-0.809016994374948 2.309016994374947,-0.951056516295154 2.0,-1.0 1.690983005625053,-0.951056516295154 1.412214747707528,-0.809016994374948 1.190983005625054,-0.587785252292475 1.048943483704847,-0.309016994374949 1.0,-0.0 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,2 1.04894348370485,2.30901699437495 1.19098300562505,2.58778525229247 1.41221474770753,2.80901699437495 1.69098300562505,2.95105651629515 2,3 2.04894348370485,3.30901699437495 2.19098300562505,3.58778525229247 2.41221474770753,3.80901699437495 2.69098300562505,3.95105651629515 3,4 3.30901699437495,3.95105651629515 3.58778525229247,3.80901699437495 3.80901699437495,3.58778525229247 3.95105651629515,3.30901699437495 4.0,3.0 4,2 3.95105651629515,1.69098300562505 3.80901699437495,1.41221474770753 3.58778525229247,1.19098300562505 3.30901699437495,1.04894348370485 3,1 3,0 2.95105651629515,-0.309016994374949 2.80901699437495,-0.587785252292474 2.58778525229247,-0.809016994374948 2.30901699437495,-0.951056516295154 2.0,-1.0 1.69098300562505,-0.951056516295154 1.41221474770753,-0.809016994374948 1.19098300562505,-0.587785252292475 1.04894348370485,-0.309016994374949 1.0,-0.0 1,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_lines fid="lines.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,2 5.309016994374948,1.951056516295153 5.587785252292474,1.809016994374947 5.809016994374947,1.587785252292473 5.951056516295154,1.309016994374947 6.0,1.0 5.951056516295154,0.690983005625053 5.809016994374948,0.412214747707528 5.587785252292474,0.190983005625054 5.309016994374949,0.048943483704847 5.0,0.0 3,0 2.690983005625051,0.048943483704847 2.412214747707526,0.190983005625053 2.190983005625052,0.412214747707528 2.048943483704846,0.690983005625053 2.0,1.0 2.048943483704846,1.309016994374947 2.190983005625052,1.587785252292472 2.412214747707526,1.809016994374947 2.690983005625051,1.951056516295153 3.0,2.0 5,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,2 5.30901699437495,1.95105651629515 5.58778525229247,1.80901699437495 5.80901699437495,1.58778525229247 5.95105651629515,1.30901699437495 6.0,1.0 5.95105651629515,0.690983005625053 5.80901699437495,0.412214747707528 5.58778525229247,0.190983005625054 5.30901699437495,0.048943483704847 5.0,0.0 3,0 2.69098300562505,0.048943483704847 2.41221474770753,0.190983005625053 2.19098300562505,0.412214747707528 2.04894348370485,0.690983005625053 2.0,1.0 2.04894348370485,1.30901699437495 2.19098300562505,1.58778525229247 2.41221474770753,1.80901699437495 2.69098300562505,1.95105651629515 3.0,2.0 5,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_lines fid="lines.4">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>10,-2 10.309016994374948,-2.048943483704847 10.587785252292473,-2.190983005625053 10.809016994374948,-2.412214747707528 10.951056516295154,-2.690983005625053 11,-3 10.951056516295154,-3.309016994374947 10.809016994374948,-3.587785252292472 10.587785252292475,-3.809016994374947 10.30901699437495,-3.951056516295153 10.0,-4.0 7,-4 6.690983005625051,-3.951056516295153 6.412214747707526,-3.809016994374947 6.190983005625052,-3.587785252292472 6.048943483704846,-3.309016994374947 6,-3 6.048943483704846,-2.690983005625053 6.190983005625052,-2.412214747707528 6.412214747707526,-2.190983005625053 6.690983005625051,-2.048943483704847 7.0,-2.0 10,-2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>10,-2 10.3090169943749,-2.04894348370485 10.5877852522925,-2.19098300562505 10.8090169943749,-2.41221474770753 10.9510565162952,-2.69098300562505 11,-3 10.9510565162952,-3.30901699437495 10.8090169943749,-3.58778525229247 10.5877852522925,-3.80901699437495 10.309016994375,-3.95105651629515 10.0,-4.0 7,-4 6.69098300562505,-3.95105651629515 6.41221474770753,-3.80901699437495 6.19098300562505,-3.58778525229247 6.04894348370485,-3.30901699437495 6,-3 6.04894348370485,-2.69098300562505 6.19098300562505,-2.41221474770753 6.41221474770753,-2.19098300562505 6.69098300562505,-2.04894348370485 7.0,-2.0 10,-2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
<ogr:buffer_lines fid="lines.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.292893218813452,1.707106781186547 9.546009500260455,1.891006524188368 9.843565534959771,1.987688340595138 10.156434465040231,1.987688340595138 10.453990499739547,1.891006524188368 10.707106781186548,1.707106781186547 10.891006524188368,1.453990499739547 10.987688340595138,1.156434465040232 10.987688340595138,0.84356553495977 10.891006524188368,0.546009500260455 10.70710678118655,0.292893218813454 6.707106781186548,-3.707106781186547 6.453990499739546,-3.891006524188368 6.15643446504023,-3.987688340595138 5.843565534959769,-3.987688340595138 5.546009500260453,-3.891006524188368 5.292893218813452,-3.707106781186547 5.108993475811633,-3.453990499739548 5.012311659404863,-3.156434465040232 5.012311659404862,-2.843565534959771 5.108993475811631,-2.546009500260455 5.29289321881345,-2.292893218813454 9.292893218813452,1.707106781186547</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9.29289321881345,1.70710678118655 9.54600950026046,1.89100652418837 9.84356553495977,1.98768834059514 10.1564344650402,1.98768834059514 10.4539904997395,1.89100652418837 10.7071067811865,1.70710678118655 10.8910065241884,1.45399049973955 10.9876883405951,1.15643446504023 10.9876883405951,0.84356553495977 10.8910065241884,0.546009500260455 10.7071067811865,0.292893218813454 6.70710678118655,-3.70710678118655 6.45399049973955,-3.89100652418837 6.15643446504023,-3.98768834059514 5.84356553495977,-3.98768834059514 5.54600950026045,-3.89100652418837 5.29289321881345,-3.70710678118655 5.10899347581163,-3.45399049973955 5.01231165940486,-3.15643446504023 5.01231165940486,-2.84356553495977 5.10899347581163,-2.54600950026046 5.29289321881345,-2.29289321881345 9.29289321881345,1.70710678118655</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
</ogr:buffer_lines>
</gml:featureMember>
<gml:featureMember>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="buffer_lines" type="ogr:buffer_lines_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="buffer_lines_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:MultiPolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

This file was deleted.

0 comments on commit f22f182

Please sign in to comment.
You can’t perform that action at this time.