mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
fix layout tests
This commit is contained in:
parent
789a83cd37
commit
83cf5fab0b
@ -588,9 +588,12 @@ Retrieves the z value for the point at index ``i``.
|
|||||||
Draws a point using a ``color`` at the specified ``x`` and ``y`` (in map coordinates).
|
Draws a point using a ``color`` at the specified ``x`` and ``y`` (in map coordinates).
|
||||||
%End
|
%End
|
||||||
|
|
||||||
QColor encodeElevation( float z ) const;
|
|
||||||
|
|
||||||
void drawPointToElevationMap( double x, double y, double z, QgsPointCloudRenderContext &context ) const;
|
void drawPointToElevationMap( double x, double y, double z, QgsPointCloudRenderContext &context ) const;
|
||||||
|
%Docstring
|
||||||
|
Draws a point at the elevation ``z`` using at the specified ``x`` and ``y`` (in map coordinates) on the elevation map.
|
||||||
|
|
||||||
|
.. versionadded:: 3.28
|
||||||
|
%End
|
||||||
|
|
||||||
void copyCommonProperties( QgsPointCloudRenderer *destination ) const;
|
void copyCommonProperties( QgsPointCloudRenderer *destination ) const;
|
||||||
%Docstring
|
%Docstring
|
||||||
|
@ -159,6 +159,46 @@ QStringList QgsPointCloudRenderer::legendRuleKeys() const
|
|||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsPointCloudRenderer::drawPointToElevationMap( double x, double y, double z, QgsPointCloudRenderContext &context ) const
|
||||||
|
{
|
||||||
|
const QPointF originalXY( x, y );
|
||||||
|
context.renderContext().mapToPixel().transformInPlace( x, y );
|
||||||
|
QPainter *elevationPainter = context.elevationPainter();
|
||||||
|
const double zMin = -5000;//context.zMin();//-37.2;
|
||||||
|
const double zMax = +5000;//context.zMax();// 532.87;
|
||||||
|
float zFloat = ( z - zMin ) / ( zMax - zMin );
|
||||||
|
zFloat = std::max<double>( 0.0, std::min<double>( 1.0, zFloat ) );
|
||||||
|
context.updateZRange( zFloat );
|
||||||
|
|
||||||
|
QColor c;
|
||||||
|
c.setRedF( zFloat );
|
||||||
|
zFloat *= std::pow<float>( 2, 8 );
|
||||||
|
zFloat -= ( int )zFloat;
|
||||||
|
c.setGreenF( zFloat );
|
||||||
|
zFloat *= std::pow<float>( 2, 8 );
|
||||||
|
zFloat -= ( int )zFloat;
|
||||||
|
c.setBlueF( zFloat );
|
||||||
|
c.setAlphaF( 1.0f );
|
||||||
|
|
||||||
|
QBrush brush( c );
|
||||||
|
switch ( mPointSymbol )
|
||||||
|
{
|
||||||
|
case Qgis::PointCloudSymbol::Square:
|
||||||
|
elevationPainter->fillRect( QRectF( x - mPainterPenWidth * 0.5,
|
||||||
|
y - mPainterPenWidth * 0.5,
|
||||||
|
mPainterPenWidth, mPainterPenWidth ), brush );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qgis::PointCloudSymbol::Circle:
|
||||||
|
elevationPainter->setBrush( brush );
|
||||||
|
elevationPainter->setPen( Qt::NoPen );
|
||||||
|
elevationPainter->drawEllipse( QRectF( x - mPainterPenWidth * 0.5,
|
||||||
|
y - mPainterPenWidth * 0.5,
|
||||||
|
mPainterPenWidth, mPainterPenWidth ) );
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void QgsPointCloudRenderer::copyCommonProperties( QgsPointCloudRenderer *destination ) const
|
void QgsPointCloudRenderer::copyCommonProperties( QgsPointCloudRenderer *destination ) const
|
||||||
{
|
{
|
||||||
destination->setPointSize( mPointSize );
|
destination->setPointSize( mPointSize );
|
||||||
|
@ -749,48 +749,11 @@ class CORE_EXPORT QgsPointCloudRenderer
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor encodeElevation( float z ) const
|
/**
|
||||||
{
|
* Draws a point at the elevation \a z using at the specified \a x and \a y (in map coordinates) on the elevation map.
|
||||||
QColor c;
|
* \since QGIS 3.28
|
||||||
c.setRedF( z );
|
*/
|
||||||
z *= std::pow<float>( 2, 8 );
|
void drawPointToElevationMap( double x, double y, double z, QgsPointCloudRenderContext &context ) const;
|
||||||
z -= ( int )z;
|
|
||||||
c.setGreenF( z );
|
|
||||||
z *= std::pow<float>( 2, 8 );
|
|
||||||
z -= ( int )z;
|
|
||||||
c.setBlueF( z );
|
|
||||||
c.setAlphaF( 1.0f );
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawPointToElevationMap( double x, double y, double z, QgsPointCloudRenderContext &context ) const
|
|
||||||
{
|
|
||||||
const QPointF originalXY( x, y );
|
|
||||||
context.renderContext().mapToPixel().transformInPlace( x, y );
|
|
||||||
QPainter *elevationPainter = context.elevationPainter();
|
|
||||||
const double zMin = -5000;//context.zMin();//-37.2;
|
|
||||||
const double zMax = +5000;//context.zMax();// 532.87;
|
|
||||||
float zFloat = ( z - zMin ) / ( zMax - zMin );
|
|
||||||
zFloat = std::max<double>( 0.0, std::min<double>( 1.0, zFloat ) );
|
|
||||||
context.updateZRange( zFloat );
|
|
||||||
QBrush brush( encodeElevation( zFloat ) );
|
|
||||||
switch ( mPointSymbol )
|
|
||||||
{
|
|
||||||
case Qgis::PointCloudSymbol::Square:
|
|
||||||
elevationPainter->fillRect( QRectF( x - mPainterPenWidth * 0.5,
|
|
||||||
y - mPainterPenWidth * 0.5,
|
|
||||||
mPainterPenWidth, mPainterPenWidth ), brush );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Qgis::PointCloudSymbol::Circle:
|
|
||||||
elevationPainter->setBrush( brush );
|
|
||||||
elevationPainter->setPen( Qt::NoPen );
|
|
||||||
elevationPainter->drawEllipse( QRectF( x - mPainterPenWidth * 0.5,
|
|
||||||
y - mPainterPenWidth * 0.5,
|
|
||||||
mPainterPenWidth, mPainterPenWidth ) );
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies common point cloud properties (such as point size and screen error) to the \a destination renderer.
|
* Copies common point cloud properties (such as point size and screen error) to the \a destination renderer.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user