make cppcheck happy

This commit is contained in:
Alexander Bruy 2023-08-10 09:23:34 +03:00 committed by Martin Dobias
parent ea6a706c01
commit d18190ce4f
11 changed files with 120 additions and 49 deletions

View File

@ -11,7 +11,6 @@
<ogr:concave_hull_points_03 gml:id="concave_hull_points_03.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>1 2</gml:lowerCorner><gml:upperCorner>3 5</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="concave_hull_points_03.geom.0"><gml:exterior><gml:LinearRing><gml:posList>2 2 3 3 2 5 1 4 2 2</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:concave_hull_points_03>
</ogr:featureMember>
</ogr:FeatureCollection>

View File

@ -40,13 +40,6 @@
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:SurfacePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <!-- restricted to Polygon --><!-- srsName="urn:ogc:def:crs:EPSG::4326" -->
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:totalDigits value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>

View File

@ -2,15 +2,15 @@
<ogr:FeatureCollection
gml:id="aFeatureCollection"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ concave_hull_points_09.xsd"
xsi:schemaLocation="http://ogr.maptools.org/ concave_hull_points_03_geos.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml/3.2">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-5 0</gml:lowerCorner><gml:upperCorner>3 8</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:featureMember>
<ogr:concave_hull_points_09 gml:id="concave_hull_points_09.0">
<ogr:concave_hull_points_03_geos gml:id="concave_hull_points_03_geos.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-5 0</gml:lowerCorner><gml:upperCorner>3 8</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="concave_hull_points_09.geom.0"><gml:exterior><gml:LinearRing><gml:posList>-1 0 1 1 2 2 3 3 2 5 -1 8 -1 7 -5 0 -1 0</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogr:geometryProperty>
</ogr:concave_hull_points_09>
<ogr:geometryProperty><gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="concave_hull_points_03_geos.geom.0"><gml:exterior><gml:LinearRing><gml:posList>-5 0 -1 0 1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -5 0</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogr:geometryProperty>
</ogr:concave_hull_points_03_geos>
</ogr:featureMember>
</ogr:FeatureCollection>

View File

@ -34,8 +34,8 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="concave_hull_points_09" type="ogr:concave_hull_points_09_Type" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="concave_hull_points_09_Type">
<xs:element name="concave_hull_points_03_geos" type="ogr:concave_hull_points_03_geos_Type" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="concave_hull_points_03_geos_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>

View File

@ -11,7 +11,6 @@
<ogr:concave_hull_points_07 gml:id="concave_hull_points_07.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-1 0</gml:lowerCorner><gml:upperCorner>3 8</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="concave_hull_points_07.geom.0"><gml:exterior><gml:LinearRing><gml:posList>1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -1 0 1 1</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogr:geometryProperty>
<ogr:id>1</ogr:id>
</ogr:concave_hull_points_07>
</ogr:featureMember>
</ogr:FeatureCollection>

View File

@ -40,13 +40,6 @@
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:SurfacePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <!-- restricted to Polygon --><!-- srsName="urn:ogc:def:crs:EPSG::4326" -->
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:totalDigits value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
gml:id="aFeatureCollection"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ concave_hull_points_07_geos.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml/3.2">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-5 0</gml:lowerCorner><gml:upperCorner>3 8</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:featureMember>
<ogr:concave_hull_points_07_geos gml:id="concave_hull_points_07_geos.0">
<gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>-5 0</gml:lowerCorner><gml:upperCorner>3 8</gml:upperCorner></gml:Envelope></gml:boundedBy>
<ogr:geometryProperty><gml:Polygon srsName="urn:ogc:def:crs:EPSG::4326" gml:id="concave_hull_points_07_geos.geom.0"><gml:exterior><gml:LinearRing><gml:posList>-5 0 -1 0 1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -5 0</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></ogr:geometryProperty>
</ogr:concave_hull_points_07_geos>
</ogr:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,47 @@
<?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/3.2"
xmlns:gmlsf="http://www.opengis.net/gmlsf/2.0"
elementFormDefault="qualified"
version="1.0">
<xs:annotation>
<xs:appinfo source="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd">
<gmlsf:ComplianceLevel>0</gmlsf:ComplianceLevel>
</xs:appinfo>
</xs:annotation>
<xs:import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
<xs:import namespace="http://www.opengis.net/gmlsf/2.0" schemaLocation="http://schemas.opengis.net/gmlsfProfile/2.0/gmlsfLevels.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="featureMember">
<xs:complexType>
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureMemberType">
<xs:sequence>
<xs:element ref="gml:AbstractFeature"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="concave_hull_points_07_geos" type="ogr:concave_hull_points_07_geos_Type" substitutionGroup="gml:AbstractFeature"/>
<xs:complexType name="concave_hull_points_07_geos_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:SurfacePropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <!-- restricted to Polygon --><!-- srsName="urn:ogc:def:crs:EPSG::4326" -->
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View File

