#include "VISU_ScalarMapPL.hxx"
#include "VISU_DataSetMapperHolder.hxx"
+#include "VISU_FieldTransform.hxx"
+
+#include "VISU_AppendFilter.hxx"
+#include "VISU_MergeFilter.hxx"
+
+#include <vtkDataSet.h>
+#include <vtkUnstructuredGrid.h>
#include <vtkDataSetMapper.h>
#include <vtkObjectFactory.h>
//----------------------------------------------------------------------------
VISU_ScalarMapPL
::VISU_ScalarMapPL():
- VISU_UnstructuredGridPL(this)
-{}
+ VISU_UnstructuredGridPL(this),
+ myAppendFilter(VISU_AppendFilter::New()),
+ myMergeFilter(VISU_MergeFilter::New())
+{
+ myAppendFilter->SetMergingInputs(true);
+ myAppendFilter->Delete();
+
+ myMergeFilter->SetMergingInputs(true);
+ myMergeFilter->Delete();
+}
//----------------------------------------------------------------------------
}
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::AddGeometry(vtkDataSet* theGeometry)
+{
+ myAppendFilter->AddInput(theGeometry);
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
+::GetNumberOfGeometry()
+{
+ return myAppendFilter->GetNumberOfInputConnections(0);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::ClearGeometry()
+{
+ myAppendFilter->RemoveAllInputs();
+}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_ScalarMapPL
+::InsertCustomPL()
+{
+ vtkDataSet* aDataSet = Superclass::InsertCustomPL();
+ myMergeFilter->SetGeometry(myAppendFilter->GetOutput());
+ myAppendFilter->SetSharedPointSet(GetFieldTransformFilter()->GetUnstructuredGridOutput());
+
+ myMergeFilter->SetScalars(aDataSet);
+ myMergeFilter->SetVectors(aDataSet);
+
+ myMergeFilter->RemoveFields();
+ myMergeFilter->AddField("VISU_FIELD", aDataSet);
+ myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
+ myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
+
+ return myMergeFilter->GetOutput();
+}
+
+
//----------------------------------------------------------------------------
#include "VISU_UnstructuredGridPL.hxx"
class VISU_DataSetMapperHolder;
+class VISU_AppendFilter;
+class VISU_MergeFilter;
//----------------------------------------------------------------------------
VISU_ScalarMapPL*
New();
+ virtual
+ void
+ AddGeometry(vtkDataSet* theGeometry);
+
+ virtual
+ int
+ GetNumberOfGeometry();
+
+ virtual
+ void
+ ClearGeometry();
+
protected:
//----------------------------------------------------------------------------
VISU_ScalarMapPL();
void
OnCreateMapperHolder();
+ virtual
+ vtkDataSet*
+ InsertCustomPL();
+
virtual
void
Build();
+
+private:
+ vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
+ vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
};
#endif