Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
c304d3f0
Commit
c304d3f0
authored
May 13, 2008
by
Utkarsh Ayachit
⛰
Browse files
ENH: It is now possible to perform block selection on hierarchical box datasets.
parent
78f5d4d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Filtering/vtkHierarchicalBoxDataSet.cxx
View file @
c304d3f0
...
...
@@ -30,7 +30,7 @@
#include <vtkstd/vector>
#include <assert.h>
vtkCxxRevisionMacro
(
vtkHierarchicalBoxDataSet
,
"1.2
0
"
);
vtkCxxRevisionMacro
(
vtkHierarchicalBoxDataSet
,
"1.2
1
"
);
vtkStandardNewMacro
(
vtkHierarchicalBoxDataSet
);
vtkInformationKeyMacro
(
vtkHierarchicalBoxDataSet
,
BOX
,
IntegerVector
);
...
...
@@ -389,6 +389,28 @@ void vtkHierarchicalBoxDataSet::PrintSelf(ostream& os, vtkIndent indent)
*/
}
//----------------------------------------------------------------------------
unsigned
int
vtkHierarchicalBoxDataSet
::
GetFlatIndex
(
unsigned
int
level
,
unsigned
int
index
)
{
if
(
level
>
this
->
GetNumberOfLevels
()
||
index
>
this
->
GetNumberOfDataSets
(
level
))
{
// invalid level, index.
vtkErrorMacro
(
"Invalid level ("
<<
level
<<
") or index ("
<<
index
<<
")"
);
return
0
;
}
unsigned
int
findex
=
0
;
for
(
unsigned
int
l
=
0
;
l
<
level
;
l
++
)
{
findex
+=
1
;
findex
+=
this
->
GetNumberOfDataSets
(
l
);
}
findex
+=
1
;
findex
+=
(
index
+
1
);
return
findex
;
}
//----------------------------------------------------------------------------
vtkHierarchicalBoxDataSet
*
vtkHierarchicalBoxDataSet
::
GetData
(
vtkInformation
*
info
)
...
...
Filtering/vtkHierarchicalBoxDataSet.h
View file @
c304d3f0
...
...
@@ -187,7 +187,12 @@ public:
// Unhiding superclass method.
virtual
int
HasMetaData
(
vtkCompositeDataIterator
*
iter
)
{
return
this
->
Superclass
::
HasMetaData
(
iter
);
}
// Description:
// Given the level and dataset index, returns the flat index provided level
// and dataset index are valid.
unsigned
int
GetFlatIndex
(
unsigned
int
level
,
unsigned
int
index
);
protected:
vtkHierarchicalBoxDataSet
();
~
vtkHierarchicalBoxDataSet
();
...
...
Graphics/vtkConvertSelection.cxx
View file @
c304d3f0
...
...
@@ -29,6 +29,7 @@
#include "vtkFieldData.h"
#include "vtkGraph.h"
#include "vtkHierarchicalBoxDataIterator.h"
#include "vtkHierarchicalBoxDataSet.h"
#include "vtkIdList.h"
#include "vtkIdTypeArray.h"
#include "vtkInformation.h"
...
...
@@ -51,7 +52,7 @@
vtkCxxSetObjectMacro
(
vtkConvertSelection
,
ArrayNames
,
vtkStringArray
);
vtkCxxRevisionMacro
(
vtkConvertSelection
,
"1.1
4
"
);
vtkCxxRevisionMacro
(
vtkConvertSelection
,
"1.1
5
"
);
vtkStandardNewMacro
(
vtkConvertSelection
);
//----------------------------------------------------------------------------
vtkConvertSelection
::
vtkConvertSelection
()
...
...
@@ -265,7 +266,19 @@ int vtkConvertSelection::ConvertToBlockSelection(
indices
.
insert
(
static_cast
<
unsigned
int
>
(
properties
->
Get
(
vtkSelection
::
COMPOSITE_INDEX
())));
}
// TODO: is has HIERARCHICAL_INDEX() & HIERARCHICAL_LEVEL.
else
if
(
properties
->
Has
(
vtkSelection
::
CONTENT_TYPE
())
&&
properties
->
Has
(
vtkSelection
::
HIERARCHICAL_INDEX
())
&&
properties
->
Has
(
vtkSelection
::
HIERARCHICAL_LEVEL
())
&&
data
->
IsA
(
"vtkHierarchicalBoxDataSet"
))
{
// convert hierarchical index to composite index.
vtkHierarchicalBoxDataSet
*
hbox
=
static_cast
<
vtkHierarchicalBoxDataSet
*>
(
data
);
indices
.
insert
(
hbox
->
GetFlatIndex
(
static_cast
<
unsigned
int
>
(
properties
->
Get
(
vtkSelection
::
HIERARCHICAL_LEVEL
())),
static_cast
<
unsigned
int
>
(
properties
->
Get
(
vtkSelection
::
HIERARCHICAL_INDEX
()))));
}
}
VTK_CREATE
(
vtkUnsignedIntArray
,
selectionList
);
...
...
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