VisualElement::GetChildListAtN fixed
authorYouri Sdobnikov <i.sdobnikov@samsung.com>
Tue, 22 Oct 2013 10:22:59 +0000 (13:22 +0300)
committerDae Young Ryu <karzia@samsung.com>
Tue, 22 Oct 2013 11:09:23 +0000 (20:09 +0900)
Change-Id: Iad1d4e66fdfaf85fdb9012fce0777d1eb155cdcf
Signed-off-by: Youri Sdobnikov <i.sdobnikov@samsung.com>
Signed-off-by: Dae Young Ryu <karzia@samsung.com>
inc/FUiAnimVisualElement.h
src/ui/animations/FUiAnimVisualElement.cpp
src/ui/animations/FUiAnim_VisualElementImpl.cpp
src/ui/inc/FUiAnim_VisualElementImpl.h

index b258194..b8c7d75 100644 (file)
@@ -1544,25 +1544,24 @@ public:
         *
         * @since               3.0
         *
-        * @return              error code
+        * @return              A pointer to list of VisualElement. It's made by Tizen::Base::Collection::ArrayList to add intersected VE's pointers
         * @param[in]   point                   The hit position in the coordinate space of this instance
-        * @param[out]  list                    Tizen::Base::Collection::ArrayListT<VisualElement*> list to add intersected VE's pointers
+
         * @see GetChildAt()
         * @see OnHitTest()
         */
-       result GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tizen::Base::Collection::IList* list);
+       Tizen::Base::Collection::IList*  GetChildListAtN(const Tizen::Graphics::FloatPoint& point);
        /**
         * Build list of selected VisualElements in the selection region
         *
         * @since               3.0
         *
-        * @return              error code
+        * @return              A pointer to list of VisualElement. It's made by Tizen::Base::Collection::ArrayList to add intersected VE's pointers
         * @param[in]   selection               The hit position in the coordinate space of this instance
         * @param[in]   mode                    selection mode
-        * @param[out]  list                    Tizen::Base::Collection::ArrayListT<VisualElement*> list to add intersected VE's pointers
-        * @see VisualElementSelectionMode
+        * @see SelectionMode
         */
-       result GetChildListAt(const Tizen::Graphics::FloatRectangle& selection, SelectionMode mode, Tizen::Base::Collection::IList* list);
+       Tizen::Base::Collection::IList*  GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, SelectionMode mode);
 
 
 
index 0345a9b..0d75186 100644 (file)
@@ -1074,24 +1074,20 @@ VisualElement::GetBoundingVolume()
        return _pVisualElementImpl->GetBoundingVolume();
 }
 
-result
-VisualElement::GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tizen::Base::Collection::IList* list)
+Tizen::Base::Collection::IList*
+VisualElement::GetChildListAtN(const Tizen::Graphics::FloatPoint& point)
 {
        CHECK_CONSTRUCTED;
 
-       return _pVisualElementImpl->GetChildListAt(point, list);
+       return _pVisualElementImpl->GetChildListAtN(point);
 }
 
-result
-VisualElement::GetChildListAt(const Tizen::Graphics::FloatRectangle& selection, SelectionMode mode, Tizen::Base::Collection::IList* list)
+Tizen::Base::Collection::IList*
+VisualElement::GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, SelectionMode mode)
 {
        CHECK_CONSTRUCTED;
 
-       list->RemoveAll();
-
-       SysTryReturnResult(NID_UI_ANIM, selection.height > 0.0f && selection.width > 0.0f, E_INVALID_ARG, "Selection width and height must be greater than 0");
-
-       return _pVisualElementImpl->GetChildListAt(selection, mode, list);
+       return _pVisualElementImpl->GetChildListAtN(selection, mode);
 }
 
 
index 085f285..f11244d 100644 (file)
@@ -8579,8 +8579,8 @@ bool operator != (const Tizen::Base::Collection::MapEntryT< float, VisualElement
        return !(obj1 == obj2);
 }
 
-result
-_VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tizen::Base::Collection::IList* list)
+Tizen::Base::Collection::IList*
+_VisualElementImpl::GetChildListAtN(const Tizen::Graphics::FloatPoint& point)
 {
 
        Tizen::Base::Collection::ArrayListT < Tizen::Base::Collection::MapEntryT < float, VisualElement* > > pairList;
@@ -8590,8 +8590,6 @@ _VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tiz
 
        GetChildListAtI(point, pairList);
 
-       list->RemoveAll();
-
        //sort by float
        Tizen::Base::Collection::IComparerT< Tizen::Base::Collection::MapEntryT< float, VisualElement* > >* pPairComparer = new IntersectedPairComparer();
 
@@ -8602,14 +8600,22 @@ _VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tiz
 
        //copy to list in right order
        int count = pairList.GetCount();
-       Tizen::Base::Collection::MapEntryT < float, VisualElement* > intersectedPair;
-       for (int i = 0; i < count; i++)
+       if(count > 0)
        {
-               pairList.GetAt(i,intersectedPair);
-               list->Add(intersectedPair.GetValue());
+               Tizen::Base::Collection::ArrayList* list = new (std::nothrow) Tizen::Base::Collection::ArrayList();
+               SysTryReturn(NID_UI_ANIM, list != null, null, E_OUT_OF_MEMORY, "Memory allocation failed, cannot create ArrayList" );
+               list->Construct();
+
+               Tizen::Base::Collection::MapEntryT < float, VisualElement* > intersectedPair;
+               for (int i = 0; i < count; i++)
+               {
+                       pairList.GetAt(i,intersectedPair);
+                       list->Add(intersectedPair.GetValue());
+               }
+               return list;
        }
 
-       return E_SUCCESS;
+       return null;
 }
 
 result
