Commit 01342928 authored by schultezub's avatar schultezub
Browse files

added CameraProperty and TrackballNavigationEventHandler stubs

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@214 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 2aa51bc3
......@@ -111,6 +111,7 @@ namespace TUMVis {
tgt::QtContextManager::deinit();
tgt::deinit();
// MainWindow dtor needs a valid TumVisApplication, so we need to call it here instead of during destruction.
delete _mainWindow;
_initialized = false;
......
......@@ -128,7 +128,7 @@ IF(TUMVIS_DEBUG)
ENDIF()
# minimum Qt version
SET(TUMVIS_REQUIRED_QT_VERSION "4.6")
SET(TUMVIS_REQUIRED_QT_VERSION "4.8")
# detect libraries
......
#include "trackballnavigationeventhandler.h"
#include "tgt/assert.h"
#include "tgt/event/mouseevent.h"
#include "core/properties/cameraproperty.h"
namespace TUMVis {
const std::string TrackballNavigationEventHandler::loggerCat_ = "TUMVis.core.eventhandler.TrackballNavigationEventHandler";
TrackballNavigationEventHandler::TrackballNavigationEventHandler(CameraProperty* property)
: AbstractEventHandler()
, _cameraProperty(property)
{
tgtAssert(_cameraProperty != 0, "Assigned property must not be 0.");
}
TrackballNavigationEventHandler::~TrackballNavigationEventHandler() {
}
bool TrackballNavigationEventHandler::accept(tgt::Event* e) {
return false;
}
void TrackballNavigationEventHandler::execute(tgt::Event* e) {
}
}
#ifndef TRACKBALLNAVIGATIONEVENTHANDLER_H__
#define TRACKBALLNAVIGATIONEVENTHANDLER_H__
#include "tgt/logmanager.h"
#include "core/eventhandlers/abstracteventhandler.h"
namespace TUMVis {
class CameraProperty;
/**
* Event handler that maps mouse wheel events to a numeric property.
*
*/
class TrackballNavigationEventHandler : public AbstractEventHandler {
public:
/**
* Creates a TrackballNavigationEventHandler.
*/
TrackballNavigationEventHandler(CameraProperty* property);
/**
* Virtual Destructor
**/
virtual ~TrackballNavigationEventHandler();
/**
* Checks, whether the given event \a e is handled by this EventHandler.
* \param e The event to check
* \return True, if the given event is handled by this EventHandler.
*/
virtual bool accept(tgt::Event* e);
/**
* Performs the event handling.
* \param e The event to handle
*/
virtual void execute(tgt::Event* e);
protected:
CameraProperty* _cameraProperty;
static const std::string loggerCat_;
};
}
#endif // TRACKBALLNAVIGATIONEVENTHANDLER_H__
......@@ -8,8 +8,8 @@ namespace TUMVis {
: _name(name)
, _title(title)
, _invalidationLevel(il)
, _inUse(false)
{
_inUse = false;
}
AbstractProperty::~AbstractProperty() {
......@@ -33,6 +33,8 @@ namespace TUMVis {
void AbstractProperty::addSharedProperty(AbstractProperty* prop) {
tgtAssert(prop != 0, "Shared property must not be 0!");
tgtAssert(typeid(this) == typeid(prop), "Shared property must be of the same type as this property.");
tbb::spin_mutex::scoped_lock lock(_localMutex);
_sharedProperties.insert(prop);
}
......
......@@ -2,6 +2,7 @@
#define ABSTRACTPROPERTY_H__
#include "sigslot/sigslot.h"
#include "tbb/include/tbb/atomic.h"
#include "tbb/include/tbb/spin_mutex.h"
#include "tgt/logmanager.h"
#include "core/tools/invalidationlevel.h"
......@@ -116,7 +117,7 @@ namespace TUMVis {
std::string _title; ///< Property title (e.g. used for GUI)
InvalidationLevel _invalidationLevel; ///< Invalidation level that this property triggers
bool _inUse; ///< flag whether property is currently in use and values are written to back buffer
tbb::atomic<bool> _inUse; ///< flag whether property is currently in use and values are written to back buffer
tbb::spin_mutex _localMutex; ///< Mutex used when altering local members
/**
......
#include "cameraproperty.h"
namespace TUMVis {
const std::string CameraProperty::loggerCat_ = "TUMVis.core.datastructures.CameraProperty";
CameraProperty::CameraProperty(const std::string& name, const std::string& title, tgt::Camera cam /*= tgt::Camera()*/, InvalidationLevel il /*= InvalidationLevel::INVALID_RESULT*/)
: GenericProperty<tgt::Camera>(name, title, cam, il)
{
}
CameraProperty::~CameraProperty() {
}
}
#ifndef CAMERAPROPERTY_H__
#define CAMERAPROPERTY_H__
#include "tgt/camera.h"
#include "core/properties/genericproperty.h"
namespace TUMVis {
class CameraProperty : public GenericProperty<tgt::Camera> {
public:
/**
* Creates a new CameraProperty
* \param name Property name (unchangable!)
* \param title Property title (e.g. used for GUI)
* \param il Invalidation level that this property triggers
*/
CameraProperty(const std::string& name, const std::string& title, tgt::Camera cam = tgt::Camera(), InvalidationLevel il = InvalidationLevel::INVALID_RESULT);
/**
* Virtual Destructor
**/
virtual ~CameraProperty();
protected:
static const std::string loggerCat_;
};
}
#endif // CAMERAPROPERTY_H__
......@@ -58,13 +58,6 @@ namespace TUMVis {
virtual void setValue(const T& value);
/**
* Locks the property and marks it as "in use". All changes to its value will be written to
* the back buffer. The buffers will be swapped on unlocking the property.
* \sa GenericProperty::unlock
*/
virtual void lock();
/**
* Unlocks the property. If the back buffer has changed, the changes will be written to the front
* buffer and all observers will be notified.
......@@ -152,12 +145,6 @@ namespace TUMVis {
}
}
template<typename T>
void TUMVis::GenericProperty<T>::lock() {
tbb::spin_mutex::scoped_lock lock(_localMutex);
_inUse = true;
}
template<typename T>
void TUMVis::GenericProperty<T>::unlock() {
tbb::spin_mutex::scoped_lock lock(_localMutex);
......
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