2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiEffects_RendererEngineModelGroup.cpp
20 * @brief This file contains implementation of Group class
24 #include <renderer/engine-model/FUiEffects_RendererEngineModelNode.h>
25 #include <renderer/engine-model/FUiEffects_RendererEngineModelGroup.h>
27 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace EngineModel
32 , _invalidBoundBox(true)
40 const ChildrenListSizeType len = _children.size();
41 for (ChildrenListSizeType i = 0; len > i; ++i)
43 _children[i]->RemoveFromParent(this);
48 Group::Visit(Visitor& v)
55 Group::AddChild(NodePtr pChild)
57 if (!pChild->AttachedToParent(this))
62 _children.push_back(pChild);
68 Group::RemoveChild(NodePtr pChild)
70 const ChildrenListSizeType len = _children.size();
71 for (ChildrenListSizeType i = 0; len > i; ++i)
73 if (pChild == _children[i])
75 InternalRemoveChild(i);
84 Group::RemoveChild(ChildrenListSizeType index)
86 if (index >= _children.size())
90 InternalRemoveChild(index);
97 for (ChildrenListType::iterator it = _children.begin(); it != _children.end(); ++it)
99 (*it)->RemoveFromParent(this);
102 InvalidateBoundBox();
107 Group::InternalRemoveChild(ChildrenListSizeType index)
109 const ChildrenListSizeType len = _children.size();
110 NodePtr current = _children[index];
111 std::swap(_children[index], _children[len - 1]);
112 current->RemoveFromParent(this);
113 InvalidateBoundBox();
118 Group::InvalidateBoundBox(void)
120 if (_boundBox.invalid)
124 _boundBox.invalid = true;
125 TouchParentBoundBox();
130 Group::GetBoundBox(void)
132 if (_boundBox.invalid)
136 return _boundBox.value;
140 Group::SetWorld(const Math::Matrix4f& arg)
143 const ChildrenListSizeType len = _children.size();
144 for (ChildrenListSizeType i = 0; len > i; ++i)
146 _children[i]->ParentMoved(this);
152 Group::SetLocal(const Math::Matrix4f& arg)
155 const ChildrenListSizeType len = _children.size();
156 for (ChildrenListSizeType i = 0; len > i; ++i)
158 _children[i]->ParentMoved(this);
164 Group::ValidateBoundBox(void)
166 _boundBox.value.Identity();
168 const ChildrenListSizeType len = _children.size();
169 for (ChildrenListSizeType i = 0; len > i; ++i)
171 _boundBox.value.Extend(_children[i]->GetBoundBoxInParentSpace());
173 _boundBox.invalid = false;
178 Group::AttachedToParent(Group* pParent)
180 if (!Node::AttachedToParent(pParent))
185 const ChildrenListSizeType len = _children.size();
186 for (ChildrenListSizeType i = 0; len > i; ++i)
188 _children[i]->ParentMoved(this);
194 Group::RemoveFromParent(Group* pParent)
196 if (!Node::RemoveFromParent(pParent))
201 const ChildrenListSizeType len = _children.size();
202 for (ChildrenListSizeType i = 0; len > i; ++i)
204 _children[i]->ParentMoved(this);
210 Group::ParentMoved(Group* pParent)
212 if (_worldTransform.invalid)
216 Node::ParentMoved(pParent);
217 const ChildrenListSizeType len = _children.size();
218 for (ChildrenListSizeType i = 0; len > i; ++i)
220 _children[i]->ParentMoved(this);
224 Group::ChildrenListSizeType
225 Group::ChildrenCount(void)
227 return _children.size();
231 Group::GetChild(ChildrenListSizeType index)
233 return _children[index];
236 }}}}} //Tizen::Ui::Effects::_Renderer::EngineModel