Commit 7fce3327 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED simplify API name + add cell data example

parent 6acf681a
# vtk DataFile Version 1.0
Cube example
ASCII
DATASET POLYDATA
POINTS 8 float
0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 1.0
0.0 1.0 1.0
POLYGONS 6 30
4 0 1 2 3
4 4 5 6 7
4 0 1 5 4
4 2 3 7 6
4 0 4 7 3
4 1 2 6 5
CELL_DATA 6
SCALARS cell_scalars int
LOOKUP_TABLE default
0
1
2
3
4
5
NORMALS cell_normals float
0 0 -1
0 0 1
0 -1 0
0 1 0
-1 0 0
1 0 0
POINT_DATA 8
SCALARS my_scalars float
LOOKUP_TABLE custom_table
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
LOOKUP_TABLE custom_table 8
0.0 0.0 0.0 1.0
1.0 0.0 0.0 1.0
0.0 1.0 0.0 1.0
1.0 1.0 0.0 1.0
0.0 0.0 1.0 1.0
1.0 0.0 1.0 1.0
0.0 1.0 1.0 1.0
1.0 1.0 1.0 1.0
......@@ -560,7 +560,7 @@ int MeshComponent::getNumberOfDataArray(int fieldFlag) {
}
// -------------------- createDataRepresentation --------------------
void MeshComponent::createDataRepresentation(FieldType field, const QString& name, RepresentationOf3DData representation) {
void MeshComponent::createDataRepresentation(FieldType field, const QString& name, SpecificRepresentation representation) {
vtkSmartPointer<vtkDataArray> dataArray = getDataArray(field, name);
if (dataArray != nullptr) {
......@@ -599,7 +599,7 @@ void MeshComponent::createDataRepresentation(FieldType field, const QString& nam
break;
default: {
// create 1D representation
QString specificName(name + getRepresentationOf3DDataName(representation));
QString specificName(name + getSpecificRepresentationName(representation));
vtkSmartPointer<vtkDoubleArray> dataArrayToDisplay = vtkSmartPointer<vtkDoubleArray>::New();
dataArrayToDisplay->SetName(specificName.toUtf8().constData());
......@@ -719,7 +719,7 @@ void MeshComponent::createDataRepresentation(FieldType field, const QString& nam
}
// -------------------- getDataRepresentationVisibility --------------------
bool MeshComponent::getDataRepresentationVisibility(FieldType field, const QString& name, RepresentationOf3DData representation) {
bool MeshComponent::getDataRepresentationVisibility(FieldType field, const QString& name, SpecificRepresentation representation) {
vtkSmartPointer<vtkDataArray> dataArray = getDataArray(field, name);
DataType type = getDataType(dataArray);
......@@ -734,9 +734,9 @@ bool MeshComponent::getDataRepresentationVisibility(FieldType field, const QStri
else {
// if this is a 3D data with a specific data representation (i.e., different than HEDGE_HOG
// Then check if the specific data array exists first
if (specific3DDataRepresentation.contains(name + getRepresentationOf3DDataName(representation))) {
if (specific3DDataRepresentation.contains(name + getSpecificRepresentationName(representation))) {
// and if it exists, check if it is shown
return dataRepresentationVisibility.value(specific3DDataRepresentation.value(name + getRepresentationOf3DDataName(representation)));
return dataRepresentationVisibility.value(specific3DDataRepresentation.value(name + getSpecificRepresentationName(representation)));
}
else {
return false;
......@@ -817,7 +817,7 @@ void MeshComponent::setScalarDataRepresentationOn(vtkSmartPointer<vtkDataArray>
}
// -------------------- setDataRepresentationVisibility --------------------
void MeshComponent::setDataRepresentationVisibility(FieldType fieldType, const QString& name, bool visibility, RepresentationOf3DData representation) {
void MeshComponent::setDataRepresentationVisibility(FieldType fieldType, const QString& name, bool visibility, SpecificRepresentation representation) {
// currently not managed
if (fieldType == MESH) {
return;
......@@ -868,7 +868,7 @@ void MeshComponent::setDataRepresentationVisibility(FieldType fieldType, const Q
setDataRepresentationOff(SCALARS);
// create 1D representation (color map)
QString specificName(name + getRepresentationOf3DDataName(representation));
QString specificName(name + getSpecificRepresentationName(representation));
if (!specific3DDataRepresentation.contains(specificName)) {
createDataRepresentation(fieldType, name, representation);
}
......@@ -984,8 +984,8 @@ const QString MeshComponent::getDataPropName(FieldType fieldType, const QString&
}
// -------------------- getCurrentDisplayTypePolicy --------------------
MeshComponent::RepresentationOf3DData MeshComponent::getCurrentDisplayTypePolicy() const {
return (RepresentationOf3DData) displayTypePolicyBox->currentData().toInt();
MeshComponent::SpecificRepresentation MeshComponent::getCurrentDisplayTypePolicy() const {
return (SpecificRepresentation) displayTypePolicyBox->currentData().toInt();
}
// -------------------- getDataModel --------------------
......@@ -1145,8 +1145,8 @@ const QString MeshComponent::getDataTypeName(vtkSmartPointer<vtkDataArray> array
}
}
// -------------------- getRepresentationOf3DDataName --------------------
const QString MeshComponent::getRepresentationOf3DDataName(const RepresentationOf3DData displayType) {
// -------------------- getSpecificRepresentationName --------------------
const QString MeshComponent::getSpecificRepresentationName(const SpecificRepresentation displayType) {
switch (displayType) {
case MeshComponent::NORM:
return "/norm";
......
......@@ -68,8 +68,8 @@ public:
MESH = 4 ///< data are attached to the whole mesh (generic field data of Vtk)
};
/// @enum RepresentationOf3DData 3D data can be represented by 1 value in different ways
enum RepresentationOf3DData {
/// @enum SpecificRepresentation 3D data can be represented by 1 value in different ways
enum SpecificRepresentation {
HEDGE_HOG, ///< 3D data are represented as 3D vector (show lines starting from the point or center of the cell)
NORM, ///< 3D data are represented in 1D using the norm of the three components
FIRST_COMPONENT, ///< Use only the value of the first component
......@@ -338,7 +338,7 @@ public:
///@endcond
/// Returns the current value of the display type selected by the user
RepresentationOf3DData getCurrentDisplayTypePolicy() const;
SpecificRepresentation getCurrentDisplayTypePolicy() const;
/// Returns the current data view model (model as the M in Qt MVC design pattern)
MeshDataModel* getDataModel();
......@@ -347,10 +347,10 @@ public:
vtkSmartPointer<vtkFieldData> getFieldData(FieldType);
/// get the current visibility status of a given data (identified with its name) of a given field type
bool getDataRepresentationVisibility(FieldType, const QString&, RepresentationOf3DData representation = HEDGE_HOG) ;
bool getDataRepresentationVisibility(FieldType, const QString&, SpecificRepresentation representation = HEDGE_HOG) ;
/// set the visibility of a given representation for a given data (identified with its name) of a given field type (create it if needed)
void setDataRepresentationVisibility(FieldType, const QString&, bool, RepresentationOf3DData representation = HEDGE_HOG);
void setDataRepresentationVisibility(FieldType, const QString&, bool, SpecificRepresentation representation = HEDGE_HOG);
/// hide all the data representation of a given data type (hide all by default)
void setDataRepresentationOff(int dataType = SCALARS | VECTORS | TENSORS);
......@@ -380,8 +380,8 @@ public:
*/
static const QString getDataTypeName(vtkSmartPointer<vtkDataArray>);
/// Helper method that returns the RepresentationOf3DData as a QString
static const QString getRepresentationOf3DDataName (const RepresentationOf3DData );
/// Helper method that returns the SpecificRepresentation as a QString
static const QString getSpecificRepresentationName (const SpecificRepresentation );
/**
* @}
......@@ -483,7 +483,7 @@ private:
QMap<vtkSmartPointer<vtkDataArray>, bool> dataRepresentationVisibility;
/// create the data representation of a given data (identified with its name) of a given field type, default visibility is off
void createDataRepresentation(FieldType, const QString&, RepresentationOf3DData representation = HEDGE_HOG) ;
void createDataRepresentation(FieldType, const QString&, SpecificRepresentation representation = HEDGE_HOG) ;
// Returns the very specific name used for the additional prop that represent this data
const QString getDataPropName(FieldType , const QString& );
......
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