2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/modeling/entity.h>
20 #include <dali/internal/event/modeling/entity-impl.h>
25 Entity Entity::New(const std::string name)
27 Internal::EntityPtr internal = Internal::Entity::New(name);
29 return Entity(internal.Get());
32 Entity Entity::DownCast( BaseHandle handle )
34 return Entity( dynamic_cast<Dali::Internal::Entity*>(handle.GetObjectPtr()) );
41 Entity::Entity(Internal::Entity* internal)
42 : BaseHandle(internal)
50 Entity::Entity(const Entity& handle)
55 Entity& Entity::operator=(const Entity& rhs)
57 BaseHandle::operator=(rhs);
61 Entity Entity::Find(const std::string& name) const
63 Internal::Entity* entity = GetImplementation(*this).Find(name);
64 return Entity(entity);
67 void Entity::SetName(const char* name)
69 GetImplementation(*this).SetName(name);
72 void Entity::SetName(const std::string& name)
74 GetImplementation(*this).SetName(name);
77 const std::string& Entity::GetName() const
79 return GetImplementation(*this).GetName();
82 void Entity::SetType(const EntityType type)
84 GetImplementation(*this).SetType(type);
87 Entity::EntityType Entity::GetType() const
89 return GetImplementation(*this).GetType();
92 void Entity::SetTransformMatrix(Matrix& matrix)
94 GetImplementation(*this).SetTransformMatrix(matrix);
97 const Matrix& Entity::GetTransformMatrix() const
99 return GetImplementation(*this).GetTransformMatrix();
102 bool Entity::HasChildren() const
104 return GetImplementation(*this).HasChildren();
107 int Entity::NumberOfChildren() const
109 return GetImplementation(*this).NumberOfChildren();
112 const EntityContainer& Entity::GetChildren() const
114 return GetImplementation(*this).GetChildren();
117 void Entity::Add(Entity child)
119 DALI_ASSERT_ALWAYS( child && "Child entity handle is empty" );
120 GetImplementation(*this).Add(GetImplementation(child));
123 Entity Entity::GetParent() const
125 Internal::Entity* parent = GetImplementation(*this).GetParent();
126 return Entity(parent);
129 void Entity::SetMeshCapacity(unsigned int capacity)
131 GetImplementation(*this).SetMeshCapacity(capacity);
134 void Entity::AddMeshIndex(unsigned int meshIndex)
136 GetImplementation(*this).AddMeshIndex(meshIndex);
139 bool Entity::HasMeshes() const
141 return GetImplementation(*this).HasMeshes();
144 int Entity::NumberOfMeshes() const
146 return GetImplementation(*this).NumberOfMeshes();
149 const EntityMeshIndices& Entity::GetMeshes() const
151 return GetImplementation(*this).GetMeshes();
154 unsigned int Entity::GetMeshByIndex(unsigned int meshIndex) const
156 return GetImplementation(*this).GetMeshByIndex (meshIndex);
159 void Entity::AddToBounds(Entity child)
161 DALI_ASSERT_ALWAYS( child && "Child entity handle is empty" );
162 GetImplementation(*this).AddToBounds(GetImplementation(child));
165 void Entity::AddToBounds( const Vector3& lowerBounds, const Vector3& upperBounds )
167 GetImplementation(*this).AddToBounds( lowerBounds, upperBounds );
170 const Vector3& Entity::GetLowerBounds() const
172 return GetImplementation(*this).GetLowerBounds();
175 const Vector3& Entity::GetUpperBounds() const
177 return GetImplementation(*this).GetUpperBounds();
180 void Entity::SetLowerBounds( const Vector3& lowerBounds )
182 GetImplementation(*this).SetLowerBounds( lowerBounds );
185 void Entity::SetUpperBounds( const Vector3& upperBounds )
187 GetImplementation(*this).SetUpperBounds( upperBounds );