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
315230de
Commit
315230de
authored
Nov 09, 2017
by
Emmanuel Promayon
Browse files
FIXED move the first access to data array in MeshComponent
parent
889adb90
Changes
3
Hide whitespace changes
Inline
Side-by-side
sdk/libraries/core/component/mesh/MeshComponent.cpp
View file @
315230de
...
...
@@ -525,6 +525,16 @@ void MeshComponent::removeSelectedSelections() {
}
}
// -------------------- getNumberOfDataArray --------------------
int
MeshComponent
::
getNumberOfDataArray
()
{
if
(
getPointSet
()
==
NULL
)
{
return
0
;
}
else
{
return
getPointSet
()
->
GetCellData
()
->
GetNumberOfArrays
()
+
getPointSet
()
->
GetPointData
()
->
GetNumberOfArrays
();
}
}
// -------------------- getDataArray --------------------
vtkSmartPointer
<
vtkDataArray
>
MeshComponent
::
getDataArray
(
MeshDataModel
::
FieldType
fieldType
,
const
QString
&
arrayName
)
{
vtkSmartPointer
<
vtkFieldData
>
dataField
;
...
...
sdk/libraries/core/component/mesh/MeshComponent.h
View file @
315230de
...
...
@@ -224,6 +224,9 @@ public:
* @{
*/
/// Get the total number of point and cell data arrays (not taking intou account the field arrays), returns -1 if there is none
int
getNumberOfDataArray
();
/**
* @brief Get the data array of specified field type and name.
*
...
...
@@ -253,7 +256,6 @@ public:
*/
void
addDataArray
(
MeshDataModel
::
FieldType
fieldType
,
const
QString
&
name
,
vtkSmartPointer
<
vtkDataArray
>
data
);
/**
* @brief Remove a data array.
*
...
...
sdk/libraries/core/component/mesh/MeshDataModel.cpp
View file @
315230de
...
...
@@ -45,11 +45,12 @@ MeshDataModel::MeshDataModel(MeshComponent* meshComp) :
// -------------------- rowCount --------------------
int
MeshDataModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
if
(
meshComponent
==
NULL
||
meshComponent
->
getPointSet
()
==
NULL
)
{
if
(
meshComponent
==
NULL
)
{
return
0
;
}
return
meshComponent
->
getPointSet
()
->
GetCellData
()
->
GetNumberOfArrays
()
+
meshComponent
->
getPointSet
()
->
GetPointData
()
->
GetNumberOfArrays
();
else
{
return
meshComponent
->
getNumberOfDataArray
();
}
}
// -------------------- columnCount --------------------
...
...
@@ -88,6 +89,7 @@ QVariant MeshDataModel::data(const QModelIndex& index, int role) const {
int
dataIndex
;
FieldType
fieldType
=
getFieldTypeOfRow
(
row
,
&
dataIndex
);
// TODO use only MeshComponent methods
vtkSmartPointer
<
vtkFieldData
>
data
=
meshComponent
->
getFieldData
(
fieldType
);
vtkSmartPointer
<
vtkDataArray
>
dataArray
=
data
->
GetArray
(
dataIndex
);
DataType
type
=
getDataType
(
dataArray
);
...
...
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