Skip to content
Permalink
Browse files

Implement refresh() and setNewItem()

  • Loading branch information
wonder-sk committed Aug 25, 2018
1 parent 7eb5d22 commit 3a0454ff5d2911a4a7acd780173fa191e7454a5d
@@ -181,6 +181,13 @@ void QgsLayoutItem3DMap::setMapSettings( Qgs3DMapSettings *settings )
update();
}

void QgsLayoutItem3DMap::refresh()
{
QgsLayoutItem::refresh();

mCapturedImage = QImage();
}

void QgsLayoutItem3DMap::setCameraPose( const QgsCameraPose &pose )
{
if ( mCameraPose == pose )
@@ -89,6 +89,9 @@ class _3D_EXPORT QgsLayoutItem3DMap : public QgsLayoutItem
//! Returns map scene. May be a null pointer if not yet configured.
Qgs3DMapSettings *mapSettings() const { return mSettings.get(); }

public slots:
void refresh() override;

protected:
void draw( QgsLayoutItemRenderContext &context ) override;
bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
@@ -138,3 +138,17 @@ void QgsLayout3DMapWidget::updateCameraPose()
pose.setHeadingAngle( mHeadingAngleSpinBox->value() );
mMap3D->setCameraPose( pose );
}

bool QgsLayout3DMapWidget::setNewItem( QgsLayoutItem *item )
{
QgsLayoutItem3DMap *newItem = qobject_cast< QgsLayoutItem3DMap * >( item );
if ( !newItem )
return false;

mMap3D = newItem;
mItemPropertiesWidget->setItem( newItem );

updateCameraPoseWidgetsFromItem();

return true;
}
@@ -28,6 +28,9 @@ class QgsLayout3DMapWidget : public QgsLayoutItemBaseWidget, private Ui::QgsLayo
public:
explicit QgsLayout3DMapWidget( QgsLayoutItem3DMap *map3D );

protected:
bool setNewItem( QgsLayoutItem *item ) override;

private:
void updateCameraPoseWidgetsFromItem();

0 comments on commit 3a0454f

Please sign in to comment.
You can’t perform that action at this time.