Commit 6d57558d authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

NEW generalizing point data loading to any type of mesh component

If a component inheriting from MeshComponent add data in the pointset
before calling initRepresentation, they will be present in the data
tab.
parent 7f72369b
......@@ -53,9 +53,6 @@ VtkMeshComponent::VtkMeshComponent (const QString& fileName) throw(AbortExcepti
// instanciate the Geometry
initRepresentation(data);
// initialize point data value (for demo or display)
initPointData();
}
// -------------------- destructor --------------------
......@@ -64,20 +61,6 @@ VtkMeshComponent::~VtkMeshComponent() {
setDataRepresentationOff();
}
// -------------------- initPointData --------------------
void VtkMeshComponent::initPointData() {
//-- add loaded data arrays
for(vtkIdType i = 0; i < myGeometry->getPointSet()->GetPointData()->GetNumberOfArrays(); i++) {
addPointData(myGeometry->getPointSet()->GetPointData()->GetArrayName(i) , myGeometry->getPointSet()->GetPointData()->GetArray(i));
}
for(vtkIdType i = 0; i < myGeometry->getPointSet()->GetCellData()->GetNumberOfArrays(); i++) {
addCellData(myGeometry->getPointSet()->GetCellData()->GetArrayName(i) , myGeometry->getPointSet()->GetCellData()->GetArray(i));
}
//-- no active data by default
setDataRepresentationOff();
}
//------------------------ getPixmap ---------------------
#include "vtklogo_20x20.xpm"
QPixmap* VtkMeshComponent::myPixmap = NULL;
......
......@@ -72,9 +72,6 @@ private:
/// the vtk logo
static QPixmap* myPixmap;
/// initialize the point data array
void initPointData();
// initialize the dynamic properties
virtual void initDynamicProperties();
......
......@@ -269,6 +269,16 @@ void MeshComponent::initSelection() {
// -------------------- initData --------------------
void MeshComponent::initData() {
//-- add loaded data arrays
for(vtkIdType i = 0; i < myGeometry->getPointSet()->GetPointData()->GetNumberOfArrays(); i++) {
addPointData(myGeometry->getPointSet()->GetPointData()->GetArrayName(i) , myGeometry->getPointSet()->GetPointData()->GetArray(i));
}
for(vtkIdType i = 0; i < myGeometry->getPointSet()->GetCellData()->GetNumberOfArrays(); i++) {
addCellData(myGeometry->getPointSet()->GetCellData()->GetArrayName(i) , myGeometry->getPointSet()->GetCellData()->GetArray(i));
}
//-- no active data by default
setDataRepresentationOff();
dataModel->refresh();
}
......
Supports Markdown
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