Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processing] Port "Points along geometry" to QgsFeatureBasedAlgorithm
(and c++), allow distance/start/end offset to be dynamic, avoid algorithm "hangs" when inappropriately small (or 0) distances are used
- Loading branch information
1 parent
e0eedc5
commit 4ff8429
Showing
24 changed files
with
1,450 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 0 additions & 142 deletions
142
python/plugins/processing/algs/qgis/PointsAlongGeometry.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
python/plugins/processing/tests/testdata/expected/points_along_lines_end_offset.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ogr:FeatureCollection | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ogr.maptools.org/ points_along_lines_end_offset.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>-3</gml:Y></gml:coord> | ||
<gml:coord><gml:X>9</gml:X><gml:Y>3</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>0</ogr:distance> | ||
<ogr:angle>90</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>1</ogr:distance> | ||
<ogr:angle>90</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>2</ogr:distance> | ||
<ogr:angle>90</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>3</ogr:distance> | ||
<ogr:angle>45</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9,3</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>4</ogr:distance> | ||
<ogr:angle>22.5</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.2"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,0</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>0</ogr:distance> | ||
<ogr:angle>0</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.2"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>1</ogr:distance> | ||
<ogr:angle>0</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.4"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-3</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>0</ogr:distance> | ||
<ogr:angle>90</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6,-3</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>0</ogr:distance> | ||
<ogr:angle>45</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6.70710678118655,-2.29289321881345</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>1</ogr:distance> | ||
<ogr:angle>45</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7.41421356237309,-1.58578643762691</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>2</ogr:distance> | ||
<ogr:angle>45</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.12132034355964,-0.878679656440358</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:distance>3</ogr:distance> | ||
<ogr:angle>45</ogr:angle> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:points_along_lines_end_offset fid="lines.6"> | ||
<ogr:distance xsi:nil="true"/> | ||
<ogr:angle xsi:nil="true"/> | ||
</ogr:points_along_lines_end_offset> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
35 changes: 35 additions & 0 deletions
35
python/plugins/processing/tests/testdata/expected/points_along_lines_end_offset.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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="points_along_lines_end_offset" type="ogr:points_along_lines_end_offset_Type" substitutionGroup="gml:_Feature"/> | ||
<xs:complexType name="points_along_lines_end_offset_Type"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureType"> | ||
<xs:sequence> | ||
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> | ||
<xs:element name="distance" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:decimal"> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="angle" 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> |
Binary file added
BIN
+8.71 KB
python/plugins/processing/tests/testdata/expected/points_along_lines_m.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
python/plugins/processing/tests/testdata/expected/points_along_lines_m.prj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] |
1 change: 1 addition & 0 deletions
1
python/plugins/processing/tests/testdata/expected/points_along_lines_m.qpj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] |
Binary file added
BIN
+1.09 KB
python/plugins/processing/tests/testdata/expected/points_along_lines_m.shp
Binary file not shown.
Binary file added
BIN
+332 Bytes
python/plugins/processing/tests/testdata/expected/points_along_lines_m.shx
Binary file not shown.
Oops, something went wrong.