Merge branch 'master' of github.com:mapnik/mapnik into feature_impl

This commit is contained in:
Dane Springmeyer 2012-01-19 12:55:20 -05:00
commit 0219d250e0
13 changed files with 70 additions and 112 deletions

View file

@ -80,7 +80,7 @@ struct polygon_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
p.set_alignment(extract<pattern_alignment_e>(state[0]));
p.set_gamma(extract<float>(state[1]));
p.set_gamma_method(extract<polygon_pattern_gamma_method_e>(state[2]));
p.set_gamma_method(extract<gamma_method_e>(state[2]));
}
};
@ -93,14 +93,7 @@ void export_polygon_pattern_symbolizer()
.value("LOCAL",LOCAL_ALIGNMENT)
.value("GLOBAL",GLOBAL_ALIGNMENT)
;
enumeration_<polygon_pattern_gamma_method_e>("gamma_method")
.value("POWER", POLYGON_PATTERN_GAMMA_POWER)
.value("LINEAR", POLYGON_PATTERN_GAMMA_LINEAR)
.value("NONE", POLYGON_PATTERN_GAMMA_NONE)
.value("THRESHOLD", POLYGON_PATTERN_GAMMA_THRESHOLD)
.value("MULTIPLY", POLYGON_PATTERN_GAMMA_MULTIPLY)
;
class_<polygon_pattern_symbolizer>("PolygonPatternSymbolizer",
init<path_expression_ptr>("<path_expression_ptr>"))
.def_pickle(polygon_pattern_symbolizer_pickle_suite())

View file

