Skip to content

Commit

Permalink
Added a test for VoronoiPolygon.py that covers some new cases
Browse files Browse the repository at this point in the history
(cherry-picked from 4b1bc82)
  • Loading branch information
havatv authored and nyalldawson committed Aug 8, 2018
1 parent acbb27c commit 2b6ef28
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ pointsvoronoi1diagram.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-0.6</gml:X><gml:Y>51.4</gml:Y></gml:coord>
<gml:coord><gml:X>0.2000000000000001</gml:X><gml:Y>51.6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.6,51.4 -0.6,51.5 -0.5,51.5 -0.5,51.4 -0.6,51.4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>10</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.5,51.5 -0.5,51.6 -0.275,51.6 -0.325,51.5 -0.5,51.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>7</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.5,51.4 -0.5,51.5 -0.325,51.5 -0.275,51.4 -0.5,51.4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>8</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.275,51.4 -0.325,51.5 -0.275,51.6 0.0,51.6 0.0,51.4 -0.275,51.4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>0.0,51.4 0.0,51.6 0.2,51.6 0.2,51.4 0.0,51.4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>2</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1diagram fid="pointsvoronoi1.4">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-0.6,51.5 -0.6,51.6 -0.5,51.6 -0.5,51.5 -0.6,51.5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>9</ogr:id>
</ogr:pointsvoronoi1diagram>
</gml:featureMember>
</ogr:FeatureCollection>
50 changes: 50 additions & 0 deletions python/plugins/processing/tests/testdata/pointsvoronoi1.gml
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ pointsvoronoi1.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-0.6</gml:X><gml:Y>51.4</gml:Y></gml:coord>
<gml:coord><gml:X>0.2</gml:X><gml:Y>51.6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.2,51.5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0.2,51.5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>2</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.4,51.6</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>7</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.4,51.4</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>8</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.6,51.6</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>9</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
<gml:featureMember>
<ogr:pointsvoronoi1 fid="pointsvoronoi1.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-0.6,51.4</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>10</ogr:id>
</ogr:pointsvoronoi1>
</gml:featureMember>
</ogr:FeatureCollection>
12 changes: 12 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml 100644 → 100755
Expand Up @@ -3558,6 +3558,18 @@ tests:
name: expected/voronoi_buffer.gml name: expected/voronoi_buffer.gml
type: vector type: vector


- algorithm: qgis:voronoipolygons
name: Vornoi with vertical and horizontal Voronoi edges
params:
BUFFER: 0.0
INPUT:
name: pointsvoronoi1.gml
type: vector
results:
OUTPUT:
name: expected/pointsvoronoi1diagram.gml
type: vector

- algorithm: native:explodelines - algorithm: native:explodelines
name: Explode lines name: Explode lines
params: params:
Expand Down

0 comments on commit 2b6ef28

Please sign in to comment.