paysages3d/src/interface/modeler/ModelerCameras.h
2016-07-23 22:58:32 +02:00

79 lines
1.7 KiB
C++

#pragma once
#include "modeler_global.h"
#include "DefinitionWatcher.h"
#include <QObject>
namespace paysages {
namespace modeler {
/**
* Storage for modeler cameras.
*/
class ModelerCameras : public QObject, public DefinitionWatcher {
Q_OBJECT
public:
ModelerCameras(MainModelerWindow *parent);
~ModelerCameras();
/**
* Process a zoom request.
*/
void processZoom(double value);
/**
* Process a scroll request.
*/
void processScroll(double xvalue, double yvalue);
/**
* Process a panning rotation.
*/
void processPanning(double xvalue, double yvalue);
/**
* Start a sun tool, the camera will follow the sun.
*
* 'duration' is the duration in milliseconds before calling endTool() automatically (0 to disable to wait for
*manual call).
*/
void startSunTool(unsigned long duration = 0);
/**
* End the tool mode.
*/
void endTool();
protected:
virtual void timerEvent(QTimerEvent *event) override;
virtual void nodeChanged(const DefinitionNode *node, const DefinitionDiff *diff,
const DefinitionNode *parent) override;
/**
* Validate current camera, pushing it to rendered scenery if needed.
*/
void validate();
public slots:
void changeActiveCamera(const QString &name);
void toolChanged(const QString &tool);
private:
MainModelerWindow *parent;
CameraDefinition *active;
CameraDefinition *current;
CameraDefinition *render;
CameraDefinition *topdown;
CameraDefinition *tool;
CameraDefinition *previous;
typedef enum { TOOL_NONE, TOOL_SUN } CameraToolMode;
CameraToolMode tool_mode;
unsigned long tool_auto_end;
};
}
}