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

Commit b22e0d2f authored by schultezub's avatar schultezub
Browse files

Introducing CameraPropertyWidget

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@395 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent ddae0632
......@@ -29,6 +29,7 @@ SET(CampvisApplicationToBeMocced
gui/properties/abstractpropertywidget.h
gui/properties/abstracttransferfunctioneditor.h
gui/properties/boolpropertywidget.h
gui/properties/camerapropertywidget.h
gui/properties/intpropertywidget.h
gui/properties/floatpropertywidget.h
gui/properties/geometry1dtransferfunctioneditor.h
......
......@@ -41,7 +41,7 @@ namespace campvis {
_titleLabel = new QLabel(QString::fromStdString(_property->getTitle() + ":"), this);
_layout = new QBoxLayout(QBoxLayout::LeftToRight, this);
_layout->setSpacing(16);
_layout->setSpacing(8);
_layout->addWidget(_titleLabel, 0);
_property->s_changed.connect(this, &AbstractPropertyWidget::onPropertyChanged);
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#include "camerapropertywidget.h"
#include <QGridLayout>
#include <QLabel>
#include "core/tools/stringutils.h"
namespace campvis {
CameraPropertyWidget::CameraPropertyWidget(CameraProperty* property, QWidget* parent /*= 0*/)
: AbstractPropertyWidget(property, parent)
, _lblCameraPosition(0)
, _lblLookDirection(0)
, _lblUpVector(0)
{
_widget = new QWidget(this);
QGridLayout* gridLayout = new QGridLayout(_widget);
_widget->setLayout(gridLayout);
_lblCameraPosition = new QLabel("Position: ", _widget);
gridLayout->addWidget(_lblCameraPosition, 0, 0);
_lblFocusPosition = new QLabel("Focus: ", _widget);
gridLayout->addWidget(_lblFocusPosition, 1, 0);
_lblLookDirection = new QLabel("Look Direction: ", _widget);
gridLayout->addWidget(_lblLookDirection, 2, 0);
_lblUpVector = new QLabel("Up Vector: ", _widget);
gridLayout->addWidget(_lblUpVector, 3, 0);
addWidget(_widget);
updateWidgetFromProperty();
}
CameraPropertyWidget::~CameraPropertyWidget() {
}
void CameraPropertyWidget::updateWidgetFromProperty() {
CameraProperty* prop = static_cast<CameraProperty*>(_property);
_lblCameraPosition->setText("Position: " + QString::fromStdString(StringUtils::toString(prop->getValue().getPosition())));
_lblFocusPosition->setText("Focus: " + QString::fromStdString(StringUtils::toString(prop->getValue().getFocus())));
_lblLookDirection->setText("Look Direction: " + QString::fromStdString(StringUtils::toString(prop->getValue().getLook())));
_lblUpVector->setText("Up Vector: " + QString::fromStdString(StringUtils::toString(prop->getValue().getUpVector())));
}
}
\ No newline at end of file
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#ifndef CAMERAPROPERTYWIDGET_H__
#define CAMERAPROPERTYWIDGET_H__
#include "application/gui/properties/abstractpropertywidget.h"
#include "core/properties/cameraproperty.h"
class QLabel;
namespace campvis {
/**
* Widget for a Camera.
* For now just offering read-access.
*/
class CameraPropertyWidget : public AbstractPropertyWidget {
Q_OBJECT;
public:
/**
* Creates a new CameraPropertyWidget for the property \a property.
* \param property The property the widget shall handle
* \param parent Parent Qt widget
*/
CameraPropertyWidget(CameraProperty* property, QWidget* parent = 0);
/**
* Destructor
*/
virtual ~CameraPropertyWidget();
protected:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void updateWidgetFromProperty();
private:
QWidget* _widget;
QLabel* _lblCameraPosition;
QLabel* _lblFocusPosition;
QLabel* _lblLookDirection;
QLabel* _lblUpVector;
};
}
#endif // CAMERAPROPERTYWIDGET_H__
......@@ -72,6 +72,7 @@ namespace campvis {
void PropertyCollectionWidget::setupWidget() {
_layout = new QVBoxLayout();
_layout->setSpacing(0);
setLayout(_layout);
}
......
......@@ -31,12 +31,14 @@
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/boolpropertywidget.h"
#include "application/gui/properties/camerapropertywidget.h"
#include "application/gui/properties/intpropertywidget.h"
#include "application/gui/properties/floatpropertywidget.h"
#include "application/gui/properties/stringpropertywidget.h"
#include "application/gui/properties/transferfunctionpropertywidget.h"
#include "core/properties/abstractproperty.h"
#include "core/properties/cameraproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/transferfunctionproperty.h"
......@@ -80,6 +82,10 @@ namespace campvis {
return new StringPropertyWidget(tester);
}
if (CameraProperty* tester = dynamic_cast<CameraProperty*>(property)) {
return new CameraPropertyWidget(tester);
}
if (TransferFunctionProperty* tester = dynamic_cast<TransferFunctionProperty*>(property)) {
return new TransferFunctionPropertyWidget(tester);
}
......
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