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

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 {
this, SIGNAL(updatePipelineWidget(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&)),
_pipelineWidget, SLOT(update(const std::vector<DataContainer*>&, const std::vector<AbstractPipeline*>&)));
connect(
_pipelineWidget, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(onPipelineWidgetItemClicked(const QModelIndex&)));
_pipelineWidget, SIGNAL(itemChanged(const QModelIndex&)),
this, SLOT(onPipelineWidgetItemChanged(const QModelIndex&)));
connect(
this, SIGNAL(updatePropCollectionWidget(HasPropertyCollection*, DataContainer*)),
_propCollectionWidget, SLOT(updatePropCollection(HasPropertyCollection*, DataContainer*)));
......@@ -239,7 +239,7 @@ namespace campvis {
emit updatePipelineWidget(_application->_dataContainers, pipelines);
}
void MainWindow::onPipelineWidgetItemClicked(const QModelIndex& index) {
void MainWindow::onPipelineWidgetItemChanged(const QModelIndex& index) {
if (index.isValid()) {
// Yak, this is so ugly - another reason why GUI programming sucks...
QVariant item = index.data(Qt::UserRole);
......
......@@ -119,8 +119,8 @@ namespace campvis {
* Slot to be called by the PipelineWidget when the selected item changes.
* \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.
*/
......
......@@ -379,6 +379,12 @@ namespace campvis {
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() {
_treeModel = new PipelineTreeModel(this);
cgtAssert(_treeModel != 0, "Failed creating TreeViewWidget model.");
......
......@@ -171,6 +171,11 @@ namespace campvis {
virtual QSize sizeHint() const;
signals:
/// Emitted whenever the currently selected item changes
void itemChanged(const QModelIndex& index);
public slots:
/**
* Updates the data in the tree view by the given collection of pipelines \a pipelines.
......@@ -179,6 +184,10 @@ namespace campvis {
void update(const std::vector<DataContainer*>& dataContainers, const std::vector<AbstractPipeline*>& pipelines);
protected:
virtual void selectionChanged(const QItemSelection& selected, const QItemSelection &deselected);
private:
/**
* Sets up the widget.
......
......@@ -32,10 +32,12 @@ namespace campvis {
: AutoEvaluationPipeline(dc)
, _usReader()
, _usBlurFilter(&_canvasSize)
//, _usResampler(&_canvasSize)
, _usMapsSolver()
{
addProcessor(&_usReader);
addProcessor(&_usBlurFilter);
//addProcessor(&_usResampler);
addProcessor(&_usMapsSolver);
}
......@@ -55,6 +57,9 @@ namespace campvis {
_usBlurFilter.p_outputImage.setValue("us.blurred");
_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");
_renderTargetID.setValue("us.blurred");
......
......@@ -29,6 +29,7 @@
#include "core/pipeline/autoevaluationpipeline.h"
#include "modules/devil/processors/devilimagereader.h"
#include "modules/preprocessing/processors/glgaussianfilter.h"
#include "modules/preprocessing/processors/glimageresampler.h"
#include "modules/cudaconfidencemaps/processors/cudaconfidencemapssolver.h"
#include "core/properties/buttonproperty.h"
......@@ -59,11 +60,12 @@ namespace campvis {
void onRenderTargetSizeChanged(const AbstractProperty *prop);
void execute();
//void execute();
protected:
DevilImageReader _usReader;
GlGaussianFilter _usBlurFilter;
//GlImageResampler _usResampler;
CudaConfidenceMapsSolver _usMapsSolver;
};
......
......@@ -88,6 +88,20 @@ namespace campvis {
}
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())
{
......
......@@ -193,7 +193,7 @@ namespace campvis {
leShader->deactivate();
// 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]);
id->setMappingInformation(img->getParent()->getMappingInformation());
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