[dali_2.2.12] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / algorithm / path-finder-waypoint.cpp
1 /*
2  * Copyright (c) 2023 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 // CLASS HEADER
18 #include <dali-scene3d/public-api/algorithm/path-finder-waypoint.h>
19
20 // INTERNAL INCLUDES
21 #include <dali-scene3d/internal/algorithm/navigation-mesh-impl.h>
22 #include <dali-scene3d/internal/algorithm/path-finder-waypoint-data.h>
23
24 // EXTERNAL INCLUDES
25 #include <cinttypes>
26
27 namespace Dali::Scene3D::Algorithm
28 {
29
30 WayPoint::WayPoint()
31 {
32   mImpl = std::make_unique<Scene3D::Internal::Algorithm::WayPointData>();
33 }
34
35 WayPoint::~WayPoint() = default;
36
37 uint32_t WayPoint::GetNavigationMeshFaceIndex() const
38 {
39   return mImpl->nodeIndex;
40 }
41
42 Dali::Vector2 WayPoint::GetFaceLocalSpacePosition() const
43 {
44   return mImpl->point2d;
45 }
46
47 Dali::Vector3 WayPoint::GetScenePosition() const
48 {
49   return mImpl->point3d;
50 }
51
52 WayPoint::WayPoint(const WayPoint& wp)
53 {
54   mImpl = std::make_unique<Internal::Algorithm::WayPointData>();
55   *mImpl = *wp.mImpl;
56 }
57
58 WayPoint& WayPoint::operator=(const WayPoint& wp)
59 {
60   mImpl = std::make_unique<Internal::Algorithm::WayPointData>();
61   *mImpl = *wp.mImpl;
62   return *this;
63 }
64
65 WayPoint::operator Internal::Algorithm::WayPointData&()
66 {
67   return *mImpl;
68 }
69
70 }