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