diff --git a/include/boost/geometry/strategies/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/distance_cross_track_box_box.hpp index cc2003623..60016c748 100644 --- a/include/boost/geometry/strategies/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/distance_cross_track_box_box.hpp @@ -39,10 +39,6 @@ public : typedef typename point_type::type box_point_type1; typedef typename point_type::type box_point_type2; - // TODO: This strategy as well as other cross-track strategies - // and therefore e.g. spherical within(Point, Box) may not work - // properly for a Box degenerated to a Segment or Point - box_point_type1 bottom_left1, bottom_right1, top_left1, top_right1; geometry::detail::assign_box_corners(box1, bottom_left1, bottom_right1, @@ -71,7 +67,9 @@ public : if (lon_min2 > 0 && lon_max2 < 0) // box2 crosses antimeridian { - //std::cout << "(box2 crosses antimeridian)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(box2 crosses antimeridian)"; +#endif right_wrap = lon_min2 - lon_max1 < lon_min1 - lon_max2; lon_max2 += two_pi; if (lon_min1 > 0 && lon_max1 < 0) // both boxes crosses antimeridian @@ -81,8 +79,9 @@ public : } else if (lon_min1 > 0 && lon_max1 < 0) // only box1 crosses antimeridian { - //std::cout << "(box1 crosses antimeridian)"; - //right_wrap = lon_min1 - lon_max2 > lon_min2 - lon_max1; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(box1 crosses antimeridian)"; +#endif return apply(box2, box1, ps_strategy); } else @@ -107,7 +106,9 @@ public : || (!left && !lon_max12) || (!lon_min12 && lon_max12)) { - //std::cout << "(up-down)\n"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(up-down)\n"; +#endif if (lat_min1 > lat_max2) { return geometry::strategy::distance::services::result_from_distance @@ -132,7 +133,6 @@ public : } // Check2: if box2 is right/left of box1 - // the max lat of box2 should be less than the max lat of box1 bool bottom_max; @@ -153,10 +153,14 @@ public : bottom_max = lat_min1 <= lat_min2; } - //std::cout << "(diagonal)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(diagonal)"; +#endif if (bottom_max && !right_wrap) { - //std::cout << "(bottom left)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(bottom left)"; +#endif if (north_shortest) { return ps_strategy.apply(top_right2, top_left1, bottom_left1); @@ -165,7 +169,9 @@ public : } if (bottom_max && right_wrap) { - //std::cout << "(bottom right)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(bottom right)"; +#endif if (north_shortest) { return ps_strategy.apply(top_left2, top_right1, bottom_right1); @@ -174,7 +180,9 @@ public : } if (!bottom_max && !right_wrap) { - //std::cout << "(top left)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(top left)"; +#endif if (north_shortest) { return ps_strategy.apply(top_left1, top_right2, bottom_right2); @@ -183,7 +191,9 @@ public : } if (!bottom_max && right_wrap) { - //std::cout << "(top right)"; +#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK_BOX_BOX + std::cout << "(top right)"; +#endif if (north_shortest) { return ps_strategy.apply(top_right1, top_left2, bottom_left2); diff --git a/include/boost/geometry/strategies/distance_cross_track_point_box.hpp b/include/boost/geometry/strategies/distance_cross_track_point_box.hpp index 6485204c6..190ce665d 100644 --- a/include/boost/geometry/strategies/distance_cross_track_point_box.hpp +++ b/include/boost/geometry/strategies/distance_cross_track_point_box.hpp @@ -40,10 +40,6 @@ public : typedef typename point_type::type box_point_type; - // TODO: This strategy as well as other cross-track strategies - // and therefore e.g. spherical within(Point, Box) may not work - // properly for a Box degenerated to a Segment or Point - box_point_type bottom_left, bottom_right, top_left, top_right; geometry::detail::assign_box_corners(box, bottom_left, bottom_right, @@ -75,25 +71,16 @@ public : { if (plat > lat_max) { - //std::cout << "plat=" << plat << std::endl; - //std::cout << "lat_max=" << lat_max << std::endl; - //std::cout << "radius=" << ps_strategy.get_distance_strategy().radius() << std::endl; - //std::cout << "r1=" << ps_strategy.get_distance_strategy().radius() * (plat - lat_max) << std::endl; - //std::cout << "r2=" << ps_strategy.get_distance_strategy().meridian(plat, lat_max) << std::endl; return geometry::strategy::distance::services::result_from_distance < - Strategy, Point, box_point_type - //>::apply(ps_strategy, ps_strategy.get_distance_strategy().radius() * (plat - lat_max)); + Strategy, Point, box_point_type >::apply(ps_strategy, ps_strategy.get_distance_strategy().meridian(plat, lat_max)); - //get_strategy(ps_strategy) --> haversine - //haversine special case for vertical distance } else if (plat < lat_min) { return geometry::strategy::distance::services::result_from_distance < - Strategy, Point, box_point_type - //>::apply(ps_strategy, ps_strategy.radius() * (lat_min - plat)); + Strategy, Point, box_point_type >::apply(ps_strategy, ps_strategy.get_distance_strategy().meridian(lat_min, plat)); } else diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp index 241ca5ede..1519b617c 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp @@ -56,7 +56,6 @@ to cross track template < typename FormulaPolicy = strategy::andoyer, - //typename Strategy = geographic_cross_track<>, typename Spheroid = srs::spheroid, typename CalculationType = void > @@ -185,34 +184,6 @@ public: } }; -/* -// define cross_track_box_box as -// default box-box strategy for the geographic coordinate system -template -struct default_strategy - < - box_tag, box_tag, Box1, Box2, - geographic_tag, geographic_tag, - Strategy - > -{ - typedef geographic_cross_track_box_box - < - typename boost::mpl::if_ - < - boost::is_void, - typename default_strategy - < - point_tag, segment_tag, - typename point_type::type, typename point_type::type, - geographic_tag, geographic_tag - >::type, - Strategy - >::type - > type; -}; -*/ - template struct default_strategy < diff --git a/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp b/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp index 8a00ff407..70a6bf4d4 100644 --- a/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp +++ b/include/boost/geometry/strategies/geographic/distance_cross_track_point_box.hpp @@ -22,9 +22,6 @@ #include #include -//#include -//#include - #include #include #include @@ -58,7 +55,6 @@ to cross track template < typename FormulaPolicy = strategy::andoyer, - //typename Strategy = geographic_cross_track<>, typename Spheroid = srs::spheroid, typename CalculationType = void > @@ -187,34 +183,6 @@ public: } }; -/* -// define cross_track_point_box as -// default point-box strategy for geographic coordinate system -template -struct default_strategy - < - point_tag, box_tag, Point, Box, - geographic_tag, geographic_tag, - Strategy - > -{ - typedef geographic_cross_track_point_box - < - typename boost::mpl::if_ - < - boost::is_void, - typename default_strategy - < - point_tag, segment_tag, - Point, typename point_type::type, - geographic_tag, geographic_tag - >::type, - Strategy - >::type - > type; -}; -*/ - template struct default_strategy < @@ -238,23 +206,6 @@ struct default_strategy geographic_tag, geographic_tag >::type type; }; -/* -template -struct default_strategy - < - box_tag, point_tag, Box, Point, - geographic_tag, geographic_tag, - Strategy - > -{ - typedef typename default_strategy - < - point_tag, box_tag, Point, Box, - geographic_tag, geographic_tag, - Strategy - >::type type; -}; -*/ } // namespace services #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS diff --git a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp index c51c75dff..c3b638e8c 100644 --- a/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp +++ b/include/boost/geometry/strategies/spherical/distance_cross_track_box_box.hpp @@ -53,8 +53,7 @@ to cross track template < typename CalculationType = void, - typename Strategy = cross_track -// typename Strategy = haversine + typename Strategy = cross_track > class cross_track_box_box { diff --git a/test/algorithms/distance/distance_geo_pl_l.cpp b/test/algorithms/distance/distance_geo_pl_l.cpp index b7417bf57..ff614b1ba 100644 --- a/test/algorithms/distance/distance_geo_pl_l.cpp +++ b/test/algorithms/distance/distance_geo_pl_l.cpp @@ -683,7 +683,7 @@ BOOST_AUTO_TEST_CASE( test_all_point_segment ) test_distance_point_multilinestring(thomas_pp(), thomas_strategy()); test_distance_point_multilinestring(andoyer_pp(), andoyer_strategy()); - // test_distance_linestring_multipoint(vincenty_pp(), vincenty_strategy()); + //test_distance_linestring_multipoint(vincenty_pp(), vincenty_strategy()); // test_distance_linestring_multipoint(thomas_pp(), thomas_strategy()); // test_distance_linestring_multipoint(andoyer_pp(), andoyer_strategy());