visualizationpipeline.h 2.88 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef VISUALIZATIONPIPELINE_H__
#define VISUALIZATIONPIPELINE_H__

#include "tgt/glcanvas.h"
#include "tgt/painter.h"
#include "tgt/event/eventlistener.h"
#include "core/eventhandlers/abstracteventhandler.h"
#include "core/pipeline/abstractpipeline.h"

#include <vector>

namespace TUMVis {

    /**
     * Abstract base class for TUMVis Pipelines.
     * 
     */
    class VisualizationPipeline : public AbstractPipeline, public tgt::EventListener, public tgt::Painter {
    public:
        /**
         * Creates a VisualizationPipeline.
         */
        VisualizationPipeline(tgt::GLCanvas* canvas = 0);

        /**
         * Virtual Destructor
         **/
        virtual ~VisualizationPipeline();


        /**
         * Initializes the OpenGL context of the pipeline and its processors.
         * \todo    merge with init() ?
         * \note    When overwriting this method, make sure to call the base class version first.
         */
        virtual void init();

        /**
         * Execute this pipeline.
         **/
        virtual void execute() = 0;

        /**
         * Performs the event handling for the assigned canvas.
         * Default behaviour is to execute all assigned EventHandlers, may be overwritten by subclasses.
         * \param e     event parameters
         */
        virtual void onEvent(tgt::Event* e);

        /**
         * Acquires the OpenGL context, and executes the pipeline
         */
        virtual void paint();

        /**
         * Is called when the viewport dimensions change, notifies the pipeline of that.
         * \param size  New viewport dimensions
         */
        virtual void sizeChanged(const tgt::ivec2& size);

        /**
         * Sets the target canvas for rendering.
         * \param canvas    Target canvas for rendering
         */
        void setCanvas(tgt::GLCanvas* canvas);

        /**
         * Returns the PropertyCollection of this processor.
         * \return _properties
         */
        PropertyCollection& getPropertyCollection();

    protected:
        DataContainer _data;                                ///< DataContainer containing local working set of data for this Pipeline
        tgt::GLCanvas* _canvas;                             ///< Target canvas for rendering
        tgt::ivec2 _canvasSize;                             ///< Viewport size of target canvas

        std::vector<AbstractEventHandler*> _eventHandlers;  ///< List of registered event handlers for the pipeline
        std::vector<AbstractProcessor*> _processors;        ///< List of all processors of this pipeline
        PropertyCollection _properties;                     ///< PropertyCollection of this pipeline, put in here all properties you want to be publicly accessible

        static const std::string loggerCat_;
    };

}

#endif // VISUALIZATIONPIPELINE_H__