Skip to content

Commit

Permalink
remove point budget approach from 2D rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Feb 10, 2021
1 parent f9e2409 commit 86a7139
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 95 deletions.
14 changes: 0 additions & 14 deletions python/core/auto_generated/pointcloud/qgspointcloudrenderer.sip.in
Expand Up @@ -383,20 +383,6 @@ Units are set via :py:func:`~QgsPointCloudRenderer.setMaximumScreenErrorUnit`.
.. seealso:: :py:func:`maximumScreenError`

.. seealso:: :py:func:`setMaximumScreenErrorUnit`
%End

int pointBudget() const;
%Docstring
Returns the maximum number of points rendered

.. seealso:: :py:func:`setPointBudget`
%End

void setPointBudget( int budget );
%Docstring
Sets the maximum number of points rendered

.. seealso:: :py:func:`pointBudget`
%End

QgsUnitTypes::RenderUnit maximumScreenErrorUnit() const;
Expand Down
5 changes: 0 additions & 5 deletions src/core/pointcloud/qgspointcloudlayerrenderer.cpp
Expand Up @@ -189,11 +189,6 @@ bool QgsPointCloudLayerRenderer::render()
canceled = true;
break;
}
if ( context.pointsRendered() > mRenderer->pointBudget() )
{
QgsDebugMsgLevel( "point budget exceeded", 2 );
break;
}
std::unique_ptr<QgsPointCloudBlock> block( pc->nodeData( n, request ) );

if ( !block )
Expand Down
13 changes: 0 additions & 13 deletions src/core/pointcloud/qgspointcloudrenderer.cpp
Expand Up @@ -141,16 +141,6 @@ void QgsPointCloudRenderer::setMaximumScreenErrorUnit( QgsUnitTypes::RenderUnit
mMaximumScreenErrorUnit = unit;
}

int QgsPointCloudRenderer::pointBudget() const
{
return mPointBudget;
}

void QgsPointCloudRenderer::setPointBudget( int budget )
{
mPointBudget = budget;
}

