Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CamiTK
CamiTK Community Edition
Commits
7fce3327
Commit
7fce3327
authored
Nov 14, 2017
by
Emmanuel Promayon
Browse files
FIXED simplify API name + add cell data example
parent
6acf681a
Changes
3
Hide whitespace changes
Inline
Side-by-side
sdk/components/vtkmesh/testdata/cube-with-point-and-cell-data.vtk
0 → 100644
View file @
7fce3327
# 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
sdk/libraries/core/component/mesh/MeshComponent.cpp
View file @
7fce3327
...
...
@@ -560,7 +560,7 @@ int MeshComponent::getNumberOfDataArray(int fieldFlag) {
}
// -------------------- createDataRepresentation --------------------
void
MeshComponent
::
createDataRepresentation
(
FieldType
field
,
const
QString
&
name
,
Representation
Of3DData
representation
)
{
void
MeshComponent
::
createDataRepresentation
(
FieldType
field
,
const
QString
&
name
,
Specific
Representation
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
+
getRepresentation
Of3DData
Name
(
representation
));
QString
specificName
(
name
+
get
Specific
RepresentationName
(
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
,
Representation
Of3DData
representation
)
{
bool
MeshComponent
::
getDataRepresentationVisibility
(
FieldType
field
,
const
QString
&
name
,
Specific
Representation
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
+
getRepresentation
Of3DData
Name
(
representation
)))
{
if
(
specific3DDataRepresentation
.
contains
(
name
+
get
Specific
RepresentationName
(
representation
)))
{
// and if it exists, check if it is shown
return
dataRepresentationVisibility
.
value
(
specific3DDataRepresentation
.
value
(
name
+
getRepresentation
Of3DData
Name
(
representation
)));
return
dataRepresentationVisibility
.
value
(
specific3DDataRepresentation
.
value
(
name
+
get
Specific
RepresentationName
(
representation
)));
}
else
{
return
false
;
...
...
@@ -817,7 +817,7 @@ void MeshComponent::setScalarDataRepresentationOn(vtkSmartPointer<vtkDataArray>
}
// -------------------- setDataRepresentationVisibility --------------------
void
MeshComponent
::
setDataRepresentationVisibility
(
FieldType
fieldType
,
const
QString
&
name
,
bool
visibility
,
Representation
Of3DData
representation
)
{
void
MeshComponent
::
setDataRepresentationVisibility
(
FieldType
fieldType
,
const
QString
&
name
,
bool
visibility
,
Specific
Representation
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
+
getRepresentation
Of3DData
Name
(
representation
));
QString
specificName
(
name
+
get
Specific
RepresentationName
(
representation
));
if
(
!
specific3DDataRepresentation
.
contains
(
specificName
))
{
createDataRepresentation
(
fieldType
,
name
,
representation
);
}
...
...
@@ -984,8 +984,8 @@ const QString MeshComponent::getDataPropName(FieldType fieldType, const QString&
}
// -------------------- getCurrentDisplayTypePolicy --------------------
MeshComponent
::
Representation
Of3DData
MeshComponent
::
getCurrentDisplayTypePolicy
()
const
{
return
(
Representation
Of3DData
)
displayTypePolicyBox
->
currentData
().
toInt
();
MeshComponent
::
Specific
Representation
MeshComponent
::
getCurrentDisplayTypePolicy
()
const
{
return
(
Specific
Representation
)
displayTypePolicyBox
->
currentData
().
toInt
();
}
// -------------------- getDataModel --------------------
...
...
@@ -1145,8 +1145,8 @@ const QString MeshComponent::getDataTypeName(vtkSmartPointer<vtkDataArray> array
}
}
// -------------------- getRepresentation
Of3DData
Name --------------------
const
QString
MeshComponent
::
getRepresentation
Of3DData
Name
(
const
Representation
Of3DData
displayType
)
{
// -------------------- get
Specific
RepresentationName --------------------
const
QString
MeshComponent
::
get
Specific
RepresentationName
(
const
Specific
Representation
displayType
)
{
switch
(
displayType
)
{
case
MeshComponent
::
NORM
:
return
"/norm"
;
...
...
sdk/libraries/core/component/mesh/MeshComponent.h
View file @
7fce3327
...
...
@@ -68,8 +68,8 @@ public:
MESH
=
4
///< data are attached to the whole mesh (generic field data of Vtk)
};
/// @enum Representation
Of3DData
3D data can be represented by 1 value in different ways
enum
Representation
Of3DData
{
/// @enum
Specific
Representation 3D data can be represented by 1 value in different ways
enum
Specific
Representation
{
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
Representation
Of3DData
getCurrentDisplayTypePolicy
()
const
;
Specific
Representation
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
&
,
Representation
Of3DData
representation
=
HEDGE_HOG
)
;
bool
getDataRepresentationVisibility
(
FieldType
,
const
QString
&
,
Specific
Representation
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
,
Representation
Of3DData
representation
=
HEDGE_HOG
);
void
setDataRepresentationVisibility
(
FieldType
,
const
QString
&
,
bool
,
Specific
Representation
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 Representation
Of3DData
as a QString
static
const
QString
getRepresentation
Of3DData
Name
(
const
Representation
Of3DData
);
/// Helper method that returns the
Specific
Representation as a QString
static
const
QString
get
Specific
RepresentationName
(
const
Specific
Representation
);
/**
* @}
...
...
@@ -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
&
,
Representation
Of3DData
representation
=
HEDGE_HOG
)
;
void
createDataRepresentation
(
FieldType
,
const
QString
&
,
Specific
Representation
representation
=
HEDGE_HOG
)
;
// Returns the very specific name used for the additional prop that represent this data
const
QString
getDataPropName
(
FieldType
,
const
QString
&
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment