index.hpp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // Boost.Geometry Index
  2. //
  3. // R-tree strategies
  4. //
  5. // Copyright (c) 2019, Oracle and/or its affiliates.
  6. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  7. //
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_INDEX_HPP
  12. #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_INDEX_HPP
  13. #include <boost/geometry/strategies/cartesian/box_in_box.hpp>
  14. #include <boost/geometry/strategies/cartesian/disjoint_box_box.hpp>
  15. //#include <boost/geometry/strategies/cartesian/disjoint_segment_box.hpp>
  16. #include <boost/geometry/strategies/cartesian/distance_projected_point.hpp>
  17. #include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
  18. #include <boost/geometry/strategies/cartesian/distance_pythagoras_point_box.hpp>
  19. #include <boost/geometry/strategies/cartesian/distance_segment_box.hpp>
  20. #include <boost/geometry/strategies/cartesian/envelope_box.hpp>
  21. #include <boost/geometry/strategies/cartesian/envelope_point.hpp>
  22. #include <boost/geometry/strategies/cartesian/envelope_segment.hpp>
  23. #include <boost/geometry/strategies/cartesian/expand_box.hpp>
  24. #include <boost/geometry/strategies/cartesian/expand_point.hpp>
  25. #include <boost/geometry/strategies/cartesian/expand_segment.hpp>
  26. #include <boost/geometry/strategies/cartesian/intersection.hpp>
  27. #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
  28. #include <boost/geometry/strategies/cartesian/point_in_point.hpp>
  29. #include <boost/geometry/strategies/cartesian/point_in_poly_winding.hpp>
  30. #include <boost/geometry/strategies/index.hpp>
  31. namespace boost { namespace geometry { namespace strategy { namespace index
  32. {
  33. template
  34. <
  35. typename CalculationType = void
  36. >
  37. struct cartesian
  38. {
  39. typedef cartesian_tag cs_tag;
  40. typedef geometry::strategy::envelope::cartesian_point envelope_point_strategy_type;
  41. typedef geometry::strategy::envelope::cartesian_box envelope_box_strategy_type;
  42. typedef geometry::strategy::envelope::cartesian_segment
  43. <
  44. CalculationType
  45. > envelope_segment_strategy_type;
  46. static inline envelope_segment_strategy_type get_envelope_segment_strategy()
  47. {
  48. return envelope_segment_strategy_type();
  49. }
  50. typedef geometry::strategy::expand::cartesian_point expand_point_strategy_type;
  51. typedef geometry::strategy::expand::cartesian_box expand_box_strategy_type;
  52. typedef geometry::strategy::expand::cartesian_segment expand_segment_strategy_type;
  53. static inline expand_segment_strategy_type get_expand_segment_strategy()
  54. {
  55. return expand_segment_strategy_type();
  56. }
  57. typedef geometry::strategy::covered_by::cartesian_point_box covered_by_point_box_strategy_type;
  58. typedef geometry::strategy::covered_by::cartesian_box_box covered_by_box_box_strategy_type;
  59. typedef geometry::strategy::within::cartesian_point_point within_point_point_strategy_type;
  60. /*
  61. typedef geometry::strategy::within::cartesian_point_box within_point_box_strategy_type;
  62. typedef geometry::strategy::within::cartesian_box_box within_box_box_strategy_type;
  63. typedef geometry::strategy::within::cartesian_winding
  64. <
  65. void, void, CalculationType
  66. > within_point_segment_strategy_type;
  67. static inline within_point_segment_strategy_type get_within_point_segment_strategy()
  68. {
  69. return within_point_segment_strategy_type();
  70. }
  71. */
  72. // used in equals(Seg, Seg) but only to get_point_in_point_strategy()
  73. typedef geometry::strategy::intersection::cartesian_segments
  74. <
  75. CalculationType
  76. > relate_segment_segment_strategy_type;
  77. static inline relate_segment_segment_strategy_type get_relate_segment_segment_strategy()
  78. {
  79. return relate_segment_segment_strategy_type();
  80. }
  81. // used in intersection_content
  82. typedef geometry::strategy::disjoint::cartesian_box_box disjoint_box_box_strategy_type;
  83. typedef geometry::strategy::distance::comparable::pythagoras
  84. <
  85. CalculationType
  86. > comparable_distance_point_point_strategy_type;
  87. static inline comparable_distance_point_point_strategy_type get_comparable_distance_point_point_strategy()
  88. {
  89. return comparable_distance_point_point_strategy_type();
  90. }
  91. typedef geometry::strategy::distance::comparable::pythagoras_point_box
  92. <
  93. CalculationType
  94. > comparable_distance_point_box_strategy_type;
  95. static inline comparable_distance_point_box_strategy_type get_comparable_distance_point_box_strategy()
  96. {
  97. return comparable_distance_point_box_strategy_type();
  98. }
  99. // TODO: comparable version should be possible
  100. typedef geometry::strategy::distance::projected_point
  101. <
  102. CalculationType,
  103. geometry::strategy::distance::pythagoras<CalculationType>
  104. > comparable_distance_point_segment_strategy_type;
  105. static inline comparable_distance_point_segment_strategy_type get_comparable_distance_point_segment_strategy()
  106. {
  107. return comparable_distance_point_segment_strategy_type();
  108. }
  109. typedef geometry::strategy::distance::cartesian_segment_box
  110. <
  111. CalculationType,
  112. geometry::strategy::distance::pythagoras<CalculationType>
  113. > comparable_distance_segment_box_strategy_type;
  114. static inline comparable_distance_segment_box_strategy_type get_comparable_distance_segment_box_strategy()
  115. {
  116. return comparable_distance_segment_box_strategy_type();
  117. }
  118. };
  119. namespace services
  120. {
  121. template <typename Geometry>
  122. struct default_strategy<Geometry, cartesian_tag>
  123. {
  124. typedef cartesian<> type;
  125. };
  126. // within and relate (MPt, Mls/MPoly)
  127. template <typename Point1, typename Point2, typename CalculationType>
  128. struct from_strategy<within::cartesian_winding<Point1, Point2, CalculationType> >
  129. {
  130. typedef strategy::index::cartesian<CalculationType> type;
  131. static inline type get(within::cartesian_winding<Point1, Point2, CalculationType> const&)
  132. {
  133. return type();
  134. }
  135. };
  136. // distance (MPt, MPt)
  137. template <typename CalculationType>
  138. struct from_strategy<distance::comparable::pythagoras<CalculationType> >
  139. {
  140. typedef strategy::index::cartesian<CalculationType> type;
  141. static inline type get(distance::comparable::pythagoras<CalculationType> const&)
  142. {
  143. return type();
  144. }
  145. };
  146. // distance (MPt, Linear/Areal)
  147. template <typename CalculationType, typename PPStrategy>
  148. struct from_strategy<distance::projected_point<CalculationType, PPStrategy> >
  149. {
  150. typedef strategy::index::cartesian<CalculationType> type;
  151. static inline type get(distance::projected_point<CalculationType, PPStrategy> const&)
  152. {
  153. return type();
  154. }
  155. };
  156. } // namespace services
  157. }}}} // namespace boost::geometry::strategy::index
  158. #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_INDEX_HPP