Skip to content

Commit

Permalink
tests for rounded values in polygonfromlayerextent algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondnijssen authored and m-kuhn committed May 11, 2019
1 parent 5936761 commit 6e62c02
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ polygon_from_extent_rounded_2.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-2</gml:X><gml:Y>-4</gml:Y></gml:coord>
<gml:coord><gml:X>12</gml:X><gml:Y>6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:polygon_from_extent_rounded_2 fid="polygon_from_extent_rounded_2.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-2,-4 12,-4 12,6 -2,6 -2,-4</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:MINX>-2</ogr:MINX>
<ogr:MINY>-4</ogr:MINY>
<ogr:MAXX>12</ogr:MAXX>
<ogr:MAXY>6</ogr:MAXY>
<ogr:CNTX>5</ogr:CNTX>
<ogr:CNTY>1</ogr:CNTY>
<ogr:AREA>140</ogr:AREA>
<ogr:PERIM>48</ogr:PERIM>
<ogr:HEIGHT>10</ogr:HEIGHT>
<ogr:WIDTH>14</ogr:WIDTH>
</ogr:polygon_from_extent_rounded_2>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,83 @@
<?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="polygon_from_extent_rounded_2" type="ogr:polygon_from_extent_rounded_2_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="polygon_from_extent_rounded_2_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PolygonPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="MINX" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MINY" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MAXX" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MAXY" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CNTX" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CNTY" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AREA" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PERIM" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="HEIGHT" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="WIDTH" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
26 changes: 26 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Expand Up @@ -1801,4 +1801,30 @@ tests:
name: expected/multipoint_delaunay.gml
type: vector

- algorithm: qgis:polygonfromlayerextent
name: Polygon from layer extent rounded to 0
params:
BY_FEATURE: false
INPUT:
name: polys.gml
type: vector
ROUND_TO: 0.0
results:
OUTPUT:
name: expected/polygon_from_extent.gml
type: vector

- algorithm: qgis:polygonfromlayerextent
name: Polygon from layer extent rounded to 2
params:
BY_FEATURE: false
INPUT:
name: lines.gml
type: vector
ROUND_TO: 2.0
results:
OUTPUT:
name: expected/polygon_from_extent_rounded_2.gml
type: vector

# See ../README.md for a description of the file format

0 comments on commit 6e62c02

Please sign in to comment.