Skip to content

Commit cc19d0a

Browse files
committed
Port hub lines algorithm to c++
Also: - optimise a bit - retain z/m values - use point on surface for non-point layers, instead of center of geometry bounding box
1 parent cac171a commit cc19d0a

File tree

10 files changed

+422
-147
lines changed

10 files changed

+422
-147
lines changed

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

-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,6 @@ qgis:generatepointspixelcentroidsalongline:
236236
qgis:generatepointspixelcentroidsinsidepolygons:
237237

238238

239-
qgis:hublines:
240-
This algorithm creates hub and spoke diagrams with lines drawn from points on the Spoke Point layer to matching points in the Hub Point layer.
241-
242-
Determination of which hub goes with each point is based on a match between the Hub ID field on the hub points and the Spoke ID field on the spoke points.
243-
244239
qgis:hypsometriccurves: >
245240
This algorithm computes hypsometric curves for an input Digital Elevation Model. Curves are produced as table files in an output folder specified by the user.
246241

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

-139
This file was deleted.

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

-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
from .Hillshade import Hillshade
8585
from .HubDistanceLines import HubDistanceLines
8686
from .HubDistancePoints import HubDistancePoints
87-
from .HubLines import HubLines
8887
from .HypsometricCurves import HypsometricCurves
8988
from .IdwInterpolation import IdwInterpolation
9089
from .ImportIntoPostGIS import ImportIntoPostGIS
@@ -216,7 +215,6 @@ def getAlgs(self):
216215
Hillshade(),
217216
HubDistanceLines(),
218217
HubDistancePoints(),
219-
HubLines(),
220218
HypsometricCurves(),
221219
IdwInterpolation(),
222220
ImportIntoPostGIS(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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/ hub_lines_multi_to_z.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>-5</gml:Y><gml:Z>0</gml:Z></gml:coord>
10+
<gml:coord><gml:X>7</gml:X><gml:Y>2</gml:Y><gml:Z>4</gml:Z></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:hub_lines_multi_to_z fid="points.3">
16+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>5,2,0 2,2,2</gml:coordinates></gml:LineString></ogr:geometryProperty>
17+
<ogr:d>2</ogr:d>
18+
<ogr:fid_2>points.2</ogr:fid_2>
19+
<ogr:elev>2</ogr:elev>
20+
</ogr:hub_lines_multi_to_z>
21+
</gml:featureMember>
22+
<gml:featureMember>
23+
<ogr:hub_lines_multi_to_z fid="points.5">
24+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0,-5,0 1,1,3</gml:coordinates></gml:LineString></ogr:geometryProperty>
25+
<ogr:d>3</ogr:d>
26+
<ogr:fid_2>points.0</ogr:fid_2>
27+
<ogr:elev>3</ogr:elev>
28+
</ogr:hub_lines_multi_to_z>
29+
</gml:featureMember>
30+
<gml:featureMember>
31+
<ogr:hub_lines_multi_to_z fid="points.7">
32+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>7,-1,0 0,-1,4</gml:coordinates></gml:LineString></ogr:geometryProperty>
33+
<ogr:d>4</ogr:d>
34+
<ogr:fid_2>points.8</ogr:fid_2>
35+
<ogr:elev>4</ogr:elev>
36+
</ogr:hub_lines_multi_to_z>
37+
</gml:featureMember>
38+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="hub_lines_multi_to_z" type="ogr:hub_lines_multi_to_z_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="hub_lines_multi_to_z_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:LineStringPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="d" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:integer">
22+
<xs:totalDigits value="10"/>
23+
</xs:restriction>
24+
</xs:simpleType>
25+
</xs:element>
26+
<xs:element name="fid_2" nillable="true" minOccurs="0" maxOccurs="1">
27+
<xs:simpleType>
28+
<xs:restriction base="xs:string">
29+
<xs:maxLength value="255"/>
30+
</xs:restriction>
31+
</xs:simpleType>
32+
</xs:element>
33+
<xs:element name="elev" nillable="true" minOccurs="0" maxOccurs="1">
34+
<xs:simpleType>
35+
<xs:restriction base="xs:integer">
36+
<xs:totalDigits value="10"/>
37+
</xs:restriction>
38+
</xs:simpleType>
39+
</xs:element>
40+
</xs:sequence>
41+
</xs:extension>
42+
</xs:complexContent>
43+
</xs:complexType>
44+
</xs:schema>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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/ hub_lines_to_poly.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.5</gml:X><gml:Y>0</gml:Y></gml:coord>
10+
<gml:coord><gml:X>4.672552783109405</gml:X><gml:Y>5.588675623800385</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:hub_lines_to_poly fid="polys.0">
16+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0.5,0.5 1,1</gml:coordinates></gml:LineString></ogr:geometryProperty>
17+
<ogr:name>aa</ogr:name>
18+
<ogr:intval>1</ogr:intval>
19+
<ogr:floatval>44.123456</ogr:floatval>
20+
<ogr:fid_2>points.0</ogr:fid_2>
21+
<ogr:id>1</ogr:id>
22+
<ogr:id2>2</ogr:id2>
23+
</ogr:hub_lines_to_poly>
24+
</gml:featureMember>
25+
<gml:featureMember>
26+
<ogr:hub_lines_to_poly fid="polys.2">
27+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>2.5,5.5 1,1</gml:coordinates></gml:LineString></ogr:geometryProperty>
28+
<ogr:name>bb</ogr:name>
29+
<ogr:intval>1</ogr:intval>
30+
<ogr:floatval>0.123</ogr:floatval>
31+
<ogr:fid_2>points.0</ogr:fid_2>
32+
<ogr:id>1</ogr:id>
33+
<ogr:id2>2</ogr:id2>
34+
</ogr:hub_lines_to_poly>
35+
</gml:featureMember>
36+
<gml:featureMember>
37+
<ogr:hub_lines_to_poly fid="polys.4">
38+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>4,0 1,1</gml:coordinates></gml:LineString></ogr:geometryProperty>
39+
<ogr:name>aa</ogr:name>
40+
<ogr:intval>1</ogr:intval>
41+
<ogr:floatval>3.33</ogr:floatval>
42+
<ogr:fid_2>points.0</ogr:fid_2>
43+
<ogr:id>1</ogr:id>
44+
<ogr:id2>2</ogr:id2>
45+
</ogr:hub_lines_to_poly>
46+
</gml:featureMember>
47+
<gml:featureMember>
48+
<ogr:hub_lines_to_poly fid="polys.5">
49+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>2.94337811900192,4.92360844529751 1,1</gml:coordinates></gml:LineString></ogr:geometryProperty>
50+
<ogr:name>bb</ogr:name>
51+
<ogr:intval>1</ogr:intval>
52+
<ogr:floatval>0.123</ogr:floatval>
53+
<ogr:fid_2>points.0</ogr:fid_2>
54+
<ogr:id>1</ogr:id>
55+
<ogr:id2>2</ogr:id2>
56+
</ogr:hub_lines_to_poly>
57+
</gml:featureMember>
58+
<gml:featureMember>
59+
<ogr:hub_lines_to_poly fid="polys.6">
60+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>4.67255278310941,5.32264875239923 1,1</gml:coordinates></gml:LineString></ogr:geometryProperty>
61+
<ogr:name>bb</ogr:name>
62+
<ogr:intval>1</ogr:intval>
63+
<ogr:floatval>0.123</ogr:floatval>
64+
<ogr:fid_2>points.0</ogr:fid_2>
65+
<ogr:id>1</ogr:id>
66+
<ogr:id2>2</ogr:id2>
67+
</ogr:hub_lines_to_poly>
68+
</gml:featureMember>
69+
<gml:featureMember>
70+
<ogr:hub_lines_to_poly fid="polys.8">
71+
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>3.12072936660269,5.58867562380038 3,3</gml:coordinates></gml:LineString></ogr:geometryProperty>
72+
<ogr:name>bb</ogr:name>
73+
<ogr:intval>2</ogr:intval>
74+
<ogr:floatval>0.123</ogr:floatval>
75+
<ogr:fid_2>points.1</ogr:fid_2>
76+
<ogr:id>2</ogr:id>
77+
<ogr:id2>1</ogr:id2>
78+
</ogr:hub_lines_to_poly>
79+
</gml:featureMember>
80+
</ogr:FeatureCollection>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="hub_lines_to_poly" type="ogr:hub_lines_to_poly_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="hub_lines_to_poly_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:LineStringPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="name" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:string">
22+
<xs:maxLength value="2"/>
23+
</xs:restriction>
24+
</xs:simpleType>
25+
</xs:element>
26+
<xs:element name="intval" nillable="true" minOccurs="0" maxOccurs="1">
27+
<xs:simpleType>
28+
<xs:restriction base="xs:integer">
29+
<xs:totalDigits value="10"/>
30+
</xs:restriction>
31+
</xs:simpleType>
32+
</xs:element>
33+
<xs:element name="floatval" nillable="true" minOccurs="0" maxOccurs="1">
34+
<xs:simpleType>
35+
<xs:restriction base="xs:decimal">
36+
</xs:restriction>
37+
</xs:simpleType>
38+
</xs:element>
39+
<xs:element name="fid_2" nillable="true" minOccurs="0" maxOccurs="1">
40+
<xs:simpleType>
41+
<xs:restriction base="xs:string">
42+
<xs:maxLength value="255"/>
43+
</xs:restriction>
44+
</xs:simpleType>
45+
</xs:element>
46+
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1">
47+
<xs:simpleType>
48+
<xs:restriction base="xs:integer">
49+
<xs:totalDigits value="10"/>
50+
</xs:restriction>
51+
</xs:simpleType>
52+
</xs:element>
53+
<xs:element name="id2" nillable="true" minOccurs="0" maxOccurs="1">
54+
<xs:simpleType>
55+
<xs:restriction base="xs:integer">
56+
<xs:totalDigits value="10"/>
57+
</xs:restriction>
58+
</xs:simpleType>
59+
</xs:element>
60+
</xs:sequence>
61+
</xs:extension>
62+
</xs:complexContent>
63+
</xs:complexType>
64+
</xs:schema>

0 commit comments

Comments
 (0)