In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

Commit 93349908 authored by schultezub's avatar schultezub

added Geometry2DtransferFunctionEditor stub

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@325 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent dbad14c0
......@@ -32,6 +32,7 @@ SET(TUMVIS_APPLICATION_TO_BE_MOCCED
gui/properties/intpropertywidget.h
gui/properties/floatpropertywidget.h
gui/properties/geometry1dtransferfunctioneditor.h
gui/properties/geometry2dtransferfunctioneditor.h
gui/properties/propertycollectionwidget.h
gui/properties/simpletransferfunctioneditor.h
gui/properties/stringpropertywidget.h
......
......@@ -271,14 +271,14 @@ namespace TUMVis {
const std::vector<TFGeometry1D*>& geometries = gtf->getGeometries();
for (std::vector<TFGeometry1D*>::const_iterator git = geometries.begin(); git != geometries.end(); ++git) {
// Add manipulator for the whole geometry and register it as event handler:
WholeTFGeometryManipulator* wtf = new WholeTFGeometryManipulator(_canvas->getSize(), gtf, *git);
WholeTFGeometryManipulator* wtf = new WholeTFGeometryManipulator(_canvas->getSize(), *git);
_manipulators.push_back(wtf);
_canvas->getEventHandler()->addListenerToFront(wtf);
wtf->s_selected.connect(this, &Geometry1DTransferFunctionEditor::onWholeTFGeometryManipulatorSelected);
// Add a manipulator for each KeyPoint and register it as event handler:
for (std::vector<TFGeometry1D::KeyPoint>::iterator kpit = (*git)->getKeyPoints().begin(); kpit != (*git)->getKeyPoints().end(); ++kpit) {
_manipulators.push_back(new KeyPointManipulator(_canvas->getSize(), gtf, *git, kpit));
_manipulators.push_back(new KeyPointManipulator(_canvas->getSize(), *git, kpit));
_canvas->getEventHandler()->addListenerToFront(_manipulators.back());
}
}
......
// ================================================================================================
//
// This file is part of the TUMVis Visualization 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
//
// 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 GEOMETRY2DTRANSFERFUNCTIONEDITOR_H__
#define GEOMETRY2DTRANSFERFUNCTIONEDITOR_H__
#include "tbb/include/tbb/mutex.h"
#include "tgt/painter.h"
#include "tgt/event/eventlistener.h"
#include "core/classification/tfgeometry2d.h"
#include "application/gui/properties/abstracttransferfunctioneditor.h"
class QGridLayout;
class QLabel;
class QPushButton;
namespace tgt {
class QtThreadedCanvas;
class Shader;
}
namespace TUMVis {
class ColorPickerWidget;
class Geometry2DTransferFunction;
class AbstractTFGeometryManipulator;
class WholeTFGeometryManipulator;
/**
* Editor widget for a Geometry2DTransferFunction.
*/
class Geometry2DTransferFunctionEditor : public AbstractTransferFunctionEditor, public tgt::EventListener, public tgt::Painter {
Q_OBJECT;
public:
/**
* Creates a new editor widget for the for the TransferFunctionProperty \a property.
* \param tf The transfer function the editor shall handle.
* \param parent Parent Qt widget
*/
Geometry2DTransferFunctionEditor(Geometry2DTransferFunction* tf, QWidget* parent = 0);
/**
* Destructor
*/
virtual ~Geometry2DTransferFunctionEditor();
/**
* Performs the painting.
*/
void paint();
/// \see tgt::Painter::sizeChanged
virtual void sizeChanged(const tgt::ivec2&);
/// \see tgt::EventListener::mousePressEvent
virtual void mousePressEvent(tgt::MouseEvent* e);
/**
* Slot to be called when the geometry vector of the transfer function has changed.
*/
void onGeometryCollectionChanged();
/**
* Slot tp be called when a WholeTFGeometryManipulator was selected.
* \param the selected WholeTFGeometryManipulator
*/
void onWholeTFGeometryManipulatorSelected(WholeTFGeometryManipulator* wtf /* :) */);
protected slots:
/**
* Slot to be called when _btnAddGeometry was clicked.
*/
void onBtnAddGeometryClicked();
/**
* Slot to be called when _btnRemoveGeometry was clicked.
*/
void onBtnRemoveGeometryClicked();
protected:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void updateWidgetFromProperty();
/**
* Updates the GeometryManipulator vector.
* Invalidates all of its iterators.
*/
void updateManipulators();
/**
* To be called when the canvas is invalidated, issues new paint job.
*/
void invalidate();
/**
* Sets up the GUI stuff.
*/
void setupGUI();
std::vector<AbstractTFGeometryManipulator*> _manipulators;
tbb::atomic<WholeTFGeometryManipulator*> _selectedGeometry;
tbb::mutex _localMutex;
QGridLayout* _layout;
tgt::QtThreadedCanvas* _canvas;
QLabel* _lblIntensityLeft;
QLabel* _lblIntensityRight;
QPushButton* _btnAddGeometry;
QPushButton* _btnRemoveGeometry;
};
}
#endif // GEOMETRY2DTRANSFERFUNCTIONEDITOR_H__
......@@ -42,11 +42,9 @@
namespace TUMVis {
AbstractTFGeometryManipulator::AbstractTFGeometryManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf)
AbstractTFGeometryManipulator::AbstractTFGeometryManipulator(const tgt::ivec2& viewportSize)
: _viewportSize(viewportSize)
, _tf(tf)
{
tgtAssert(tf != 0, "Transfer Function must not be 0.");
}
void AbstractTFGeometryManipulator::setViewportSize(const tgt::ivec2& viewportSize) {
......@@ -65,12 +63,11 @@ namespace TUMVis {
// ================================================================================================
KeyPointManipulator::KeyPointManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf, TFGeometry1D* geometry, const std::vector<TFGeometry1D::KeyPoint>::iterator& keyPoint)
: AbstractTFGeometryManipulator(viewportSize, tf)
KeyPointManipulator::KeyPointManipulator(const tgt::ivec2& viewportSize, TFGeometry1D* geometry, const std::vector<TFGeometry1D::KeyPoint>::iterator& keyPoint)
: AbstractTFGeometryManipulator(viewportSize)
, _geometry(geometry)
, _keyPoint(keyPoint)
, _mousePressed(false)
//, _pressedPosition(0, 0)
{
tgtAssert(geometry != 0, "Geometry must not be 0.");
}
......@@ -139,8 +136,8 @@ namespace TUMVis {
// ================================================================================================
WholeTFGeometryManipulator::WholeTFGeometryManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf, TFGeometry1D* geometry)
: AbstractTFGeometryManipulator(viewportSize, tf)
WholeTFGeometryManipulator::WholeTFGeometryManipulator(const tgt::ivec2& viewportSize, TFGeometry1D* geometry)
: AbstractTFGeometryManipulator(viewportSize)
, _geometry(geometry)
, _mousePressed(false)
{
......
......@@ -33,6 +33,7 @@
#include "tgt/matrix.h"
#include "tgt/event/eventlistener.h"
#include "core/classification/tfgeometry1d.h"
#include "core/classification/tfgeometry2d.h"
namespace TUMVis {
class Geometry1DTransferFunction;
......@@ -48,9 +49,8 @@ namespace TUMVis {
/**
* Creates a new AbstractTFGeometryManipulator for the given Geometry1DTransferFunction.
* \param viewportSize Viewport size (extent of the OpenGL rendering canvas)
* \param tf Parent TF of the geometries to manipulate
*/
AbstractTFGeometryManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf);
AbstractTFGeometryManipulator(const tgt::ivec2& viewportSize);
/**
* Pure virtual Destructor
......@@ -85,7 +85,6 @@ namespace TUMVis {
tgt::vec2 viewportToTF(const tgt::ivec2& pos) const;
tgt::ivec2 _viewportSize; ///< Viewport size (extent of the OpenGL rendering canvas)
Geometry1DTransferFunction* _tf; ///< Parent TF of the geometries to manipulate (might be handy somewhere later...)
};
// ================================================================================================
......@@ -98,11 +97,10 @@ namespace TUMVis {
/**
* Creates a new KeyPointManipulator
* \param viewportSize Viewport size (extent of the OpenGL rendering canvas)
* \param tf Parent TF of the geometries to manipulate
* \param geometry Parent geometry of the KeyPoint to manipulate
* \param keyPoint Iterator to the KeyPoint to manipulate
*/
KeyPointManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf, TFGeometry1D* geometry, const std::vector<TFGeometry1D::KeyPoint>::iterator& keyPoint);
KeyPointManipulator(const tgt::ivec2& viewportSize, TFGeometry1D* geometry, const std::vector<TFGeometry1D::KeyPoint>::iterator& keyPoint);
/// \see AbstractTFGeometryManipulator::render
void render();
......@@ -136,10 +134,9 @@ namespace TUMVis {
/**
* Creates a new KeyPointManipulator
* \param viewportSize Viewport size (extent of the OpenGL rendering canvas)
* \param tf Parent TF of the geometries to manipulate
* \param geometry Parent geometry of the KeyPoint to manipulate
*/
WholeTFGeometryManipulator(const tgt::ivec2& viewportSize, Geometry1DTransferFunction* tf, TFGeometry1D* geometry);
WholeTFGeometryManipulator(const tgt::ivec2& viewportSize, TFGeometry1D* geometry);
/**
* Destructor
......
......@@ -30,10 +30,12 @@
#include "application/gui/properties/abstracttransferfunctioneditor.h"
#include "application/gui/properties/geometry1dtransferfunctioneditor.h"
#include "application/gui/properties/geometry2dtransferfunctioneditor.h"
#include "application/gui/properties/simpletransferfunctioneditor.h"
#include "core/classification/abstracttransferfunction.h"
#include "core/classification/geometry1dtransferfunction.h"
#include "core/classification/geometry2dtransferfunction.h"
#include "core/classification/simpletransferfunction.h"
namespace TUMVis {
......@@ -49,6 +51,10 @@ namespace TUMVis {
return new Geometry1DTransferFunctionEditor(tester);
}
if (Geometry2DTransferFunction* tester = dynamic_cast<Geometry2DTransferFunction*>(tf)) {
return new Geometry2DTransferFunctionEditor(tester);
}
return 0;
}
......
......@@ -71,8 +71,7 @@ namespace TUMVis {
* \return
*/
std::vector<KeyPoint>& getKeyPoints();
/**
* Renders this transfer function geometry to the current active OpenGL context for usage in editor.
* \note Must be called from an active and valid OpenGL context.
......
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