mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
initial implementation
This commit is contained in:
parent
e3da221f7f
commit
14ff8e3489
@ -78,6 +78,20 @@ Sets the maximum screen ``error`` allowed when rendering the point cloud.
|
|||||||
Larger values result in a faster render with less points rendered.
|
Larger values result in a faster render with less points rendered.
|
||||||
|
|
||||||
.. seealso:: :py:func:`maximumScreenError`
|
.. seealso:: :py:func:`maximumScreenError`
|
||||||
|
%End
|
||||||
|
|
||||||
|
bool showBoundingBoxes() const;
|
||||||
|
%Docstring
|
||||||
|
Returns whether bounding boxes will be visible when rendering the point cloud.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`setShowBoundingBoxes`
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setShowBoundingBoxes( bool showBoundingBoxes );
|
||||||
|
%Docstring
|
||||||
|
Sets whether bounding boxes will be visible when rendering the point cloud.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`showBoundingBoxes`
|
||||||
%End
|
%End
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -112,7 +112,7 @@ Qt3DCore::QEntity *QgsPointCloudLayer3DRenderer::createEntity( const Qgs3DMapSet
|
|||||||
if ( !mSymbol )
|
if ( !mSymbol )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return new QgsPointCloudLayerChunkedEntity( pcl->dataProvider()->index(), map, dynamic_cast<QgsPointCloud3DSymbol *>( mSymbol->clone() ), maximumScreenError() );
|
return new QgsPointCloudLayerChunkedEntity( pcl->dataProvider()->index(), map, dynamic_cast<QgsPointCloud3DSymbol *>( mSymbol->clone() ), maximumScreenError(), showBoundingBoxes() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsPointCloudLayer3DRenderer::setSymbol( QgsPointCloud3DSymbol *symbol )
|
void QgsPointCloudLayer3DRenderer::setSymbol( QgsPointCloud3DSymbol *symbol )
|
||||||
@ -128,6 +128,7 @@ void QgsPointCloudLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWri
|
|||||||
|
|
||||||
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
|
elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
|
||||||
elem.setAttribute( QStringLiteral( "max-screen-error" ), maximumScreenError() );
|
elem.setAttribute( QStringLiteral( "max-screen-error" ), maximumScreenError() );
|
||||||
|
elem.setAttribute( QStringLiteral( "show-bounding-boxes" ), showBoundingBoxes() ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
|
||||||
|
|
||||||
QDomElement elemSymbol = doc.createElement( QStringLiteral( "symbol" ) );
|
QDomElement elemSymbol = doc.createElement( QStringLiteral( "symbol" ) );
|
||||||
if ( mSymbol )
|
if ( mSymbol )
|
||||||
@ -146,6 +147,7 @@ void QgsPointCloudLayer3DRenderer::readXml( const QDomElement &elem, const QgsRe
|
|||||||
|
|
||||||
const QString symbolType = elemSymbol.attribute( QStringLiteral( "type" ) );
|
const QString symbolType = elemSymbol.attribute( QStringLiteral( "type" ) );
|
||||||
mMaximumScreenError = elem.attribute( QStringLiteral( "max-screen-error" ), QStringLiteral( "1.0" ) ).toDouble();
|
mMaximumScreenError = elem.attribute( QStringLiteral( "max-screen-error" ), QStringLiteral( "1.0" ) ).toDouble();
|
||||||
|
mShowBoundingBoxes = elem.attribute( QStringLiteral( "show-bounding-boxes" ), "0" ).toInt();
|
||||||
|
|
||||||
if ( symbolType == QLatin1String( "single-color" ) )
|
if ( symbolType == QLatin1String( "single-color" ) )
|
||||||
mSymbol.reset( new QgsSingleColorPointCloud3DSymbol );
|
mSymbol.reset( new QgsSingleColorPointCloud3DSymbol );
|
||||||
@ -176,3 +178,14 @@ void QgsPointCloudLayer3DRenderer::setMaximumScreenError( double error )
|
|||||||
{
|
{
|
||||||
mMaximumScreenError = error;
|
mMaximumScreenError = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QgsPointCloudLayer3DRenderer::showBoundingBoxes() const
|
||||||
|
{
|
||||||
|
return mShowBoundingBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsPointCloudLayer3DRenderer::setShowBoundingBoxes( bool showBoundingBoxes )
|
||||||
|
{
|
||||||
|
mShowBoundingBoxes = showBoundingBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -208,10 +208,25 @@ class _3D_EXPORT QgsPointCloudLayer3DRenderer : public QgsAbstract3DRenderer
|
|||||||
*/
|
*/
|
||||||
void setMaximumScreenError( double error );
|
void setMaximumScreenError( double error );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether bounding boxes will be visible when rendering the point cloud.
|
||||||
|
*
|
||||||
|
* \see setShowBoundingBoxes()
|
||||||
|
*/
|
||||||
|
bool showBoundingBoxes() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether bounding boxes will be visible when rendering the point cloud.
|
||||||
|
*
|
||||||
|
* \see showBoundingBoxes()
|
||||||
|
*/
|
||||||
|
void setShowBoundingBoxes( bool showBoundingBoxes );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsMapLayerRef mLayerRef; //!< Layer used to extract mesh data from
|
QgsMapLayerRef mLayerRef; //!< Layer used to extract mesh data from
|
||||||
std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
|
std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
|
||||||
double mMaximumScreenError = 1.0;
|
double mMaximumScreenError = 1.0;
|
||||||
|
bool mShowBoundingBoxes = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
|
@ -196,12 +196,12 @@ QgsAABB nodeBoundsToAABB( QgsPointCloudDataBounds nodeBounds, QgsVector3D offset
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, QgsPointCloud3DSymbol *symbol, float maxScreenError )
|
QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes )
|
||||||
: QgsChunkedEntity( maxScreenError,
|
: QgsChunkedEntity( maxScreenError,
|
||||||
new QgsPointCloudLayerChunkLoaderFactory( map, pc, symbol ), true )
|
new QgsPointCloudLayerChunkLoaderFactory( map, pc, symbol ), true )
|
||||||
{
|
{
|
||||||
setUsingAdditiveStrategy( true );
|
setUsingAdditiveStrategy( true );
|
||||||
setShowBoundingBoxes( false );
|
setShowBoundingBoxes( showBoundingBoxes );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity()
|
QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity()
|
||||||
|
@ -115,7 +115,7 @@ class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, QgsPointCloud3DSymbol *symbol, float maxScreenError );
|
explicit QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes );
|
||||||
|
|
||||||
~QgsPointCloudLayerChunkedEntity();
|
~QgsPointCloudLayerChunkedEntity();
|
||||||
};
|
};
|
||||||
|
@ -100,6 +100,7 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la
|
|||||||
connect( mColorRampShaderMaxEdit, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::minMaxChanged );
|
connect( mColorRampShaderMaxEdit, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::minMaxChanged );
|
||||||
|
|
||||||
connect( mMaxScreenErrorSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::maximumScreenErrorChanged );
|
connect( mMaxScreenErrorSpinBox, qgis::overload<double>::of( &QDoubleSpinBox::valueChanged ), this, &QgsPointCloud3DSymbolWidget::maximumScreenErrorChanged );
|
||||||
|
connect( mShowBoundingBoxesCheckBox, &QCheckBox::stateChanged, this, &QgsPointCloud3DSymbolWidget::showBoundingBoxesChanged );
|
||||||
|
|
||||||
rampAttributeChanged();
|
rampAttributeChanged();
|
||||||
|
|
||||||
@ -571,3 +572,22 @@ void QgsPointCloud3DSymbolWidget::maximumScreenErrorChanged( double maxScreenErr
|
|||||||
mMaximumScreenError = maxScreenError;
|
mMaximumScreenError = maxScreenError;
|
||||||
emitChangedSignal();
|
emitChangedSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsPointCloud3DSymbolWidget::showBoundingBoxesChanged( int checkBoxState )
|
||||||
|
{
|
||||||
|
Q_UNUSED( checkBoxState );
|
||||||
|
bool showBoundingBoxes = mShowBoundingBoxesCheckBox->isChecked();
|
||||||
|
if ( showBoundingBoxes == mShowBoundingBoxes )
|
||||||
|
return;
|
||||||
|
mShowBoundingBoxes = showBoundingBoxes;
|
||||||
|
emitChangedSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void QgsPointCloud3DSymbolWidget::setShowBoundingBoxes( bool showBoundingBoxes )
|
||||||
|
{
|
||||||
|
if ( showBoundingBoxes == mShowBoundingBoxes )
|
||||||
|
return;
|
||||||
|
mShowBoundingBoxesCheckBox->setChecked( showBoundingBoxes );
|
||||||
|
mShowBoundingBoxes = showBoundingBoxes;
|
||||||
|
emitChangedSignal();
|
||||||
|
}
|
||||||
|
@ -36,6 +36,8 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
|
|||||||
|
|
||||||
void setMaximumScreenError( double maxScreenError );
|
void setMaximumScreenError( double maxScreenError );
|
||||||
double maximumScreenError() const { return mMaximumScreenError; }
|
double maximumScreenError() const { return mMaximumScreenError; }
|
||||||
|
void setShowBoundingBoxes( bool showBoundingBoxes );
|
||||||
|
double showBoundingBoxes() const { return mShowBoundingBoxes; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void reloadColorRampShaderMinMax();
|
void reloadColorRampShaderMinMax();
|
||||||
@ -55,6 +57,7 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
|
|||||||
void greenAttributeChanged();
|
void greenAttributeChanged();
|
||||||
void blueAttributeChanged();
|
void blueAttributeChanged();
|
||||||
void maximumScreenErrorChanged( double maxScreenError );
|
void maximumScreenErrorChanged( double maxScreenError );
|
||||||
|
void showBoundingBoxesChanged( int state );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
@ -70,6 +73,7 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
|
|||||||
|
|
||||||
bool mBlockMinMaxChanged = false;
|
bool mBlockMinMaxChanged = false;
|
||||||
double mMaximumScreenError = 1.0f;
|
double mMaximumScreenError = 1.0f;
|
||||||
|
bool mShowBoundingBoxes = false;
|
||||||
|
|
||||||
double mProviderMin = std::numeric_limits< double >::quiet_NaN();
|
double mProviderMin = std::numeric_limits< double >::quiet_NaN();
|
||||||
double mProviderMax = std::numeric_limits< double >::quiet_NaN();
|
double mProviderMax = std::numeric_limits< double >::quiet_NaN();
|
||||||
|
@ -44,6 +44,7 @@ void QgsPointCloudLayer3DRendererWidget::setRenderer( const QgsPointCloudLayer3D
|
|||||||
{
|
{
|
||||||
mWidgetPointCloudSymbol->setSymbol( const_cast<QgsPointCloud3DSymbol *>( renderer->symbol() ) );
|
mWidgetPointCloudSymbol->setSymbol( const_cast<QgsPointCloud3DSymbol *>( renderer->symbol() ) );
|
||||||
mWidgetPointCloudSymbol->setMaximumScreenError( renderer->maximumScreenError() );
|
mWidgetPointCloudSymbol->setMaximumScreenError( renderer->maximumScreenError() );
|
||||||
|
mWidgetPointCloudSymbol->setShowBoundingBoxes( renderer->showBoundingBoxes() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ QgsPointCloudLayer3DRenderer *QgsPointCloudLayer3DRendererWidget::renderer()
|
|||||||
renderer->setSymbol( sym );
|
renderer->setSymbol( sym );
|
||||||
renderer->setLayer( qobject_cast<QgsPointCloudLayer *>( mLayer ) );
|
renderer->setLayer( qobject_cast<QgsPointCloudLayer *>( mLayer ) );
|
||||||
renderer->setMaximumScreenError( mWidgetPointCloudSymbol->maximumScreenError() );
|
renderer->setMaximumScreenError( mWidgetPointCloudSymbol->maximumScreenError() );
|
||||||
|
renderer->setShowBoundingBoxes( mWidgetPointCloudSymbol->showBoundingBoxes() );
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +41,6 @@
|
|||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="lblTransparency_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point size</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QgsDoubleSpinBox" name="mPointSizeSpinBox">
|
<widget class="QgsDoubleSpinBox" name="mPointSizeSpinBox">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
@ -58,6 +51,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lblTransparency_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Point size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QDoubleSpinBox" name="mMaxScreenErrorSpinBox">
|
<widget class="QDoubleSpinBox" name="mMaxScreenErrorSpinBox">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
@ -75,6 +75,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="mShowBoundingBoxesCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show point cloud bounding boxes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -461,16 +468,16 @@ enhancement</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>QgsPointCloudAttributeComboBox</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>qgspointcloudattributecombobox.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QgsDoubleSpinBox</class>
|
<class>QgsDoubleSpinBox</class>
|
||||||
<extends>QDoubleSpinBox</extends>
|
<extends>QDoubleSpinBox</extends>
|
||||||
<header>qgsdoublespinbox.h</header>
|
<header>qgsdoublespinbox.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>QgsPointCloudAttributeComboBox</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>qgspointcloudattributecombobox.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>QgsColorRampShaderWidget</class>
|
<class>QgsColorRampShaderWidget</class>
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user