| Home | Libraries | People | FAQ | More

#### strategy::buffer::end_flat

Let the buffer create flat ends.

###### Description

This strategy can be used as EndStrategy for the buffer algorithm. It creates a flat end for each linestring-end. It can be applied for (multi)linestrings. Also it is applicable for spikes in (multi)polygons. This strategy is only applicable for Cartesian coordinate systems.

###### Synopsis

    class strategy::buffer::end_flat
    {
      // ...
    };

###### Header

`#include <boost/geometry/strategies/cartesian/buffer_end_flat.hpp>`

###### Example

Shows how the end_flat strategy can be used as a EndStrategy to create flat ends

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

    int main()
    {
        using point = boost::geometry::model::d2::point_xy<double>;
        using linestring = boost::geometry::model::linestring<point>;
        using polygon = boost::geometry::model::polygon<point>;

        // Declare the flat-end strategy
        boost::geometry::strategy::buffer::end_flat end_strategy;

        // Declare other strategies
        boost::geometry::strategy::buffer::distance_symmetric<double> distance_strategy(1.0);
        boost::geometry::strategy::buffer::side_straight side_strategy;
        boost::geometry::strategy::buffer::join_round join_strategy;
        boost::geometry::strategy::buffer::point_circle point_strategy;

        // Declare/fill a multi linestring
        boost::geometry::model::multi_linestring<linestring> ml;
        boost::geometry::read_wkt("MULTILINESTRING((3 5,5 10,7 5),(7 7,11 10,15 7,19 10))", ml);

        // Create the buffered geometry with flat ends
        boost::geometry::model::multi_polygon<polygon> result;
        boost::geometry::buffer(ml, result,
                    distance_strategy, side_strategy,
                    join_strategy, end_strategy, point_strategy);

        return 0;
    }

###### Output

###### See also

- buffer (with strategies)
- end_round