mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Address more comments
This commit is contained in:
parent
a28cd2ce11
commit
d1d148f0c6
7
python/core/auto_additions/qgspointcloudrenderer.py
Normal file
7
python/core/auto_additions/qgspointcloudrenderer.py
Normal file
@ -0,0 +1,7 @@
|
||||
# The following has been generated automatically from src/core/pointcloud/qgspointcloudrenderer.h
|
||||
# monkey patching scoped based enum
|
||||
QgsPointCloudRenderer.DrawOrder.Default.__doc__ = "Draw points in the order they are stored"
|
||||
QgsPointCloudRenderer.DrawOrder.BottomToTop.__doc__ = "Draw points with larger Z values last"
|
||||
QgsPointCloudRenderer.DrawOrder.TopToBottom.__doc__ = "Draw points with larger Z values first"
|
||||
QgsPointCloudRenderer.DrawOrder.__doc__ = 'Pointcloud rendering order for 2d views\n/since QGIS 3.24\n\n' + '* ``Default``: ' + QgsPointCloudRenderer.DrawOrder.Default.__doc__ + '\n' + '* ``BottomToTop``: ' + QgsPointCloudRenderer.DrawOrder.BottomToTop.__doc__ + '\n' + '* ``TopToBottom``: ' + QgsPointCloudRenderer.DrawOrder.TopToBottom.__doc__
|
||||
# --
|
||||
@ -197,7 +197,7 @@ Abstract base class for 2d point cloud renderers.
|
||||
Circle,
|
||||
};
|
||||
|
||||
enum DrawOrder
|
||||
enum class DrawOrder
|
||||
{
|
||||
Default,
|
||||
BottomToTop,
|
||||
|
||||
@ -446,13 +446,21 @@ int QgsPointCloudLayerRenderer::renderNodesSorted( const QVector<IndexedPointClo
|
||||
if ( pointCount == 0 )
|
||||
return 0;
|
||||
|
||||
if ( order == QgsPointCloudRenderer::DrawOrder::BottomToTop )
|
||||
std::sort( allPairs.begin(), allPairs.end(), []( QPair<int, double> a, QPair<int, double> b ) { return a.second < b.second; } );
|
||||
else if ( order == QgsPointCloudRenderer::DrawOrder::TopToBottom )
|
||||
std::sort( allPairs.begin(), allPairs.end(), []( QPair<int, double> a, QPair<int, double> b ) { return a.second > b.second; } );
|
||||
switch ( order )
|
||||
{
|
||||
case QgsPointCloudRenderer::DrawOrder::BottomToTop:
|
||||
std::sort( allPairs.begin(), allPairs.end(), []( QPair<int, double> a, QPair<int, double> b ) { return a.second < b.second; } );
|
||||
break;
|
||||
case QgsPointCloudRenderer::DrawOrder::TopToBottom:
|
||||
std::sort( allPairs.begin(), allPairs.end(), []( QPair<int, double> a, QPair<int, double> b ) { return a.second > b.second; } );
|
||||
break;
|
||||
case QgsPointCloudRenderer::DrawOrder::Default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Now we can reconstruct a byte array sorted by Z value
|
||||
QByteArray sortedByteArray;
|
||||
sortedByteArray.reserve( allPairs.size() );
|
||||
for ( QPair<int, double> pair : allPairs )
|
||||
sortedByteArray.append( allByteArrays.mid( pair.first * recordSize, recordSize ) );
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const Qg
|
||||
element.setAttribute( QStringLiteral( "maximumScreenError" ), qgsDoubleToString( mMaximumScreenError ) );
|
||||
element.setAttribute( QStringLiteral( "maximumScreenErrorUnit" ), QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
|
||||
element.setAttribute( QStringLiteral( "pointSymbol" ), QString::number( mPointSymbol ) );
|
||||
element.setAttribute( QStringLiteral( "drawOrder2d" ), QString::number( mDrawOrder2d ) );
|
||||
element.setAttribute( QStringLiteral( "drawOrder2d" ), QString::number( static_cast< int >( mDrawOrder2d ) ) );
|
||||
}
|
||||
|
||||
QgsPointCloudRenderer::PointSymbol QgsPointCloudRenderer::pointSymbol() const
|
||||
|
||||
@ -276,7 +276,7 @@ class CORE_EXPORT QgsPointCloudRenderer
|
||||
* Pointcloud rendering order for 2d views
|
||||
* /since QGIS 3.24
|
||||
*/
|
||||
enum DrawOrder
|
||||
enum class DrawOrder : int
|
||||
{
|
||||
Default, //!< Draw points in the order they are stored
|
||||
BottomToTop, //!< Draw points with larger Z values last
|
||||
|
||||
@ -101,9 +101,9 @@ QgsPointCloudRendererPropertiesWidget::QgsPointCloudRendererPropertiesWidget( Qg
|
||||
connect( mPointSizeSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
connect( mPointSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
|
||||
mDrawOrderComboBox->addItem( tr( "Default" ), QgsPointCloudRenderer::DrawOrder::Default );
|
||||
mDrawOrderComboBox->addItem( tr( "Bottom to top" ), QgsPointCloudRenderer::DrawOrder::BottomToTop );
|
||||
mDrawOrderComboBox->addItem( tr( "Top to bottom" ), QgsPointCloudRenderer::DrawOrder::TopToBottom );
|
||||
mDrawOrderComboBox->addItem( tr( "Default" ), static_cast< int >( QgsPointCloudRenderer::DrawOrder::Default ) );
|
||||
mDrawOrderComboBox->addItem( tr( "Bottom to Top" ), static_cast< int >( QgsPointCloudRenderer::DrawOrder::BottomToTop ) );
|
||||
mDrawOrderComboBox->addItem( tr( "Top to Bottom" ), static_cast< int >( QgsPointCloudRenderer::DrawOrder::TopToBottom ) );
|
||||
|
||||
mMaxErrorUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMetersInMapUnits << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels
|
||||
<< QgsUnitTypes::RenderPoints << QgsUnitTypes::RenderInches );
|
||||
@ -152,7 +152,7 @@ void QgsPointCloudRendererPropertiesWidget::syncToLayer( QgsMapLayer *layer )
|
||||
mPointSizeUnitWidget->setMapUnitScale( mLayer->renderer()->pointSizeMapUnitScale() );
|
||||
|
||||
mPointStyleComboBox->setCurrentIndex( mPointStyleComboBox->findData( mLayer->renderer()->pointSymbol() ) );
|
||||
mDrawOrderComboBox->setCurrentIndex( mDrawOrderComboBox->findData( mLayer->renderer()->drawOrder2d() ) );
|
||||
mDrawOrderComboBox->setCurrentIndex( mDrawOrderComboBox->findData( static_cast< int >( mLayer->renderer()->drawOrder2d() ) ) );
|
||||
|
||||
mMaxErrorSpinBox->setValue( mLayer->renderer()->maximumScreenError() );
|
||||
mMaxErrorUnitWidget->setUnit( mLayer->renderer()->maximumScreenErrorUnit() );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user