@@ -8643,10 +8649,10 @@ _VisualElementImpl::GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tiz
        return E_SUCCESS;
 }
 
-result
-_VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList* list)
+Tizen::Base::Collection::IList*
+_VisualElementImpl::GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode)
 {
-       list->RemoveAll();
+
        int j;
 
        //make global selection
@@ -8704,7 +8710,8 @@ _VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatRectangle& select
                //test if VE BV is included with selection
                if (!localSelection.FindIncludedPoints(GetBoundingVolume()))
                {
-                       return E_SUCCESS;
+
+                       return null;
                }
        }
 
@@ -8713,22 +8720,31 @@ _VisualElementImpl::GetChildListAt(const Tizen::Graphics::FloatRectangle& select
        _VisualElementImpl* pChild = null;
        int count = __children.GetCount();
 
-       //test all children to have intersected and included elements
-       for (int i = 0; i < count; i++)
+       if (count > 0)
        {
-               __children.GetAt(i, pChild);
 
-               if (pChild != null)
+               Tizen::Base::Collection::ArrayList* list = new (std::nothrow) Tizen::Base::Collection::ArrayList();
+               SysTryReturn(NID_UI_ANIM, list != null, null, E_OUT_OF_MEMORY, "Memory allocation failed, cannot create ArrayList" );
+               list->Construct();
+
+               //test all children to have intersected and included elements
+               for (int i = 0; i < count; i++)
                {
-                       pChild->GetSelectedI(globalSelection, mode, list);
+                       __children.GetAt(i, pChild);
+
+                       if (pChild != null)
+                       {
+                               pChild->GetSelectedI(globalSelection, mode, *list);
+                       }
                }
        }
 
-       return E_SUCCESS;
+       return null;
+
 }
 
 result
-_VisualElementImpl::GetSelectedI(const Tizen::Ui::Animations::_Selection& globalSelection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList* list)
+_VisualElementImpl::GetSelectedI(const Tizen::Ui::Animations::_Selection& globalSelection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList& list)
 {
        _Selection localSelection = globalSelection;
        localSelection.Transform(GetMatrixFromTop());
@@ -8761,7 +8777,7 @@ _VisualElementImpl::GetSelectedI(const Tizen::Ui::Animations::_Selection& global
                                        //test this mesh to be included by selection
                                        if (!localSelection.FindExcludedPoints(pMesh))
                                        {
-                                               list->Add(GetPublic());
+                                               list.Add(GetPublic());
                                        }
                                }
                                else
@@ -8772,14 +8788,14 @@ _VisualElementImpl::GetSelectedI(const Tizen::Ui::Animations::_Selection& global
                                        //test this mesh to have points included in selection
                                        if (localSelection.FindIncludedPoints(pMesh))
                                        {
-                                               list->Add(GetPublic());
+                                               list.Add(GetPublic());
                                        }
                                        else
                                        {
                                                //test this mesh to have edges intersected with selection
                                                if (localSelection.FindIncludedMeshIntersections(pMesh))
                                                {
-                                                       list->Add(GetPublic());
+                                                       list.Add(GetPublic());
                                                }
                                        }
                                }
index 41efa1a..b1419be 100644 (file)
@@ -1425,10 +1425,10 @@ private:
        BoundingVolume& GetBoundingVolume(void);
 
        //Picking instruments
-       result GetChildListAt(const Tizen::Graphics::FloatPoint& point, Tizen::Base::Collection::IList* list);
+       Tizen::Base::Collection::IList* GetChildListAtN(const Tizen::Graphics::FloatPoint& point);
        result GetChildListAtI(const Tizen::Graphics::FloatPoint point, Tizen::Base::Collection::ArrayListT<Tizen::Base::Collection::MapEntryT < float, VisualElement* > >& pairList);
-       result GetChildListAt(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList* list);
-       result GetSelectedI(const Tizen::Ui::Animations::_Selection& selection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList* list);
+       Tizen::Base::Collection::IList* GetChildListAtN(const Tizen::Graphics::FloatRectangle& selection, VisualElement::SelectionMode mode);
+       result GetSelectedI(const Tizen::Ui::Animations::_Selection& selection, VisualElement::SelectionMode mode, Tizen::Base::Collection::IList& list);
 
 public:
        enum