378d822fb345c24c95d0410c4cba4fa894b19f75
[platform/core/api/maps-service.git] / src / view / poly_shape_hit_test.h
1 /* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__
17 #define __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__
18
19
20 #include <maps_util.h>
21
22
23 namespace view
24 {
25         class poly_shape_hit_test {
26         private:
27                 vector<float> __x;
28                 vector<float> __y;
29                 float accuracy;
30         public:
31                 poly_shape_hit_test() : accuracy(10.) {}
32         public:
33                 void add_point(const float x, const float y);
34                 bool hit_test(const float x, const float y, const bool polygon, const int w = 0) const;
35         protected:
36                 bool hit_test_bounding_box(const float x, const float y) const;
37                 bool hit_test_polyline(const float x, const float y, const bool polygon, const int w) const;
38                 bool hit_test_segment(const float x1, const float y1, const float x2, const float y2,
39                         const float x, const float y, const int w = 0) const;
40                 bool hit_test_vertices(const float x, const float y) const;
41                 bool pnpoly(const float x, const float y) const;
42         };
43 };
44
45 #endif                          /* __MAPS_VIEW_POLY_SHAPE_HIT_TEST_H__ */