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

Commit 0a24f3c1 authored by schultezub's avatar schultezub

fixed several TODOs

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@429 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 4b9b4ad6
......@@ -35,9 +35,10 @@ namespace campvis {
AbstractPropertyWidget::AbstractPropertyWidget(AbstractProperty* property, QWidget* parent /*= 0*/)
: QWidget(parent)
, _property(property)
, _ignorePropertyUpdates(false)
, _layout(0)
{
_ignorePropertyUpdates = 0;
_titleLabel = new QLabel(QString::fromStdString(_property->getTitle() + ":"), this);
_layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
......@@ -56,7 +57,7 @@ namespace campvis {
}
void AbstractPropertyWidget::onPropertyChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates)
if (_ignorePropertyUpdates == 0)
updateWidgetFromProperty();
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@
#define ABSTRACTPROPERTYWIDGET_H__
#include "sigslot/sigslot.h"
#include "tbb/include/tbb/atomic.h"
#include <QBoxLayout>
#include <QLabel>
#include <QWidget>
......@@ -73,8 +74,8 @@ namespace campvis {
AbstractProperty* _property; ///< The property this widget handles
// TODO: This flag is not thread-safe, it probably should be...
bool _ignorePropertyUpdates; ///< Flag whether the widget shall ignore incoming signals from properties being updated.
/// Semaphore acts as flag whether the widget shall ignore incoming signals from properties being updated.
tbb::atomic<int> _ignorePropertyUpdates;
private:
/// Slot getting called when the property has changed, so that the widget can be updated.
......
......@@ -35,8 +35,8 @@ namespace campvis {
AbstractTransferFunctionEditor::AbstractTransferFunctionEditor(AbstractTransferFunction* tf, QWidget* parent /*= 0*/)
: QWidget(parent)
, _transferFunction(tf)
, _ignorePropertyUpdates(false)
{
_ignorePropertyUpdates = 0;
_transferFunction->s_changed.connect(this, &AbstractTransferFunctionEditor::onTFChanged);
}
......@@ -45,7 +45,7 @@ namespace campvis {
}
void AbstractTransferFunctionEditor::onTFChanged() {
if (!_ignorePropertyUpdates)
if (_ignorePropertyUpdates == 0)
updateWidgetFromProperty();
}
}
\ No newline at end of file
......@@ -66,8 +66,8 @@ namespace campvis {
AbstractTransferFunction* _transferFunction; ///< The transfer function this widget handles
// TODO: This flag is not thread-safe, it probably should be...
bool _ignorePropertyUpdates; ///< Flag whether the widget shall ignore incoming signals from properties being updated.
/// Semaphore acts as flag whether the widget shall ignore incoming signals from properties being updated.
tbb::atomic<int> _ignorePropertyUpdates;
private:
/// Slot getting called when the transfer function has changed, so that the widget can be updated.
......
......@@ -55,10 +55,10 @@ namespace campvis {
}
void BoolPropertyWidget::onStateChanged(int value) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
BoolProperty* prop = static_cast<BoolProperty*>(_property);
prop->setValue(_spinBox->isChecked());
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
}
\ No newline at end of file
......@@ -59,14 +59,14 @@ namespace campvis {
}
void FloatPropertyWidget::onValueChanged(double value) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
FloatProperty* prop = static_cast<FloatProperty*>(_property);
prop->setValue(value);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
void FloatPropertyWidget::onPropertyMinMaxChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates) {
if (_ignorePropertyUpdates == 0) {
FloatProperty* prop = static_cast<FloatProperty*>(_property);
_spinBox->setMinimum(prop->getMinValue());
_spinBox->setMaximum(prop->getMaxValue());
......
......@@ -173,18 +173,18 @@ namespace campvis {
template<size_t SIZE>
void campvis::VecPropertyWidget<SIZE>::onValueChangedImpl() {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
PropertyType* prop = static_cast<PropertyType*>(_property);
typename VecPropertyWidgetTraits<SIZE>::BaseType newValue;
for (size_t i = 0; i < size; ++i)
newValue[i] = _spinBox[i]->value();
prop->setValue(newValue);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
template<size_t SIZE>
void campvis::VecPropertyWidget<SIZE>::onPropertyMinMaxChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates) {
if (_ignorePropertyUpdates == 0) {
PropertyType* prop = static_cast<PropertyType*>(_property);
for (size_t i = 0; i < size; ++i) {
_spinBox[i]->setMinimum(prop->getMinValue()[i]);
......
......@@ -57,14 +57,14 @@ namespace campvis {
}
void IntPropertyWidget::onValueChanged(int value) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
IntProperty* prop = static_cast<IntProperty*>(_property);
prop->setValue(value);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
void IntPropertyWidget::onPropertyMinMaxChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates) {
if (_ignorePropertyUpdates == 0) {
IntProperty* prop = static_cast<IntProperty*>(_property);
_spinBox->setMinimum(prop->getMinValue());
_spinBox->setMaximum(prop->getMaxValue());
......
......@@ -171,18 +171,18 @@ namespace campvis {
template<size_t SIZE>
void campvis::IVecPropertyWidget<SIZE>::onValueChangedImpl() {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
PropertyType* prop = static_cast<PropertyType*>(_property);
typename IVecPropertyWidgetTraits<SIZE>::BaseType newValue;
for (size_t i = 0; i < size; ++i)
newValue[i] = _spinBox[i]->value();
prop->setValue(newValue);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
template<size_t SIZE>
void campvis::IVecPropertyWidget<SIZE>::onPropertyMinMaxChanged(const AbstractProperty* property) {
if (!_ignorePropertyUpdates) {
if (_ignorePropertyUpdates == 0) {
PropertyType* prop = static_cast<PropertyType*>(_property);
for (size_t i = 0; i < size; ++i) {
_spinBox[i]->setMinimum(prop->getMinValue()[i]);
......
......@@ -66,10 +66,10 @@ namespace campvis {
}
void OptionPropertyWidget::onComboBoxIndexChanged(int value) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
AbstractOptionProperty* prop = static_cast<AbstractOptionProperty*>(_property);
prop->setValue(value);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
}
\ No newline at end of file
......@@ -77,15 +77,15 @@ namespace campvis {
}
void SimpleTransferFunctionEditor::onLeftColorChanged(const QColor& color) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
static_cast<SimpleTransferFunction*>(_transferFunction)->setLeftColor(QtColorTools::toTgtColor(_cpwColorLeft->color()));
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
void SimpleTransferFunctionEditor::onRightColorChanged(const QColor& color) {
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
static_cast<SimpleTransferFunction*>(_transferFunction)->setRightColor(QtColorTools::toTgtColor(_cpwColorRight->color()));
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
......
......@@ -58,8 +58,8 @@ namespace campvis {
void StringPropertyWidget::onTextChanged(const QString& text) {
StringProperty* prop = static_cast<StringProperty*>(_property);
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
prop->setValue(text.toStdString());
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
}
\ No newline at end of file
......@@ -124,12 +124,12 @@ namespace campvis {
void TransferFunctionPropertyWidget::onDomainChanged(double value) {
TransferFunctionProperty* prop = static_cast<TransferFunctionProperty*>(_property);
_ignorePropertyUpdates = true;
++_ignorePropertyUpdates;
_spinDomainLeft->setMaximum(_spinDomainRight->value());
_spinDomainRight->setMinimum(_spinDomainLeft->value());
tgt::vec2 newDomain(static_cast<float>(_spinDomainLeft->value()), static_cast<float>(_spinDomainRight->value()));
prop->getTF()->setIntensityDomain(newDomain);
_ignorePropertyUpdates = false;
--_ignorePropertyUpdates;
}
void TransferFunctionPropertyWidget::onEditClicked(bool checked) {
......
......@@ -103,7 +103,6 @@ namespace campvis {
bool tmp = shader->getIgnoreUniformLocationError();
shader->setIgnoreUniformLocationError(true);
// TODO: set domain mapping uniforms
shader->setUniform(transFuncUniform + "._texture", texUnit.getUnitNumber());
switch (getDimensionality()) {
case 1:
......
......@@ -75,8 +75,10 @@ namespace campvis {
if (_data == 0)
return;
if (! _data->isShareable())
_data = _data->clone(); // TODO: update timestamp?
if (! _data->isShareable()) {
_data = _data->clone();
_timestamp = clock();
}
_data->addReference();
}
......
......@@ -132,7 +132,6 @@ namespace campvis {
tempUnit.activate();
_texture->bind();
// TODO: map signed types
// map signed integer types from [-1.0:1.0] to [0.0:1.0] in order to avoid clamping of negative values
if (isInteger && isSigned) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
......
......@@ -58,23 +58,6 @@ namespace campvis {
void QuadRenderer::renderQuad() {
_quad->render();
// // TODO: get rid of intermediate mode and use VBOs as soon as they are ready.
// glDepthFunc(GL_ALWAYS);
// glBegin(GL_QUADS);
// glTexCoord2f(0.f, 0.f);
// glVertex2f(-1.f, -1.f);
//
// glTexCoord2f(1.f, 0.f);
// glVertex2f(1.f, -1.f);
//
// glTexCoord2f(1.f, 1.f);
// glVertex2f(1.f, 1.f);
//
// glTexCoord2f(0.f, 1.f);
// glVertex2f(-1.f, 1.f);
// glEnd();
// glDepthFunc(GL_LESS);
}
......
......@@ -64,11 +64,11 @@ namespace campvis {
addProcessor(&_usEEP);
addProcessor(&_usDVR);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_eventHandlers.push_back(_trackballEH);
addEventHandler(&_wheelHandler);
//addEventHandler(&_tfWindowingHandler);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_eventHandlers.push_back(_trackballEH);
}
AdvancedUsVis::~AdvancedUsVis() {
......
......@@ -75,7 +75,7 @@ namespace campvis {
n *= -1.f;
// TODO: the implicit GUI updates randomly crashes the applictation...
//_mirrorNormal.setValue(n);
p_mirrorNormal.setValue(n);
std::vector<tgt::vec3> vertices;
......
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