transferfunctionproperty.h 3.97 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
// ================================================================================================
// 
// 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 Universität München
//      Boltzmannstr. 3, 85748 Garching b. München, 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.
// 
// ================================================================================================

29
30
31
32
33
34
35
36
37
#ifndef TRANSFERFUNCTIONPROPERTY_H__
#define TRANSFERFUNCTIONPROPERTY_H__

#include "sigslot/sigslot.h"
#include "core/properties/abstractproperty.h"
#include "core/classification/abstracttransferfunction.h"

namespace TUMVis {

38
39
40
    /**
     * \todo    Implement correct behavior if the TF changes during locked property state.
     */
41
42
43
44
45
46
    class TransferFunctionProperty : public AbstractProperty, public sigslot::has_slots<> {
    public:
        /**
         * Creates a new TransferFunctionProperty
         * \param name      Property name (unchangable!)
         * \param title     Property title (e.g. used for GUI)
schultezub's avatar
schultezub committed
47
         * \param tf        Transfer function to initialize the property with.
48
49
50
51
52
53
54
55
56
         * \param il        Invalidation level that this property triggers
         */
        TransferFunctionProperty(const std::string& name, const std::string& title, AbstractTransferFunction* tf, InvalidationLevel il = InvalidationLevel::INVALID_RESULT);

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

57
        /// \see AbstractProperty::deinit()
schultezub's avatar
schultezub committed
58
        virtual void deinit();
59

schultezub's avatar
schultezub committed
60
61
62
63
64
        /**
         * Gets the TransferFunction of this property.
         * \note    This is a non-const pointer, if you mess with it be sure you know what you're doing!
         * \return  _transferFunction
         */
65
66
        AbstractTransferFunction* getTF();

67
68
69
70
71
72
73
74
        /**
         * Replaces the transfer function with \a tf.
         * \note    First triggers s_BeforeTFReplace, then deletes the current TF, replaces it with
         *          \a tf and finally triffers s_AfterTFReplace.
         * \param   tf  The new transfer function for this property.
         */
        void replaceTF(AbstractTransferFunction* tf);

schultezub's avatar
schultezub committed
75
76
77
        /**
         * Slot being called when \a _transferFunction has changed.
         */
78
79
80
        void onTFChanged();


81
82
83
        sigslot::signal1<AbstractTransferFunction*> s_BeforeTFReplace;
        sigslot::signal1<AbstractTransferFunction*> s_AfterTFReplace;

84
    protected:
schultezub's avatar
schultezub committed
85
        AbstractTransferFunction* _transferFunction;    ///< Transfer function of this property
86
87
88
89
90
91
92

        static const std::string loggerCat_;
    };

}

#endif // TRANSFERFUNCTIONPROPERTY_H__