QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
33 if ( mRespectLayerColors )
46 QDomElement element = document.createElement( QStringLiteral(
"elevation" ) );
49 element.setAttribute( QStringLiteral(
"max_screen_error" ),
qgsDoubleToString( mMaximumScreenError ) );
50 element.setAttribute( QStringLiteral(
"max_screen_error_unit" ),
QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
51 element.setAttribute( QStringLiteral(
"point_size" ),
qgsDoubleToString( mPointSize ) );
53 element.setAttribute( QStringLiteral(
"point_symbol" ),
qgsEnumValueToKey( mPointSymbol ) );
55 element.setAttribute( QStringLiteral(
"respect_layer_colors" ), mRespectLayerColors ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
56 element.setAttribute( QStringLiteral(
"opacity_by_distance" ), mApplyOpacityByDistanceEffect ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
58 parentElement.appendChild( element );
64 const QDomElement elevationElement = element.firstChildElement( QStringLiteral(
"elevation" ) ).toElement();
67 mMaximumScreenError = elevationElement.attribute( QStringLiteral(
"max_screen_error" ), QStringLiteral(
"0.3" ) ).toDouble();
72 mPointSize = elevationElement.attribute( QStringLiteral(
"point_size" ), QStringLiteral(
"0.6" ) ).toDouble();
77 const QString colorString = elevationElement.attribute( QStringLiteral(
"point_color" ) );
78 if ( !colorString.isEmpty() )
86 mRespectLayerColors = elevationElement.attribute( QStringLiteral(
"respect_layer_colors" ), QStringLiteral(
"1" ) ).toInt();
87 mApplyOpacityByDistanceEffect = elevationElement.attribute( QStringLiteral(
"opacity_by_distance" ) ).toInt();
94 std::unique_ptr< QgsPointCloudLayerElevationProperties > res = std::make_unique< QgsPointCloudLayerElevationProperties >(
nullptr );
95 res->copyCommonProperties(
this );
97 res->mMaximumScreenError = mMaximumScreenError;
98 res->mMaximumScreenErrorUnit = mMaximumScreenErrorUnit;
99 res->mPointSize = mPointSize;
100 res->mPointSizeUnit = mPointSizeUnit;
101 res->mPointSymbol = mPointSymbol;
102 res->mPointColor = mPointColor;
103 res->mRespectLayerColors = mRespectLayerColors;
104 res->mApplyOpacityByDistanceEffect = mApplyOpacityByDistanceEffect;
106 return res.release();
111 QStringList properties;
112 properties << tr(
"Scale: %1" ).arg(
mZScale );
113 properties << tr(
"Offset: %1" ).arg(
mZOffset );
114 return QStringLiteral(
"<ul><li>%1</li></ul>" ).arg( properties.join( QLatin1String(
"</li><li>" ) ) );
127 if ( pcLayer->dataProvider() )
132 const double zMin = stats.
minimum( QStringLiteral(
"Z" ) );
133 const double zMax = stats.
maximum( QStringLiteral(
"Z" ) );
134 if ( !std::isnan( zMin ) && !std::isnan( zMax ) )
154 mMaximumScreenError = error;
161 if ( unit == mMaximumScreenErrorUnit )
164 mMaximumScreenErrorUnit = unit;
176 if ( mPointSymbol == symbol )
179 mPointSymbol = symbol;
186 if ( color == mPointColor )
196 if ( apply == mApplyOpacityByDistanceEffect )
199 mApplyOpacityByDistanceEffect = apply;
203 if ( mApplyOpacityByDistanceEffect )
221 if ( mPointSizeUnit == units )
224 mPointSizeUnit = units;
231 if ( mRespectLayerColors == enabled )
234 mRespectLayerColors = enabled;
238 if ( mRespectLayerColors )
static QString encodeColor(const QColor &color)
QgsDoubleRange calculateZRange(QgsMapLayer *layer) const override
Attempts to calculate the overall elevation or z range for the specified layer, using the settings de...
void setPointSymbol(Qgis::PointCloudSymbol symbol)
Sets the symbol used drawing points in elevation profile charts.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
QColor fetchRandomStyleColor() const
Returns a random color for use with a new symbol style (e.g.
void setMaximumScreenErrorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the maximum screen error allowed when generating elevation profiles for the point c...
RenderUnit
Rendering size units.
The class is used as a container of context for various read/write operations on other objects.
Base class for storage of map layer elevation properties.
Point cloud layer specific subclass of QgsMapLayerElevationProperties.
Represents a map layer supporting display of point clouds.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes.
Class used to store statistics of a point cloud dataset.
@ RenderMillimeters
Millimeters.
bool showByDefaultInElevationProfilePlots() const override
Returns true if the layer should be visible by default in newly created elevation profile plots.
static QColor decodeColor(const QString &str)
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
double maximum(const QString &attribute) const
Returns the maximum value for the attribute attribute If no matching statistic is available then NaN ...
void readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common class properties from a DOM element previously written by writeXml().
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
Qgis::PointCloudSymbol pointSymbol() const
Returns the symbol used drawing points in elevation profile charts.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
void setRespectLayerColors(bool enabled)
Sets whether layer coloring should be respected when rendering elevation profile plots.
void setPointSize(double size)
Sets the point size used for drawing points in elevation profile charts.
@ Square
Renders points as squares.
PointCloudSymbol
Rendering symbols for point cloud points.
QString htmlSummary() const override
Returns a HTML formatted summary of the properties.
void setPointColor(const QColor &color)
Sets the color used drawing points in elevation profile charts.
QDomElement writeXml(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) override
Writes the properties to a DOM element, to be used later with readXml().
void rendererChanged()
Signal emitted when renderer is changed.
void profileGenerationPropertyChanged()
Emitted when any of the elevation properties which relate solely to generation of elevation profiles ...
void profileRenderingPropertyChanged()
Emitted when any of the elevation properties which relate solely to presentation of elevation results...
void setApplyOpacityByDistanceEffect(bool apply)
Sets whether a reduced opacity by distance from profile curve effect should be applied when drawing p...
double minimum(const QString &attribute) const
Returns the minimum value for the attribute attribute If no matching statistic is available then NaN ...
QgsRange which stores a range of double values.
Base class for all map layer types. This is the base class for all map layer types (vector,...
bool hasElevation() const override
Returns true if the layer has an elevation or z component.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
void changed()
Emitted when any of the elevation properties have changed.
void setMaximumScreenError(double error)
Sets the maximum screen error allowed when generating elevation profiles for the point cloud.
void setPointSizeUnit(const QgsUnitTypes::RenderUnit units)
Sets the units used for the point size used for drawing points in elevation profile charts.
bool isVisibleInZRange(const QgsDoubleRange &range) const override
Returns true if the layer should be visible and rendered for the specified z range.
void writeCommonProperties(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)
Writes common class properties to a DOM element, to be used later with readXml().
QgsPointCloudLayerElevationProperties * clone() const override
Creates a clone of the properties.
QgsPointCloudLayerElevationProperties(QObject *parent)
Constructor for QgsPointCloudLayerElevationProperties, with the specified parent object.
bool readXml(const QDomElement &element, const QgsReadWriteContext &context) override
Reads the elevation properties from a DOM element previously written by writeXml().