Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adhere to new Core API #15

Merged
merged 1 commit into from
Jan 15, 2024
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
4 changes: 3 additions & 1 deletion ExampleAnalysis/src/ExampleAnalysisPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "PointData/PointData.h"

#include <event/Event.h>

#include <QtCore>
#include <QDebug>

Expand Down Expand Up @@ -33,7 +35,7 @@ ExampleAnalysisPlugin::ExampleAnalysisPlugin(const PluginFactory* factory) :
void ExampleAnalysisPlugin::init()
{
// Create example output dataset (a points dataset which is derived from the input points dataset) and set the output dataset
setOutputDataset(_core->createDerivedDataset("Output Data", getInputDataset(), getInputDataset()));
setOutputDataset(mv::data().createDerivedDataset("Output Data", getInputDataset(), getInputDataset()));

// Retrieve the input dataset for our specific data type (in our case points)
// The HDPS core sets the input dataset reference when the plugin is created
Expand Down
18 changes: 9 additions & 9 deletions ExampleData/src/ExampleDataPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ExampleDataPlugin::init()
*/
Dataset<DatasetImpl> ExampleDataPlugin::createDataSet(const QString& guid /*= ""*/) const
{
return new PixelSet(_core, getName(), guid);
return new PixelSet(getName(), guid);
}

std::vector<QColor>& ExampleDataPlugin::getData()
Expand All @@ -44,8 +44,8 @@ void ExampleDataPlugin::setData(QImage image) {
}
}

PixelSet::PixelSet(CoreInterface* core, QString dataName, const QString& guid /*= ""*/) :
DatasetImpl(core, dataName, guid)
PixelSet::PixelSet(QString dataName, const QString& guid /*= ""*/) :
DatasetImpl(dataName, true, guid)
{
}

Expand All @@ -55,12 +55,12 @@ PixelSet::~PixelSet()

Dataset<DatasetImpl> PixelSet::createSubsetFromSelection(const QString& guiName, const Dataset<DatasetImpl>& parentDataSet /*= Dataset<DatasetImpl>()*/, const bool& visible /*= true*/) const
{
return _core->createSubsetFromSelection(getSelection<PixelSet>(), const_cast<PixelSet*>(this), guiName, parentDataSet, visible);
return mv::data().createSubsetFromSelection(getSelection<PixelSet>(), const_cast<PixelSet*>(this), guiName, parentDataSet, visible);
}