@ -58,7 +58,7 @@ struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
p.set_opacity(extract<float>(state[0]));
p.set_gamma(extract<float>(state[1]));
p.set_gamma_method(extract<polygon_gamma_method_e>(state[2]));
p.set_gamma_method(extract<gamma_method_e>(state[2]));
}
};
@ -66,15 +66,7 @@ struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
void export_polygon_symbolizer()
{
using namespace boost::python;
enumeration_<polygon_gamma_method_e>("gamma_method")
.value("POWER", POLYGON_GAMMA_POWER)
.value("LINEAR", POLYGON_GAMMA_LINEAR)
.value("NONE", POLYGON_GAMMA_NONE)
.value("THRESHOLD", POLYGON_GAMMA_THRESHOLD)
.value("MULTIPLY", POLYGON_GAMMA_MULTIPLY)
;
class_<polygon_symbolizer>("PolygonSymbolizer",
init<>("Default PolygonSymbolizer - solid fill grey"))
.def(init<color const&>("TODO"))

View file

@ -37,6 +37,7 @@ void export_geometry();
void export_palette();
void export_image();
void export_image_view();
void export_gamma_method();
void export_grid();
void export_grid_view();
void export_map();
@ -407,6 +408,7 @@ BOOST_PYTHON_MODULE(_mapnik)
export_palette();
export_image();
export_image_view();
export_gamma_method();
export_grid();
export_grid_view();
export_expression();

View file

@ -126,14 +126,7 @@ void export_stroke ()
.value("ROUND_JOIN",ROUND_JOIN)
.value("BEVEL_JOIN",BEVEL_JOIN)
;
enumeration_<gamma_method_e>("gamma_method")
.value("POWER", GAMMA_POWER)
.value("LINEAR", GAMMA_LINEAR)
.value("NONE", GAMMA_NONE)
.value("THRESHOLD", GAMMA_THRESHOLD)
.value("MULTIPLY", GAMMA_MULTIPLY)
;
class_<stroke>("Stroke",init<>(
"Creates a new default black stroke with the width of 1.\n"))
.def(init<color,float>(

View file

@ -26,6 +26,7 @@
// mapnik
#include <mapnik/symbolizer.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/gamma_method.hpp>
namespace mapnik
{
@ -38,17 +39,6 @@ enum pattern_alignment_enum {
DEFINE_ENUM( pattern_alignment_e, pattern_alignment_enum );
enum polygon_pattern_gamma_method_enum {
POLYGON_PATTERN_GAMMA_POWER, //agg::gamma_power
POLYGON_PATTERN_GAMMA_LINEAR, //agg::gamma_linear
POLYGON_PATTERN_GAMMA_NONE, //agg::gamma_none
POLYGON_PATTERN_GAMMA_THRESHOLD, //agg::gamma_threshold
POLYGON_PATTERN_GAMMA_MULTIPLY, //agg::gamma_multiply
polygon_pattern_gamma_method_enum_MAX
};
DEFINE_ENUM( polygon_pattern_gamma_method_e, polygon_pattern_gamma_method_enum );
struct MAPNIK_DECL polygon_pattern_symbolizer :
public symbolizer_with_image, public symbolizer_base
{
@ -58,13 +48,13 @@ struct MAPNIK_DECL polygon_pattern_symbolizer :
void set_alignment(pattern_alignment_e align);
void set_gamma(double gamma);
double get_gamma() const;
void set_gamma_method(polygon_pattern_gamma_method_e gamma_method);
polygon_pattern_gamma_method_e get_gamma_method() const;
void set_gamma_method(gamma_method_e gamma_method);
gamma_method_e get_gamma_method() const;
private:
pattern_alignment_e alignment_;
double gamma_;
polygon_pattern_gamma_method_e gamma_method_;
gamma_method_e gamma_method_;
};
}

View file

@ -28,44 +28,34 @@
#include <mapnik/symbolizer.hpp>
#include <mapnik/filter_factory.hpp>
#include <mapnik/enumeration.hpp>
#include <mapnik/gamma_method.hpp>
// stl
#include <string>
namespace mapnik
{
enum polygon_gamma_method_enum {
POLYGON_GAMMA_POWER, //agg::gamma_power
POLYGON_GAMMA_LINEAR, //agg::gamma_linear
POLYGON_GAMMA_NONE, //agg::gamma_none
POLYGON_GAMMA_THRESHOLD, //agg::gamma_threshold
POLYGON_GAMMA_MULTIPLY, //agg::gamma_multiply
polygon_gamma_method_enum_MAX
};
DEFINE_ENUM( polygon_gamma_method_e, polygon_gamma_method_enum );
struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base
{
explicit polygon_symbolizer()
polygon_symbolizer()
: symbolizer_base(),
fill_(color(128,128,128)),
opacity_(1.0),
gamma_(1.0),
gamma_method_(POLYGON_GAMMA_POWER) {}
gamma_method_(GAMMA_POWER) {}
polygon_symbolizer(color const& fill)
: symbolizer_base(),
fill_(fill),
opacity_(1.0),
gamma_(1.0),
gamma_method_(POLYGON_GAMMA_POWER) {}
gamma_method_(GAMMA_POWER) {}
color const& get_fill() const
{
return fill_;
}
void set_fill(color const& fill)
{
fill_ = fill;
@ -86,11 +76,11 @@ struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base
{
return gamma_;
}
void set_gamma_method(polygon_gamma_method_e gamma_method)
void set_gamma_method(gamma_method_e gamma_method)
{
gamma_method_ = gamma_method;
}
polygon_gamma_method_e get_gamma_method() const
gamma_method_e get_gamma_method() const
{
return gamma_method_;
}
@ -99,7 +89,7 @@ private:
color fill_;
double opacity_;
double gamma_;
polygon_gamma_method_e gamma_method_;
gamma_method_e gamma_method_;
};
struct MAPNIK_DECL building_symbolizer : public symbolizer_base

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/color.hpp>
#include <mapnik/gamma_method.hpp>
#include <mapnik/enumeration.hpp>
// stl
@ -61,17 +62,6 @@ enum line_join_enum
DEFINE_ENUM( line_join_e, line_join_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 );
class MAPNIK_DECL stroke
{
color c_;

View file

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

42
src/gamma_method.cpp Normal file
View file

@ -0,0 +1,42 @@
/*****************************************************************************
*
* 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
*
*****************************************************************************/
//$Id$
// mapnik
#include <mapnik/gamma_method.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

@ -1217,7 +1217,7 @@ void map_parser::parse_polygon_pattern_symbolizer( rule & rule,
if (gamma) symbol.set_gamma(*gamma);
// gamma method
optional<polygon_pattern_gamma_method_e> gamma_method = get_opt_attr<polygon_pattern_gamma_method_e>(sym, "gamma-method");
optional<gamma_method_e> gamma_method = get_opt_attr<gamma_method_e>(sym, "gamma-method");
if (gamma_method) symbol.set_gamma_method(*gamma_method);
parse_metawriter_in_symbolizer(symbol, sym);
@ -1894,7 +1894,7 @@ void map_parser::parse_polygon_symbolizer( rule & rule, ptree const & sym )
optional<double> gamma = get_opt_attr<double>(sym, "gamma");
if (gamma) poly_sym.set_gamma(*gamma);
// gamma method
optional<polygon_gamma_method_e> gamma_method = get_opt_attr<polygon_gamma_method_e>(sym, "gamma-method");
optional<gamma_method_e> gamma_method = get_opt_attr<gamma_method_e>(sym, "gamma-method");
if (gamma_method) poly_sym.set_gamma_method(*gamma_method);
parse_metawriter_in_symbolizer(poly_sym, sym);

View file

@ -35,22 +35,11 @@ static const char * pattern_alignment_strings[] = {
IMPLEMENT_ENUM( pattern_alignment_e, pattern_alignment_strings )
static const char * polygon_pattern_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( polygon_pattern_gamma_method_e, polygon_pattern_gamma_method_strings )
polygon_pattern_symbolizer::polygon_pattern_symbolizer(path_expression_ptr file)
: symbolizer_with_image(file), symbolizer_base(),
alignment_(LOCAL_ALIGNMENT),
gamma_(1.0),
gamma_method_(POLYGON_PATTERN_GAMMA_POWER) {}
gamma_method_(GAMMA_POWER) {}
polygon_pattern_symbolizer::polygon_pattern_symbolizer(polygon_pattern_symbolizer const& rhs)
: symbolizer_with_image(rhs), symbolizer_base(rhs),
@ -78,12 +67,12 @@ void polygon_pattern_symbolizer::set_gamma(double gamma)
gamma_ = gamma;
}
void polygon_pattern_symbolizer::set_gamma_method(polygon_pattern_gamma_method_e gamma_method)
void polygon_pattern_symbolizer::set_gamma_method(gamma_method_e gamma_method)
{
gamma_method_ = gamma_method;
}
polygon_pattern_gamma_method_e polygon_pattern_symbolizer::get_gamma_method() const
gamma_method_e polygon_pattern_symbolizer::get_gamma_method() const
{
return gamma_method_;
}

View file

@ -27,17 +27,5 @@
namespace mapnik
{
static const char * polygon_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( polygon_gamma_method_e, polygon_gamma_method_strings )
}

View file

@ -46,18 +46,6 @@ static const char * line_join_strings[] = {
IMPLEMENT_ENUM( line_join_e, line_join_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 )
stroke::stroke()
: c_(0,0,0),
width_(1.0),