Skip to content
Permalink
Browse files
Add T test
  • Loading branch information
nirvn committed Aug 31, 2021
1 parent c8179c3 commit 75c8eb7798e2dcc19be1ce2807399a91ef7b3675
@@ -0,0 +1,16 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>lines_t_shape_snapped</Name>
<ElementPath>lines_t_shape_snapped</ElementPath>
<!--MULTILINESTRING-->
<GeometryType>5</GeometryType>
<SRSName>urn:ogc:def:crs:EPSG::4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>3</FeatureCount>
<ExtentXMin>0.75573</ExtentXMin>
<ExtentXMax>8.21641</ExtentXMax>
<ExtentYMin>-2.23951</ExtentYMin>
<ExtentYMax>5.12878</ExtentYMax>
</DatasetSpecificInfo>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.23950504124656 0.755728689275893</gml:lowerCorner><gml:upperCorner>5.12878093492209 8.21640696608616</gml:upperCorner></gml:Envelope></gml:boundedBy>

<ogr:featureMember>
<ogr:lines_t_shape_snapped gml:id="lines_t_shape.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.23950504124656 0.755728689275893</gml:lowerCorner><gml:upperCorner>5.12878093492209 7.0730522456462</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>-2.23950504124656 0.755728689275893 1.43703755953514 3.90787414793983 5.12878093492209 7.0730522456462</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape_snapped>
</ogr:featureMember>
<ogr:featureMember>
<ogr:lines_t_shape_snapped gml:id="lines_t_shape.1">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-1.90458295142072 3.90787414793983</gml:lowerCorner><gml:upperCorner>5.12878093492209 8.21640696608616</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>5.12878093492209 7.0730522456462 1.43703755953514 3.90787414793983 -1.90458295142072 8.21640696608616</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape_snapped>
</ogr:featureMember>
<ogr:featureMember>
<ogr:lines_t_shape_snapped gml:id="lines_t_shape.2">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.23950504124656 0.755728689275893</gml:lowerCorner><gml:upperCorner>1.43703755953514 8.21640696608616</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>-2.23950504124656 0.755728689275893 1.43703755953514 3.90787414793983 -1.90458295142072 8.21640696608616</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape_snapped>
</ogr:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,16 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>lines_t_shape</Name>
<ElementPath>lines_t_shape</ElementPath>
<!--MULTILINESTRING-->
<GeometryType>5</GeometryType>
<SRSName>urn:ogc:def:crs:EPSG::4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>3</FeatureCount>
<ExtentXMin>0.75573</ExtentXMin>
<ExtentXMax>8.21641</ExtentXMax>
<ExtentYMin>-2.33190</ExtentYMin>
<ExtentYMax>5.12878</ExtentYMax>
</DatasetSpecificInfo>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.33189734188818 0.755728689275893</gml:lowerCorner><gml:upperCorner>5.12878093492209 8.21640696608616</gml:upperCorner></gml:Envelope></gml:boundedBy>

<ogr:featureMember>
<ogr:lines_t_shape gml:id="lines_t_shape.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.23950504124656 0.755728689275893</gml:lowerCorner><gml:upperCorner>5.12878093492209 7.0730522456462</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>-2.23950504124656 0.755728689275893 5.12878093492209 7.0730522456462</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape>
</ogr:featureMember>
<ogr:featureMember>
<ogr:lines_t_shape gml:id="lines_t_shape.1">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-1.90458295142072 3.96636113657195</gml:lowerCorner><gml:upperCorner>5.08258478460128 8.21640696608616</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>5.08258478460128 7.15389550870761 1.38689275893675 3.96636113657195 -1.90458295142072 8.21640696608616</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape>
</ogr:featureMember>
<ogr:featureMember>
<ogr:lines_t_shape gml:id="lines_t_shape.2">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-2.33189734188818 0.882768102658111</gml:lowerCorner><gml:upperCorner>1.30604949587534 8.13556370302475</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:MultiCurve srsName="urn:ogc:def:crs:EPSG::4326"><gml:curveMember><gml:LineString><gml:posList>-2.33189734188818 0.882768102658111 1.30604949587534 3.94326306141155 -1.93923006416132 8.13556370302475</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></ogr:geometryProperty>
</ogr:lines_t_shape>
</ogr:featureMember>
</ogr:FeatureCollection>
@@ -630,6 +630,22 @@ tests:
name: expected/snap_geometries.gml
type: vector

- algorithm: native:snapgeometries
name: Snap lines to lines (against itself; ordering check)
params:
BEHAVIOR: '0'
INPUT:
name: lines_t_shape.gml
type: vector
REFERENCE_LAYER:
name: lines_t_shape.gml
type: vector
TOLERANCE: 0.3
results:
OUTPUT:
name: expected/lines_t_shape_snapped.gml
type: vector

- algorithm: native:poleofinaccessibility
name: Pole of inaccessibility (polygons)
params:
@@ -103,7 +103,8 @@ bool QgsSnapIndex::SegmentSnapItem::getProjection( const QgsPoint &p, QgsPoint &

bool QgsSnapIndex::SegmentSnapItem::withinDistance( const QgsPoint &p, const double tolerance )
{
const double distance = QgsGeometryUtils::sqrDistToLine( p.x(), p.y(), idxFrom->point().x(), idxFrom->point().y(), idxTo->point().x(), idxTo->point().y() );
double minDistX, minDistY;
const double distance = QgsGeometryUtils::sqrDistToLine( p.x(), p.y(), idxFrom->point().x(), idxFrom->point().y(), idxTo->point().x(), idxTo->point().y(), minDistX, minDistY, 4 * std::numeric_limits<double>::epsilon() );
return distance <= tolerance;
}

0 comments on commit 75c8eb7

Please sign in to comment.