Commit f2c44ee4 authored by Declara Denis's avatar Declara Denis Committed by Christian Schulte zu Berge
Browse files

Made PipelineTreeWidget react also to keyboard events.

Now it is possible to change the property window just by navigating
the PipelineTreeWidget with the arrow keys
parent a689d727
...@@ -176,8 +176,8 @@ namespace campvis { ...@@ -176,8 +176,8 @@ namespace campvis {
this, SIGNAL(updatePipelineWidget(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&)), this, SIGNAL(updatePipelineWidget(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&)),
_pipelineWidget, SLOT(update(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&))); _pipelineWidget, SLOT(update(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&)));
connect( connect(
_pipelineWidget, SIGNAL(clicked(const QModelIndex&)), _pipelineWidget, SIGNAL(itemChanged(const QModelIndex&)),
this, SLOT(onPipelineWidgetItemClicked(const QModelIndex&))); this, SLOT(onPipelineWidgetItemChanged(const QModelIndex&)));
connect( connect(
this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*, DataContainer*)), this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*, DataContainer*)),
_propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*, DataContainer*))); _propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*, DataContainer*)));
...@@ -239,7 +239,7 @@ namespace campvis { ...@@ -239,7 +239,7 @@ namespace campvis {
emit updatePipelineWidget(_application->_dataContainers, pipelines); emit updatePipelineWidget(_application->_dataContainers, pipelines);
} }
void MainWindow::onPipelineWidgetItemClicked(const QModelIndex& index) { void MainWindow::onPipelineWidgetItemChanged(const QModelIndex& index) {
if (index.isValid()) { if (index.isValid()) {
// Yak, this is so ugly - another reason why GUI programming sucks... // Yak, this is so ugly - another reason why GUI programming sucks...
QVariant item = index.data(Qt::UserRole); QVariant item = index.data(Qt::UserRole);
......
...@@ -119,8 +119,8 @@ namespace campvis { ...@@ -119,8 +119,8 @@ namespace campvis {
* Slot to be called by the PipelineWidget when the selected item changes. * Slot to be called by the PipelineWidget when the selected item changes.
* \param index Index of the selected item * \param index Index of the selected item
*/ */
void onPipelineWidgetItemClicked(const QModelIndex& index); void onPipelineWidgetItemChanged(const QModelIndex& index);
/** /**
* Slot to be called when _btnExecute was clicked. * Slot to be called when _btnExecute was clicked.
*/ */
......
...@@ -379,6 +379,12 @@ namespace campvis { ...@@ -379,6 +379,12 @@ namespace campvis {
updateGeometry(); updateGeometry();
} }
void PipelineTreeWidget::selectionChanged(const QItemSelection& selected, const QItemSelection &deselected) {
QTreeView::selectionChanged(selected, deselected);
QModelIndexList selection = this->selectedIndexes();
emit itemChanged(selection.first());
}
void PipelineTreeWidget::setupWidget() { void PipelineTreeWidget::setupWidget() {
_treeModel = new PipelineTreeModel(this); _treeModel = new PipelineTreeModel(this);
cgtAssert(_treeModel != 0, "Failed creating TreeViewWidget model."); cgtAssert(_treeModel != 0, "Failed creating TreeViewWidget model.");
......
...@@ -171,6 +171,11 @@ namespace campvis { ...@@ -171,6 +171,11 @@ namespace campvis {
virtual QSize sizeHint() const; virtual QSize sizeHint() const;
signals:
/// Emitted whenever the currently selected item changes
void itemChanged(const QModelIndex& index);
public slots: public slots:
/** /**
* Updates the data in the tree view by the given collection of pipelines \a pipelines. * Updates the data in the tree view by the given collection of pipelines \a pipelines.
...@@ -179,6 +184,10 @@ namespace campvis { ...@@ -179,6 +184,10 @@ namespace campvis {
void update(const std::vector<DataContainer*>& dataContainers, const std::vector<AbstractPipeline*>& pipelines); void update(const std::vector<DataContainer*>& dataContainers, const std::vector<AbstractPipeline*>& pipelines);
protected:
virtual void selectionChanged(const QItemSelection& selected, const QItemSelection &deselected);
private: private:
/** /**
* Sets up the widget. * Sets up the widget.
......
...@@ -32,10 +32,12 @@ namespace campvis { ...@@ -32,10 +32,12 @@ namespace campvis {
: AutoEvaluationPipeline(dc) : AutoEvaluationPipeline(dc)
, _usReader() , _usReader()
, _usBlurFilter(&_canvasSize) , _usBlurFilter(&_canvasSize)
//, _usResampler(&_canvasSize)
, _usMapsSolver() , _usMapsSolver()
{ {
addProcessor(&_usReader); addProcessor(&_usReader);
addProcessor(&_usBlurFilter); addProcessor(&_usBlurFilter);
//addProcessor(&_usResampler);
addProcessor(&_usMapsSolver); addProcessor(&_usMapsSolver);
} }
...@@ -55,6 +57,9 @@ namespace campvis { ...@@ -55,6 +57,9 @@ namespace campvis {
_usBlurFilter.p_outputImage.setValue("us.blurred"); _usBlurFilter.p_outputImage.setValue("us.blurred");
_usBlurFilter.p_outputImage.addSharedProperty(&_usMapsSolver.p_inputImage); _usBlurFilter.p_outputImage.addSharedProperty(&_usMapsSolver.p_inputImage);
//_usResampler.p_outputImage.setValue("us.resampled");
//_usResampler.p_outputImage.addSharedProperty(&_usMapsSolver.p_inputImage);
_usMapsSolver.p_outputConfidenceMap.setValue("us.confidence"); _usMapsSolver.p_outputConfidenceMap.setValue("us.confidence");
_renderTargetID.setValue("us.blurred"); _renderTargetID.setValue("us.blurred");
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "core/pipeline/autoevaluationpipeline.h" #include "core/pipeline/autoevaluationpipeline.h"
#include "modules/devil/processors/devilimagereader.h" #include "modules/devil/processors/devilimagereader.h"
#include "modules/preprocessing/processors/glgaussianfilter.h" #include "modules/preprocessing/processors/glgaussianfilter.h"
#include "modules/preprocessing/processors/glimageresampler.h"
#include "modules/cudaconfidencemaps/processors/cudaconfidencemapssolver.h" #include "modules/cudaconfidencemaps/processors/cudaconfidencemapssolver.h"
#include "core/properties/buttonproperty.h" #include "core/properties/buttonproperty.h"
...@@ -59,11 +60,12 @@ namespace campvis { ...@@ -59,11 +60,12 @@ namespace campvis {
void onRenderTargetSizeChanged(const AbstractProperty *prop); void onRenderTargetSizeChanged(const AbstractProperty *prop);
void execute(); //void execute();
protected: protected:
DevilImageReader _usReader; DevilImageReader _usReader;
GlGaussianFilter _usBlurFilter; GlGaussianFilter _usBlurFilter;
//GlImageResampler _usResampler;
CudaConfidenceMapsSolver _usMapsSolver; CudaConfidenceMapsSolver _usMapsSolver;
}; };
......
...@@ -88,6 +88,20 @@ namespace campvis { ...@@ -88,6 +88,20 @@ namespace campvis {
} }
void CudaConfidenceMapsSolver::updateResult(DataContainer& data) { void CudaConfidenceMapsSolver::updateResult(DataContainer& data) {
ImageRepresentationLocal::ScopedRepresentation img(data, p_inputImage.getValue());
if (img != 0) {
cgt::ivec3 size = img->getSize();
ImageData *id = new ImageData(img->getParent()->getDimensionality(), size, img->getParent()->getNumChannels());
size_t elementCount = cgt::hmul(size);
uint8_t *imgData = new uint8_t[elementCount];
std::cout << "imgcount: " << elementCount << std::endl;
for (size_t i = 0; i < elementCount; ++i)
imgData[i] = (uint8_t)i;
WeaklyTypedPointer wtpData(WeaklyTypedPointer::UINT8, 1, imgData);
ImageRepresentationLocal::create(id, wtpData);
id->setMappingInformation(img->getParent()->getMappingInformation());
data.addData(p_outputConfidenceMap.getValue(), id);
}
/* /*
if(p_receiveTransforms.getValue()) if(p_receiveTransforms.getValue())
{ {
......
...@@ -193,7 +193,7 @@ namespace campvis { ...@@ -193,7 +193,7 @@ namespace campvis {
leShader->deactivate(); leShader->deactivate();
// put resulting image into DataContainer // put resulting image into DataContainer
ImageData* id = new ImageData(3, size, img->getParent()->getNumChannels()); ImageData* id = new ImageData(img->getParent()->getDimensionality(), size, img->getParent()->getNumChannels());
ImageRepresentationGL::create(id, resultTextures[0]); ImageRepresentationGL::create(id, resultTextures[0]);
id->setMappingInformation(img->getParent()->getMappingInformation()); id->setMappingInformation(img->getParent()->getMappingInformation());
data.addData(p_outputImage.getValue(), id); data.addData(p_outputImage.getValue(), id);
......
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