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
29 changes: 26 additions & 3 deletions src/ColoringAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,33 @@ ColoringAction::ColoringAction(QObject* parent, const QString& title) :

const auto currentColorDataset = getCurrentColorDataset();

if (currentColorDataset.isValid()) {
const auto currentColorDatasetTypeIsPointType = currentColorDataset->getDataType() == PointType;
if (_currentColorPointsDataset.isValid()) {
disconnect(&_currentColorPointsDataset, &Dataset<Points>::dataDimensionsChanged, this, nullptr);
}

_dimensionAction.setPointsDataset(currentColorDatasetTypeIsPointType ? Dataset<Points>(currentColorDataset) : Dataset<Points>());
_currentColorPointsDataset = Dataset<Points>();

if (currentColorDataset.isValid()) {
if (currentColorDataset->getDataType() == PointType) {
_currentColorPointsDataset = currentColorDataset.get<Points>();

if (_currentColorPointsDataset.isValid()) {
connect(&_currentColorPointsDataset, &Dataset<Points>::dataDimensionsChanged, this, [this]() {
if (_currentColorPointsDataset.isValid()) {
_dimensionAction.setPointsDataset(_currentColorPointsDataset);
updateScatterPlotWidgetColors();
}
});

_dimensionAction.setPointsDataset(_currentColorPointsDataset);
}
else {
_dimensionAction.setPointsDataset(Dataset<Points>());
}
}
else {
_dimensionAction.setPointsDataset(Dataset<Points>());
}
//_dimensionAction.setVisible(currentColorDatasetTypeIsPointType);

emit currentColorDatasetChanged(currentColorDataset);
Expand Down
15 changes: 8 additions & 7 deletions src/ColoringAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ class ColoringAction : public VerticalGroupAction
void currentColorDatasetChanged(Dataset<DatasetImpl> currentColorDataset);

private:
ScatterplotPlugin* _scatterplotPlugin; /** Pointer to scatter plot plugin */
ColorSourceModel _colorByModel; /** Color by model (model input for the color by action) */
OptionAction _colorByAction; /** Action for picking the coloring type */
ColorAction _constantColorAction; /** Action for picking the constant color */
DimensionPickerAction _dimensionAction; /** Dimension picker action */
ColorMap1DAction _colorMap1DAction; /** One-dimensional color map action */
ColorMap2DAction _colorMap2DAction; /** Two-dimensional color map action */
ScatterplotPlugin* _scatterplotPlugin; /** Pointer to scatter plot plugin */
ColorSourceModel _colorByModel; /** Color by model (model input for the color by action) */
OptionAction _colorByAction; /** Action for picking the coloring type */
ColorAction _constantColorAction; /** Action for picking the constant color */
DimensionPickerAction _dimensionAction; /** Dimension picker action */
ColorMap1DAction _colorMap1DAction; /** One-dimensional color map action */
ColorMap2DAction _colorMap2DAction; /** Two-dimensional color map action */
Dataset<Points> _currentColorPointsDataset; /** Current color dataset */

/** Default constant color */
static const QColor DEFAULT_CONSTANT_COLOR;
Expand Down