mapnik/src/simplify.cpp
Mathis Logemann e7c3d04309 format dir include and src
format all files

Revert "format all files"

This reverts commit 95d5812e49e7f916b68e786596f5a8eb5bcac414.

Revert "format some files"

This reverts commit ed3c8762d4d828b2b28e7b18809fc33f4f8ccaf5.

format all files

fix formatting in dir include

fix formatting of debug macro
2022-01-27 00:12:08 +01:00

41 lines
1.3 KiB
C++

// mapnik
#include <mapnik/simplify.hpp>
#include <mapnik/warning.hpp>
MAPNIK_DISABLE_WARNING_PUSH
#include <mapnik/warning_ignore.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/bimap.hpp>
MAPNIK_DISABLE_WARNING_POP
namespace mapnik {
using simplify_algorithm_lookup_type = boost::bimap<simplify_algorithm_e, std::string>;
static const simplify_algorithm_lookup_type simplify_lookup =
boost::assign::list_of<simplify_algorithm_lookup_type::relation>(radial_distance, "radial-distance")(
douglas_peucker,
"douglas-peucker")(visvalingam_whyatt, "visvalingam-whyatt")(zhao_saalfeld, "zhao-saalfeld");
boost::optional<simplify_algorithm_e> simplify_algorithm_from_string(std::string const& name)
{
boost::optional<simplify_algorithm_e> algo;
simplify_algorithm_lookup_type::right_const_iterator right_iter = simplify_lookup.right.find(name);
if (right_iter != simplify_lookup.right.end())
{
algo.reset(right_iter->second);
}
return algo;
}
boost::optional<std::string> simplify_algorithm_to_string(simplify_algorithm_e value)
{
boost::optional<std::string> algo;
simplify_algorithm_lookup_type::left_const_iterator left_iter = simplify_lookup.left.find(value);
if (left_iter != simplify_lookup.left.end())
{
algo.reset(left_iter->second);
}
return algo;
}
} // namespace mapnik