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 FUi_CoordinateSystemUtils.cpp
20 * @brief This file contains implementation of _CoordinateSystemUtils class
22 * This file contains implementation _CoordinateSystemUtils class.
25 #include <FBaseErrors.h>
26 #include <FOspConfig.h>
27 #include "FUi_CoordinateSystemUtils.h"
29 using namespace Tizen::Graphics;
31 namespace Tizen { namespace Ui {
33 _CoordinateSystem* _CoordinateSystemUtils::__pCoordinateSystemInstance = null;
35 _ICoordinateSystemTransformer*
36 _CoordinateSystemUtils::GetTransformer(void)
38 if (__pCoordinateSystemInstance == null)
40 __pCoordinateSystemInstance = _CoordinateSystem::GetInstance();
41 SysTryReturn(NID_UI, __pCoordinateSystemInstance, null, E_SYSTEM, "[E_SYSTEM] Coordinate system instance must not be null.");
44 _ICoordinateSystemTransformer* pTransform = __pCoordinateSystemInstance->GetTransformer();
45 SysTryReturn(NID_UI, pTransform, null, E_SYSTEM, "[E_SYSTEM] The valid coordinate transformer does not exist.");
50 _ICoordinateSystemTransformer*
51 _CoordinateSystemUtils::GetInverseTransformer(void)
53 if (__pCoordinateSystemInstance == null)
55 __pCoordinateSystemInstance = _CoordinateSystem::GetInstance();
56 SysTryReturn(NID_UI, __pCoordinateSystemInstance, null, E_SYSTEM, "[E_SYSTEM] Coordinate system instance must not be null.");
59 _ICoordinateSystemTransformer* pInverseTransform= __pCoordinateSystemInstance->GetInverseTransformer();
60 SysTryReturn(NID_UI, pInverseTransform, null, E_SYSTEM, "[E_SYSTEM] The valid coordinate inverse transformer does not exist.");
62 return pInverseTransform;
66 // Transform Utilities
68 _CoordinateSystemUtils::Transform(const Rectangle& rect)
70 return GetTransformer()->Transform(rect);
74 _CoordinateSystemUtils::Transform(const Point& point, const Dimension& dim)
76 return GetTransformer()->Transform(Rectangle(point, dim));
80 _CoordinateSystemUtils::Transform(const Dimension& dim)
82 return GetTransformer()->Transform(dim);
86 _CoordinateSystemUtils::Transform(const Point& point)
88 return GetTransformer()->Transform(point);
92 _CoordinateSystemUtils::HorizontalTransform(int scalar)
94 return GetTransformer()->TransformHorizontal(scalar);
98 _CoordinateSystemUtils::VerticalTransform(int scalar)
100 return GetTransformer()->TransformVertical(scalar);
104 // InverseTransform Utilities
106 _CoordinateSystemUtils::InverseTransform(const Rectangle& rect)
108 return GetInverseTransformer()->Transform(rect);
112 _CoordinateSystemUtils::InverseTransform(const Point& point, const Dimension& dim)
114 return GetInverseTransformer()->Transform(Rectangle(point, dim));
118 _CoordinateSystemUtils::InverseTransform(const Dimension& dim)
120 return GetInverseTransformer()->Transform(dim);
124 _CoordinateSystemUtils::InverseTransform(const Point& point)
126 return GetInverseTransformer()->Transform(point);
130 _CoordinateSystemUtils::InverseHorizontalTransform(int scalar)
132 return GetInverseTransformer()->TransformHorizontal(scalar);
136 _CoordinateSystemUtils::InverseVerticalTransform(int scalar)
138 return GetInverseTransformer()->TransformVertical(scalar);