Skip to content

Commit

Permalink
Implement refresh() and setNewItem()
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Aug 25, 2018
1 parent 7eb5d22 commit 3a0454f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/3d/qgslayoutitem3dmap.cpp
Expand Up @@ -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 )
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgslayoutitem3dmap.h
Expand Up @@ -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;
Expand Down
14 changes: 14 additions & 0 deletions src/app/layout/qgslayout3dmapwidget.cpp
Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions src/app/layout/qgslayout3dmapwidget.h
Expand Up @@ -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();

Expand Down

0 comments on commit 3a0454f

Please sign in to comment.