QList<QgsLayerTreeModelLegendNode *> QgsPointCloudRenderer::createLegendNodes( QgsLayerTreeLayer * )
{
return QList<QgsLayerTreeModelLegendNode *>();
Expand All @@ -166,7 +156,6 @@ void QgsPointCloudRenderer::copyCommonProperties( QgsPointCloudRenderer *destina
destination->setPointSize( mPointSize );
destination->setPointSizeUnit( mPointSizeUnit );
destination->setPointSizeMapUnitScale( mPointSizeMapUnitScale );
destination->setPointBudget( mPointBudget );
destination->setMaximumScreenError( mMaximumScreenError );
destination->setMaximumScreenErrorUnit( mMaximumScreenErrorUnit );
destination->setPointSymbol( mPointSymbol );
Expand All @@ -177,7 +166,6 @@ void QgsPointCloudRenderer::restoreCommonProperties( const QDomElement &element,
mPointSize = element.attribute( QStringLiteral( "pointSize" ), QStringLiteral( "1" ) ).toDouble();
mPointSizeUnit = QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral( "pointSizeUnit" ), QStringLiteral( "MM" ) ) );
mPointSizeMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( element.attribute( QStringLiteral( "pointSizeMapUnitScale" ), QString() ) );
mPointBudget = element.attribute( QStringLiteral( "pointBudget" ), QStringLiteral( "10000000" ) ).toInt();

mMaximumScreenError = element.attribute( QStringLiteral( "maximumScreenError" ), QStringLiteral( "0.3" ) ).toDouble();
mMaximumScreenErrorUnit = QgsUnitTypes::decodeRenderUnit( element.attribute( QStringLiteral( "maximumScreenErrorUnit" ), QStringLiteral( "MM" ) ) );
Expand All @@ -189,7 +177,6 @@ void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const Qg
element.setAttribute( QStringLiteral( "pointSize" ), qgsDoubleToString( mPointSize ) );
element.setAttribute( QStringLiteral( "pointSizeUnit" ), QgsUnitTypes::encodeUnit( mPointSizeUnit ) );
element.setAttribute( QStringLiteral( "pointSizeMapUnitScale" ), QgsSymbolLayerUtils::encodeMapUnitScale( mPointSizeMapUnitScale ) );
element.setAttribute( QStringLiteral( "pointBudget" ), QString::number( mPointBudget ) );

element.setAttribute( QStringLiteral( "maximumScreenError" ), qgsDoubleToString( mMaximumScreenError ) );
element.setAttribute( QStringLiteral( "maximumScreenErrorUnit" ), QgsUnitTypes::encodeUnit( mMaximumScreenErrorUnit ) );
Expand Down
13 changes: 0 additions & 13 deletions src/core/pointcloud/qgspointcloudrenderer.h
Expand Up @@ -453,18 +453,6 @@ class CORE_EXPORT QgsPointCloudRenderer
*/
void setMaximumScreenError( double error );

/**
* Returns the maximum number of points rendered
* \see setPointBudget()
*/
int pointBudget() const;

/**
* Sets the maximum number of points rendered
* \see pointBudget()
*/
void setPointBudget( int budget );

/**
* Returns the unit for the maximum screen error allowed when rendering the point cloud.
*
Expand Down Expand Up @@ -580,7 +568,6 @@ class CORE_EXPORT QgsPointCloudRenderer
double mPointSize = 1;
QgsUnitTypes::RenderUnit mPointSizeUnit = QgsUnitTypes::RenderMillimeters;
QgsMapUnitScale mPointSizeMapUnitScale;
int mPointBudget = 10000000;

PointSymbol mPointSymbol = Square;
int mPainterPenWidth = 1;
Expand Down
3 changes: 0 additions & 3 deletions src/gui/pointcloud/qgspointcloudrendererpropertieswidget.cpp
Expand Up @@ -98,7 +98,6 @@ QgsPointCloudRendererPropertiesWidget::QgsPointCloudRendererPropertiesWidget( Qg

connect( mPointSizeSpinBox, qgis::overload<double>::of( &QgsDoubleSpinBox::valueChanged ), this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
connect( mPointSizeUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
connect( mPointBudgetSpinBox, qgis::overload<int>::of( &QgsSpinBox::valueChanged ), this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );

mMaxErrorUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMetersInMapUnits << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels
<< QgsUnitTypes::RenderPoints << QgsUnitTypes::RenderInches );
Expand Down Expand Up @@ -144,7 +143,6 @@ void QgsPointCloudRendererPropertiesWidget::syncToLayer( QgsMapLayer *layer )
mPointSizeSpinBox->setValue( mLayer->renderer()->pointSize() );
mPointSizeUnitWidget->setUnit( mLayer->renderer()->pointSizeUnit() );
mPointSizeUnitWidget->setMapUnitScale( mLayer->renderer()->pointSizeMapUnitScale() );
mPointBudgetSpinBox->setValue( mLayer->renderer()->pointBudget() );

mPointStyleComboBox->setCurrentIndex( mPointStyleComboBox->findData( mLayer->renderer()->pointSymbol() ) );

Expand Down Expand Up @@ -178,7 +176,6 @@ void QgsPointCloudRendererPropertiesWidget::apply()
mLayer->renderer()->setPointSize( mPointSizeSpinBox->value() );
mLayer->renderer()->setPointSizeUnit( mPointSizeUnitWidget->unit() );
mLayer->renderer()->setPointSizeMapUnitScale( mPointSizeUnitWidget->getMapUnitScale() );
mLayer->renderer()->setPointBudget( mPointBudgetSpinBox->value() );

mLayer->renderer()->setPointSymbol( static_cast< QgsPointCloudRenderer::PointSymbol >( mPointStyleComboBox->currentData().toInt() ) );

Expand Down
80 changes: 33 additions & 47 deletions src/ui/pointcloud/qgspointcloudrendererpropsdialogbase.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>374</width>
<width>389</width>
<height>501</height>
</rect>
</property>
Expand Down Expand Up @@ -169,13 +169,43 @@
<property name="rightMargin">
<number>3</number>
</property>
<item row="3" column="0">
<item row="0" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mMaxErrorSpinBox">
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>99999999999.000000000000000</double>
</property>
<property name="value">
<double>0.300000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QgsBlendModeComboBox" name="mBlendModeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblBlend">
<property name="text">
<string>Blending mode</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QgsOpacityWidget" name="mOpacityWidget" native="true">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QgsUnitSelectionWidget" name="mMaxErrorUnitWidget">
<property name="minimumSize">
Expand All @@ -189,64 +219,20 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QgsOpacityWidget" name="mOpacityWidget" native="true">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="lblTransparency">
<property name="text">
<string>Opacity</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mMaxErrorSpinBox">
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>99999999999.000000000000000</double>
</property>
<property name="value">
<double>0.300000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblTransparency_2">
<property name="text">
<string>Maximum error</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QgsBlendModeComboBox" name="mBlendModeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>4</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QSpinBox" name="mPointBudgetSpinBox">
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelPointBudget">
<property name="text">
<string>Point budget</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 86a7139

Please sign in to comment.