Skip to content

Commit 8a96573

Browse files
committed
Port Union algorithm to c++ using existing intersection+difference algs
1 parent 85b2efa commit 8a96573

File tree

12 files changed

+417
-256
lines changed

12 files changed

+417
-256
lines changed

python/plugins/processing/algs/help/qgis.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,6 @@ qgis:truncatetable: >
530530

531531
Warning - this algorithm modifies the layer in place, and deleted features cannot be restored!
532532

533-
qgis:union: >
534-
This algorithm creates a layer containing all the features from both input layers. In the case of polygon layers, separate features are created for overlapping and non-overlapping features. The attribute table of the union layer contains attribute values from the respective input layer for non-overlapping features, and attribute values from both input layers for overlapping features.
535-
536-
537533
qgis:variabledistancebuffer: >
538534
This algorithm computes a buffer area for all the features in an input layer. The size of the buffer for a given feature is defined by an attribute, so it allows different features to have different buffer sizes.
539535

python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py

-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
from .TinInterpolation import TinInterpolation
138138
from .TopoColors import TopoColor
139139
from .TruncateTable import TruncateTable
140-
from .Union import Union
141140
from .UniqueValues import UniqueValues
142141
from .VariableDistanceBuffer import VariableDistanceBuffer
143142
from .VectorSplit import VectorSplit
@@ -253,7 +252,6 @@ def getAlgs(self):
253252
TinInterpolation(),
254253
TopoColor(),
255254
TruncateTable(),
256-
Union(),
257255
UniqueValues(),
258256
VariableDistanceBuffer(),
259257
VectorSplit(),

python/plugins/processing/algs/qgis/Union.py

-250
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ union1.xsd"
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>0</gml:X><gml:Y>1</gml:Y></gml:coord>
10+
<gml:coord><gml:X>9</gml:X><gml:Y>11</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:union1 fid="union1.0">
16+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,6 2,5 1,5 1,6 2,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
17+
<ogr:id_a>A1</ogr:id_a>
18+
<ogr:id_b>B2</ogr:id_b>
19+
</ogr:union1>
20+
</gml:featureMember>
21+
<gml:featureMember>
22+
<ogr:union1 fid="union1.1">
23+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,5 3,5 3,6 4,6 4,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
24+
<ogr:id_a>A2</ogr:id_a>
25+
<ogr:id_b>B2</ogr:id_b>
26+
</ogr:union1>
27+
</gml:featureMember>
28+
<gml:featureMember>
29+
<ogr:union1 fid="union1.2">
30+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,7 7,7 7,8 8,8 8,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
31+
<ogr:id_a>A3</ogr:id_a>
32+
<ogr:id_b>B1</ogr:id_b>
33+
</ogr:union1>
34+
</gml:featureMember>
35+
<gml:featureMember>
36+
<ogr:union1 fid="union1.3">
37+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,7 5,7 5,8 6,8 6,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
38+
<ogr:id_a>A3</ogr:id_a>
39+
<ogr:id_b>B3</ogr:id_b>
40+
</ogr:union1>
41+
</gml:featureMember>
42+
<gml:featureMember>
43+
<ogr:union1 fid="union1.4">
44+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,5 2,3 1,3 1,5 2,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,6 1,11 8,11 8,10 2,10 2,6 1,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
45+
<ogr:id_a>A1</ogr:id_a>
46+
<ogr:id_b xsi:nil="true"/>
47+
</ogr:union1>
48+
</gml:featureMember>
49+
<gml:featureMember>
50+
<ogr:union1 fid="union1.5">
51+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,3 3,4 4,4 4,3 3,3</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
52+
<ogr:id_a>A4</ogr:id_a>
53+
<ogr:id_b xsi:nil="true"/>
54+
</ogr:union1>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ogr:union1 fid="union1.6">
58+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>4,6 6,6 6,5 4,5 4,6</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
59+
<ogr:id_a>A2</ogr:id_a>
60+
<ogr:id_b xsi:nil="true"/>
61+
</ogr:union1>
62+
</gml:featureMember>
63+
<gml:featureMember>
64+
<ogr:union1 fid="union1.7">
65+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7,7 6,7 6,8 7,8 7,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,8 9,8 9,7 8,7 8,8</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
66+
<ogr:id_a>A3</ogr:id_a>
67+
<ogr:id_b xsi:nil="true"/>
68+
</ogr:union1>
69+
</gml:featureMember>
70+
<gml:featureMember>
71+
<ogr:union1 fid="union1.8">
72+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>8,7 8,1 1,1 1,2 7,2 7,7 8,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>7,8 7,9 8,9 8,8 7,8</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
73+
<ogr:id_a xsi:nil="true"/>
74+
<ogr:id_b>B1</ogr:id_b>
75+
</ogr:union1>
76+
</gml:featureMember>
77+
<gml:featureMember>
78+
<ogr:union1 fid="union1.9">
79+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,3 6,3 6,4 5,4 5,3</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
80+
<ogr:id_a xsi:nil="true"/>
81+
<ogr:id_b>B4</ogr:id_b>
82+
</ogr:union1>
83+
</gml:featureMember>
84+
<gml:featureMember>
85+
<ogr:union1 fid="union1.10">
86+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1,5 0,5 0,6 1,6 1,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,5 2,5 2,6 3,6 3,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
87+
<ogr:id_a xsi:nil="true"/>
88+
<ogr:id_b>B2</ogr:id_b>
89+
</ogr:union1>
90+
</gml:featureMember>
91+
<gml:featureMember>
92+
<ogr:union1 fid="union1.11">
93+
<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,7 3,7 3,8 5,8 5,7</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogr:geometryProperty>
94+
<ogr:id_a xsi:nil="true"/>
95+
<ogr:id_b>B3</ogr:id_b>
96+
</ogr:union1>
97+
</gml:featureMember>
98+
</ogr:FeatureCollection>

0 commit comments

Comments
 (0)