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

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

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 {
void AutoEvaluationPipeline::onPropertyCollectionPropertyAdded(AbstractProperty* property) {
// check whether the incoming property is of the correct type (we only care about DataNameProperties)
if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) {
// check whether this property is already present in the port map
IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (it == _iteratorMap.end()) {
// add to port map and register to changed signal
if (dnp->getAccessInfo() == DataNameProperty::READ) {
if (dnp->getAccessInfo() == DataNameProperty::READ) {
// check whether this property is already present in the port map
IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (it == _iteratorMap.end()) {
// add to port map and register to changed signal
tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false);
std::pair<PortMapType::iterator, bool> result = _portMap.insert(std::make_pair(dnp->getValue(), dnp));
cgtAssert(result.second, "Could not insert Property into port map!");
......@@ -192,23 +191,21 @@ namespace campvis {
dnp->s_changed.connect(this, &AutoEvaluationPipeline::onDataNamePropertyChanged);
}
}
}
else {
// this should not happen, otherwise we did something wrong before.
cgtAssert(false, "This property is already in iterator map!");
else {
// this should not happen, otherwise we did something wrong before.
cgtAssert(false, "This property is already in iterator map!");
}
}
}
}
void AutoEvaluationPipeline::onPropertyCollectionPropertyRemoved(AbstractProperty* property) {
// check whether the incoming property is of the correct type (we only care about DataNameProperties)
if (DataNameProperty* dnp = dynamic_cast<DataNameProperty*>(property)) {
// find string-iterator pair for the given property
IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (it != _iteratorMap.end()) {
if (dnp->getAccessInfo() == DataNameProperty::READ) {
if (dnp->getAccessInfo() == DataNameProperty::READ) {
// find string-iterator pair for the given property
IteratorMapType::iterator it = _iteratorMap.find(dnp);
if (it != _iteratorMap.end()) {
// remove from port map and deregister from changed signal
dnp->s_changed.disconnect(this);
......@@ -219,10 +216,10 @@ namespace campvis {
_portMap.unsafe_erase(it->second);
_iteratorMap.unsafe_erase(it);
}
}
else {
// this should not happen, otherwise we did something wrong before.
cgtAssert(false, "Could not find Property in iterator map!");
else {
// this should not happen, otherwise we did something wrong before.
cgtAssert(false, "Could not find Property in iterator map!");
}
}
}
}
......
......@@ -109,6 +109,9 @@ namespace campvis {
p_camera.addSharedProperty(&_orientationOverlay.p_camera);
p_outputImage.addSharedProperty(&_orientationOverlay.p_targetImageId);
s_processorCanBeDeleted.connect(this, &VolumeRenderer::onProcessorCanBeDeleted);
}
VolumeRenderer::~VolumeRenderer() {
......@@ -219,11 +222,11 @@ namespace campvis {
p_camera.removeSharedProperty(&currentRaycaster->p_camera);
p_outputImage.removeSharedProperty(&currentRaycaster->p_targetImageID);
p_raycasterProps.clearProperties();
p_raycasterProps.deinitAllProperties();
removeProperty(p_raycasterProps);
//p_raycasterProps.deinitAllProperties();
//removeProperty(p_raycasterProps);
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);
//_raycaster->p_lqMode.setVisible(false);
//_raycaster->p_camera.setVisible(false);
......@@ -231,7 +234,7 @@ namespace campvis {
//_raycaster->p_entryImageID.setVisible(false);
//_raycaster->p_exitImageID.setVisible(false);
//_raycaster->p_targetImageID.setVisible(false);
addProperty(p_raycasterProps, AbstractProcessor::VALID);
//addProperty(p_raycasterProps, AbstractProcessor::VALID);
p_lqMode.addSharedProperty(&_raycaster->p_lqMode);
p_inputVolume.addSharedProperty(&_raycaster->p_sourceImageID);
......@@ -241,8 +244,12 @@ namespace campvis {
cgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
currentRaycaster->deinit();
delete currentRaycaster;
_raycaster->init();
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);
......@@ -263,5 +270,10 @@ namespace campvis {
RaycastingProcessor* VolumeRenderer::getRaycastingProcessor() {
return _raycaster;
}
void VolumeRenderer::onProcessorCanBeDeleted(AbstractProcessor* processor) {
delete processor;
}
}
......@@ -135,6 +135,20 @@ namespace campvis {
OrientationOverlay _orientationOverlay;
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.
......
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