The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 4d134fe3 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge Committed by Hossain Mahmud
Browse files

Two fixes:

* Fixed signal issues in VolumeRenderer when updating the raycasting processor.
* Fixed assertions in AutoEvaluationPipeline::onPropertyCollectionPropertyAdded() and AutoEvaluationPipeline::onPropertyCollectionPropertyRemoved().

Conflicts:
	modules/vis/processors/volumerenderer.cpp
	modules/vis/processors/volumerenderer.h
parent aa3eb3fd
...@@ -178,12 +178,11 @@ namespace campvis { ...@@ -178,12 +178,11 @@ namespace campvis {
void AutoEvaluationPipeline::onPropertyCollectionPropertyAdded(AbstractProperty* property) { void AutoEvaluationPipeline::onPropertyCollectionPropertyAdded(AbstractProperty* property) {
// check whether the incoming property is of the correct type (we only care about DataNameProperties) // check whether the incoming property is of the correct type (we only care about DataNameProperties)
if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) { if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) {
// check whether this property is already present in the port map if (dnp->getAccessInfo() == DataNameProperty::READ) {
IteratorMapType::iterator it = _iteratorMap.find(dnp); // check whether this property is already present in the port map
if (it == _iteratorMap.end()) { IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (it == _iteratorMap.end()) {
// add to port map and register to changed signal // add to port map and register to changed signal
if (dnp->getAccessInfo() == DataNameProperty::READ) {
tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false); tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false);
std::pair<PortMapType::iterator, bool> result = _portMap.insert(std::make_pair(dnp->getValue(), dnp)); std::pair<PortMapType::iterator, bool> result = _portMap.insert(std::make_pair(dnp->getValue(), dnp));
cgtAssert(result.second, "Could not insert Property into port map!"); cgtAssert(result.second, "Could not insert Property into port map!");
...@@ -192,23 +191,21 @@ namespace campvis { ...@@ -192,23 +191,21 @@ namespace campvis {
dnp->s_changed.connect(this, &AutoEvaluationPipeline::onDataNamePropertyChanged); dnp->s_changed.connect(this, &AutoEvaluationPipeline::onDataNamePropertyChanged);
} }
} }
else {
} // this should not happen, otherwise we did something wrong before.
else { cgtAssert(false, "This property is already in iterator map!");
// this should not happen, otherwise we did something wrong before. }
cgtAssert(false, "This property is already in iterator map!");
} }
} }
} }
void AutoEvaluationPipeline::onPropertyCollectionPropertyRemoved(AbstractProperty* property) { void AutoEvaluationPipeline::onPropertyCollectionPropertyRemoved(AbstractProperty* property) {
// check whether the incoming property is of the correct type (we only care about DataNameProperties) // check whether the incoming property is of the correct type (we only care about DataNameProperties)
if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) { if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) {
// find string-iterator pair for the given property if (dnp->getAccessInfo() == DataNameProperty::READ) {
IteratorMapType::iterator it = _iteratorMap.find(dnp); // find string-iterator pair for the given property
if (it != _iteratorMap.end()) { IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (dnp->getAccessInfo() == DataNameProperty::READ) { if (it != _iteratorMap.end()) {
// remove from port map and deregister from changed signal // remove from port map and deregister from changed signal
dnp->s_changed.disconnect(this); dnp->s_changed.disconnect(this);
...@@ -219,10 +216,10 @@ namespace campvis { ...@@ -219,10 +216,10 @@ namespace campvis {
_portMap.unsafe_erase(it->second); _portMap.unsafe_erase(it->second);
_iteratorMap.unsafe_erase(it); _iteratorMap.unsafe_erase(it);
} }
} else {
else { // this should not happen, otherwise we did something wrong before.
// this should not happen, otherwise we did something wrong before. cgtAssert(false, "Could not find Property in iterator map!");
cgtAssert(false, "Could not find Property in iterator map!"); }
} }
} }
} }
......
...@@ -109,6 +109,9 @@ namespace campvis { ...@@ -109,6 +109,9 @@ namespace campvis {
p_camera.addSharedProperty(&_orientationOverlay.p_camera); p_camera.addSharedProperty(&_orientationOverlay.p_camera);
p_outputImage.addSharedProperty(&_orientationOverlay.p_targetImageId); p_outputImage.addSharedProperty(&_orientationOverlay.p_targetImageId);
s_processorCanBeDeleted.connect(this, &VolumeRenderer::onProcessorCanBeDeleted);
} }
VolumeRenderer::~VolumeRenderer() { VolumeRenderer::~VolumeRenderer() {
...@@ -219,11 +222,11 @@ namespace campvis { ...@@ -219,11 +222,11 @@ namespace campvis {
p_camera.removeSharedProperty(&currentRaycaster->p_camera); p_camera.removeSharedProperty(&currentRaycaster->p_camera);
p_outputImage.removeSharedProperty(&currentRaycaster->p_targetImageID); p_outputImage.removeSharedProperty(&currentRaycaster->p_targetImageID);
p_raycasterProps.clearProperties(); p_raycasterProps.clearProperties();
p_raycasterProps.deinitAllProperties(); //p_raycasterProps.deinitAllProperties();
removeProperty(p_raycasterProps); //removeProperty(p_raycasterProps);
currentRaycaster->s_invalidated.disconnect(this); currentRaycaster->s_invalidated.disconnect(this);
_raycaster = RaycasterFactory::getRef().createRaycaster(p_raycastingProcSelector.getOptionId(), p_viewportSizeProp); _raycaster = RaycasterFactory::getRef().createRaycaster(p_raycastingProcSelector.getOptionId(), _viewportSizeProperty);
p_raycasterProps.addPropertyCollection(*_raycaster); p_raycasterProps.addPropertyCollection(*_raycaster);
//_raycaster->p_lqMode.setVisible(false); //_raycaster->p_lqMode.setVisible(false);
//_raycaster->p_camera.setVisible(false); //_raycaster->p_camera.setVisible(false);
...@@ -231,7 +234,7 @@ namespace campvis { ...@@ -231,7 +234,7 @@ namespace campvis {
//_raycaster->p_entryImageID.setVisible(false); //_raycaster->p_entryImageID.setVisible(false);
//_raycaster->p_exitImageID.setVisible(false); //_raycaster->p_exitImageID.setVisible(false);
//_raycaster->p_targetImageID.setVisible(false); //_raycaster->p_targetImageID.setVisible(false);
addProperty(p_raycasterProps, AbstractProcessor::VALID); //addProperty(p_raycasterProps, AbstractProcessor::VALID);
p_lqMode.addSharedProperty(&_raycaster->p_lqMode); p_lqMode.addSharedProperty(&_raycaster->p_lqMode);
p_inputVolume.addSharedProperty(&_raycaster->p_sourceImageID); p_inputVolume.addSharedProperty(&_raycaster->p_sourceImageID);
...@@ -241,8 +244,12 @@ namespace campvis { ...@@ -241,8 +244,12 @@ namespace campvis {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard; cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
currentRaycaster->deinit(); currentRaycaster->deinit();
delete currentRaycaster; _raycaster->init();
invalidate(RAYCASTER_INVALID); invalidate(RAYCASTER_INVALID);
// queue the deletion of currentRaycaster as signal, to ensure that the deletion does
// not happen before all previously emitted signals have been handled.
s_processorCanBeDeleted.queueSignal(currentRaycaster);
} }
VisualizationProcessor::onPropertyChanged(prop); VisualizationProcessor::onPropertyChanged(prop);
...@@ -263,5 +270,10 @@ namespace campvis { ...@@ -263,5 +270,10 @@ namespace campvis {
RaycastingProcessor* VolumeRenderer::getRaycastingProcessor() { RaycastingProcessor* VolumeRenderer::getRaycastingProcessor() {
return _raycaster; return _raycaster;
} }
void VolumeRenderer::onProcessorCanBeDeleted(AbstractProcessor* processor) {
delete processor;
}
} }
...@@ -135,6 +135,20 @@ namespace campvis { ...@@ -135,6 +135,20 @@ namespace campvis {
OrientationOverlay _orientationOverlay; OrientationOverlay _orientationOverlay;
static const std::string loggerCat_; static const std::string loggerCat_;
private:
/// Signal emitted when the processor in the signal's argument should be deleted
/// We perform this deletion through signals to ensure that all previouosly emitted signals
/// have been handled before the processor is deleted.
sigslot::signal1<AbstractProcessor*> s_processorCanBeDeleted;
/**
* Callback method for s_processorCanBeDeleted signal, deletes \a processor.
* We perform this deletion through signals to ensure that all previouosly emitted signals
* have been handled before the processor is deleted.
* \param processor Processor to delete.
*/
void onProcessorCanBeDeleted(AbstractProcessor* processor);
}; };
// Instantiate template to register the pipelines. // Instantiate template to register the pipelines.
......
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