pointpredicatehistogram.h 4.09 KB
Newer Older
1
2
3
4
// ================================================================================================
// 
// This file is part of the CAMPVis Software Framework.
// 
5
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
6
7
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
//      Chair for Computer Aided Medical Procedures
8
9
//      Technische Universitaet Muenchen
//      Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
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
// 
// 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.
// 
// ================================================================================================
#ifndef POINTPREDICATEHISTOGRAM_H__
#define POINTPREDICATEHISTOGRAM_H__

#include "sigslot/sigslot.h"

#include "modules/advancedusvis/datastructures/pointpredicate.h"

#include <vector>

namespace campvis {

    /**
     * Data object storing information about selected predicates and their settings.
     */
38
    class PointPredicateHistogram : public sigslot::has_slots {
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
    public:

        /**
         * Constructor.
         */
        PointPredicateHistogram();

        /**
         * Destructor.
         */
        virtual ~PointPredicateHistogram();

        /// Locks this histogram, so that changes are written to back buffer
        void lock();

        /// Unlocks this histogram
        void unlock();


        /**
         * Adds \a predicateToAdd to the predicate histogram.
         * \param   predicateToAdd  predicate to add
         */
        void addPredicate(AbstractPointPredicate* predicateToAdd);

        /**
         * Removes the predicate at index \a i.
         * \param   i   Index in predicate vector.
         */
        void removePredicate(size_t i);

        /**
         * Resets the predicate histogram to default setting.
         */
73
        void resetPredicates(bool resetColors = true);
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

        /**
         * Returns the vector of predicates.
         * \return  _predicates
         */
        std::vector<AbstractPointPredicate*>& getPredicates();

        /**
         * Return the GLSL header defining all uniforms and GLSL function of the predicates.
         * \return  A GLSL header to include into all shaders using this predicate histogram.
         */
        std::string getGlslHeader() const;

        /**
         * Sets up \a shader for rendering (i.e. sets all uniform values).
         * \param   shader  Shader to setup.
         */
        void setupRenderShader(tgt::Shader* shader) const;

93
94
95
96
97
98
        /**
         * Sets the GLSL predicate function argument string.
         * \param   pfas    the GLSL predicate function argument string (without parentheses)
         */
        void setPredicateFunctionArgumentString(const std::string& pfas);

99
100

        /// Signal emitted when this predicate histogram's configuration (importance, color, ...) has changed
101
        sigslot::signal0 s_configurationChanged;
102
        /// Signal emitted when this predicate histogram's GLSL header has changed
103
        sigslot::signal0 s_headerChanged;
104
105
106
107
108
109
110
111
112

    private:
        /// Slot called when a predicate's configuration has changed
        void onPredicateConfigurationChanged();
        /// Slot called when a predicate's enabled state has changed
        void onPredicateEnabledChanged();

        /// vector of all voxel predicates
        std::vector<AbstractPointPredicate*> _predicates;
113
114
        /// The GLSL predicate function argument string (without parentheses).
        std::string _predicateFunctionArgumentString;
115
116
117
118
119
120
121
122

        static const std::string loggerCat_;

    };

}

#endif // POINTPREDICATEHISTOGRAM_H__