05.11., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 78025428 authored by schultezub's avatar schultezub

converted VisualizationPipeline::_canvasSize to property an let it change the Qt widget canvas size

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@470 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 695fdc4a
......@@ -43,7 +43,7 @@
namespace campvis {
const std::string RaycastingProcessor::loggerCat_ = "CAMPVis.modules.vis.RaycastingProcessor";
RaycastingProcessor::RaycastingProcessor(GenericProperty<tgt::ivec2>& renderTargetSize, const std::string& fragmentShaderFileName, bool bindEntryExitDepthTextures)
RaycastingProcessor::RaycastingProcessor(IVec2Property& renderTargetSize, const std::string& fragmentShaderFileName, bool bindEntryExitDepthTextures)
: VisualizationProcessor(renderTargetSize)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ)
, p_entryImageID("entryImageID", "Input Entry Points Image", "", DataNameProperty::READ)
......
......@@ -66,7 +66,7 @@ namespace campvis {
* \param fragmentShaderFileName Filename for the fragment shader being automatically loaded.
* \param bindEntryExitDepthTextures Flag whether to also bind the depth textures of the entry-/exit points.
*/
RaycastingProcessor(GenericProperty<tgt::ivec2>& renderTargetSize, const std::string& fragmentShaderFileName, bool bindEntryExitDepthTextures);
RaycastingProcessor(IVec2Property& renderTargetSize, const std::string& fragmentShaderFileName, bool bindEntryExitDepthTextures);
/**
* Destructor
......
......@@ -44,12 +44,14 @@ namespace campvis {
: AbstractPipeline()
, tgt::EventListener()
, _lqMode(false)
, _effectiveRenderTargetSize("canvasSize", "Canvas Size", tgt::ivec2(128, 128))
, _canvasSize("CanvasSize", "Canvas Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _effectiveRenderTargetSize("EffectiveRenderTargetSize", "Render Target Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _renderTargetID("renderTargetID", "Render Target ID", "VisualizationPipeline.renderTarget")
, _canvas(0)
{
_data.s_dataAdded.connect(this, &VisualizationPipeline::onDataContainerDataAdded);
addProperty(&_renderTargetID);
addProperty(&_canvasSize);
_renderTargetID.s_changed.connect<VisualizationPipeline>(this, &VisualizationPipeline::onPropertyChanged);
}
......@@ -79,11 +81,13 @@ namespace campvis {
}
const tgt::ivec2& VisualizationPipeline::getRenderTargetSize() const {
return _renderTargetSize;
return _canvasSize.getValue();
}
void VisualizationPipeline::setRenderTargetSize(const tgt::ivec2& size) {
_renderTargetSize = size;
if (_canvasSize.getValue() != size)
_canvasSize.setValue(size);
updateEffectiveRenderTargetSize();
}
......@@ -112,6 +116,10 @@ namespace campvis {
void VisualizationPipeline::onPropertyChanged(const AbstractProperty* prop) {
if (prop == &_renderTargetID)
s_renderTargetChanged();
else if (prop == &_canvasSize && _canvas != 0) {
if (_canvasSize.getValue() != _canvas->getSize())
_canvas->setSize(_canvasSize.getValue());
}
else
AbstractPipeline::onPropertyChanged(prop);
}
......@@ -133,9 +141,9 @@ namespace campvis {
void VisualizationPipeline::updateEffectiveRenderTargetSize() {
if (_lqMode)
_effectiveRenderTargetSize.setValue(_renderTargetSize / 2);
_effectiveRenderTargetSize.setValue(_canvasSize.getValue() / 2);
else
_effectiveRenderTargetSize.setValue(_renderTargetSize);
_effectiveRenderTargetSize.setValue(_canvasSize.getValue());
}
void VisualizationPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
......
......@@ -36,7 +36,7 @@
#include "tgt/event/eventlistener.h"
#include "core/eventhandlers/abstracteventhandler.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include <vector>
......@@ -178,10 +178,10 @@ namespace campvis {
tbb::concurrent_hash_map<AbstractProcessor*, bool> _isVisProcessorMap;
tgt::ivec2 _renderTargetSize; ///< original render target size
IVec2Property _canvasSize; ///< original canvas size
bool _lqMode; ///< Flag whether low quality mode is enables
GenericProperty<tgt::ivec2> _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
IVec2Property _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
StringProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
std::vector<AbstractEventHandler*> _eventHandlers; ///< List of registered event handlers for the pipeline
......
......@@ -31,11 +31,11 @@
namespace campvis {
VisualizationProcessor::VisualizationProcessor(GenericProperty<tgt::ivec2>& canvasSize)
VisualizationProcessor::VisualizationProcessor(IVec2Property& renderTargetSize)
: AbstractProcessor()
, _renderTargetSize("canvasSize", "Canvas Size", canvasSize.getValue())
, _renderTargetSize("renderTargetSize", "Canvas Size", renderTargetSize.getValue(), renderTargetSize.getMinValue(), renderTargetSize.getMaxValue())
{
canvasSize.addSharedProperty(&_renderTargetSize);
renderTargetSize.addSharedProperty(&_renderTargetSize);
_renderTargetSize.s_changed.connect<VisualizationProcessor>(this, &VisualizationProcessor::onPropertyChanged);
}
......
......@@ -32,7 +32,7 @@
#include "tgt/vector.h"
#include "core/pipeline/abstractprocessor.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
namespace campvis {
......@@ -55,7 +55,7 @@ namespace campvis {
* be assigned as shared property of the given \a renderTargetSize property.
* \param renderTargetSize Reference to the parent pipeline's render target size property.
*/
VisualizationProcessor(GenericProperty<tgt::ivec2>& renderTargetSize);
VisualizationProcessor(IVec2Property& renderTargetSize);
/**
* Virtual Destructor
......@@ -64,7 +64,7 @@ namespace campvis {
protected:
GenericProperty<tgt::ivec2> _renderTargetSize; ///< Viewport size of target canvas
IVec2Property _renderTargetSize; ///< Viewport size of target canvas
};
}
......
......@@ -175,6 +175,8 @@ public:
/// Getter
ivec2 getSize() const;
virtual void setSize(ivec2 newSize) = 0;
/// Getter
int getWidth() const;
......
......@@ -571,4 +571,9 @@ KeyEvent::KeyCode QtCanvas::getKey(int key) {
}
}
void QtCanvas::setSize(ivec2 newSize) {
QWidget::resize(newSize.x, newSize.y);
}
} // namespace
......@@ -84,6 +84,8 @@ public:
*/
virtual void resizeGL(int w, int h);
virtual void setSize(ivec2 newSize);
/**
* Called by Qt if there is a paint event; it uses the \a painter_ to paint() something.
*/
......
......@@ -79,7 +79,7 @@ namespace campvis {
addEventHandler(&_wheelHandler);
//addEventHandler(&_tfWindowingHandler);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _canvasSize.getValue());
_eventHandlers.push_back(_trackballEH);
}
......@@ -239,7 +239,7 @@ namespace campvis {
}
void AdvancedUsVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_renderTargetSize);
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -57,7 +57,7 @@ namespace campvis {
GenericOption<std::string>("mappingSharpness", "Mapping Uncertainty to Sharpness")
};
AdvancedUsFusion::AdvancedUsFusion(GenericProperty<tgt::ivec2>& canvasSize)
AdvancedUsFusion::AdvancedUsFusion(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_usImageId("UsImageId", "Ultrasound Input Image", "", DataNameProperty::READ)
, p_blurredImageId("BlurredImageId", "Blurred Ultrasound Image", "", DataNameProperty::READ)
......
......@@ -55,7 +55,7 @@ namespace campvis {
/**
* Constructs a new AdvancedUsFusion Processor
**/
AdvancedUsFusion(GenericProperty<tgt::ivec2>& canvasSize);
AdvancedUsFusion(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -48,7 +48,7 @@
namespace campvis {
const std::string DevilImageReader::loggerCat_ = "CAMPVis.modules.io.DevilImageReader";
DevilImageReader::DevilImageReader(GenericProperty<tgt::ivec2>& canvasSize)
DevilImageReader::DevilImageReader(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_url("url", "Image URL", "")
, p_targetImageID("targetImageName", "Target Image ID", "DevilImageReader.output", DataNameProperty::WRITE)
......
......@@ -53,7 +53,7 @@ namespace campvis {
/**
* Constructs a new DevilImageReader Processor
**/
DevilImageReader(GenericProperty<tgt::ivec2>& canvasSize);
DevilImageReader(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -56,7 +56,7 @@ namespace campvis {
{
addProperty(&_camera);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _canvasSize.getValue());
_eventHandlers.push_back(_trackballEH);
addProcessor(&_imageReader);
......@@ -156,7 +156,7 @@ namespace campvis {
}
void DVRVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_renderTargetSize);
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -76,7 +76,7 @@ namespace campvis {
addProperty(&_camera);
_trackballHandler = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_trackballHandler = new TrackballNavigationEventHandler(this, &_camera, _canvasSize.getValue());
addEventHandler(&_wheelHandler);
addEventHandler(_trackballHandler);
}
......@@ -185,7 +185,7 @@ namespace campvis {
_renderTargetID.setValue("ixpv");
_trackballHandler->setViewportSize(_renderTargetSize);
_trackballHandler->setViewportSize(_canvasSize.getValue());
}
const std::string IxpvDemo::getName() const {
......@@ -193,7 +193,7 @@ namespace campvis {
}
void IxpvDemo::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballHandler->setViewportSize(_renderTargetSize);
_trackballHandler->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -44,7 +44,7 @@
namespace campvis {
const std::string DepthDarkening::loggerCat_ = "CAMPVis.modules.vis.DepthDarkening";
DepthDarkening::DepthDarkening(GenericProperty<tgt::ivec2>& canvasSize)
DepthDarkening::DepthDarkening(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_inputImage("InputImage", "Input Image", "", DataNameProperty::READ)
, p_outputImage("OutputImage", "Output Image", "dd.output", DataNameProperty::WRITE)
......
......@@ -51,7 +51,7 @@ namespace campvis {
/**
* Constructs a new DepthDarkening Processor
**/
DepthDarkening(GenericProperty<tgt::ivec2>& canvasSize);
DepthDarkening(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -35,7 +35,7 @@
namespace campvis {
const std::string DRRRaycaster::loggerCat_ = "CAMPVis.modules.vis.DRRRaycaster";
DRRRaycaster::DRRRaycaster(GenericProperty<tgt::ivec2>& canvasSize)
DRRRaycaster::DRRRaycaster(IVec2Property& canvasSize)
: RaycastingProcessor(canvasSize, "modules/vis/glsl/drrraycaster.frag", false)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_shift("shift", "Normalization Shift", 0.f, -10.f, 10.f)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new DRRRaycaster Processor
**/
DRRRaycaster(GenericProperty<tgt::ivec2>& canvasSize);
DRRRaycaster(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -43,7 +43,7 @@
namespace campvis {
const std::string EEPGenerator::loggerCat_ = "CAMPVis.modules.vis.EEPGenerator";
EEPGenerator::EEPGenerator(GenericProperty<tgt::ivec2>& canvasSize)
EEPGenerator::EEPGenerator(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ)
, p_geometryID("geometryID", "Input Geometry ID", "proxygeometry", DataNameProperty::READ)
......
......@@ -54,7 +54,7 @@ namespace campvis {
/**
* Constructs a new EEPGenerator Processor
**/
EEPGenerator(GenericProperty<tgt::ivec2>& canvasSize);
EEPGenerator(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -42,7 +42,7 @@
namespace campvis {
const std::string GeometryRenderer::loggerCat_ = "CAMPVis.modules.vis.GeometryRenderer";
GeometryRenderer::GeometryRenderer(GenericProperty<tgt::ivec2>& canvasSize)
GeometryRenderer::GeometryRenderer(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_geometryID("geometryID", "Input Geometry ID", "gr.input", DataNameProperty::READ)
, p_renderTargetID("p_renderTargetID", "Output Image", "gr.output", DataNameProperty::WRITE)
......
......@@ -51,7 +51,7 @@ namespace campvis {
/**
* Constructs a new GeometryRenderer Processor
**/
GeometryRenderer(GenericProperty<tgt::ivec2>& canvasSize);
GeometryRenderer(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -44,7 +44,7 @@
namespace campvis {
const std::string IxpvCompositor::loggerCat_ = "CAMPVis.modules.vis.IxpvCompositor";
IxpvCompositor::IxpvCompositor(GenericProperty<tgt::ivec2>& canvasSize)
IxpvCompositor::IxpvCompositor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_xRayImageId("XRayImageId", "X-Ray input image", "", DataNameProperty::READ)
, p_3dSliceImageId("3DSliceImageId", "Slice input image rendered in 3D world space", "", DataNameProperty::READ)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new IxpvCompositor Processor
**/
IxpvCompositor(GenericProperty<tgt::ivec2>& canvasSize);
IxpvCompositor(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -44,7 +44,7 @@
namespace campvis {
const std::string QuadView::loggerCat_ = "CAMPVis.modules.vis.QuadView";
QuadView::QuadView(GenericProperty<tgt::ivec2>& canvasSize)
QuadView::QuadView(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_inputImage1("InputImage1", "First Input Image", "", DataNameProperty::READ)
, p_inputImage2("InputImage2", "Second Input Image", "", DataNameProperty::READ)
......
......@@ -47,7 +47,7 @@ namespace campvis {
/**
* Constructs a new QuadView Processor
**/
QuadView(GenericProperty<tgt::ivec2>& canvasSize);
QuadView(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -53,7 +53,7 @@ namespace campvis {
const std::string RenderTargetCompositor::loggerCat_ = "CAMPVis.modules.vis.RenderTargetCompositor";
RenderTargetCompositor::RenderTargetCompositor(GenericProperty<tgt::ivec2>& canvasSize)
RenderTargetCompositor::RenderTargetCompositor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_firstImageId("FirstImageId", "First Input Image", "", DataNameProperty::READ)
, p_secondImageId("SecondImageId", "Second Input Image", "", DataNameProperty::READ)
......
......@@ -63,7 +63,7 @@ namespace campvis {
/**
* Constructs a new RenderTargetCompositor Processor
**/
RenderTargetCompositor(GenericProperty<tgt::ivec2>& canvasSize);
RenderTargetCompositor(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -36,7 +36,7 @@
namespace campvis {
const std::string SimpleRaycaster::loggerCat_ = "CAMPVis.modules.vis.SimpleRaycaster";
SimpleRaycaster::SimpleRaycaster(GenericProperty<tgt::ivec2>& canvasSize)
SimpleRaycaster::SimpleRaycaster(IVec2Property& canvasSize)
: RaycastingProcessor(canvasSize, "modules/vis/glsl/simpleraycaster.frag", true)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_enableShadowing("EnableShadowing", "Enable Hard Shadows", false, AbstractProcessor::INVALID_SHADER)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new SimpleRaycaster Processor
**/
SimpleRaycaster(GenericProperty<tgt::ivec2>& canvasSize);
SimpleRaycaster(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -44,7 +44,7 @@
namespace campvis {
const std::string SliceExtractor::loggerCat_ = "CAMPVis.modules.vis.SliceExtractor";
SliceExtractor::SliceExtractor(GenericProperty<tgt::ivec2>& canvasSize)
SliceExtractor::SliceExtractor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
......
......@@ -54,7 +54,7 @@ namespace campvis {
/**
* Constructs a new SliceExtractor Processor
**/
SliceExtractor(GenericProperty<tgt::ivec2>& canvasSize);
SliceExtractor(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -47,7 +47,7 @@
namespace campvis {
const std::string SliceRenderer3D::loggerCat_ = "CAMPVis.modules.vis.SliceRenderer3D";
SliceRenderer3D::SliceRenderer3D(GenericProperty<tgt::ivec2>& canvasSize)
SliceRenderer3D::SliceRenderer3D(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
......
......@@ -54,7 +54,7 @@ namespace campvis {
/**
* Constructs a new SliceRenderer3D Processor
**/
SliceRenderer3D(GenericProperty<tgt::ivec2>& canvasSize);
SliceRenderer3D(IVec2Property& canvasSize);
/**
* Destructor
......
......@@ -44,7 +44,7 @@
namespace campvis {
const std::string VirtualMirrorCombine::loggerCat_ = "CAMPVis.modules.vis.VirtualMirrorCombine";
VirtualMirrorCombine::VirtualMirrorCombine(GenericProperty<tgt::ivec2>& canvasSize)
VirtualMirrorCombine::VirtualMirrorCombine(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_normalImageID("normalImageID", "Normal DVR Input Image", "", DataNameProperty::READ)
, p_mirrorImageID("mirrorImageID", "Mirror DVR Input Image", "", DataNameProperty::READ)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new VirtualMirrorCombine Processor
**/
VirtualMirrorCombine(GenericProperty<tgt::ivec2>& canvasSize);
VirtualMirrorCombine(IVec2Property& canvasSize);
/**
* Destructor
......
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