Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 9de33c78 authored by schultezub's avatar schultezub
Browse files

started integrating DataContainerInspectorCanvas into the DataContainerInspectorWidget

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@435 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent e9796f50
......@@ -30,8 +30,16 @@
#include "datacontainerinspectorwidget.h"
#include "tgt/assert.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "tgt/qt/qtcontextmanager.h"
#include "tgt/qt/qtthreadedcanvas.h"
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/datacontainer.h"
#include "core/datastructures/facegeometry.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "application/gui/datacontainertreewidget.h"
#include "application/gui/qtdatahandle.h"
......@@ -39,6 +47,9 @@ namespace campvis {
DataContainerInspectorWidget::DataContainerInspectorWidget(QWidget* parent)
: QWidget(parent)
, _quad(0)
, _paintShader(0)
, _currentSlice(-1)
, _dataContainer(0)
, _selectedDataHandle(0)
, _dctWidget(0)
......@@ -63,6 +74,9 @@ namespace campvis {
_dataContainer = dataContainer;
_dctWidget->update(dataContainer);
if (_canvas != 0)
_canvas->setDataContainer(_dataContainer);
if (_dataContainer != 0) {
_dataContainer->s_dataAdded.connect(this, &DataContainerInspectorWidget::onDataContainerDataAdded);
......@@ -130,9 +144,8 @@ namespace campvis {
_lblTimestamp = new QLabel("Timestamp: ", _infoWidget);
_infoWidgetLayout->addWidget(_lblTimestamp);
// _canvas = CtxtMgr.createContext("DataContainerInspector", "", tgt::ivec2(128, 128), tgt::GLCanvas::RGBA, _infoWidget);
// _infoWidgetLayout->addWidget(_canvas, 1);
_infoWidgetLayout->addWidget(new QWidget(_infoWidget), 1);
_canvas = new DataContainerInspectorCanvas(_infoWidget);
_infoWidgetLayout->addWidget(_canvas, 1);
_mainLayout->addWidget(_infoWidget, 1);
......@@ -180,4 +193,14 @@ namespace campvis {
return QString::number(numBytes) + units[index];
}
void DataContainerInspectorWidget::init() {
if (_canvas != 0)
_canvas->init();
}
void DataContainerInspectorWidget::deinit() {
if (_canvas != 0)
_canvas->deinit();
}
}
\ No newline at end of file
......@@ -36,6 +36,7 @@
#include "tgt/qt/qtthreadedcanvas.h"
#include "application/gui/qtdatahandle.h"
#include "application/gui/datacontainerinspectorcanvas.h"
#include "core/tools/opengljobprocessor.h"
#include <QLabel>
......@@ -48,12 +49,15 @@ class QModelIndex;
namespace tgt {
class Texture;
class TextureUnit;
class Shader;
}
namespace campvis {
class AbstractPipeline;
class DataContainer;
class DataContainerTreeWidget;
class FaceGeometry;
class DataContainerInspectorWidget : public QWidget, public sigslot::has_slots<> {
Q_OBJECT;
......@@ -86,6 +90,18 @@ namespace campvis {
* \return QSize(640, 480)
*/
QSize sizeHint() const;
/**
* Initializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
virtual void init();
/**
* Deinitializes the OpenGL stuff (e.g. shaders).
* Must be called with a valid and locked OpenGL context.
*/
void deinit();
signals:
void dataContainerChanged(const QString&, QtDataHandle);
......@@ -122,13 +138,17 @@ namespace campvis {
*/
QString humanizeBytes(size_t numBytes) const;
tgt::Shader* _paintShader;
FaceGeometry* _quad; ///< Quad used for rendering
int _currentSlice; ///< current slice if rendering a 3D image fullscreen, render MIP if negative
DataContainer* _dataContainer; ///< The DataContainer this widget is inspecting
QtDataHandle _selectedDataHandle; ///< The currently selected QtDataHandle
QString _selectedDataHandleName; ///< The name of the currently selected QtDataHandle
tgt::ivec2 _selectedIndex; ///< row/column of selected item
DataContainerTreeWidget* _dctWidget; ///< The TreeWidget showing the DataHandles in _dataContainer
tgt::QtThreadedCanvas* _canvas; ///< The OpenGL canvas for rendering the DataContainer's contents
DataContainerInspectorCanvas* _canvas; ///< The OpenGL canvas for rendering the DataContainer's contents
QHBoxLayout* _mainLayout; ///< Layout for this widget
QWidget* _infoWidget; ///< Widget showing the information about the selected QtDataHandle
......
......@@ -46,7 +46,6 @@ namespace campvis {
, _pipelineWidget(0)
, _propCollectionWidget(0)
, _dcInspectorWidget(0)
, _dcInspectorCanvas(0)
, _btnExecute(0)
, _btnShowDataContainerInspector(0)
, _selectedPipeline(0)
......@@ -58,15 +57,14 @@ namespace campvis {
MainWindow::~MainWindow() {
_application->s_PipelinesChanged.disconnect(this);
delete _dcInspectorCanvas;
delete _dcInspectorWidget;
}
void MainWindow::setup() {
qRegisterMetaType<QtDataHandle>("QtDataHandle");
_dcInspectorCanvas = new DataContainerInspectorCanvas();
_dcInspectorCanvas->show();
_dcInspectorWidget = new DataContainerInspectorWidget();
_dcInspectorWidget->show();
_centralWidget = new QWidget(this);
QHBoxLayout* mainLayout = new QHBoxLayout();
......@@ -126,9 +124,6 @@ namespace campvis {
if (AbstractPipeline* pipeline = dynamic_cast<AbstractPipeline*>(ptr)) {
_selectedPipeline = pipeline;
_selectedProcessor = 0;
if (_dcInspectorCanvas != 0)
_dcInspectorCanvas->setDataContainer(&_selectedPipeline->getDataContainer());
if (_dcInspectorWidget != 0)
onBtnShowDataContainerInspectorClicked();
}
......@@ -158,22 +153,19 @@ namespace campvis {
void MainWindow::onBtnShowDataContainerInspectorClicked() {
if (_selectedPipeline != 0) {
if (_dcInspectorWidget == 0) {
_dcInspectorWidget = new DataContainerInspectorWidget();
}
_dcInspectorWidget->setDataContainer(&(_selectedPipeline->getDataContainer()));
_dcInspectorWidget->show();
}
}
void MainWindow::init() {
if (_dcInspectorCanvas != 0)
_dcInspectorCanvas->init();
if (_dcInspectorWidget != 0)
_dcInspectorWidget->init();
}
void MainWindow::deinit() {
if (_dcInspectorCanvas != 0)
_dcInspectorCanvas->deinit();
if (_dcInspectorWidget != 0)
_dcInspectorWidget->deinit();
}
}
\ No newline at end of file
......@@ -122,8 +122,6 @@ namespace campvis {
PropertyCollectionWidget* _propCollectionWidget; ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
DataContainerInspectorWidget* _dcInspectorWidget; ///< Widget for inspecting the DataContainer of the selected pipeline.
DataContainerInspectorCanvas* _dcInspectorCanvas;
QPushButton* _btnExecute; ///< Button to execute the selected pipeline/processor
QPushButton* _btnShowDataContainerInspector; ///< Button to show the DataContainerInspector for the selected pipeline
......
......@@ -67,6 +67,23 @@ namespace campvis {
}
};
/**
* Creates a new ScopedRepresentation for the given DataHandle, that behaves like a T*.
* \param dh Source DataHandle
*/
ScopedRepresentation(DataHandle dataHandle)
: dh(dataHandle)
, data(0)
, representation(0)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
representation = data->getRepresentation<T>();
}
}
};
/**
* Implicit conversion operator to const T*.
* \return The image representation of the image in the DataHandle, may be 0 when no DataHandle was found,
......
......@@ -76,6 +76,23 @@ namespace campvis {
}
}
};
/**
* Creates a new ScopedRepresentation for the given DataHandle, that behaves like a T*.
* \param dh Source DataHandle
*/
ScopedRepresentation(DataHandle dataHandle)
: dh(dataHandle)
, data(0)
, representation(0)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
representation = data->getRepresentation<ThisType>();
}
}
};
/**
* Implicit conversion operator to const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>*.
......
......@@ -109,6 +109,23 @@ namespace campvis {
}
}
};
/**
* Creates a new ScopedRepresentation for the given DataHandle, that behaves like a T*.
* \param dh Source DataHandle
*/
ScopedRepresentation(DataHandle dataHandle)
: dh(dataHandle)
, data(0)
, representation(0)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
representation = data->getRepresentation<ThisType>();
}
}
};
/**
* Implicit conversion operator to const GenericImageRepresentationItk<BASETYPE, NUMCHANNELS, DIMENSIONALITY>*.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment