@@ -14,7 +14,9 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
1414 GroupAction(parent, title),
1515 _scatterplotPlugin(dynamic_cast <ScatterplotPlugin*>(parent->parent ())),
1616 _positionDatasetPickerAction(this , " Position" ),
17- _colorDatasetPickerAction(this , " Color" )
17+ _colorDatasetPickerAction(this , " Color" ),
18+ _pointSizeDatasetPickerAction(this , " Point size" ),
19+ _pointOpacityDatasetPickerAction(this , " Point opacity" )
1820{
1921 setIconByName (" database" );
2022 setToolTip (" Manage loaded datasets for position and color" );
@@ -23,15 +25,24 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
2325
2426 addAction (&_positionDatasetPickerAction);
2527 addAction (&_colorDatasetPickerAction);
28+ addAction (&_pointSizeDatasetPickerAction);
29+ addAction (&_pointOpacityDatasetPickerAction);
2630
2731 _positionDatasetPickerAction.setFilterFunction ([this ](mv::Dataset<DatasetImpl> dataset) -> bool {
2832 return dataset->getDataType () == PointType;
29- });
33+ });
3034
3135 _colorDatasetPickerAction.setFilterFunction ([this ](mv::Dataset<DatasetImpl> dataset) -> bool {
3236 return (dataset->getDataType () == PointType || dataset->getDataType () == ColorType || dataset->getDataType () == ClusterType);
33- });
37+ });
38+
39+ _pointSizeDatasetPickerAction.setFilterFunction ([this ](mv::Dataset<DatasetImpl> dataset) -> bool {
40+ return dataset->getDataType () == PointType;
41+ });
3442
43+ _pointOpacityDatasetPickerAction.setFilterFunction ([this ](mv::Dataset<DatasetImpl> dataset) -> bool {
44+ return dataset->getDataType () == PointType;
45+ });
3546
3647 auto scatterplotPlugin = dynamic_cast <ScatterplotPlugin*>(parent->parent ());
3748
@@ -53,6 +64,44 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
5364 connect (&scatterplotPlugin->getSettingsAction ().getColoringAction (), &ColoringAction::currentColorDatasetChanged, this , [this ](Dataset<DatasetImpl> currentColorDataset) -> void {
5465 _colorDatasetPickerAction.setCurrentDataset (currentColorDataset);
5566 });
67+
68+ auto & pointPlotAction = scatterplotPlugin->getSettingsAction ().getPlotAction ().getPointPlotAction ();
69+ auto & pointSizeAction = pointPlotAction.getSizeAction ();
70+ auto & pointOpacityAction = pointPlotAction.getOpacityAction ();
71+
72+ const auto pointSizeSourceChanged = [this , &pointSizeAction]() -> void {
73+ _pointSizeDatasetPickerAction.setCurrentDataset (pointSizeAction.isSourceDataset () ? pointSizeAction.getCurrentDataset () : nullptr );
74+
75+ if (!pointSizeAction.isSourceDataset ())
76+ _pointSizeDatasetPickerAction.setCurrentIndex (-1 );
77+ };
78+
79+ connect (&pointSizeAction, &ScalarAction::sourceSelectionChanged, this , pointSizeSourceChanged);
80+ connect (&pointSizeAction, &ScalarAction::sourceDataChanged, this , pointSizeSourceChanged);
81+
82+ connect (&_pointSizeDatasetPickerAction, &DatasetPickerAction::datasetPicked, this , [this , &pointSizeAction](Dataset<DatasetImpl> dataset) -> void {
83+ if (!dataset.isValid ())
84+ return ;
85+
86+ pointSizeAction.setCurrentDataset (dataset);
87+ });
88+
89+ const auto pointOpacitySourceChanged = [this , &pointOpacityAction]() -> void {
90+ _pointOpacityDatasetPickerAction.setCurrentDataset (pointOpacityAction.isSourceDataset () ? pointOpacityAction.getCurrentDataset () : nullptr );
91+
92+ if (!pointOpacityAction.isSourceDataset ())
93+ _pointOpacityDatasetPickerAction.setCurrentIndex (-1 );
94+ };
95+
96+ connect (&pointOpacityAction, &ScalarAction::sourceSelectionChanged, this , pointOpacitySourceChanged);
97+ connect (&pointOpacityAction, &ScalarAction::sourceDataChanged, this , pointOpacitySourceChanged);
98+
99+ connect (&_pointOpacityDatasetPickerAction, &DatasetPickerAction::datasetPicked, this , [this , &pointOpacityAction](Dataset<DatasetImpl> dataset) -> void {
100+ if (!dataset.isValid ())
101+ return ;
102+
103+ pointOpacityAction.setCurrentDataset (dataset);
104+ });
56105}
57106
58107void DatasetsAction::connectToPublicAction (WidgetAction* publicAction, bool recursive)
0 commit comments