Opened 6 years ago

Closed 6 years ago

#12410 closed Feature Requests (fixed)

boost::geometry::correct on a polygon in a geographic cs doesn't work

Reported by: andydev2k2k@… Owned by: Barend Gehrels
Milestone: Boost 1.64.0 Component: geometry
Version: Boost 1.61.0 Severity: Showstopper
Keywords: area, correct, geographic Cc:

Description

It doesn't compile. See this simple example (and yes, I know the polygon is empty. That doesn't matter)

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/geometries.hpp>

int main()
{
	typedef boost::geometry::model::polygon
		<
		boost::geometry::model::point<double, 2, boost::geometry::cs::geographic<boost::geometry::degree>>
		> polygon_t;

	polygon_t poly;

	boost::geometry::correct( poly );

	return 0;
}

Compiler output :

1>------ Build started: Project: boostscratch10, Configuration: Debug Win32 ------ 1> main.cpp 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\area.hpp(41): error C2664: 'int boost::mpl::assertion_failed<false>(boost::mpl::assert<false>::type)': cannot convert argument 1 from 'boost::mpl::failed (thiscall boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag,boost::geometry::model::point<double,2,boost::geometry::cs::geographic<boost::geometry::degree>>>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::* *)(boost::mpl::assert_::types<PointOfSegment,boost::mpl::na,boost::mpl::na,boost::mpl::na>)' to 'boost::mpl::assert<false>::type' 1> with 1> [ 1> PointOfSegment=boost::geometry::model::point<double,2,boost::geometry::cs::geographic<boost::geometry::degree>> 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\area.hpp(41): note: No constructor could take the source type, or constructor overload resolution was ambiguous 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(42): note: see reference to class template instantiation 'boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag,boost::geometry::model::point<double,2,boost::geometry::cs::geographic<boost::geometry::degree>>>' being compiled 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(177): note: see reference to class template instantiation 'boost::geometry::default_area_result<Polygon>' being compiled 1> with 1> [ 1> Polygon=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(247): note: see reference to class template instantiation 'boost::geometry::detail::correct::correct_polygon<Polygon>' being compiled 1> with 1> [ 1> Polygon=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(287): note: see reference to class template instantiation 'boost::geometry::dispatch::correct<Geometry,boost::geometry::polygon_tag>' being compiled 1> with 1> [ 1> Geometry=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(285): note: while compiling class template member function 'void boost::geometry::resolve_variant::correct<Geometry>::apply(Geometry &)' 1> with 1> [ 1> Geometry=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(328): note: see reference to function template instantiation 'void boost::geometry::resolve_variant::correct<Geometry>::apply(Geometry &)' being compiled 1> with 1> [ 1> Geometry=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(328): note: see reference to class template instantiation 'boost::geometry::resolve_variant::correct<Geometry>' being compiled 1> with 1> [ 1> Geometry=polygon_t 1> ] 1> c:\users\sesa408586\documents\visual studio 2015\projects\boostscratch10\main.cpp(14): note: see reference to function template instantiation 'void boost::geometry::correct<polygon_t>(Geometry &)' being compiled 1> with 1> [ 1> Geometry=polygon_t 1> ] 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(42): error C2039: 'type': is not a member of 'boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag,boost::geometry::model::point<double,2,boost::geometry::cs::geographic<boost::geometry::degree>>>' 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(38): note: see declaration of 'boost::geometry::strategy::area::services::default_strategy<boost::geometry::geographic_tag,boost::geometry::model::point<double,2,boost::geometry::cs::geographic<boost::geometry::degree>>>' 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(44): error C2955: 'boost::type': use of class template requires template argument list 1> d:\boost_1_61_0\boost_1_61_0\boost\type.hpp(14): note: see declaration of 'boost::type' 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(44): error C2039: 'return_type': is not a member of 'boost::type' 1> d:\boost_1_61_0\boost_1_61_0\boost\type.hpp(14): note: see declaration of 'boost::type' 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(44): error C3646: 'type': unknown override specifier 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\strategies\default_area_result.hpp(44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(177): error C2039: 'type': is not a member of 'boost::geometry::default_area_result<Polygon>' 1> with 1> [ 1> Polygon=polygon_t 1> ] 1> d:\boost_1_61_0\boost_1_61_0\boost\geometry\algorithms\correct.hpp(177): note: see declaration of 'boost::geometry::default_area_result<Polygon>' 1> with 1> [ 1> Polygon=polygon_t 1> ] ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Change History (1)

comment:1 by awulkiew, 6 years ago

Keywords: area correct geographic added
Milestone: To Be DeterminedBoost 1.64.0
Resolution: fixed
Status: newclosed
Type: BugsFeature Requests

Added support for geographic CS in area() fixes compilation error in correct():

https://github.com/boostorg/geometry/pull/359

Note: See TracTickets for help on using tickets.