fix handling of all sym enums as expressions - fixes tests from #2328

This commit is contained in:
Dane Springmeyer 2014-08-03 21:28:19 -07:00
parent 532c03552d
commit 9f05389754
12 changed files with 47 additions and 105 deletions

View file

@ -22,7 +22,7 @@
#include <boost/python.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include "mapnik_enumeration.hpp"
void export_gamma_method()

View file

@ -24,7 +24,7 @@
#define MAPNIK_AGG_HELPERS_HPP
// mapnik
#include <mapnik/gamma_method.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
// agg
#include "agg_gamma_functions.h"

View file

@ -34,7 +34,7 @@
#include <mapnik/image_compositing.hpp> // for composite_mode_e
#include <mapnik/pixel_position.hpp>
#include <mapnik/request.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/renderer_common.hpp>
#include <mapnik/image_data.hpp>
// boost

View file

@ -1,43 +0,0 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2012 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
#ifndef MAPNIK_GAMMA_METHOD_HPP
#define MAPNIK_GAMMA_METHOD_HPP
#include <mapnik/enumeration.hpp>
namespace mapnik {
enum gamma_method_enum {
GAMMA_POWER, //agg::gamma_power
GAMMA_LINEAR, //agg::gamma_linear
GAMMA_NONE, //agg::gamma_none
GAMMA_THRESHOLD, //agg::gamma_threshold
GAMMA_MULTIPLY, //agg::gamma_multiply
gamma_method_enum_MAX
};
DEFINE_ENUM (gamma_method_e, gamma_method_enum );
}
#endif // MAPNIK_GAMMA_METHOD_HPP

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/image_scaling.hpp>
#include <mapnik/image_compositing.hpp>
#include <mapnik/simplify.hpp>
#include <mapnik/expression.hpp>
@ -38,7 +39,6 @@
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/group/group_symbolizer_properties.hpp>
#include <mapnik/attribute.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/symbolizer_enumerations.hpp>
#include <mapnik/util/dasharray_parser.hpp>
@ -185,14 +185,7 @@ struct evaluate_path_wrapper<std::string>
namespace detail {
template <typename T>
struct enum_traits
{
using result_type = boost::optional<T>;
static result_type from_string(std::string const& str)
{
return result_type();
}
};
struct enum_traits {};
template <>
struct enum_traits<composite_mode_e>
@ -204,6 +197,16 @@ struct enum_traits<composite_mode_e>
}
};
template <>
struct enum_traits<scaling_method_e>
{
using result_type = boost::optional<scaling_method_e>;
static result_type from_string(std::string const& str)
{
return scaling_method_from_string(str);
}
};
template <>
struct enum_traits<simplify_algorithm_e>
{
@ -232,16 +235,22 @@ template <> struct enum_traits<e> { \
} \
};\
ENUM_FROM_STRING( pattern_alignment_enum )
ENUM_FROM_STRING( line_join_enum )
ENUM_FROM_STRING( line_cap_enum )
ENUM_FROM_STRING( line_join_enum )
ENUM_FROM_STRING( point_placement_enum )
ENUM_FROM_STRING( marker_placement_enum )
ENUM_FROM_STRING( gamma_method_enum )
ENUM_FROM_STRING( line_rasterizer_enum )
ENUM_FROM_STRING( marker_placement_enum )
ENUM_FROM_STRING( marker_multi_policy_enum )
ENUM_FROM_STRING( debug_symbolizer_mode_enum )
ENUM_FROM_STRING( pattern_alignment_enum )
ENUM_FROM_STRING( halo_rasterizer_enum )
ENUM_FROM_STRING( label_placement_enum )
ENUM_FROM_STRING( vertical_alignment_enum )
ENUM_FROM_STRING( horizontal_alignment_enum )
ENUM_FROM_STRING( justify_alignment_enum )
ENUM_FROM_STRING( text_transform_enum )
ENUM_FROM_STRING( text_upright_enum )
ENUM_FROM_STRING( gamma_method_enum )
// enum
template <typename T, bool is_enum = true>

View file

@ -184,6 +184,17 @@ enum text_upright_enum
DEFINE_ENUM(text_upright_e, text_upright_enum);
enum gamma_method_enum {
GAMMA_POWER, //agg::gamma_power
GAMMA_LINEAR, //agg::gamma_linear
GAMMA_NONE, //agg::gamma_none
GAMMA_THRESHOLD, //agg::gamma_threshold
GAMMA_MULTIPLY, //agg::gamma_multiply
gamma_method_enum_MAX
};
DEFINE_ENUM (gamma_method_e, gamma_method_enum );
}

View file

@ -168,7 +168,6 @@ source = Split(
feature_type_style.cpp
font_engine_freetype.cpp
font_set.cpp
gamma_method.cpp
gradient.cpp
graphics.cpp
parse_path.cpp

View file

@ -1,41 +0,0 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
// mapnik
#include <mapnik/gamma_method.hpp>
#include <mapnik/enumeration.hpp>
namespace mapnik
{
static const char * gamma_method_strings[] = {
"power", //agg::gamma_power
"linear", //agg::gamma_linear
"none", //agg::gamma_none
"threshold", //agg::gamma_threshold
"multiply", //agg::gamma_multiply",
""
};
IMPLEMENT_ENUM( gamma_method_e, gamma_method_strings )
}

View file

@ -31,7 +31,6 @@
#include <mapnik/color_factory.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/symbolizer_utils.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/datasource_cache.hpp>

View file

@ -172,4 +172,15 @@ static const char * text_upright_strings[] = {
};
IMPLEMENT_ENUM(text_upright_e, text_upright_strings)
static const char * gamma_method_strings[] = {
"power", //agg::gamma_power
"linear", //agg::gamma_linear
"none", //agg::gamma_none
"threshold", //agg::gamma_threshold
"multiply", //agg::gamma_multiply",
""
};
IMPLEMENT_ENUM( gamma_method_e, gamma_method_strings )
} // namespace mapnik

View file

@ -22,7 +22,6 @@
#include <mapnik/symbolizer.hpp>
#include <mapnik/color.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/simplify.hpp>
// boost

View file

@ -27,13 +27,11 @@
#include <mapnik/util/conversions.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/color_factory.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/rule.hpp>
#include <mapnik/feature_type_style.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/config_error.hpp>
#include <mapnik/raster_colorizer.hpp>
#include <mapnik/expression.hpp>
// stl