35  if ( !rendererAbstractMetadata )
 
   38  if ( !rendererMetadata )
 
   43  if ( !iconName.isEmpty() )
 
   52static void _initRendererWidgetFunctions()
 
   54  static bool sInitialized = 
false;
 
   58  _initRenderer( QStringLiteral( 
"extent" ), QgsPointCloudExtentRendererWidget::create, QStringLiteral( 
"styleicons/pointcloudextent.svg" ) );
 
   59  _initRenderer( QStringLiteral( 
"rgb" ), QgsPointCloudRgbRendererWidget::create, QStringLiteral( 
"styleicons/multibandcolor.svg" ) );
 
   60  _initRenderer( QStringLiteral( 
"ramp" ), QgsPointCloudAttributeByRampRendererWidget::create, QStringLiteral( 
"styleicons/singlebandpseudocolor.svg" ) );
 
   61  _initRenderer( QStringLiteral( 
"classified" ), QgsPointCloudClassifiedRendererWidget::create, QStringLiteral( 
"styleicons/paletted.svg" ) );
 
   73  layout()->setContentsMargins( 0, 0, 0, 0 );
 
   76  _initRendererWidgetFunctions();
 
   80  for ( 
const QString &name : renderers )
 
   83      cboRenderers->addItem( m->icon(), m->visibleName(), name );
 
   86  cboRenderers->setCurrentIndex( -1 ); 
 
   91  connect( cboRenderers, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::rendererChanged );
 
   93  connect( mBlendModeComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
 
   96  mPointSizeUnitWidget->setUnits( {Qgis::RenderUnit::Millimeters,
 
   97                                   Qgis::RenderUnit::MetersInMapUnits,
 
   98                                   Qgis::RenderUnit::MapUnits,
 
   99                                   Qgis::RenderUnit::Pixels,
 
  100                                   Qgis::RenderUnit::Points,
 
  101                                   Qgis::RenderUnit::Inches } );
 
  103  connect( mPointSizeSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
 
  110  mMaxErrorUnitWidget->setUnits( { Qgis::RenderUnit::Millimeters,
 
  111                                   Qgis::RenderUnit::MetersInMapUnits,
 
  112                                   Qgis::RenderUnit::MapUnits,
 
  113                                   Qgis::RenderUnit::Pixels,
 
  114                                   Qgis::RenderUnit::Points,
 
  115                                   Qgis::RenderUnit::Inches } );
 
  116  mMaxErrorSpinBox->setClearValue( 0.3 );
 
  118  connect( mMaxErrorSpinBox, qOverload<double>( &QgsDoubleSpinBox::valueChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
 
  121  connect( mPointStyleComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
 
  122  connect( mDrawOrderComboBox, 
static_cast<void ( QComboBox::* )( 
int )
>( &QComboBox::currentIndexChanged ), 
this, &QgsPointCloudRendererPropertiesWidget::emitWidgetChanged );
 
  139  mLayer = qobject_cast< QgsPointCloudLayer * >( layer );
 
  141  mBlockChangedSignal = 
true;
 
  142  mOpacityWidget->setOpacity( mLayer->
opacity() );
 
  144  mBlendModeComboBox->setBlendMode( mLayer->
blendMode() );
 
  149    const QString rendererName = mLayer->
renderer()->
type();
 
  151    const int rendererIdx = cboRenderers->findData( rendererName );
 
  152    cboRenderers->setCurrentIndex( rendererIdx );
 
  155    Q_ASSERT( rendererIdx != -1 && 
"there must be a renderer!" );
 
  161    mPointStyleComboBox->setCurrentIndex( mPointStyleComboBox->findData( 
static_cast< int >( mLayer->
renderer()->
pointSymbol() ) ) );
 
  162    mDrawOrderComboBox->setCurrentIndex( mDrawOrderComboBox->findData( 
static_cast< int >( mLayer->
renderer()->
drawOrder2d() ) ) );
 
  168  mBlockChangedSignal = 
false;
 
  180  mLayer->
setOpacity( mOpacityWidget->opacity() );
 
  181  mLayer->
setBlendMode( mBlendModeComboBox->blendMode() );
 
  185  else if ( !cboRenderers->currentData().toString().isEmpty() )
 
  202void QgsPointCloudRendererPropertiesWidget::rendererChanged()
 
  204  if ( cboRenderers->currentIndex() == -1 )
 
  206    QgsDebugError( QStringLiteral( 
"No current item -- this should never happen!" ) );
 
  210  const QString rendererName = cboRenderers->currentData().toString();
 
  213  std::unique_ptr< QgsPointCloudRenderer > oldRenderer;
 
  214  std::unique_ptr< QgsPointCloudRenderer > newRenderer;
 
  216    newRenderer.reset( mActiveWidget->
renderer() );
 
  220    oldRenderer = std::move( newRenderer );
 
  230    stackedWidget->removeWidget( mActiveWidget );
 
  232    delete mActiveWidget;
 
  233    mActiveWidget = 
nullptr;
 
  238  if ( rendererMetadata )
 
  245    mActiveWidget = widget;
 
  246    stackedWidget->addWidget( mActiveWidget );
 
  247    stackedWidget->setCurrentWidget( mActiveWidget );
 
  249    if ( mMapCanvas || mMessageBar )
 
  264    stackedWidget->setCurrentWidget( pageNoWidget );
 
  269void QgsPointCloudRendererPropertiesWidget::emitWidgetChanged()
 
  271  if ( !mBlockChangedSignal )
 
PointCloudSymbol
Rendering symbols for point cloud points.
 
@ Circle
Renders points as circles.
 
@ Square
Renders points as squares.
 
PointCloudDrawOrder
Pointcloud rendering order for 2d views.
 
@ BottomToTop
Draw points with larger Z values last.
 
@ Default
Draw points in the order they are stored.
 
@ TopToBottom
Draw points with larger Z values first.
 
static QgsPointCloudRendererRegistry * pointCloudRendererRegistry()
Returns the application's point cloud renderer registry, used for managing point cloud layer 2D rende...
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
Base class for all map layer types.
 
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
 
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
 
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
 
Represents a map layer supporting display of point clouds.
 
QgsPointCloudRenderer * renderer()
Returns the 2D renderer for the point cloud.
 
void setRenderer(QgsPointCloudRenderer *renderer)
Sets the 2D renderer for the point cloud.
 
Registry of 2D renderers for point clouds.
 
QgsPointCloudRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
 
QStringList renderersList() const
Returns a list of available renderers.
 
void setMaximumScreenError(double error)
Sets the maximum screen error allowed when rendering the point cloud.
 
void setMaximumScreenErrorUnit(Qgis::RenderUnit unit)
Sets the unit for the maximum screen error allowed when rendering the point cloud.
 
const QgsMapUnitScale & pointSizeMapUnitScale() const
Returns the map unit scale used for the point size.
 
void setPointSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for the point size.
 
void setPointSize(double size)
Sets the point size.
 
virtual QString type() const =0
Returns the identifier of the renderer type.
 
virtual QgsPointCloudRenderer * clone() const =0
Create a deep copy of this renderer.
 
Qgis::RenderUnit maximumScreenErrorUnit() const
Returns the unit for the maximum screen error allowed when rendering the point cloud.
 
void setDrawOrder2d(Qgis::PointCloudDrawOrder order)
Sets the drawing order used by the renderer for drawing points.
 
void setPointSizeUnit(const Qgis::RenderUnit units)
Sets the units used for the point size.
 
void setPointSymbol(Qgis::PointCloudSymbol symbol)
Sets the symbol used by the renderer for drawing points.
 
double maximumScreenError() const
Returns the maximum screen error allowed when rendering the point cloud.
 
Qgis::RenderUnit pointSizeUnit() const
Returns the units used for the point size.
 
Qgis::PointCloudSymbol pointSymbol() const
Returns the symbol used by the renderer for drawing points.
 
Qgis::PointCloudDrawOrder drawOrder2d() const
Returns the drawing order used by the renderer for drawing points.
 
double pointSize() const
Returns the point size.
 
static bool layerIsContainedInGroupLayer(QgsProject *project, QgsMapLayer *layer)
Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
The class is used as a container of context for various read/write operations on other objects.
 
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
 
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
 
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
 
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
 
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
 
#define QgsDebugMsgLevel(str, level)
 
#define QgsDebugError(str)
 
QgsPointCloudRendererWidget *(* QgsPointCloudRendererWidgetFunc)(QgsPointCloudLayer *, QgsStyle *, QgsPointCloudRenderer *)