VTK
9.1.0
Rendering
RayTracing
RTWrapper
VisRTX
Group.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "../Types.h"
4
#include "
Geometry.h
"
5
6
#include <VisRTX.h>
7
8
#include <set>
9
10
namespace
RTW
11
{
12
class
Group
:
public
Object
13
{
14
friend
class
World
;
15
16
public
:
17
Group
() :
Object
(
RTW_GROUP
) {}
18
19
~Group
() {}
20
21
void
Commit
()
override
{}
22
23
void
SetObject
(
const
std::string
&
id
,
Object
*
object
)
override
24
{
25
Object::SetObject
(
id
,
object
);
26
if
(
object
&& object->
GetDataType
() ==
RTW_DATA
)
27
{
28
Data
*
data
=
reinterpret_cast<
Data
*
>
(object);
29
if
(
data
->GetElementDataType() ==
RTW_GEOMETRIC_MODEL
)
30
{
31
int
numElements =
data
->GetNumElements();
32
Object
**elemData =
reinterpret_cast<
Object
**
>
(
data
->GetData());
33
while
(numElements-- > 0)
34
{
35
Object
*elem = *elemData;
36
assert(elem->
GetDataType
() ==
RTW_GEOMETRIC_MODEL
);
37
geometricModels.insert(
reinterpret_cast<
GeometricModel
*
>
(elem));
38
elemData++;
39
}
40
}
41
}
42
else
if
(
object
&& object->
GetDataType
() ==
RTW_GEOMETRIC_MODEL
)
43
geometricModels.insert(
reinterpret_cast<
GeometricModel
*
>
(
object
));
44
}
45
46
void
RemoveParam
(
const
std::string
&
id
)
override
47
{
48
Object
*obj =
GetObject
({
id
});
49
if
(obj && obj->
GetDataType
() ==
RTW_GEOMETRIC_MODEL
)
50
geometricModels.erase(
reinterpret_cast<
GeometricModel
*
>
(obj));
51
Object::RemoveParam
(
id
);
52
}
53
54
55
private
:
56
std::set<GeometricModel *> geometricModels;
57
58
};
59
}
RTW_DATA
@ RTW_DATA
Definition:
Types.h:134
vtkX3D::data
@ data
Definition:
vtkX3D.h:321
RTW::Group::SetObject
void SetObject(const std::string &id, Object *object) override
Definition:
Group.h:23
Geometry.h
RTW::Group::Commit
void Commit() override
Definition:
Group.h:21
RTW
Definition:
Backend.h:6
RTW::Object::GetDataType
RTWDataType GetDataType() const
Definition:
Object.h:306
RTW::Object::RemoveParam
virtual void RemoveParam(const std::string &id)
Definition:
Object.h:230
RTW::Group
Definition:
Group.h:13
RTW_GEOMETRIC_MODEL
@ RTW_GEOMETRIC_MODEL
Definition:
Types.h:138
RTW::Object
Definition:
Object.h:19
RTW::Data
Definition:
Data.h:10
RTW::Group::Group
Group()
Definition:
Group.h:17
RTW::World
Definition:
World.h:13
RTW::GeometricModel
Definition:
GeometricModel.h:13
vtkX3D::string
@ string
Definition:
vtkX3D.h:496
RTW::Object::SetObject
virtual void SetObject(const std::string &id, Object *object)
Definition:
Object.h:78
RTW::Group::~Group
~Group()
Definition:
Group.h:19
RTW::Object::GetObject
T * GetObject(const std::vector< std::string > &ids, T *defaultValue=nullptr, bool *found=nullptr) const
Definition:
Object.h:98
RTW::Group::RemoveParam
void RemoveParam(const std::string &id) override
Definition:
Group.h:46
RTW_GROUP
@ RTW_GROUP
Definition:
Types.h:140
Generated on Fri Nov 5 2021 00:11:18 for VTK by
1.8.20