Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions src/ScatterplotPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,13 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) :
totalNumIndices += cluster.getIndices().size();
}

if (totalNumIndices == _positionDataset->getNumPoints())
int totalNumPoints = 0;
if (_positionDataset->isDerivedData())
totalNumPoints = _positionSourceDataset->getFullDataset<Points>()->getNumPoints();
else
totalNumPoints = _positionDataset->getFullDataset<Points>()->getNumPoints();

if (totalNumIndices == totalNumPoints)
{
// Use the clusters set for points color
dropRegions << new DropWidget::DropRegion(this, "Color", description, "palette", true, [this, candidateDataset]() {
Expand Down Expand Up @@ -388,8 +394,27 @@ void ScatterplotPlugin::init()

connect(&_positionDataset, &Dataset<>::changed, this, &ScatterplotPlugin::updateHeadsUpDisplay);
connect(&_positionDataset, &Dataset<>::guiNameChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);
connect(&_settingsAction.getColoringAction(), &ColoringAction::currentColorDatasetChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);
connect(&_settingsAction.getColoringAction().getColorByAction(), &OptionAction::currentIndexChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);
connect(&_positionDataset, &Dataset<>::guiNameChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);

const auto currentColorDatasetChanged = [this](Dataset<DatasetImpl> currentColorDataset) -> void {
if (_colorDataset == currentColorDataset)
return;

if (_colorDataset.isValid())
disconnect(&_colorDataset, &Dataset<>::guiNameChanged, this, nullptr);

_colorDataset = currentColorDataset;

connect(&_colorDataset, &Dataset<>::guiNameChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);

updateHeadsUpDisplay();
};

connect(&_settingsAction.getColoringAction(), &ColoringAction::currentColorDatasetChanged, this, currentColorDatasetChanged);
connect(&_settingsAction.getColoringAction().getColorByAction(), &OptionAction::currentIndexChanged, this, [this, currentColorDatasetChanged](const std::int32_t& currentIndex) -> void {
currentColorDatasetChanged(_settingsAction.getColoringAction().getCurrentColorDataset());
});

connect(&_settingsAction.getPlotAction().getPointPlotAction().getSizeAction(), &ScalarAction::sourceDataChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);
connect(&_settingsAction.getPlotAction().getPointPlotAction().getOpacityAction(), &ScalarAction::sourceDataChanged, this, &ScatterplotPlugin::updateHeadsUpDisplay);

Expand Down Expand Up @@ -1004,7 +1029,9 @@ void ScatterplotPlugin::updateHeadsUpDisplay()
getHeadsUpDisplayAction().addHeadsUpDisplayItem(QString("%1 by:").arg(metaDataName), data->getGuiName(), "", itemPtr);
};

addMetaDataToHeadsUpDisplay("Color", _settingsAction.getColoringAction().getCurrentColorDataset(), datasetsItem);
if (_settingsAction.getColoringAction().getColorByAction().getCurrentIndex() >= 2)
addMetaDataToHeadsUpDisplay("Color", _colorDataset, datasetsItem);

addMetaDataToHeadsUpDisplay("Size", _settingsAction.getPlotAction().getPointPlotAction().getSizeAction().getCurrentDataset(), datasetsItem);
addMetaDataToHeadsUpDisplay("Opacity", _settingsAction.getPlotAction().getPointPlotAction().getOpacityAction().getCurrentDataset(), datasetsItem);

Expand Down
1 change: 1 addition & 0 deletions src/ScatterplotPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class ScatterplotPlugin : public ViewPlugin
ScatterplotWidget* _scatterPlotWidget; /** The visualization widget */
Dataset<Points> _positionDataset; /** Smart pointer to points dataset for point position */
Dataset<Points> _positionSourceDataset; /** Smart pointer to source of the points dataset for point position (if any) */
Dataset<DatasetImpl> _colorDataset; /** Smart pointer to dataset used for coloring (if any) */
std::vector<mv::Vector2f> _positions; /** Point positions */
unsigned int _numPoints; /** Number of point positions */
SettingsAction _settingsAction; /** Group action for all settings */
Expand Down
Loading