DALi signals refactor to remove V2 naming
[platform/core/uifw/dali-core.git] / dali / public-api / modeling / entity.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // INTERNAL INCLUDES
19 #include <dali/public-api/modeling/entity.h>
20 #include <dali/internal/event/modeling/entity-impl.h>
21
22 namespace Dali
23 {
24
25 Entity Entity::New(const std::string name)
26 {
27   Internal::EntityPtr internal = Internal::Entity::New(name);
28
29   return Entity(internal.Get());
30 }
31
32 Entity Entity::DownCast( BaseHandle handle )
33 {
34   return Entity( dynamic_cast<Dali::Internal::Entity*>(handle.GetObjectPtr()) );
35 }
36
37 Entity::Entity()
38 {
39 }
40
41 Entity::Entity(Internal::Entity* internal)
42 : BaseHandle(internal)
43 {
44 }
45
46 Entity::~Entity()
47 {
48 }
49
50 Entity::Entity(const Entity& handle)
51 : BaseHandle(handle)
52 {
53 }
54
55 Entity& Entity::operator=(const Entity& rhs)
56 {
57   BaseHandle::operator=(rhs);
58   return *this;
59 }
60
61 Entity Entity::Find(const std::string& name) const
62 {
63   Internal::Entity* entity = GetImplementation(*this).Find(name);
64   return Entity(entity);
65 }
66
67 void Entity::SetName(const char* name)
68 {
69   GetImplementation(*this).SetName(name);
70 }
71
72 void Entity::SetName(const std::string& name)
73 {
74   GetImplementation(*this).SetName(name);
75 }
76
77 const std::string& Entity::GetName() const
78 {
79   return GetImplementation(*this).GetName();
80 }
81
82 void Entity::SetType(const EntityType type)
83 {
84   GetImplementation(*this).SetType(type);
85 }
86
87 Entity::EntityType Entity::GetType() const
88 {
89   return GetImplementation(*this).GetType();
90 }
91
92 void Entity::SetTransformMatrix(Matrix& matrix)
93 {
94   GetImplementation(*this).SetTransformMatrix(matrix);
95 }
96
97 const Matrix& Entity::GetTransformMatrix() const
98 {
99   return GetImplementation(*this).GetTransformMatrix();
100 }
101
102 bool Entity::HasChildren() const
103 {
104   return GetImplementation(*this).HasChildren();
105 }
106
107 int Entity::NumberOfChildren() const
108 {
109   return GetImplementation(*this).NumberOfChildren();
110 }
111
112 const EntityContainer& Entity::GetChildren() const
113 {
114   return GetImplementation(*this).GetChildren();
115 }
116
117 void Entity::Add(Entity child)
118 {
119   DALI_ASSERT_ALWAYS( child && "Child entity handle is empty" );
120   GetImplementation(*this).Add(GetImplementation(child));
121 }
122
123 Entity Entity::GetParent() const
124 {
125   Internal::Entity* parent = GetImplementation(*this).GetParent();
126   return Entity(parent);
127 }
128
129 void Entity::SetMeshCapacity(unsigned int capacity)
130 {
131   GetImplementation(*this).SetMeshCapacity(capacity);
132 }
133
134 void Entity::AddMeshIndex(unsigned int meshIndex)
135 {
136   GetImplementation(*this).AddMeshIndex(meshIndex);
137 }
138
139 bool Entity::HasMeshes() const
140 {
141   return GetImplementation(*this).HasMeshes();
142 }
143
144 int Entity::NumberOfMeshes() const
145 {
146   return GetImplementation(*this).NumberOfMeshes();
147 }
148
149 const EntityMeshIndices& Entity::GetMeshes() const
150 {
151   return GetImplementation(*this).GetMeshes();
152 }
153
154 unsigned int Entity::GetMeshByIndex(unsigned int meshIndex) const
155 {
156   return GetImplementation(*this).GetMeshByIndex (meshIndex);
157 }
158
159 void Entity::AddToBounds(Entity child)
160 {
161   DALI_ASSERT_ALWAYS( child && "Child entity handle is empty" );
162   GetImplementation(*this).AddToBounds(GetImplementation(child));
163 }
164
165 void Entity::AddToBounds( const Vector3& lowerBounds, const Vector3& upperBounds )
166 {
167   GetImplementation(*this).AddToBounds( lowerBounds, upperBounds );
168 }
169
170 const Vector3& Entity::GetLowerBounds() const
171 {
172   return GetImplementation(*this).GetLowerBounds();
173 }
174
175 const Vector3& Entity::GetUpperBounds() const
176 {
177   return GetImplementation(*this).GetUpperBounds();
178 }
179
180 void Entity::SetLowerBounds( const Vector3& lowerBounds )
181 {
182   GetImplementation(*this).SetLowerBounds( lowerBounds );
183 }
184
185 void Entity::SetUpperBounds( const Vector3& upperBounds )
186 {
187   GetImplementation(*this).SetUpperBounds( upperBounds );
188 }
189
190
191 } // namespace Dali
192