Skip to content

Commit

Permalink
qgsvectorlayerprofilegenerator: const some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano committed Dec 16, 2024
1 parent 0a4b1e2 commit 46883ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/core/vector/qgsvectorlayerprofilegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ QgsProfileSnapResult QgsVectorLayerProfileResults::snapPointToIndividualFeatures
return res;
}

void QgsVectorLayerProfileResults::visitFeaturesAtPoint( const QgsProfilePoint &point, double maximumPointDistanceDelta, double maximumPointElevationDelta, double maximumSurfaceElevationDelta, const std::function< void( QgsFeatureId, double delta, double distance, double elevation ) > &visitor, bool visitWithin )
void QgsVectorLayerProfileResults::visitFeaturesAtPoint( const QgsProfilePoint &point, double maximumPointDistanceDelta, double maximumPointElevationDelta, double maximumSurfaceElevationDelta, const std::function< void( QgsFeatureId, double delta, double distance, double elevation ) > &visitor, bool visitWithin ) const
{
// TODO -- add spatial index if performance is an issue

Expand Down Expand Up @@ -336,7 +336,7 @@ void QgsVectorLayerProfileResults::visitFeaturesAtPoint( const QgsProfilePoint &
}
}

void QgsVectorLayerProfileResults::visitFeaturesInRange( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange, const std::function<void ( QgsFeatureId )> &visitor )
void QgsVectorLayerProfileResults::visitFeaturesInRange( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange, const std::function<void ( QgsFeatureId )> &visitor ) const
{
// TODO -- add spatial index if performance is an issue
const QgsRectangle profileRange( distanceRange.lower(), elevationRange.lower(), distanceRange.upper(), elevationRange.upper() );
Expand Down Expand Up @@ -1621,7 +1621,7 @@ bool QgsVectorLayerProfileGenerator::generateProfileForPolygons()
return true;
}

double QgsVectorLayerProfileGenerator::terrainHeight( double x, double y )
double QgsVectorLayerProfileGenerator::terrainHeight( double x, double y ) const
{
if ( !mTerrainProvider )
return std::numeric_limits<double>::quiet_NaN();
Expand All @@ -1640,7 +1640,7 @@ double QgsVectorLayerProfileGenerator::terrainHeight( double x, double y )
return mTerrainProvider->heightAt( x, y );
}

double QgsVectorLayerProfileGenerator::featureZToHeight( double x, double y, double z, double offset )
double QgsVectorLayerProfileGenerator::featureZToHeight( double x, double y, double z, double offset ) const
{
switch ( mClamping )
{
Expand Down Expand Up @@ -1677,7 +1677,7 @@ double QgsVectorLayerProfileGenerator::featureZToHeight( double x, double y, dou
return ( std::isnan( z ) ? 0 : z ) * mScale + offset;
}

void QgsVectorLayerProfileGenerator::clampAltitudes( QgsLineString *lineString, const QgsPoint &centroid, double offset )
void QgsVectorLayerProfileGenerator::clampAltitudes( QgsLineString *lineString, const QgsPoint &centroid, double offset ) const
{
for ( int i = 0; i < lineString->nCoordinates(); ++i )
{
Expand Down Expand Up @@ -1729,7 +1729,7 @@ void QgsVectorLayerProfileGenerator::clampAltitudes( QgsLineString *lineString,
}
}

bool QgsVectorLayerProfileGenerator::clampAltitudes( QgsPolygon *polygon, double offset )
bool QgsVectorLayerProfileGenerator::clampAltitudes( QgsPolygon *polygon, double offset ) const
{
if ( !polygon->is3D() )
polygon->addZValue( 0 );
Expand Down
12 changes: 6 additions & 6 deletions src/core/vector/qgsvectorlayerprofilegenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class CORE_EXPORT QgsVectorLayerProfileResults : public QgsAbstractProfileSurfac
QgsProfileSnapResult snapPointToIndividualFeatures( const QgsProfilePoint &point, const QgsProfileSnapContext &context );

void visitFeaturesAtPoint( const QgsProfilePoint &point, double maximumPointDistanceDelta, double maximumPointElevationDelta, double maximumSurfaceElevationDelta,
const std::function< void( QgsFeatureId, double delta, double distance, double elevation ) > &visitor, bool visitWithin );
const std::function< void( QgsFeatureId, double delta, double distance, double elevation ) > &visitor, bool visitWithin ) const;
void visitFeaturesInRange( const QgsDoubleRange &distanceRange, const QgsDoubleRange &elevationRange,
const std::function<void ( QgsFeatureId )> &visitor );
const std::function<void ( QgsFeatureId )> &visitor ) const;
};


Expand Down Expand Up @@ -136,11 +136,11 @@ class CORE_EXPORT QgsVectorLayerProfileGenerator : public QgsAbstractProfileSurf
void processTriangleIntersectForLine( const QgsPolygon *triangle, const QgsLineString *intersect, QVector< QgsGeometry > &transformedParts, QVector< QgsGeometry > &crossSectionParts );
void processTriangleIntersectForPolygon( const QgsPolygon *triangle, const QgsPolygon *intersectionPolygon, QVector< QgsGeometry > &transformedParts, QVector< QgsGeometry > &crossSectionParts );

double terrainHeight( double x, double y );
double featureZToHeight( double x, double y, double z, double offset );
double terrainHeight( double x, double y ) const;
double featureZToHeight( double x, double y, double z, double offset ) const;

void clampAltitudes( QgsLineString *lineString, const QgsPoint &centroid, double offset );
bool clampAltitudes( QgsPolygon *polygon, double offset );
void clampAltitudes( QgsLineString *lineString, const QgsPoint &centroid, double offset ) const;
bool clampAltitudes( QgsPolygon *polygon, double offset ) const;

QString mId;
std::unique_ptr<QgsFeedback> mFeedback = nullptr;
Expand Down

0 comments on commit 46883ae

Please sign in to comment.