mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Add option to change between VPC overview and extends
This commit is contained in:
parent
a0fb608f69
commit
efa8912b0b
@ -575,6 +575,20 @@ Sets the text format renderers should use for rendering labels
|
||||
%Docstring
|
||||
Returns the text format renderer is using for rendering labels
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
void setShowExtends( const bool show );
|
||||
%Docstring
|
||||
Set whether the renderer should render point cloud extends instead of overview when zoomed out
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
bool showExtends() const;
|
||||
%Docstring
|
||||
Returns whether the renderer renders point cloud extends instead of overview when zoomed out
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
|
@ -575,6 +575,20 @@ Sets the text format renderers should use for rendering labels
|
||||
%Docstring
|
||||
Returns the text format renderer is using for rendering labels
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
void setShowExtends( const bool show );
|
||||
%Docstring
|
||||
Set whether the renderer should render point cloud extends instead of overview when zoomed out
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
bool showExtends() const;
|
||||
%Docstring
|
||||
Returns whether the renderer renders point cloud extends instead of overview when zoomed out
|
||||
|
||||
.. versionadded:: 3.42
|
||||
%End
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "qgspointcloudrequest.h"
|
||||
#include "qgsrendercontext.h"
|
||||
#include "qgsruntimeprofiler.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgsvirtualpointcloudprovider.h"
|
||||
|
||||
#include <delaunator.hpp>
|
||||
@ -209,8 +208,10 @@ bool QgsPointCloudLayerRenderer::render()
|
||||
visibleIndexes.append( si );
|
||||
}
|
||||
}
|
||||
// if the overview of virtual point cloud exists we render it when we are zoomed out
|
||||
// if the overview of virtual point cloud exists and user hasn't requested point cloud extends we render overview,
|
||||
// when we are zoomed out
|
||||
if ( vpcProvider.overview() != nullptr &&
|
||||
!mRenderer->showExtends() &&
|
||||
renderExtent.width() > vpcProvider.averageSubIndexWidth() &&
|
||||
renderExtent.height() > vpcProvider.averageSubIndexHeight() )
|
||||
{
|
||||
@ -226,9 +227,10 @@ bool QgsPointCloudLayerRenderer::render()
|
||||
|
||||
QgsPointCloudIndex pc = si.index();
|
||||
|
||||
if ( !pc || !pc.isValid() )
|
||||
if ( ( !pc || !pc.isValid() || mRenderer->showExtends() ) &&
|
||||
renderExtent.width() > vpcProvider.averageSubIndexWidth() &&
|
||||
renderExtent.height() > vpcProvider.averageSubIndexHeight() )
|
||||
{
|
||||
// TODO: render the individual extents when zoomed out and users requests them
|
||||
mSubIndexExtentRenderer->renderExtent( si.polygonBounds(), context );
|
||||
// render the label of point cloud tile
|
||||
if ( mSubIndexExtentRenderer->showLabels() )
|
||||
|
@ -218,6 +218,7 @@ void QgsPointCloudRenderer::copyCommonProperties( QgsPointCloudRenderer *destina
|
||||
|
||||
destination->setShowLabels( mShowLabels );
|
||||
destination->setLabelTextFormat( mLabelTextFormat );
|
||||
destination->setShowExtends( mShowExtends );
|
||||
}
|
||||
|
||||
void QgsPointCloudRenderer::restoreCommonProperties( const QDomElement &element, const QgsReadWriteContext &context )
|
||||
@ -242,6 +243,7 @@ void QgsPointCloudRenderer::restoreCommonProperties( const QDomElement &element,
|
||||
mLabelTextFormat = QgsTextFormat();
|
||||
mLabelTextFormat.readXml( element.firstChildElement( QStringLiteral( "text-style" ) ), context );
|
||||
}
|
||||
mShowExtends = element.attribute( QStringLiteral( "showExtends" ), QStringLiteral( "0" ) ).toInt();
|
||||
}
|
||||
|
||||
void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const QgsReadWriteContext &context ) const
|
||||
@ -267,6 +269,7 @@ void QgsPointCloudRenderer::saveCommonProperties( QDomElement &element, const Qg
|
||||
QDomDocument doc = element.ownerDocument();
|
||||
element.appendChild( mLabelTextFormat.writeXml( doc, context ) );
|
||||
}
|
||||
element.setAttribute( QStringLiteral( "showExtends" ), QString::number( mShowExtends ) );
|
||||
}
|
||||
|
||||
Qgis::PointCloudSymbol QgsPointCloudRenderer::pointSymbol() const
|
||||
|
@ -701,6 +701,18 @@ class CORE_EXPORT QgsPointCloudRenderer
|
||||
*/
|
||||
QgsTextFormat labelTextFormat() const { return mLabelTextFormat; }
|
||||
|
||||
/**
|
||||
* Set whether the renderer should render point cloud extends instead of overview when zoomed out
|
||||
* \since QGIS 3.42
|
||||
*/
|
||||
void setShowExtends( const bool show ) { mShowExtends = show; }
|
||||
|
||||
/**
|
||||
* Returns whether the renderer renders point cloud extends instead of overview when zoomed out
|
||||
* \since QGIS 3.42
|
||||
*/
|
||||
bool showExtends() const { return mShowExtends; }
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
@ -842,6 +854,8 @@ class CORE_EXPORT QgsPointCloudRenderer
|
||||
|
||||
bool mShowLabels = false;
|
||||
QgsTextFormat mLabelTextFormat;
|
||||
|
||||
bool mShowExtends = false;
|
||||
};
|
||||
|
||||
#endif // QGSPOINTCLOUDRENDERER_H
|
||||
|
@ -124,11 +124,11 @@ QgsPointCloudRendererPropertiesWidget::QgsPointCloudRendererPropertiesWidget( Qg
|
||||
connect( mHorizontalTriangleThresholdSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
connect( mHorizontalTriangleUnitWidget, &QgsUnitSelectionWidget::changed, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
|
||||
// show label options only for virtual point clouds
|
||||
bool showLabelOptions = !mLayer->dataProvider()->subIndexes().isEmpty();
|
||||
mLabels->setVisible( showLabelOptions );
|
||||
mLabelOptions->setVisible( showLabelOptions );
|
||||
// show virtual point cloud options only when vpc layer is selected
|
||||
bool showVpcOptions = !mLayer->dataProvider()->subIndexes().isEmpty();
|
||||
mVpcGroupBox->setVisible( showVpcOptions );
|
||||
mLabelOptions->setDialogTitle( tr( "Customize label text" ) );
|
||||
connect( mExtendsCheckBox, &QCheckBox::stateChanged, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
connect( mLabels, &QCheckBox::stateChanged, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
connect( mLabelOptions, &QgsFontButton::changed, this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
|
||||
|
||||
@ -191,6 +191,7 @@ void QgsPointCloudRendererPropertiesWidget::syncToLayer( QgsMapLayer *layer )
|
||||
{
|
||||
mLabels->setChecked( mLayer->renderer()->showLabels() );
|
||||
mLabelOptions->setTextFormat( mLayer->renderer()->labelTextFormat() );
|
||||
mExtendsCheckBox->setChecked( mLayer->renderer()->showExtends() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,6 +235,7 @@ void QgsPointCloudRendererPropertiesWidget::apply()
|
||||
|
||||
mLayer->renderer()->setShowLabels( mLabels->isChecked() );
|
||||
mLayer->renderer()->setLabelTextFormat( mLabelOptions->textFormat() );
|
||||
mLayer->renderer()->setShowExtends( mExtendsCheckBox->isChecked() );
|
||||
}
|
||||
|
||||
void QgsPointCloudRendererPropertiesWidget::rendererChanged()
|
||||
|
@ -169,6 +169,55 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBox" name="mVpcGroupBox">
|
||||
<property name="title">
|
||||
<string>Virtual Point Cloud Options</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="mLabels">
|
||||
<property name="text">
|
||||
<string>Show tile labels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>301</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QgsFontButton" name="mLabelOptions">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="mExtendsCheckBox">
|
||||
<property name="text">
|
||||
<string>Show point cloud extends</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="mLayerRenderingGroupBox">
|
||||
<property name="title">
|
||||
@ -279,33 +328,6 @@
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="mLabels">
|
||||
<property name="text">
|
||||
<string>Show tile labels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsFontButton" name="mLabelOptions">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user