int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon polygon;
// Polygon
{
polygon my_polygon;
boost::geometry::read_wkt("POLYGON ((0 0,0 5,4 5,4 4,3 3,2 4,2 1,3 2,4 1,4 0,0 0))", my_polygon);
boost::geometry::model::multi_polygon<polygon> my_output;
boost::geometry::buffer_inserter<polygon>
(
my_polygon,
std::back_inserter(my_output),
boost::geometry::strategy::buffer::distance_assymetric<double>(0.4, 0.4),
boost::geometry::strategy::buffer::join_round()
);
std::cout << "Input polygon, area: " << boost::geometry::area(my_polygon) << std::endl;
std::cout << "Output, area: " << boost::geometry::area(my_output) << std::endl;
}
return 0;
}
Barend,
When I compile your example, I get errors from MSVC++ 2010. I have the latest extensions, but I am using them with the 1.52 release; will that cause problems?
John
1>------ Build started: Project: etl6_EngCore, Configuration: Debug x64 ------
1> DL_GeometryBasics.cpp
1>F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1112): warning C4267: 'initializing' : conversion from 'size_t' to 'const int', possible loss of data
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1111) : while compiling class template member function 'void boost::geometry::detail::buffer::buffered_piece_collection<Ring>::start_new_ring(void)'
1> with
1> [
1> Ring=boost::geometry::model::ring
1> ]
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp(357) : see reference to class template instantiation 'boost::geometry::detail::buffer::buffered_piece_collection<Ring>' being compiled
1> with
1> [
1> Ring=boost::geometry::model::ring
1> ]
1> DL_GeometryBasics.cpp(34) : see reference to function template instantiation 'void boost::geometry::buffer_inserter,boost::geometry::strategy::buffer::distance_assymetric<CoordinateType>,boost::geometry::strategy::buffer::join_round>(const GeometryInput &,OutputIterator,const DistanceStrategy &,const JoinStrategy &)' being compiled
1> with
1> [
1> _Container=boost::geometry::model::multi_polygon<polygon>,
1> CoordinateType=double,
1> PointIn=point_type,
1> PointOut=point_type,
1> GeometryInput=polygon,
1> OutputIterator=std::back_insert_iterator,
1> DistanceStrategy=boost::geometry::strategy::buffer::distance_assymetric<double>,
1> JoinStrategy=boost::geometry::strategy::buffer::join_round
1> ]
1>F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(577): warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(567) : while compiling class template member function 'int boost::geometry::detail::buffer::buffered_piece_collection<Ring>::piece_count(const boost::geometry::detail::buffer::buffered_piece_collection<Ring>::buffer_occupation_info &)'
1> with
1> [
1> Ring=boost::geometry::model::ring
1> ]
1>F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1130): warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1122) : while compiling class template member function 'int boost::geometry::detail::buffer::buffered_piece_collection<Ring>::add_point(const boost::geometry::model::d2::point_xy<CoordinateType> &)'
1> with
1> [
1> Ring=boost::geometry::model::ring,
1> CoordinateType=double
1> ]
1>F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1141): warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1134) : while compiling class template member function 'boost::geometry::detail::buffer::buffered_piece_collection<Ring>::piece &boost::geometry::detail::buffer::buffered_piece_collection<Ring>::add_piece(boost::geometry::detail::buffer::piece_type,bool)'
1> with
1> [
1> Ring=boost::geometry::model::ring
1> ]
1>F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp(1177): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp(192) : see reference to function template instantiation 'boost::geometry::detail::buffer::buffered_piece_collection<Ring>::piece &boost::geometry::detail::buffer::buffered_piece_collection<Ring>::add_piece>(boost::geometry::detail::buffer::piece_type,const Range &)' being compiled
1> with
1> [
1> Ring=boost::geometry::model::ring,
1> _Ty=point_type,
1> _Ax=std::allocator,
1> Range=std::vector>
1> ]
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp(246) : see reference to function template instantiation 'void boost::geometry::detail::buffer::buffer_range::iterate,DistanceStrategy,JoinStrategy>(Collection &,Iterator,Iterator,boost::geometry::buffer_side_selector,const DistanceStrategy &,const JoinStrategy &,bool)' being compiled
1> with
1> [
1> RingOutput=output_ring_type,
1> Tag=boost::geometry::ring_tag,
1> Collection=boost::geometry::detail::buffer::buffered_piece_collection>,
1> _Myvec=std::_Vector_val>,
1> DistanceStrategy=boost::geometry::strategy::buffer::distance_assymetric<double>,
1> JoinStrategy=boost::geometry::strategy::buffer::join_round,
1> Iterator=std::_Vector_const_iterator>>
1> ]
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp(313) : see reference to function template instantiation 'void boost::geometry::dispatch::buffer_inserter::apply(const RingInput &,Collection &,const DistanceStrategy &,const JoinStrategy &)' being compiled
1> with
1> [
1> Tag=boost::geometry::ring_tag,
1> RingInput=input_ring_type,
1> RingOutput=output_ring_type,
1> Collection=boost::geometry::detail::buffer::buffered_piece_collection>,
1> DistanceStrategy=boost::geometry::strategy::buffer::distance_assymetric<double>,
1> JoinStrategy=boost::geometry::strategy::buffer::join_round
1> ]
1> F:\DataManagement\RPDM\Server\libraries\boost\boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp(364) : see reference to function template instantiation 'void boost::geometry::dispatch::buffer_inserter::apply(const PolygonInput &,Collection &,const DistanceStrategy &,const JoinStrategy &)' being compiled
1> with
1> [
1> Tag=boost::geometry::polygon_tag,
1> RingInput=polygon,
1> RingOutput=polygon,
1> Ring=boost::geometry::model::ring,
1> DistanceStrategy=boost::geometry::strategy::buffer::distance_assymetric<double>,
1> JoinStrategy=boost::geometry::strategy::buffer::join_round,
1> PolygonInput=polygon,
1> Collection=boost::geometry::detail::buffer::buffered_piece_collection>
1> ]
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========