Dataset<DatasetImpl> PixelSet::copy() const
{
auto copySet = new PixelSet(_core, getRawDataName());
auto copySet = new PixelSet(getRawDataName());

copySet->_indices = _indices;

Expand All @@ -84,12 +84,12 @@ void PixelSet::setSelectionIndices(const std::vector<std::uint32_t>& indices)

bool PixelSet::canSelect() const
{
return getRawData<ExampleDataPlugin>().getData().size() >= 1;
return getRawData<ExampleDataPlugin>()->getData().size() >= 1;
}

bool PixelSet::canSelectAll() const
{
return canSelect() && (getSelectionSize() < getRawData<ExampleDataPlugin>().getData().size());
return canSelect() && (getSelectionSize() < getRawData<ExampleDataPlugin>()->getData().size());
}

bool PixelSet::canSelectNone() const
Expand All @@ -109,7 +109,7 @@ void PixelSet::selectAll()

// Clear and resize
selectionIndices.clear();
selectionIndices.resize(getRawData<ExampleDataPlugin>().getData().size());
selectionIndices.resize(getRawData<ExampleDataPlugin>()->getData().size());

// Generate cluster selection indices
std::iota(selectionIndices.begin(), selectionIndices.end(), 0);
Expand All @@ -136,7 +136,7 @@ void PixelSet::selectInvert()
std::set<std::uint32_t> selectionSet(selectionIndices.begin(), selectionIndices.end());

// Get number of items
const auto numberOfItems = getRawData<ExampleDataPlugin>().getData().size();
const auto numberOfItems = getRawData<ExampleDataPlugin>()->getData().size();

// Clear and resize
selectionIndices.clear();
Expand Down
2 changes: 1 addition & 1 deletion ExampleData/src/ExampleDataPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ExampleDataPlugin : public RawData
class PixelSet : public mv::DatasetImpl
{
public:
PixelSet(mv::CoreInterface* core, QString dataName, const QString& guid = "");
PixelSet(QString dataName, const QString& guid = "");
~PixelSet() override;

/**
Expand Down
2 changes: 1 addition & 1 deletion ExampleLoader/src/ExampleLoaderPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ExampleLoaderPlugin::init()
void ExampleLoaderPlugin::loadData()
{
_dataSetName = "ExampleData";
auto points = _core->addDataset<Points>("Points", _dataSetName);
auto points = mv::data().createDataset<Points>("Points", _dataSetName);

// Create 2D example data by randomly generating 1000 points
std::default_random_engine generator;
Expand Down
3 changes: 1 addition & 2 deletions ExampleTransformation/src/ExampleTransformationPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ void ExampleTransformationPlugin::transform()
// Create new data set
case ExampleTransformationPlugin::Type::Pow2:
{
auto derivedData = _core->createDerivedDataset<Points>(points->getGuiName() + "(Pow2)", points);
events().notifyDatasetAdded(derivedData);
auto derivedData = mv::data().createDerivedDataset<Points>(points->getGuiName() + "(Pow2)", points);

std::vector<float> transformedData;
transformedData.resize(points->getNumPoints() * points->getNumDimensions());
Expand Down
2 changes: 1 addition & 1 deletion ExampleView/src/ExampleViewPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void ExampleViewPlugin::init()
else {

// Get points dataset from the core
auto candidateDataset = _core->requestDataset<Points>(datasetId);
auto candidateDataset = mv::data().getDataset<Points>(datasetId);

// Accept points datasets drag and drop
if (dataType == PointType) {
Expand Down
5 changes: 2 additions & 3 deletions ExampleViewJS/src/ExampleViewJSPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void ExampleViewJSPlugin::init()
dropRegions << new DropWidget::DropRegion(this, "Warning", "Data already loaded", "exclamation-circle", false);
}
else {
auto candidateDataset = _core->requestDataset<Points>(datasetId);
auto candidateDataset = mv::data().getDataset<Points>(datasetId);

dropRegions << new DropWidget::DropRegion(this, "Points", QString("Visualize %1 as parallel coordinates").arg(datasetGuiName), "map-marker-alt", true, [this, candidateDataset]() {
loadData({ candidateDataset });
Expand Down Expand Up @@ -189,8 +189,7 @@ void ExampleViewJSPlugin::createData()
{
// Here, we create a random data set, so that we do not need
// to use other plugins for loading when trying out this example
auto points = _core->addDataset<Points>("Points", "ExampleViewJSData");
events().notifyDatasetAdded(points);
auto points = mv::data().createDataset<Points>("Points", "ExampleViewJSData");

int numPoints = 2;
int numDimensions = 5;
Expand Down
5 changes: 2 additions & 3 deletions ExampleViewOpenGL/src/ExampleViewGLPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ExampleViewGLPlugin::ExampleViewGLPlugin(const PluginFactory* factory) :
dropRegions << new DropWidget::DropRegion(this, "Warning", "Data already loaded", "exclamation-circle", false);
}
else {
auto candidateDataset = _core->requestDataset<Points>(datasetId);
auto candidateDataset = mv::data().getDataset<Points>(datasetId);

dropRegions << new DropWidget::DropRegion(this, "Points", QString("Visualize %1 as parallel coordinates").arg(datasetGuiName), "map-marker-alt", true, [this, candidateDataset]() {
loadData({ candidateDataset });
Expand Down Expand Up @@ -188,8 +188,7 @@ void ExampleViewGLPlugin::createData()
{
// Here, we create a random data set, so that we do not need
// to use other plugins for loading when trying out this example
auto points = _core->addDataset<Points>("Points", "ExampleViewGLData");
events().notifyDatasetAdded(points);
auto points = mv::data().createDataset<Points>("Points", "ExampleViewGLData");

int numPoints = 50;
int numDimensions = 3;
Expand Down
Loading