From 822f3263660bfd971d86808dff0d580b8c2924c9 Mon Sep 17 00:00:00 2001 From: Moritz Heinemann Date: Mon, 27 Jan 2020 20:25:17 +0100 Subject: [PATCH 1/5] init TableFlagFilter --- .../mmstd_datatools/src/mmstd_datatools.cpp | 2 + .../src/table/TableFlagFilter.cpp | 106 ++++++++++++++++++ .../src/table/TableFlagFilter.h | 62 ++++++++++ 3 files changed, 170 insertions(+) create mode 100644 plugins/mmstd_datatools/src/table/TableFlagFilter.cpp create mode 100644 plugins/mmstd_datatools/src/table/TableFlagFilter.h diff --git a/plugins/mmstd_datatools/src/mmstd_datatools.cpp b/plugins/mmstd_datatools/src/mmstd_datatools.cpp index c022219f96..854906e151 100644 --- a/plugins/mmstd_datatools/src/mmstd_datatools.cpp +++ b/plugins/mmstd_datatools/src/mmstd_datatools.cpp @@ -81,6 +81,7 @@ #include "table/MMFTDataWriter.h" #include "table/TableColumnFilter.h" #include "table/TableColumnScaler.h" +#include "table/TableFlagFilter.h" #include "table/TableJoin.h" #include "table/TableObserverPlane.h" #include "table/TableToLines.h" @@ -213,6 +214,7 @@ class plugin_instance : public megamol::core::utility::plugins::Plugin200Instanc this->module_descriptions.RegisterAutoDescription(); this->module_descriptions.RegisterAutoDescription(); this->module_descriptions.RegisterAutoDescription(); + this->module_descriptions.RegisterAutoDescription(); this->module_descriptions.RegisterAutoDescription(); this->module_descriptions.RegisterAutoDescription(); this->module_descriptions.RegisterAutoDescription(); diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp new file mode 100644 index 0000000000..4546573207 --- /dev/null +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp @@ -0,0 +1,106 @@ +/* + * TableFlagFilter.cpp + * + * Copyright (C) 2020 by VISUS (University of Stuttgart) + * Alle Rechte vorbehalten. + */ + +#include "stdafx.h" +#include "TableFlagFilter.h" + +#include "vislib/sys/Log.h" + +using namespace megamol::stdplugin::datatools; +using namespace megamol::stdplugin::datatools::table; +using namespace megamol; + +TableFlagFilter::TableFlagFilter() + : core::Module() + , tableInSlot("getDataIn", "Float table input") + , flagStorageInSlot("readFlagStorage", "Flag storage read input") + , tableOutSlot("getDataOut", "Float table output") { + + this->tableInSlot.SetCompatibleCall(); + this->MakeSlotAvailable(&this->tableInSlot); + + this->flagStorageInSlot.SetCompatibleCall(); + this->MakeSlotAvailable(&this->flagStorageInSlot); + + this->tableOutSlot.SetCallback(TableDataCall::ClassName(), + TableDataCall::FunctionName(0), + &TableFlagFilter::getData); + this->tableOutSlot.SetCallback(TableDataCall::ClassName(), + TableDataCall::FunctionName(1), + &TableFlagFilter::getHash); + this->MakeSlotAvailable(&this->tableOutSlot); +} + +TableFlagFilter::~TableFlagFilter() { + this->Release(); +} + +bool TableFlagFilter::create() { + return true; +} + +void TableFlagFilter::release() { +} + +bool TableFlagFilter::getData(core::Call &call) { + auto *tableOutCall = dynamic_cast(&call); + auto *tableInCall = this->tableInSlot.CallAs(); + auto *flagsInCall = this->flagStorageInSlot.CallAs(); + + if (tableOutCall == nullptr) { + return false; + } + + if (tableInCall == nullptr) { + vislib::sys::Log::DefaultLog.WriteMsg( + vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a table!"); + return false; + } + + if (flagsInCall == nullptr) { + vislib::sys::Log::DefaultLog.WriteMsg( + vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a flag storage!"); + return false; + } + + tableInCall->SetFrameID(tableOutCall->GetFrameID()); + (*tableInCall)(1); + tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); + tableOutCall->SetDataHash(tableInCall->DataHash()); + + return true; +} + +bool TableFlagFilter::getHash(core::Call &call) { + auto *tableOutCall = dynamic_cast(&call); + auto *tableInCall = this->tableInSlot.CallAs(); + auto *flagsInCall = this->flagStorageInSlot.CallAs(); + + if (tableOutCall == nullptr) { + return false; + } + + if (tableInCall == nullptr) { + vislib::sys::Log::DefaultLog.WriteMsg( + vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a table!"); + return false; + } + + if (flagsInCall == nullptr) { + vislib::sys::Log::DefaultLog.WriteMsg( + vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a flag storage!"); + return false; + } + + tableInCall->SetFrameID(tableOutCall->GetFrameID()); + (*tableInCall)(0); + tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); + tableOutCall->SetDataHash(tableInCall->DataHash()); + tableOutCall->Set(tableInCall->GetColumnsCount(), tableInCall->GetRowsCount(), tableInCall->GetColumnsInfos(), tableInCall->GetData()); + + return true; +} diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.h b/plugins/mmstd_datatools/src/table/TableFlagFilter.h new file mode 100644 index 0000000000..0f56dc81e8 --- /dev/null +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.h @@ -0,0 +1,62 @@ +/* + * TableFlagFilter.h + * + * Copyright (C) 2020 by VISUS (University of Stuttgart) + * Alle Rechte vorbehalten. + */ + +#ifndef MEGAMOL_DATATOOLS_FLOATTABLE_FLOATTABLEFLAGFILTER_H_INCLUDED +#define MEGAMOL_DATATOOLS_FLOATTABLE_FLOATTABLEFLAGFILTER_H_INCLUDED + +#include "mmcore/Module.h" +#include "mmcore/CalleeSlot.h" +#include "mmcore/CallerSlot.h" +#include "mmcore/FlagCall_GL.h" +#include "mmstd_datatools/table/TableDataCall.h" + +namespace megamol { +namespace stdplugin { +namespace datatools { +namespace table { + +/* + * Module to filter rows from a table based on a flag storage. + */ +class TableFlagFilter : public core::Module { +public: + /** Return module class name */ + static const char* ClassName() { return "TableFlagFilter"; } + + /** Return module class description */ + static const char* Description() { return "Filters rows from a table based on a flag storage."; } + + /** Module is always available */ + static bool IsAvailable() { return true; } + + /** Ctor */ + TableFlagFilter(); + + /** Dtor */ + ~TableFlagFilter() override; + +protected: + bool create() override; + + void release() override; + + bool getData(core::Call &call); + + bool getHash(core::Call &call); + +private: + core::CallerSlot tableInSlot; + core::CallerSlot flagStorageInSlot; + core::CalleeSlot tableOutSlot; +}; + +} /* end namespace table */ +} /* end namespace datatools */ +} /* end namespace stdplugin */ +} /* end namespace megamol */ + +#endif /* MEGAMOL_DATATOOLS_FLOATTABLE_FLOATTABLEFLAGFILTER_H_INCLUDED */ From 4863c5a476c2cb7526c2f44dc864f70d6ed9ddbe Mon Sep 17 00:00:00 2001 From: Moritz Heinemann Date: Mon, 27 Jan 2020 20:32:45 +0100 Subject: [PATCH 2/5] fix data/hash --- plugins/mmstd_datatools/src/table/TableFlagFilter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp index 4546573207..7dbe1ffc84 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp @@ -68,9 +68,10 @@ bool TableFlagFilter::getData(core::Call &call) { } tableInCall->SetFrameID(tableOutCall->GetFrameID()); - (*tableInCall)(1); + (*tableInCall)(0); tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); tableOutCall->SetDataHash(tableInCall->DataHash()); + tableOutCall->Set(tableInCall->GetColumnsCount(), tableInCall->GetRowsCount(), tableInCall->GetColumnsInfos(), tableInCall->GetData()); return true; } @@ -97,10 +98,9 @@ bool TableFlagFilter::getHash(core::Call &call) { } tableInCall->SetFrameID(tableOutCall->GetFrameID()); - (*tableInCall)(0); + (*tableInCall)(1); tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); tableOutCall->SetDataHash(tableInCall->DataHash()); - tableOutCall->Set(tableInCall->GetColumnsCount(), tableInCall->GetRowsCount(), tableInCall->GetColumnsInfos(), tableInCall->GetData()); return true; } From 33fe98e63d41e391cf3a4ef9fbe33db43f086236 Mon Sep 17 00:00:00 2001 From: Moritz Heinemann Date: Mon, 27 Jan 2020 21:03:19 +0100 Subject: [PATCH 3/5] copy table data --- .../src/table/TableFlagFilter.cpp | 57 ++++++++++++------- .../src/table/TableFlagFilter.h | 9 +++ 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp index 7dbe1ffc84..e4ac87e16e 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp @@ -18,7 +18,11 @@ TableFlagFilter::TableFlagFilter() : core::Module() , tableInSlot("getDataIn", "Float table input") , flagStorageInSlot("readFlagStorage", "Flag storage read input") - , tableOutSlot("getDataOut", "Float table output") { + , tableOutSlot("getDataOut", "Float table output") + , frameCount(0) + , dataHash(0) + , colCount(0) + , rowCount(0) { this->tableInSlot.SetCompatibleCall(); this->MakeSlotAvailable(&this->tableInSlot); @@ -47,36 +51,31 @@ void TableFlagFilter::release() { } bool TableFlagFilter::getData(core::Call &call) { - auto *tableOutCall = dynamic_cast(&call); - auto *tableInCall = this->tableInSlot.CallAs(); - auto *flagsInCall = this->flagStorageInSlot.CallAs(); - - if (tableOutCall == nullptr) { + if (!this->handleCall(call)) { return false; } - if (tableInCall == nullptr) { - vislib::sys::Log::DefaultLog.WriteMsg( - vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a table!"); - return false; - } + auto *tableOutCall = dynamic_cast(&call); + tableOutCall->SetFrameCount(this->frameCount); + tableOutCall->SetDataHash(this->dataHash); + tableOutCall->Set(this->colCount, this->rowCount, this->colInfos.data(), this->data.data()); - if (flagsInCall == nullptr) { - vislib::sys::Log::DefaultLog.WriteMsg( - vislib::sys::Log::LEVEL_ERROR, "TableFlagFilter requires a flag storage!"); + return true; +} + +bool TableFlagFilter::getHash(core::Call &call) { + if (!this->handleCall(call)) { return false; } - tableInCall->SetFrameID(tableOutCall->GetFrameID()); - (*tableInCall)(0); - tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); - tableOutCall->SetDataHash(tableInCall->DataHash()); - tableOutCall->Set(tableInCall->GetColumnsCount(), tableInCall->GetRowsCount(), tableInCall->GetColumnsInfos(), tableInCall->GetData()); + auto *tableOutCall = dynamic_cast(&call); + tableOutCall->SetFrameCount(this->frameCount); + tableOutCall->SetDataHash(this->dataHash); return true; } -bool TableFlagFilter::getHash(core::Call &call) { +bool TableFlagFilter::handleCall(core::Call &call) { auto *tableOutCall = dynamic_cast(&call); auto *tableInCall = this->tableInSlot.CallAs(); auto *flagsInCall = this->flagStorageInSlot.CallAs(); @@ -99,8 +98,22 @@ bool TableFlagFilter::getHash(core::Call &call) { tableInCall->SetFrameID(tableOutCall->GetFrameID()); (*tableInCall)(1); - tableOutCall->SetFrameCount(tableInCall->GetFrameCount()); - tableOutCall->SetDataHash(tableInCall->DataHash()); + (*tableInCall)(0); + + if (this->frameCount != tableInCall->GetFrameCount() || this->dataHash != tableInCall->DataHash()) { + vislib::sys::Log::DefaultLog.WriteMsg(vislib::sys::Log::LEVEL_INFO, "TableFlagFilter: Filter table."); + this->frameCount = tableInCall->GetFrameCount(); + this->dataHash = tableInCall->DataHash(); + this->colCount = tableInCall->GetColumnsCount(); + this->rowCount = tableInCall->GetRowsCount(); + this->colInfos.resize(this->colCount); + for (size_t i = 0; i < this->colCount; ++i) { + this->colInfos[i] = tableInCall->GetColumnsInfos()[i]; + } + tableInCall->GetColumnsInfos(); + this->data.resize(this->colCount * this->rowCount); + std::memcpy(this->data.data(), tableInCall->GetData(), this->colCount * this->rowCount * sizeof(float)); + } return true; } diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.h b/plugins/mmstd_datatools/src/table/TableFlagFilter.h index 0f56dc81e8..3bd12e24f8 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.h +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.h @@ -48,10 +48,19 @@ class TableFlagFilter : public core::Module { bool getHash(core::Call &call); + bool handleCall(core::Call &call); + private: core::CallerSlot tableInSlot; core::CallerSlot flagStorageInSlot; core::CalleeSlot tableOutSlot; + + unsigned int frameCount; + size_t dataHash; + size_t colCount; + size_t rowCount; + std::vector colInfos; + std::vector data; }; } /* end namespace table */ From 683b3599e6027a50d02927a990ee15aa1cf2784f Mon Sep 17 00:00:00 2001 From: Moritz Heinemann Date: Tue, 28 Jan 2020 11:41:19 +0100 Subject: [PATCH 4/5] filter table with flags --- .../src/table/TableFlagFilter.cpp | 72 +++++++++++++++---- .../src/table/TableFlagFilter.h | 8 ++- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp index e4ac87e16e..26852ae688 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp @@ -19,9 +19,10 @@ TableFlagFilter::TableFlagFilter() , tableInSlot("getDataIn", "Float table input") , flagStorageInSlot("readFlagStorage", "Flag storage read input") , tableOutSlot("getDataOut", "Float table output") - , frameCount(0) + , tableInFrameCount(0) + , tableInDataHash(0) + , tableInColCount(0) , dataHash(0) - , colCount(0) , rowCount(0) { this->tableInSlot.SetCompatibleCall(); @@ -56,9 +57,9 @@ bool TableFlagFilter::getData(core::Call &call) { } auto *tableOutCall = dynamic_cast(&call); - tableOutCall->SetFrameCount(this->frameCount); + tableOutCall->SetFrameCount(this->tableInFrameCount); tableOutCall->SetDataHash(this->dataHash); - tableOutCall->Set(this->colCount, this->rowCount, this->colInfos.data(), this->data.data()); + tableOutCall->Set(this->tableInColCount, this->rowCount, this->colInfos.data(), this->data.data()); return true; } @@ -69,7 +70,7 @@ bool TableFlagFilter::getHash(core::Call &call) { } auto *tableOutCall = dynamic_cast(&call); - tableOutCall->SetFrameCount(this->frameCount); + tableOutCall->SetFrameCount(this->tableInFrameCount); tableOutCall->SetDataHash(this->dataHash); return true; @@ -99,20 +100,61 @@ bool TableFlagFilter::handleCall(core::Call &call) { tableInCall->SetFrameID(tableOutCall->GetFrameID()); (*tableInCall)(1); (*tableInCall)(0); + (*flagsInCall)(core::FlagCallRead_GL::CallGetData); - if (this->frameCount != tableInCall->GetFrameCount() || this->dataHash != tableInCall->DataHash()) { + if (this->tableInFrameCount != tableInCall->GetFrameCount() || this->tableInDataHash != tableInCall->DataHash() || flagsInCall->hasUpdate()) { vislib::sys::Log::DefaultLog.WriteMsg(vislib::sys::Log::LEVEL_INFO, "TableFlagFilter: Filter table."); - this->frameCount = tableInCall->GetFrameCount(); - this->dataHash = tableInCall->DataHash(); - this->colCount = tableInCall->GetColumnsCount(); - this->rowCount = tableInCall->GetRowsCount(); - this->colInfos.resize(this->colCount); - for (size_t i = 0; i < this->colCount; ++i) { + + this->dataHash++; + + this->tableInFrameCount = tableInCall->GetFrameCount(); + this->tableInDataHash = tableInCall->DataHash(); + this->tableInColCount = tableInCall->GetColumnsCount(); + size_t tableInRowCount = tableInCall->GetRowsCount(); + + // download flags + flagsInCall->getData()->validateFlagCount(tableInRowCount); + auto flags = flagsInCall->getData()->flags; + uint32_t *flagsData = new uint32_t[flags->getByteSize() / sizeof(uint32_t)]; + flags->bind(); + glGetBufferSubData(flags->getTarget(), 0, flags->getByteSize(), flagsData); + + // copy column infos + this->colInfos.resize(this->tableInColCount); + for (size_t i = 0; i < this->tableInColCount; ++i) { this->colInfos[i] = tableInCall->GetColumnsInfos()[i]; + this->colInfos[i].SetMinimumValue(std::numeric_limits::max()); + this->colInfos[i].SetMaximumValue(std::numeric_limits::lowest()); } - tableInCall->GetColumnsInfos(); - this->data.resize(this->colCount * this->rowCount); - std::memcpy(this->data.data(), tableInCall->GetData(), this->colCount * this->rowCount * sizeof(float)); + + static const core::FlagStorage::FlagItemType filteredTestMask = core::FlagStorage::ENABLED | core::FlagStorage::FILTERED; + static const core::FlagStorage::FlagItemType filteredPassMask = core::FlagStorage::ENABLED; + + // Resize data to size of input table. With this we only need to allocate memory once. + this->data.resize(this->tableInColCount * tableInRowCount); + this->rowCount = 0; + + const float *tableInData = tableInCall->GetData(); + for (size_t r = 0; r < tableInRowCount; ++r) { + if ((flagsData[r] & filteredTestMask) == filteredPassMask) { + for (size_t c = 0; c < this->tableInColCount; ++c) { + float val = tableInData[this->tableInColCount * r + c]; + this->data[this->tableInColCount * this->rowCount + c] = val; + if (val < this->colInfos[c].MinimumValue()) { + this->colInfos[c].SetMinimumValue(val); + } + if (val > this->colInfos[c].MaximumValue()) { + this->colInfos[c].SetMaximumValue(val); + } + } + this->rowCount++; + } + } + + // delete memory of filtered rows + this->data.resize(this->tableInColCount * this->rowCount); + + delete[] flagsData; } return true; diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.h b/plugins/mmstd_datatools/src/table/TableFlagFilter.h index 3bd12e24f8..1f0b9f8285 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.h +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.h @@ -55,9 +55,13 @@ class TableFlagFilter : public core::Module { core::CallerSlot flagStorageInSlot; core::CalleeSlot tableOutSlot; - unsigned int frameCount; + // input table properties + unsigned int tableInFrameCount; + size_t tableInDataHash; + size_t tableInColCount; + + // filtered table size_t dataHash; - size_t colCount; size_t rowCount; std::vector colInfos; std::vector data; From da1cca842fb727e855c53339bbd3e028e61b586c Mon Sep 17 00:00:00 2001 From: Moritz Heinemann Date: Tue, 28 Jan 2020 12:05:36 +0100 Subject: [PATCH 5/5] add filter mode param --- .../src/table/TableFlagFilter.cpp | 26 ++++++++++++++++--- .../src/table/TableFlagFilter.h | 8 ++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp index 26852ae688..954dc9439c 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.cpp @@ -8,6 +8,7 @@ #include "stdafx.h" #include "TableFlagFilter.h" +#include "mmcore/param/EnumParam.h" #include "vislib/sys/Log.h" using namespace megamol::stdplugin::datatools; @@ -19,6 +20,7 @@ TableFlagFilter::TableFlagFilter() , tableInSlot("getDataIn", "Float table input") , flagStorageInSlot("readFlagStorage", "Flag storage read input") , tableOutSlot("getDataOut", "Float table output") + , filterModeParam("filterMode", "filter mode") , tableInFrameCount(0) , tableInDataHash(0) , tableInColCount(0) @@ -38,6 +40,12 @@ TableFlagFilter::TableFlagFilter() TableDataCall::FunctionName(1), &TableFlagFilter::getHash); this->MakeSlotAvailable(&this->tableOutSlot); + + auto* fmp = new core::param::EnumParam(FilterMode::FILTERED); + fmp->SetTypePair(FilterMode::FILTERED, "Filtered"); + fmp->SetTypePair(FilterMode::SELECTED, "Selected"); + this->filterModeParam << fmp; + this->MakeSlotAvailable(&this->filterModeParam); } TableFlagFilter::~TableFlagFilter() { @@ -127,8 +135,12 @@ bool TableFlagFilter::handleCall(core::Call &call) { this->colInfos[i].SetMaximumValue(std::numeric_limits::lowest()); } - static const core::FlagStorage::FlagItemType filteredTestMask = core::FlagStorage::ENABLED | core::FlagStorage::FILTERED; - static const core::FlagStorage::FlagItemType filteredPassMask = core::FlagStorage::ENABLED; + core::FlagStorage::FlagItemType testMask = core::FlagStorage::ENABLED | core::FlagStorage::FILTERED; + core::FlagStorage::FlagItemType passMask = core::FlagStorage::ENABLED;; + if (static_cast(this->filterModeParam.Param()->Value()) == FilterMode::SELECTED) { + testMask = core::FlagStorage::ENABLED | core::FlagStorage::SELECTED | core::FlagStorage::FILTERED; + passMask = core::FlagStorage::ENABLED | core::FlagStorage::SELECTED; + } // Resize data to size of input table. With this we only need to allocate memory once. this->data.resize(this->tableInColCount * tableInRowCount); @@ -136,7 +148,7 @@ bool TableFlagFilter::handleCall(core::Call &call) { const float *tableInData = tableInCall->GetData(); for (size_t r = 0; r < tableInRowCount; ++r) { - if ((flagsData[r] & filteredTestMask) == filteredPassMask) { + if ((flagsData[r] & testMask) == passMask) { for (size_t c = 0; c < this->tableInColCount; ++c) { float val = tableInData[this->tableInColCount * r + c]; this->data[this->tableInColCount * this->rowCount + c] = val; @@ -155,6 +167,14 @@ bool TableFlagFilter::handleCall(core::Call &call) { this->data.resize(this->tableInColCount * this->rowCount); delete[] flagsData; + + // nicer output + if (this->rowCount == 0) { + for (size_t i = 0; i < this->tableInColCount; ++i) { + this->colInfos[i].SetMinimumValue(0.0); + this->colInfos[i].SetMaximumValue(0.0); + } + } } return true; diff --git a/plugins/mmstd_datatools/src/table/TableFlagFilter.h b/plugins/mmstd_datatools/src/table/TableFlagFilter.h index 1f0b9f8285..2639bc8e68 100644 --- a/plugins/mmstd_datatools/src/table/TableFlagFilter.h +++ b/plugins/mmstd_datatools/src/table/TableFlagFilter.h @@ -12,6 +12,7 @@ #include "mmcore/CalleeSlot.h" #include "mmcore/CallerSlot.h" #include "mmcore/FlagCall_GL.h" +#include "mmcore/param/ParamSlot.h" #include "mmstd_datatools/table/TableDataCall.h" namespace megamol { @@ -51,10 +52,17 @@ class TableFlagFilter : public core::Module { bool handleCall(core::Call &call); private: + enum FilterMode { + FILTERED = 0, + SELECTED = 1 + }; + core::CallerSlot tableInSlot; core::CallerSlot flagStorageInSlot; core::CalleeSlot tableOutSlot; + core::param::ParamSlot filterModeParam; + // input table properties unsigned int tableInFrameCount; size_t tableInDataHash;