QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsprofilerequest.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsprofilerequest.cpp
3 ---------------
4 begin : February 2022
5 copyright : (C) 2022 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#include "qgsprofilerequest.h"
18
19#include "qgscurve.h"
20#include "qgsterrainprovider.h"
21
23 : mCurve( curve )
24{
25
26}
27
29
31 : mCurve( other.mCurve ? other.mCurve->clone() : nullptr )
32 , mCrs( other.mCrs )
33 , mTransformContext( other.mTransformContext )
34 , mTolerance( other.mTolerance )
35 , mStepDistance( other.mStepDistance )
36 , mTerrainProvider( other.mTerrainProvider ? other.mTerrainProvider->clone() : nullptr )
37 , mExpressionContext( other.mExpressionContext )
38{
39
40}
41
43{
44 if ( &other == this )
45 return *this;
46
47 mCurve.reset( other.mCurve ? other.mCurve->clone() : nullptr );
48 mCrs = other.mCrs;
49 mTransformContext = other.mTransformContext;
50 mTolerance = other.mTolerance;
51 mStepDistance = other.mStepDistance;
52 mTerrainProvider.reset( other.mTerrainProvider ? other.mTerrainProvider->clone() : nullptr );
53 mExpressionContext = other.mExpressionContext;
54 return *this;
55}
56
58{
59 if ( !qgsDoubleNear( mTolerance, other.mTolerance )
60 || !qgsDoubleNear( mStepDistance, other.mStepDistance )
61 || mCrs != other.mCrs
62 || !( mTransformContext == other.mTransformContext ) )
63 return false;
64
65 if ( ( !mCurve && other.mCurve )
66 || ( mCurve && !other.mCurve ) )
67 {
68 return false;
69 }
70 else if ( mCurve && other.mCurve )
71 {
72 if ( !mCurve->equals( *other.mCurve ) )
73 return false;
74 }
75
76 if ( ( mTerrainProvider && !other.mTerrainProvider )
77 || ( !mTerrainProvider && other.mTerrainProvider ) )
78 {
79 return false;
80 }
81 else if ( mTerrainProvider && other.mTerrainProvider )
82 {
83 if ( !mTerrainProvider->equals( other.mTerrainProvider.get() ) )
84 return false;
85 }
86
87 return true;
88}
89
91{
92 return !( *this == other );
93}
94
96{
97 mCurve.reset( curve );
98 return *this;
99}
100
102{
103 return mCurve.get();
104}
105
107{
108 mCrs = crs;
109 return *this;
110}
111
113{
114 return mCrs;
115}
116
118{
119 return mTransformContext;
120}
121
123{
124 mTransformContext = context;
125 return *this;
126}
127
129{
130 mTolerance = tolerance;
131 return *this;
132}
133
135{
136 mTerrainProvider.reset( provider );
137 return *this;
138}
139
141{
142 return mTerrainProvider.get();
143}
144
146{
147 mStepDistance = distance;
148 return *this;
149}
150
152{
153 mExpressionContext = context;
154 return *this;
155}
156
Abstract base class for terrain providers.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Abstract base class for curved geometry type.
Definition qgscurve.h:36
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsProfileRequest & setStepDistance(double distance)
Sets the profile step distance (in crs() units).
QgsAbstractTerrainProvider * terrainProvider() const
Returns the terrain provider.
QgsProfileRequest(QgsCurve *curve)
Constructor for QgsProfileRequest.
QgsProfileRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate expressions.
bool operator==(const QgsProfileRequest &other) const
QgsCoordinateReferenceSystem crs() const
Returns the desired Coordinate Reference System for the profile.
bool operator!=(const QgsProfileRequest &other) const
double tolerance() const
Returns the tolerance of the request (in crs() units).
QgsProfileRequest & setTransformContext(const QgsCoordinateTransformContext &context)
Sets the transform context, for use when transforming coordinates from a source to the request's crs(...
QgsCurve * profileCurve() const
Returns the cross section profile curve, which represents the line along which the profile should be ...
QgsProfileRequest & setTerrainProvider(QgsAbstractTerrainProvider *provider)
Sets the terrain provider.
QgsProfileRequest & setProfileCurve(QgsCurve *curve)
Sets the cross section profile curve, which represents the line along which the profile should be gen...
QgsProfileRequest & setTolerance(double tolerance)
Sets the tolerance of the request (in crs() units).
QgsProfileRequest & setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the desired Coordinate Reference System (crs) for the profile.
QgsProfileRequest & operator=(const QgsProfileRequest &other)
QgsCoordinateTransformContext transformContext() const
Returns the transform context, for use when transforming coordinates from a source to the request's c...
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
Definition qgis.h:6607