forked from Rsnelllenberg/VolumeProjectorPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransferFunctionPlugin.h
More file actions
128 lines (93 loc) · 3.6 KB
/
Copy pathTransferFunctionPlugin.h
File metadata and controls
128 lines (93 loc) · 3.6 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#pragma once
#include <ViewPlugin.h>
#include <actions/HorizontalToolbarAction.h>
#include <graphics/Vector2f.h>
#include "SettingsAction.h"
#include "MaterialSettings.h"
#include <QPointer>
#include <QTimer>
using namespace mv::plugin;
using namespace mv::util;
using namespace mv::gui;
class Points;
class TransferFunctionWidget;
namespace mv
{
namespace gui {
class DropWidget;
}
}
class TransferFunctionPlugin : public ViewPlugin
{
Q_OBJECT
public:
TransferFunctionPlugin(const PluginFactory* factory);
~TransferFunctionPlugin() override = default;
void init() override;
/**
* Load one (or more datasets in the view)
* @param datasets Dataset(s) to load
*/
void loadData(const mv::Datasets& datasets) override;
/** Get number of points in the position dataset */
std::uint32_t getNumberOfPoints() const;
public:
void createSubset(const bool& fromSourceData = false, const QString& name = "");
protected: // Data loading
/** Invoked when the position points dataset changes */
void positionDatasetChanged();
public: // Miscellaneous
/** Get smart pointer to points dataset for point position */
mv::Dataset<Points>& getPositionDataset();
public:
/** Get reference to the scatter plot widget */
TransferFunctionWidget& getTransferFunctionWidget();
SettingsAction& getSettingsAction() { return *(_settingsAction).get(); }
private:
void updateVolumeData();
void updateSelection();
public: // Serialization
/**
* Load plugin from variant map
* @param variantMap Variant map representation of the plugin
*/
void fromVariantMap(const QVariantMap& variantMap) override;
/**
* Save plugin to variant map
* @return Variant map representation of the plugin
*/
QVariantMap toVariantMap() const override;
private:
QPointer<TransferFunctionWidget> _transferFunctionWidget; /** The visualization widget */
mv::gui::DropWidget* _dropWidget; /** Widget for dropping datasets */
mv::Dataset<Points> _positionDataset; /** Smart pointer to points dataset for point position */
std::vector<mv::Vector2f> _positions; /** Point positions */
unsigned int _numPoints; /** Number of point positions */
QPointer<SettingsAction> _settingsAction; /** Group action for all settings */
QPointer<MaterialSettings> _materialSettings; /** Material settings action */
QPointer<HorizontalToolbarAction> _primaryToolbarAction; /** Horizontal toolbar for primary content */
};
// =============================================================================
// Factory
// =============================================================================
class TransferFunctionPluginFactory : public ViewPluginFactory
{
Q_INTERFACES(mv::plugin::ViewPluginFactory mv::plugin::PluginFactory)
Q_OBJECT
Q_PLUGIN_METADATA(IID "studio.manivault.TransferFunctionPlugin"
FILE "PluginInfo.json")
public:
TransferFunctionPluginFactory();
ViewPlugin* produce() override;
/**
* Get plugin trigger actions given \p datasets
* @param datasets Vector of input datasets
* @return Vector of plugin trigger actions
*/
PluginTriggerActions getPluginTriggerActions(const mv::Datasets& datasets) const override;
/**
* Get the URL of the GitHub repository
* @return URL of the GitHub repository (or readme markdown URL if set)
*/
QUrl getRepositoryUrl() const override;
};