Some fixes/improvements for using CAMPVis as external library:

* saved CMake config now also exports the symbol ${CAMPVIS_APPLICATION_LIBRARIES}
* Property widget registration moved to a separate cpp file. This allows external programs to include property widgets' header files without re-registering them.
parent 28989435
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/genericproperty.h"
class QCheckBox;
......@@ -66,8 +65,6 @@ namespace campvis {
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<BoolPropertyWidget, BoolProperty>;
}
#endif // BOOLPROPERTYWIDGET_H__
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/buttonproperty.h"
class QPushButton;
......@@ -67,8 +66,6 @@ namespace campvis {
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<ButtonPropertyWidget, ButtonProperty>;
}
#endif // BUTTONPROPERTYWIDGET_H__
......@@ -28,7 +28,6 @@
#include "application/applicationapi.h"
#include "application/gui/adjusterwidgets/doubleadjusterwidget.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "application/gui/qtcolortools.h"
#include "core/properties/floatingpointproperty.h"
......@@ -76,11 +75,6 @@ namespace campvis {
};
// ================================================================================================
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<ColorPropertyWidget, ColorProperty>;
}
#endif // COLORPROPERTYWIDGET_H__
......@@ -29,7 +29,6 @@
#include "core/properties/datanameproperty.h"
#include "application/gui/qtdatahandle.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
class QComboBox;
class QLineEdit;
......@@ -89,9 +88,7 @@ namespace campvis {
QComboBox* _combobox;
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<DataNamePropertyWidget, DataNameProperty, 10>;
}
#endif // DATANAMEPROPERTYWIDGET_H__
......@@ -89,4 +89,23 @@ namespace campvis {
if (_ignorePropertyUpdates == 0)
emit s_propertyChanged(property);
}
Vec2PropertyWidget::Vec2PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : VecPropertyWidget<2>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
Vec3PropertyWidget::Vec3PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : VecPropertyWidget<3>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
Vec4PropertyWidget::Vec4PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : VecPropertyWidget<4>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
}
......@@ -27,7 +27,6 @@
#include "application/gui/adjusterwidgets/doubleadjusterwidget.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/floatingpointproperty.h"
namespace campvis {
......@@ -78,9 +77,6 @@ namespace campvis {
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<FloatPropertyWidget, FloatProperty>;
// ================================================================================================
namespace {
......@@ -238,16 +234,10 @@ namespace campvis {
// ================================================================================================
class Vec2PropertyWidget : public VecPropertyWidget<2> {
class CAMPVIS_APPLICATION_API Vec2PropertyWidget : public VecPropertyWidget<2> {
Q_OBJECT
public:
Vec2PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: VecPropertyWidget<2>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
Vec2PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(double value) { onValueChangedImpl(); };
......@@ -255,16 +245,10 @@ namespace campvis {
// ================================================================================================
class Vec3PropertyWidget : public VecPropertyWidget<3> {
class CAMPVIS_APPLICATION_API Vec3PropertyWidget : public VecPropertyWidget<3> {
Q_OBJECT
public:
Vec3PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: VecPropertyWidget<3>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
Vec3PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(double value) { onValueChangedImpl(); };
......@@ -272,28 +256,15 @@ namespace campvis {
// ================================================================================================
class Vec4PropertyWidget : public VecPropertyWidget<4> {
class CAMPVIS_APPLICATION_API Vec4PropertyWidget : public VecPropertyWidget<4> {
Q_OBJECT
public:
Vec4PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: VecPropertyWidget<4>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
}
}
Vec4PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(double value) { onValueChangedImpl(); };
};
// ================================================================================================
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<Vec2PropertyWidget, typename VecPropertyWidgetTraits<2>::PropertyType, 5>;
template class PropertyWidgetRegistrar<Vec3PropertyWidget, typename VecPropertyWidgetTraits<3>::PropertyType, 5>;
template class PropertyWidgetRegistrar<Vec4PropertyWidget, typename VecPropertyWidgetTraits<4>::PropertyType, 5>;
}
#endif // FLOATPROPERTYWIDGET_H__
......@@ -143,4 +143,22 @@ namespace campvis {
_btnShowHideTimer->setText(_sbInterval->isVisible() ? tr("H") : tr("S"));
}
IVec2PropertyWidget::IVec2PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : IVecPropertyWidget<2>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
IVec3PropertyWidget::IVec3PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : IVecPropertyWidget<3>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
IVec4PropertyWidget::IVec4PropertyWidget(PropertyType* property, DataContainer* dataContainer /*= nullptr*/, QWidget* parent /*= 0*/) : IVecPropertyWidget<4>(property, dataContainer, parent) {
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
}
\ No newline at end of file
......@@ -27,7 +27,6 @@
#include "application/gui/adjusterwidgets/intadjusterwidget.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/numericproperty.h"
class QCheckBox;
......@@ -84,9 +83,6 @@ namespace campvis {
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<IntPropertyWidget, IntProperty>;
// ================================================================================================
namespace {
......@@ -226,13 +222,7 @@ namespace campvis {
class IVec2PropertyWidget : public IVecPropertyWidget<2> {
Q_OBJECT
public:
IVec2PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: IVecPropertyWidget<2>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
IVec2PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(int value) { onValueChangedImpl(); };
......@@ -243,13 +233,7 @@ namespace campvis {
class IVec3PropertyWidget : public IVecPropertyWidget<3> {
Q_OBJECT
public:
IVec3PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: IVecPropertyWidget<3>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
IVec3PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(int value) { onValueChangedImpl(); };
......@@ -260,24 +244,11 @@ namespace campvis {
class IVec4PropertyWidget : public IVecPropertyWidget<4> {
Q_OBJECT
public:
IVec4PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0)
: IVecPropertyWidget<4>(property, dataContainer, parent)
{
for (size_t i = 0; i < size; ++i) {
connect(_adjusters[i], SIGNAL(valueChanged(int)), this, SLOT(onValueChanged(int)));
}
}
IVec4PropertyWidget(PropertyType* property, DataContainer* dataContainer = nullptr, QWidget* parent = 0);
private slots:
void onValueChanged(int value) { onValueChangedImpl(); };
};
// ================================================================================================
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<IVec2PropertyWidget, typename IVecPropertyWidgetTraits<2>::PropertyType, 5>;
template class PropertyWidgetRegistrar<IVec3PropertyWidget, typename IVecPropertyWidgetTraits<3>::PropertyType, 5>;
template class PropertyWidgetRegistrar<IVec4PropertyWidget, typename IVecPropertyWidgetTraits<4>::PropertyType, 5>;
}
#endif // INTPROPERTYWIDGET_H__
......@@ -31,7 +31,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertycollectionwidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
namespace campvis {
class DataContainer;
......@@ -68,9 +67,6 @@ namespace campvis {
PropertyCollectionWidget* _pcw;
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<MetaPropertyWidget, MetaProperty>;
}
#endif // METAPROPERTYWIDGET_H__
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/optionproperty.h"
......@@ -69,8 +68,5 @@ namespace campvis {
QComboBox* _comboBox;
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<OptionPropertyWidget, AbstractOptionProperty, 10>;
}
#endif // OPTIONPROPERTYWIDGET_H__
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2015, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#include "application/gui/properties/propertywidgetfactory.h"
#include "application/gui/properties/boolpropertywidget.h"
#include "application/gui/properties/buttonpropertywidget.h"
#include "application/gui/properties/colorpropertywidget.h"
#include "application/gui/properties/datanamepropertywidget.h"
#include "application/gui/properties/floatpropertywidget.h"
#include "application/gui/properties/intpropertywidget.h"
#include "application/gui/properties/metapropertywidget.h"
#include "application/gui/properties/optionpropertywidget.h"
#include "application/gui/properties/statuspropertywidget.h"
#include "application/gui/properties/stringpropertywidget.h"
#include "application/gui/properties/transferfunctionpropertywidget.h"
namespace campvis {
// explicitly instantiate templates to register the property widgets
template class PropertyWidgetRegistrar<BoolPropertyWidget, BoolProperty>;
template class PropertyWidgetRegistrar<ButtonPropertyWidget, ButtonProperty>;
template class PropertyWidgetRegistrar<ColorPropertyWidget, ColorProperty>;
template class PropertyWidgetRegistrar<DataNamePropertyWidget, DataNameProperty, 10>;
template class PropertyWidgetRegistrar<FloatPropertyWidget, FloatProperty>;
template class PropertyWidgetRegistrar<Vec2PropertyWidget, typename VecPropertyWidgetTraits<2>::PropertyType, 5>;
template class PropertyWidgetRegistrar<Vec3PropertyWidget, typename VecPropertyWidgetTraits<3>::PropertyType, 5>;
template class PropertyWidgetRegistrar<Vec4PropertyWidget, typename VecPropertyWidgetTraits<4>::PropertyType, 5>;
template class PropertyWidgetRegistrar<IntPropertyWidget, IntProperty>;
template class PropertyWidgetRegistrar<IVec2PropertyWidget, typename IVecPropertyWidgetTraits<2>::PropertyType, 5>;
template class PropertyWidgetRegistrar<IVec3PropertyWidget, typename IVecPropertyWidgetTraits<3>::PropertyType, 5>;
template class PropertyWidgetRegistrar<IVec4PropertyWidget, typename IVecPropertyWidgetTraits<4>::PropertyType, 5>;
template class PropertyWidgetRegistrar<MetaPropertyWidget, MetaProperty>;
template class PropertyWidgetRegistrar<OptionPropertyWidget, AbstractOptionProperty, 10>;
template class PropertyWidgetRegistrar<StatusPropertyWidget, StatusProperty>;
template class PropertyWidgetRegistrar<StringPropertyWidget, StringProperty>;
template class PropertyWidgetRegistrar<TransferFunctionPropertyWidget, TransferFunctionProperty>;
}
\ No newline at end of file
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/statusproperty.h"
......@@ -66,8 +65,5 @@ namespace campvis {
QLabel * _statusLabel;
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<StatusPropertyWidget, StatusProperty>;
}
#endif // STATUSPROPERTYWIDGET_H__
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/stringproperty.h"
......@@ -72,8 +71,5 @@ namespace campvis {
QPushButton* _btnLoadFile;
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<StringPropertyWidget, StringProperty>;
}
#endif // STRINGPROPERTYWIDGET_H__
......@@ -27,7 +27,6 @@
#include "application/applicationapi.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
#include "core/properties/transferfunctionproperty.h"
class QDockWidget;
......@@ -115,9 +114,6 @@ namespace campvis {
bool wasVisible; ///< remembers whether _docWidget was visible or not
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
template class PropertyWidgetRegistrar<TransferFunctionPropertyWidget, TransferFunctionProperty>;
}
#endif // TRANSFERFUNCTIONPROPERTYWIDGET_H__
......@@ -21,3 +21,4 @@ include("${CAMPVIS_CMAKE_DIR}/CAMPVisTargets.cmake")
# These are IMPORTED targets created by FooBarTargets.cmake
SET(CAMPVIS_CORE_LIBRARIES campvis-core)
SET(CAMPVIS_MODULES_LIBRARIES campvis-modules)
SET(CAMPVIS_APPLICATION_LIBRARIES campvis-application-lib)
......@@ -59,7 +59,7 @@ namespace campvis {
_imageReader.p_targetImageID.addSharedProperty(&_ve.p_inputVolume);
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(128, cgt::vec2(0.f, .05f));
Geometry1DTransferFunction* dvrTF = new Geometry1DTransferFunction(512, cgt::vec2(0.f, .05f));
dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.12f, .15f), cgt::col4(85, 0, 0, 128), cgt::col4(255, 0, 0, 128)));
dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.19f, .28f), cgt::col4(89, 89, 89, 155), cgt::col4(89, 89, 89, 155)));
dvrTF->addGeometry(TFGeometry1D::createQuad(cgt::vec2(.41f, .51f), cgt::col4(170, 170, 128, 64), cgt::col4(192, 192, 128, 64)));
......
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