@ -268,6 +268,52 @@ tests:
cast: str
fid: skip
- algorithm: native:concavehull
name: Concave Hull (GEOS 0.3)
params:
ALPHA: 0.7
HOLES: true
INPUT:
name: points.gml
type: vector
NO_MULTIGEOMETRY: false
results:
OUTPUT:
name: expected/concave_hull_points_07_geos.gml
type: vector
- algorithm: native:concavehull
name: Concave Hull (GEOS 0.7)
params:
ALPHA: 0.3
HOLES: true
INPUT:
name: points.gml
type: vector
NO_MULTIGEOMETRY: false
results:
OUTPUT:
name: expected/concave_hull_points_03_geos.gml
type: vector
# concave hull tests should be upddated when CI will be using GEOS>=3.11
# current tests data were generated by Python implementation which produces
# incorrect result by not including all input points in the concave hull
# see https://github.com/qgis/QGIS/issues/54561
- algorithm: native:concavehull
name: Concave Hull - Points (0.3)
params:
ALPHA: 0.3
HOLES: true
INPUT:
name: points.gml
type: vector
NO_MULTIGEOMETRY: false
results:
OUTPUT:
name: expected/concave_hull_points_03.gml
type: vector
- algorithm: native:concavehull
name: Concave Hull - Points (0.7)
params:
@ -281,26 +327,6 @@ tests:
OUTPUT:
name: expected/concave_hull_points_07.gml
type: vector
compare:
geometry:
normalize: True
- algorithm: native:concavehull
name: Concave Hull - Points (0.9)
params:
ALPHA: 1
HOLES: true
INPUT:
name: points.gml
type: vector
NO_MULTIGEOMETRY: false
results:
OUTPUT:
name: expected/concave_hull_points_09.gml
type: vector
compare:
geometry:
normalize: True
- algorithm: qgis:knearestconcavehull
name: K-nearest Neighbor Concave Hull - Points (k=7)

View File

@ -90,12 +90,11 @@ QVariantMap QgsConcaveHullAlgorithm::processAlgorithm( const QVariantMap &parame
if ( !sink )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );
QgsGeometry concaveHull;
#if GEOS_VERSION_MAJOR==3 && GEOS_VERSION_MINOR<11
concaveHullQgis( sink, parameters, context, feedback );
#else
//~ #if GEOS_VERSION_MAJOR==3 && GEOS_VERSION_MINOR<11
//~ concaveHullQgis( sink, parameters, context, feedback );
//~ #else
concaveHullGeos( sink, parameters, feedback );
#endif
//~ #endif
QVariantMap outputs;
outputs.insert( QStringLiteral( "OUTPUT" ), dest );
@ -255,7 +254,7 @@ void QgsConcaveHullAlgorithm::concaveHullQgis( std::unique_ptr< QgsFeatureSink >
toDelete << edgesIt.key();
}
edgesIt++;
++edgesIt;
i++;
multiStepFeedback.setProgress( i * step );
}

View File

@ -209,7 +209,6 @@ QString QgsVoronoiPolygonsAlgorithm::voronoiWithoutAttributes( const QVariantMap
QgsFeatureIterator it = mSource->getFeatures( request, QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks );
QgsGeometry allPoints;
QHash< QgsFeatureId, QgsAttributes > attributeCache;
double step = mSource->featureCount() > 0 ? 100.0 / mSource->featureCount() : 1;