Commit 7d9c4d9d authored by ghweber's avatar ghweber
Browse files

Add infrastructure for adding filter after expression evaluator.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@1057 18c085ea-50e0-402c-830e-de6fd14e8384
parent b627a708
......@@ -55,6 +55,7 @@
#include <avtLegend.h>
#include <avtMapper.h>
#include <avtBehavior.h>
#include <avtDatasetToDatasetFilter.h>
#include <vector>
#include <enumtypes.h>
......@@ -221,6 +222,9 @@ class WindowAttributes;
// Added bool return to SetScaleMode. Added virtual method
// CanDoCurveViewScaling.
//
// Gunther H. Weber, Thu Apr 12 10:48:17 PDT 2007
// Added GetFilterForTopOfPipeline()
//
// Kathleen Bonnell, Wed May 9 16:58:50 PDT 2007
// Added WindowMode arg to SetScaleMode. Added virtual method
// CanDo2DViewScaling.
......@@ -296,6 +300,8 @@ class PLOTTER_API avtPlot
virtual bool CanDoCurveViewScaling(void) { return false; }
virtual bool CanDo2DViewScaling(void) { return true; }
virtual avtFilter *GetFilterForTopOfPipeline() { return 0; }
protected:
bool needsRecalculation;
int index;
......
......@@ -118,6 +118,47 @@ DataNetwork::~DataNetwork(void)
}
}
// ****************************************************************************
// Method: DataNetwork::AddFilterNodeAfterExpressionEvaluator()
//
// Purpose: Add a filter at the beginning of the pipeline (after expression
// evaluator.
//
// Programmer: Gunther H. Weber
// Creation: Apr 12, 2007
//
// ****************************************************************************
void DataNetwork::AddFilterNodeAfterExpressionEvaluator(NetnodeFilter *f)
{
std::vector<Netnode*>::iterator it = ++nodeList.begin();
if (it != nodeList.end())
{
// There is another Netnode ...
NetnodeFilter *f2 = dynamic_cast<NetnodeFilter*>(*it);
if (f2)
{
// ... and it is a filter
// -> Insert out filter and connect inputs and outputs
f->GetInputNodes() = f2->GetInputNodes();
f2->GetInputNodes().clear();
f2->GetInputNodes().push_back(f);
nodeList.insert(it, f);
}
else
{
// ... it is not a filter
debug1 << "DataNetwork::AddFilterNodeAfterExpressionEvaluator(NetnodeFilter *f): Subsequent Netnode is not a filter!" << endl;
}
}
else
{
// There is no other filter
// -> Add our filter as last Netnode and conncect inputs
f->GetInputNodes().push_back(*nodeList.begin());
nodeList.push_back(f);
}
}
// ****************************************************************************
// Method: DataNetwork::GetWriter
//
......
......@@ -100,6 +100,10 @@
// Brad Whitlock, Wed Mar 21 23:02:05 PST 2007
// Added plotName.
//
// Gunther H. Weber, Thu Apr 12 11:02:44 PDT 2007
// Added AddFilterNodeAfterExpressionEveluator that adds node directly
// after expression evaluator
//
// ****************************************************************************
class DataNetwork
{
......@@ -114,6 +118,7 @@ public:
virtual void SetPlot(avtPlot *_plot) { plot = _plot; };
void SetTerminalNode(Netnode* t) {terminalNode = t;};
void AddNode(Netnode *n) { nodeList.push_back(n); };
void AddFilterNodeAfterExpressionEvaluator(NetnodeFilter *f);
void SetPipelineSpec(avtPipelineSpecification_p s) {pspec = s;};
avtDataObject_p GetOutput(void) { return terminalNode->GetOutput(); };
void SetDataSpec(avtDataSpecification_p s) {dspec = s;};
......
......@@ -1039,6 +1039,9 @@ NetworkManager::AddFilter(const string &filtertype,
// Brad Whitlock, Wed Mar 21 23:00:00 PST 2007
// Added plotName.
//
// Gunther H. Weber, Thu Apr 12 10:52:36 PDT 2007
// Add filter to beginning of pipeline if necessary
//
// ****************************************************************************
void
NetworkManager::MakePlot(const string &plotName, const string &pluginID,
......@@ -1067,11 +1070,35 @@ NetworkManager::MakePlot(const string &plotName, const string &pluginID,
avtPlot *p = PlotPluginManager::Instance()->
GetEnginePluginInfo(pluginID)->AllocAvtPlot();
// Check, whether plot wants to place a filter at the beginning of
// the pipeline
if (avtFilter *f = p->GetFilterForTopOfPipeline()) {
debug5 << "NetworkManager::MakePlot(): Inserting filter on top of pipeline." << std::endl;
NetnodeFilter *filt = new NetnodeFilter(f, "InsertedPlotFilter");
//f->GetOutput()->SetTransientStatus(true);
if (workingNet->GetNodeList().size() > 1)
workingNet->AddFilterNodeAfterExpressionEvaluator(filt);
else
{
std::vector<Netnode*> &filtInputs = filt->GetInputNodes();
Netnode *n = workingNetnodeList.back();
workingNetnodeList.pop_back();
filtInputs.push_back(n);
// Push the filter onto the working list.
workingNetnodeList.push_back(filt);
workingNet->AddNode(filt);
}
debug5 << "NetworkManager::MakePlot(): Added filter after expression evaluator." << std::endl;
}
p->SetDataExtents(dataExtents);
workingNet->SetPlot(p);
workingNet->GetPlot()->SetAtts(atts);
workingNet->SetPlottype(pluginID);
workingNet->SetPlotName(plotName);
debug5 << "NetworkManager::MakePlot(): Leaving NetworkManager::MakePlot()." << std::endl;
}
// ****************************************************************************
......@@ -1092,6 +1119,9 @@ NetworkManager::MakePlot(const string &plotName, const string &pluginID,
// Mark C. Miller, Tue Jan 4 10:23:19 PST 2005
// Added code to set network's window ID and manage multiple VisWindow
// objects
//
// Gunther H. Weber, Thu Apr 12 11:00:57 PDT 2007
// Added missing space to debug message
// ****************************************************************************
int
NetworkManager::EndNetwork(int windowID)
......@@ -1100,7 +1130,7 @@ NetworkManager::EndNetwork(int windowID)
if (workingNetnodeList.size() != 1)
{
debug1 << "Network building still in progress. Filter required to "
<< "absorb" << workingNetnodeList.size() << " nodes." << endl;
<< "absorb " << workingNetnodeList.size() << " nodes." << endl;
EXCEPTION0(ImproperUseException);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment