OpenWalnut  1.5.0dev
WVisualizationPropertyHandler.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WVISUALIZATIONPROPERTYHANDLER_H
26 #define WVISUALIZATIONPROPERTYHANDLER_H
27 
28 #include <memory>
29 
30 #include "../WProtonData.h"
31 #include "../WSingleSelectorName.h"
32 
33 
34 /**
35  * Creates, updates and handles the visualization properties.
36  */
38 {
39 public:
40  /**
41  * Function variables for updating the data
42  */
43  typedef boost::function< void( ) > CallbackPtr;
44 
45  /**
46  * shared_ptr that points to itself
47  */
48  typedef std::shared_ptr< WVisualizationPropertyHandler > SPtr;
49 
50  /**
51  * constructor
52  *
53  * \param protonData Pointer to the content and header of the CSV
54  * \param properties A property variable that is generated by the WModul
55  * \param dataUpdate A function variable that reinitializes the WDataSets
56  */
58  WPropertyGroup::SPtr properties,
60 
61  /**
62  * creates the group property and the subproperty
63  */
64  void createProperties();
65 
66  /**
67  * update current group property and subproperty
68  */
69  void updateProperty();
70 
71  /**
72  * toggle the visibility of plain color and transfer function
73  */
74  void toggleColorProperties();
75 
76  /**
77  * Getter
78  *
79  * \return WPropBool of color from edep
80  */
81  WPropBool getColorFromEdep();
82 
83  /**
84  * Getter
85  *
86  * \return WPropBool of sizes from edep
87  */
88  WPropBool getSizesFromEdep();
89 
90 
91  /**
92  * Getter
93  *
94  * \return WPropBool switch to enable cluster size conversion.
95  */
96  WPropBool getEnableClusterSize();
97 
98  /**
99  * Getter
100  *
101  * \return WPropBool of color from selection
102  */
103  WPropColor getColorSelection();
104 
105  /**
106  * Getter
107  * \return WPropTransferFunction of the current transfer function
108  */
109  WPropTransferFunction getTransferFunction();
110 
111  /**
112  * Sets the transfer function
113  * \return WTransferFunction with specified gradient
114  */
116 
117 private:
118  /**
119  * Reload data when properties for selection of primaries and secondaries changed
120  *
121  * \param property contains reference to the property which called updateProperty()
122  */
123  void propertyCallback( WPropertyBase::SPtr property );
124 
125  /**
126  * Pointer to the content and header of the CSV
127  */
129 
130  /**
131  * A property variable that is generated by the WModul
132  */
134 
135  /**
136  * A function variable that reinitializes the WDataSets
137  */
139 
140  /**
141  * Property group for visualization modes
142  */
144 
145  /**
146  * Decides whether to color points based on the deposited energy or not.
147  */
148  WPropBool m_colorFromEdep;
149 
150  /**
151  * Decides whether to scale the points sizes according to their deposited energy.
152  */
153  WPropBool m_sizesFromEdep;
154 
155  /**
156  * En-/Disables the clustersize conversion.
157  */
159 
160  /**
161  * Property that holds the current selected color when not coloring points based on their deposited energy.
162  */
163  WPropColor m_colorSelection;
164 
165  /**
166  * Property that holds the current transfer function for the gradient.
167  */
168  WPropTransferFunction m_gradient;
169 
170  /**
171  * Property that holds a trigger to apply the current transfer function for the gradient
172  */
173  WPropTrigger m_applyGradient;
174 };
175 
176 #endif // WVISUALIZATIONPROPERTYHANDLER_H
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
Definition: WPropertyBase.h:53
std::shared_ptr< WPropertyGroup > SPtr
shared pointer to object of this type
std::shared_ptr< WProtonData > SPtr
shared_ptr that points to itself
Definition: WProtonData.h:52
A class that stores a 1D transfer function which consists of a linear interpolation of alpha and colo...
Creates, updates and handles the visualization properties.
WPropBool m_enabledClusterSize
En-/Disables the clustersize conversion.
void toggleColorProperties()
toggle the visibility of plain color and transfer function
WPropBool m_sizesFromEdep
Decides whether to scale the points sizes according to their deposited energy.
boost::function< void() > CallbackPtr
Function variables for updating the data.
WPropTrigger m_applyGradient
Property that holds a trigger to apply the current transfer function for the gradient.
WTransferFunction setColorGradient()
Sets the transfer function.
WPropColor m_colorSelection
Property that holds the current selected color when not coloring points based on their deposited ener...
WPropTransferFunction m_gradient
Property that holds the current transfer function for the gradient.
void propertyCallback(WPropertyBase::SPtr property)
Reload data when properties for selection of primaries and secondaries changed.
WPropTransferFunction getTransferFunction()
Getter.
WVisualizationPropertyHandler(WProtonData::SPtr protonData, WPropertyGroup::SPtr properties, WVisualizationPropertyHandler::CallbackPtr dataUpdate)
constructor
void createProperties()
creates the group property and the subproperty
WPropBool m_colorFromEdep
Decides whether to color points based on the deposited energy or not.
WProtonData::SPtr m_protonData
Pointer to the content and header of the CSV.
std::shared_ptr< WVisualizationPropertyHandler > SPtr
shared_ptr that points to itself
WPropertyGroup::SPtr m_properties
A property variable that is generated by the WModul.
void updateProperty()
update current group property and subproperty
WPropGroup m_visualizationGroup
Property group for visualization modes.
WVisualizationPropertyHandler::CallbackPtr m_dataUpdate
A function variable that reinitializes the WDataSets.