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
7dbd6154
Commit
7dbd6154
authored
Nov 08, 2017
by
Emmanuel Promayon
Browse files
FIXED cleaner code for MeshDataModel
Divide and conquer / easier to undestand / easier to maintain...
parent
68b107dd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
sdk/libraries/core/component/mesh/MeshComponent.cpp
View file @
7dbd6154
...
...
@@ -875,6 +875,25 @@ MeshDataModel* MeshComponent::getDataModel() {
return
dataModel
;
}
// -------------------- getFieldData --------------------
vtkSmartPointer
<
vtkFieldData
>
MeshComponent
::
getFieldData
(
MeshDataModel
::
FieldType
fieldType
)
{
switch
(
fieldType
)
{
case
MeshDataModel
::
POINTS
:
return
getPointSet
()
->
GetPointData
();
break
;
case
MeshDataModel
::
CELLS
:
return
getPointSet
()
->
GetCellData
();
break
;
case
MeshDataModel
::
MESH
:
default:
return
getPointSet
()
->
GetFieldData
();
break
;
}
}
// -------------------- removeSelectedData --------------------
void
MeshComponent
::
removeSelectedData
()
{
// TODO : handle multiple selection and cell/mesh data array deletion
...
...
sdk/libraries/core/component/mesh/MeshComponent.h
View file @
7dbd6154
...
...
@@ -303,12 +303,15 @@ public:
*/
void
setActiveData
(
MeshDataModel
::
FieldType
fieldType
,
const
char
*
name
);
/// Return the current value of the display type selected by the user
/// Return
s
the current value of the display type selected by the user
MeshDataModel
::
DisplayTypeFor3DData
getCurrentDisplayTypePolicy
()
const
;
///
g
et the current data view model (model as the M in Qt MVC design pattern)
///
R
et
urns
the current data view model (model as the M in Qt MVC design pattern)
MeshDataModel
*
getDataModel
();
/// Returns the corresponding vtkFieldData (point data, cell data or field data)
vtkSmartPointer
<
vtkFieldData
>
getFieldData
(
MeshDataModel
::
FieldType
);
/**
* @}
*/
...
...
sdk/libraries/core/component/mesh/MeshDataModel.cpp
View file @
7dbd6154
This diff is collapsed.
Click to expand it.
sdk/libraries/core/component/mesh/MeshDataModel.h
View file @
7dbd6154
...
...
@@ -29,6 +29,9 @@
#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include <vtkSmartPointer.h>
class
vtkDataArray
;
namespace
camitk
{
class
MeshComponent
;
...
...
@@ -52,7 +55,7 @@ public :
enum
FieldType
{
POINTS
=
1
,
///< data are attached to point
CELLS
=
2
,
///< data are attached to cells
MESH
=
4
///< data are attached to the whole mesh
MESH
=
4
///< data are attached to the whole mesh
(generic field data of Vtk)
};
/// @enum DataType Data fields can have different dimensions
...
...
@@ -110,9 +113,27 @@ public :
/// static method that returns the FieldType enum as a QString
static
const
QMap
<
int
,
QString
>&
getFieldNames
();
/// helper method that returns the field type as a string
static
const
QString
getFieldName
(
const
FieldType
);
/// static method that returns the DataType enum as a QString
static
const
QMap
<
int
,
QString
>&
getDataNames
();
static
const
QMap
<
int
,
QString
>&
getDataTypeNames
();
/// Helper method that returns the datatype as a string
static
const
QString
getDataTypeName
(
const
DataType
);
/// Returns the data type of a data array depending on the number of components of the given data array:
static
const
MeshDataModel
::
DataType
getDataType
(
vtkSmartPointer
<
vtkDataArray
>
);
/** Returns the data type string of an data array depending on the number of components of the given data array:
* If the number of components is different than 1, 3 and 9 (the managed type SCALARS, VECTORS, TENSORS)
* then the method returns a string equals to the number of components.
*/
static
const
QString
getDataTypeName
(
vtkSmartPointer
<
vtkDataArray
>
);
/// Helper method that returns the DisplayTypeFor3DData as a QString
static
const
QString
getDisplayTypeFor3DDataName
(
const
DisplayTypeFor3DData
);
/**
* @brief Refresh the model
*/
...
...
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