Merge branch 'master' of github.com:mapnik/mapnik
This commit is contained in:
commit
d7d346d799
57 changed files with 1153 additions and 845 deletions
|
@ -37,10 +37,7 @@ Build dependencies are:
|
|||
Mapnik Core depends on:
|
||||
|
||||
* Boost
|
||||
- >= 1.46 is recommended
|
||||
- >= 1.45 is required if compiling with clang++
|
||||
- >= 1.42 works on most systems and most compilers
|
||||
- >= 1.47 is required to support wkt/wkb geometry output (optional)
|
||||
- >= 1.47 is required.
|
||||
- These libraries are required:
|
||||
- filesystem
|
||||
- system
|
||||
|
|
27
SConstruct
27
SConstruct
|
@ -44,7 +44,7 @@ SCONS_CONFIGURE_CACHE = 'config.cache'
|
|||
SCONF_TEMP_DIR = '.sconf_temp'
|
||||
# auto-search directories for boost libs/headers
|
||||
BOOST_SEARCH_PREFIXES = ['/usr/local','/opt/local','/sw','/usr',]
|
||||
BOOST_MIN_VERSION = '1.41'
|
||||
BOOST_MIN_VERSION = '1.47'
|
||||
CAIROMM_MIN_VERSION = '1.8.0'
|
||||
|
||||
DEFAULT_LINK_PRIORITY = ['internal','other','frameworks','user','system']
|
||||
|
@ -323,8 +323,6 @@ opts.AddVariables(
|
|||
|
||||
BoolVariable('RENDERING_STATS', 'Output rendering statistics during style processing', 'False'),
|
||||
|
||||
BoolVariable('INTERNAL_LIBAGG', 'Use provided libagg', 'True'),
|
||||
|
||||
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
|
||||
|
||||
# Variables for optional dependencies
|
||||
|
@ -1244,15 +1242,10 @@ if not preconfigured:
|
|||
env['SKIPPED_DEPS'].append('pgsql2sqlite_rtree')
|
||||
env['PGSQL2SQLITE'] = False
|
||||
|
||||
# Decide which libagg to use
|
||||
# if we are using internal agg, then prepend to make sure
|
||||
# we link locally
|
||||
|
||||
if env['INTERNAL_LIBAGG']:
|
||||
# we rely on an internal, patched copy of agg with critical fixes
|
||||
# prepend to make sure we link locally
|
||||
env.Prepend(CPPPATH = '#deps/agg/include')
|
||||
env.Prepend(LIBPATH = '#deps/agg')
|
||||
else:
|
||||
env.ParseConfig('pkg-config --libs --cflags libagg')
|
||||
|
||||
if env['CAIRO']:
|
||||
if env['CAIRO_LIBS'] or env['CAIRO_INCLUDES']:
|
||||
|
@ -1416,18 +1409,18 @@ if not preconfigured:
|
|||
ndebug_flags = '-DNDEBUG'
|
||||
|
||||
# Enable logging in debug mode (always) and release mode (when specified)
|
||||
if env['DEFAULT_LOG_SEVERITY']:
|
||||
severities = ['info', 'debug', 'warn', 'error', 'fatal', 'none']
|
||||
if env['DEFAULT_LOG_SEVERITY']:
|
||||
if env['DEFAULT_LOG_SEVERITY'] not in severities:
|
||||
color_print(1,"Cannot set default logger severity to '%s', available options are 'info', 'debug', 'warn', 'error', 'fatal', 'none'." % env['DEFAULT_LOG_SEVERITY'])
|
||||
severities_list = ', '.join(["'%s'" % s for s in severities])
|
||||
color_print(1,"Cannot set default logger severity to '%s', available options are %s." % (env['DEFAULT_LOG_SEVERITY'], severities_list))
|
||||
Exit(1)
|
||||
else:
|
||||
log_severity = severities.index(env['DEFAULT_LOG_SEVERITY'])
|
||||
else:
|
||||
if env['DEBUG']:
|
||||
log_severity = 1 # debug
|
||||
else:
|
||||
log_severity = 3 # error
|
||||
severities_list = ', '.join(["'%s'" % s for s in severities])
|
||||
color_print(1,"No logger severity specified, available options are %s." % severities_list)
|
||||
Exit(1)
|
||||
|
||||
log_enabled = ' -DMAPNIK_LOG -DMAPNIK_DEFAULT_LOG_SEVERITY=%d' % log_severity
|
||||
|
||||
|
@ -1677,7 +1670,7 @@ if not HELP_REQUESTED:
|
|||
SetOption("num_jobs", env['JOBS'])
|
||||
|
||||
# Build agg first, doesn't need anything special
|
||||
if env['RUNTIME_LINK'] == 'shared' and env['INTERNAL_LIBAGG']:
|
||||
if env['RUNTIME_LINK'] == 'shared':
|
||||
SConscript('deps/agg/build.py')
|
||||
|
||||
# Build the core library
|
||||
|
|
|
@ -46,6 +46,11 @@ expression_ptr parse_expression_(std::string const& wkt)
|
|||
return parse_expression(wkt,"utf8");
|
||||
}
|
||||
|
||||
std::string expression_to_string_(mapnik::expr_node const& expr)
|
||||
{
|
||||
return mapnik::to_expression_string(expr);
|
||||
}
|
||||
|
||||
mapnik::value expression_evaluate_(mapnik::expr_node const& expr, mapnik::Feature const& f)
|
||||
{
|
||||
// will be auto-converted to proper python type by `mapnik_value_to_python`
|
||||
|
@ -75,7 +80,7 @@ void export_expression()
|
|||
"TODO"
|
||||
"",no_init)
|
||||
.def("evaluate", &expression_evaluate_)
|
||||
.def("__str__",&to_expression_string);
|
||||
.def("__str__",&expression_to_string_);
|
||||
;
|
||||
|
||||
def("Expression",&parse_expression_,(arg("expr")),"Expression string");
|
||||
|
|
|
@ -149,7 +149,7 @@ void blend (image_32 & im, unsigned x, unsigned y, image_32 const& im2, float op
|
|||
|
||||
void composite(image_32 & im, image_32 & im2, mapnik::composite_mode_e mode, float opacity)
|
||||
{
|
||||
mapnik::composite(im.data(),im2.data(),mode,opacity,0,0,true,true);
|
||||
mapnik::composite(im.data(),im2.data(),mode,opacity,0,0,false,true);
|
||||
}
|
||||
|
||||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||
|
|
|
@ -194,7 +194,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
boost::get<1>(*itr).to_string().c_str()));
|
||||
}
|
||||
|
||||
typedef mapnik::coord_transform2<mapnik::CoordTransform,mapnik::geometry_type> path_type;
|
||||
typedef mapnik::coord_transform<mapnik::CoordTransform,mapnik::geometry_type> path_type;
|
||||
|
||||
for (unsigned i=0; i<feat->num_geometries();++i)
|
||||
{
|
||||
|
@ -289,6 +289,32 @@ void MapWidget::mouseReleaseEvent(QMouseEvent* e)
|
|||
}
|
||||
}
|
||||
|
||||
void MapWidget::wheelEvent(QWheelEvent* e)
|
||||
{
|
||||
if (!map_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QPoint corner(map_->width(), map_->height());
|
||||
QPoint zoomCoords;
|
||||
double zoom;
|
||||
if (e->delta() > 0)
|
||||
{
|
||||
zoom = 0.5;
|
||||
QPoint center = corner / 2;
|
||||
QPoint delta = e->pos() - center;
|
||||
zoomCoords = zoom * delta + center;
|
||||
}
|
||||
else
|
||||
{
|
||||
zoom = 2.0;
|
||||
zoomCoords = corner - e->pos();
|
||||
}
|
||||
|
||||
map_->pan_and_zoom(zoomCoords.x(), zoomCoords.y(), zoom);
|
||||
updateMap();
|
||||
}
|
||||
|
||||
void MapWidget::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
|
@ -486,6 +512,10 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
|||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
}
|
||||
catch (const std::exception & ex)
|
||||
{
|
||||
std::cerr << "exception: " << ex.what() << std::endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Unknown exception caught!\n";
|
||||
|
@ -522,6 +552,10 @@ void render_grid(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
|
|||
{
|
||||
std::cerr << ex.what() << std::endl;
|
||||
}
|
||||
catch (const std::exception & ex)
|
||||
{
|
||||
std::cerr << "exception: " << ex.what() << std::endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Unknown exception caught!\n";
|
||||
|
|
|
@ -99,6 +99,7 @@ protected:
|
|||
void mousePressEvent(QMouseEvent* e);
|
||||
void mouseMoveEvent(QMouseEvent* e);
|
||||
void mouseReleaseEvent(QMouseEvent* e);
|
||||
void wheelEvent(QWheelEvent* e);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void export_to_file(unsigned width,
|
||||
unsigned height,
|
||||
|
|
15
deps/agg/include/agg_conv_transform.h
vendored
15
deps/agg/include/agg_conv_transform.h
vendored
|
@ -29,11 +29,8 @@ namespace agg
|
|||
template<class VertexSource, class Transformer=trans_affine> class conv_transform
|
||||
{
|
||||
public:
|
||||
explicit conv_transform(VertexSource& source) :
|
||||
m_source(&source), m_trans() {}
|
||||
|
||||
conv_transform(VertexSource& source, const Transformer& tr) :
|
||||
m_source(&source), m_trans(tr) {}
|
||||
conv_transform(VertexSource& source, Transformer& tr) :
|
||||
m_source(&source), m_trans(&tr) {}
|
||||
|
||||
void attach(VertexSource& source) { m_source = &source; }
|
||||
|
||||
|
@ -47,14 +44,14 @@ namespace agg
|
|||
unsigned cmd = m_source->vertex(x, y);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_trans.transform(x, y);
|
||||
m_trans->transform(x, y);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void transformer(const Transformer& tr)
|
||||
void transformer(Transformer& tr)
|
||||
{
|
||||
m_trans = tr;
|
||||
m_trans = &tr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -63,7 +60,7 @@ namespace agg
|
|||
operator = (const conv_transform<VertexSource>&);
|
||||
|
||||
VertexSource* m_source;
|
||||
Transformer m_trans;
|
||||
const Transformer* m_trans;
|
||||
};
|
||||
|
||||
|
||||
|
|
100
deps/agg/include/agg_pixfmt_rgba.h
vendored
100
deps/agg/include/agg_pixfmt_rgba.h
vendored
|
@ -1,3 +1,4 @@
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
// Anti-Grain Geometry - Version 2.4
|
||||
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
||||
|
@ -116,15 +117,6 @@ namespace agg
|
|||
const GammaLut& m_gamma;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=============================================================blender_rgba
|
||||
template<class ColorT, class Order> struct blender_rgba
|
||||
{
|
||||
|
@ -1393,7 +1385,91 @@ namespace agg
|
|||
};
|
||||
|
||||
|
||||
// merge grain (GIMP)
|
||||
// E = I + M - 128
|
||||
|
||||
template <typename ColorT, typename Order>
|
||||
struct comp_op_rgba_grain_merge
|
||||
{
|
||||
typedef ColorT color_type;
|
||||
typedef Order order_type;
|
||||
typedef typename color_type::value_type value_type;
|
||||
typedef typename color_type::calc_type calc_type;
|
||||
typedef typename color_type::long_type long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = color_type::base_shift,
|
||||
base_mask = color_type::base_mask
|
||||
};
|
||||
|
||||
static AGG_INLINE void blend_pix(value_type* p,
|
||||
unsigned sr, unsigned sg, unsigned sb,
|
||||
unsigned sa, unsigned cover)
|
||||
{
|
||||
|
||||
if (cover < 255)
|
||||
{
|
||||
sr = (sr * cover + 255) >> 8;
|
||||
sg = (sg * cover + 255) >> 8;
|
||||
sb = (sb * cover + 255) >> 8;
|
||||
sa = (sa * cover + 255) >> 8;
|
||||
}
|
||||
if (sa > 0)
|
||||
{
|
||||
calc_type da = p[Order::A];
|
||||
int dr = sr + p[Order::R] - 128;
|
||||
int dg = sg + p[Order::G] - 128;
|
||||
int db = sb + p[Order::B] - 128;
|
||||
p[Order::R] = dr < 0 ? 0 : (dr > 255 ? 255 : dr);
|
||||
p[Order::G] = dg < 0 ? 0 : (dg > 255 ? 255 : dg);
|
||||
p[Order::B] = db < 0 ? 0 : (db > 255 ? 255 : db);
|
||||
p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// grain extract (GIMP)
|
||||
// E = I - M + 128
|
||||
|
||||
template <typename ColorT, typename Order>
|
||||
struct comp_op_rgba_grain_extract
|
||||
{
|
||||
typedef ColorT color_type;
|
||||
typedef Order order_type;
|
||||
typedef typename color_type::value_type value_type;
|
||||
typedef typename color_type::calc_type calc_type;
|
||||
typedef typename color_type::long_type long_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = color_type::base_shift,
|
||||
base_mask = color_type::base_mask
|
||||
};
|
||||
|
||||
static AGG_INLINE void blend_pix(value_type* p,
|
||||
unsigned sr, unsigned sg, unsigned sb,
|
||||
unsigned sa, unsigned cover)
|
||||
{
|
||||
if (cover < 255)
|
||||
{
|
||||
sr = (sr * cover + 255) >> 8;
|
||||
sg = (sg * cover + 255) >> 8;
|
||||
sb = (sb * cover + 255) >> 8;
|
||||
sa = (sa * cover + 255) >> 8;
|
||||
}
|
||||
if (sa > 0)
|
||||
{
|
||||
calc_type da = p[Order::A];
|
||||
int dr = p[Order::R] - sr + 128;
|
||||
int dg = p[Order::G] - sg + 128;
|
||||
int db = p[Order::B] - sb + 128;
|
||||
|
||||
p[Order::R] = dr < 0 ? 0 : (dr > 255 ? 255 : dr);
|
||||
p[Order::G] = dg < 0 ? 0 : (dg > 255 ? 255 : dg);
|
||||
p[Order::B] = db < 0 ? 0 : (db > 255 ? 255 : db);
|
||||
p[Order::A] = (value_type)(sa + da - ((sa * da + base_mask) >> base_shift));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//======================================================comp_op_table_rgba
|
||||
|
@ -1442,6 +1518,8 @@ namespace agg
|
|||
comp_op_rgba_contrast <ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_invert <ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_grain_merge<ColorT,Order>::blend_pix,
|
||||
comp_op_rgba_grain_extract<ColorT,Order>::blend_pix,
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -1477,7 +1555,8 @@ namespace agg
|
|||
comp_op_contrast, //----comp_op_contrast
|
||||
comp_op_invert, //----comp_op_invert
|
||||
comp_op_invert_rgb, //----comp_op_invert_rgb
|
||||
|
||||
comp_op_grain_merge, //----comp_op_grain_merge_rgb
|
||||
comp_op_grain_extract, //----comp_op_grain_extract_rgb
|
||||
end_of_comp_op_e
|
||||
};
|
||||
|
||||
|
@ -2899,4 +2978,3 @@ namespace agg
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
29
deps/agg/include/agg_span_image_filter_rgba.h
vendored
29
deps/agg/include/agg_span_image_filter_rgba.h
vendored
|
@ -725,7 +725,6 @@ namespace agg
|
|||
base_type::m_ry_inv) >>
|
||||
image_subpixel_shift;
|
||||
int total_weight = 0;
|
||||
int total_weight_alpha = 0;
|
||||
int x_lr = x >> image_subpixel_shift;
|
||||
int x_hr = ((image_subpixel_mask - (x & image_subpixel_mask)) *
|
||||
base_type::m_rx_inv) >>
|
||||
|
@ -743,18 +742,12 @@ namespace agg
|
|||
int weight = (weight_y * weight_array[x_hr] +
|
||||
image_filter_scale / 2) >>
|
||||
downscale_shift;
|
||||
int weight_alpha = (weight_y * weight_array[x_hr] / base_mask * fg_ptr[3] +
|
||||
image_filter_scale / 2) >>
|
||||
downscale_shift;
|
||||
|
||||
fg[0] += *fg_ptr++ * weight_alpha;
|
||||
fg[1] += *fg_ptr++ * weight_alpha;
|
||||
fg[2] += *fg_ptr++ * weight_alpha;
|
||||
fg[0] += *fg_ptr++ * weight;
|
||||
fg[1] += *fg_ptr++ * weight;
|
||||
fg[2] += *fg_ptr++ * weight;
|
||||
fg[3] += *fg_ptr++ * weight;
|
||||
|
||||
total_weight += weight;
|
||||
total_weight_alpha += weight_alpha;
|
||||
|
||||
x_hr += base_type::m_rx_inv;
|
||||
if(x_hr >= filter_scale) break;
|
||||
fg_ptr = (const value_type*)base_type::source().next_x();
|
||||
|
@ -764,25 +757,15 @@ namespace agg
|
|||
fg_ptr = (const value_type*)base_type::source().next_y();
|
||||
}
|
||||
|
||||
if (total_weight && total_weight_alpha)
|
||||
{
|
||||
fg[0] /= total_weight;
|
||||
fg[1] /= total_weight;
|
||||
fg[2] /= total_weight;
|
||||
fg[3] /= total_weight;
|
||||
fg[0] = fg[0] / total_weight_alpha * fg[3] / base_mask;
|
||||
fg[1] = fg[1] / total_weight_alpha * fg[3] / base_mask;
|
||||
fg[2] = fg[2] / total_weight_alpha * fg[3] / base_mask;
|
||||
|
||||
if(fg[0] < 0) fg[0] = 0;
|
||||
if(fg[1] < 0) fg[1] = 0;
|
||||
if(fg[2] < 0) fg[2] = 0;
|
||||
if(fg[3] < 0) fg[3] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fg[0] = 0;
|
||||
fg[1] = 0;
|
||||
fg[2] = 0;
|
||||
fg[3] = 0;
|
||||
}
|
||||
|
||||
if(fg[order_type::A] > base_mask) fg[order_type::A] = base_mask;
|
||||
if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A];
|
||||
|
|
|
@ -38,45 +38,20 @@ namespace mapnik
|
|||
|
||||
typedef coord_array<coord2d> CoordinateArray;
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform
|
||||
{
|
||||
coord_transform(Transform const& t, Geometry& geom)
|
||||
: t_(t), geom_(geom) {}
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
t_.forward(x, y);
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry& geom_;
|
||||
};
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform2
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
//typedef typename Geometry::value_type value_type;
|
||||
|
||||
coord_transform2(Transform const& t,
|
||||
coord_transform(Transform const& t,
|
||||
Geometry & geom,
|
||||
proj_transform const& prj_trans)
|
||||
: t_(&t),
|
||||
geom_(geom),
|
||||
prj_trans_(&prj_trans) {}
|
||||
|
||||
explicit coord_transform2(Geometry & geom)
|
||||
explicit coord_transform(Geometry & geom)
|
||||
: t_(0),
|
||||
geom_(geom),
|
||||
prj_trans_(0) {}
|
||||
|
@ -91,7 +66,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
t_ = &t;
|
||||
}
|
||||
|
||||
unsigned vertex(double *x, double *y)
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = SEG_MOVETO;
|
||||
bool ok = false;
|
||||
|
@ -113,7 +88,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
void rewind(unsigned pos) const
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
@ -129,44 +104,6 @@ private:
|
|||
proj_transform const* prj_trans_;
|
||||
};
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform3
|
||||
{
|
||||
coord_transform3(Transform const& t,
|
||||
Geometry const& geom,
|
||||
proj_transform const& prj_trans,
|
||||
int dx, int dy)
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans),
|
||||
dx_(dx), dy_(dy) {}
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
double z = 0;
|
||||
prj_trans_.backward(*x, *y, z);
|
||||
t_.forward(x, y);
|
||||
*x += dx_;
|
||||
*y += dy_;
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
proj_transform const& prj_trans_;
|
||||
int dx_;
|
||||
int dy_;
|
||||
};
|
||||
|
||||
|
||||
class CoordTransform
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -73,6 +73,12 @@ struct evaluate : boost::static_visitor<T1>
|
|||
|
||||
template <typename Tag>
|
||||
value_type operator() (unary_node<Tag> const& x) const
|
||||
{
|
||||
typename make_op<Tag>::type func;
|
||||
return func(boost::apply_visitor(*this, x.expr));
|
||||
}
|
||||
|
||||
value_type operator() (unary_node<tags::logical_not> const& x) const
|
||||
{
|
||||
return ! (boost::apply_visitor(evaluate<feature_type,value_type>(feature_),x.expr).to_bool());
|
||||
}
|
||||
|
|
|
@ -198,21 +198,26 @@ struct expression_grammar : qi::grammar<Iterator, expr_node(), space_type>
|
|||
| ( (lit('>') | lit("gt") ) >> additive_expr [ _val > _1 ])
|
||||
)
|
||||
;
|
||||
|
||||
additive_expr = multiplicative_expr [_val = _1]
|
||||
>> * ( '+' >> multiplicative_expr[_val += _1]
|
||||
| '-' >> multiplicative_expr[_val -= _1]
|
||||
)
|
||||
;
|
||||
|
||||
multiplicative_expr = primary_expr [_val = _1]
|
||||
>> *( '*' >> primary_expr [_val *= _1]
|
||||
| '/' >> primary_expr [_val /= _1]
|
||||
| '%' >> primary_expr [_val %= _1]
|
||||
multiplicative_expr = unary_expr [_val = _1]
|
||||
>> *( '*' >> unary_expr [_val *= _1]
|
||||
| '/' >> unary_expr [_val /= _1]
|
||||
| '%' >> unary_expr [_val %= _1]
|
||||
| regex_match_expr[_val = regex_match_(_val, _1)]
|
||||
| regex_replace_expr(_val) [_val = _1]
|
||||
)
|
||||
;
|
||||
|
||||
unary_expr = primary_expr [_val = _1]
|
||||
| '+' >> primary_expr [_val = _1]
|
||||
| '-' >> primary_expr [_val = -_1]
|
||||
;
|
||||
|
||||
primary_expr = strict_double [_val = _1]
|
||||
| int_ [_val = _1]
|
||||
|
@ -256,6 +261,7 @@ struct expression_grammar : qi::grammar<Iterator, expr_node(), space_type>
|
|||
rule_type logical_expr;
|
||||
rule_type additive_expr;
|
||||
rule_type multiplicative_expr;
|
||||
rule_type unary_expr;
|
||||
rule_type not_expr;
|
||||
rule_type primary_expr;
|
||||
qi::rule<Iterator, std::string() > regex_match_expr;
|
||||
|
|
|
@ -40,6 +40,14 @@ namespace mapnik
|
|||
{
|
||||
|
||||
namespace tags {
|
||||
struct negate
|
||||
{
|
||||
static const char* str()
|
||||
{
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
struct plus
|
||||
{
|
||||
static const char* str()
|
||||
|
@ -166,6 +174,7 @@ typedef mapnik::value value_type;
|
|||
typedef boost::variant <
|
||||
value_type,
|
||||
attribute,
|
||||
boost::recursive_wrapper<unary_node<tags::negate> >,
|
||||
boost::recursive_wrapper<binary_node<tags::plus> >,
|
||||
boost::recursive_wrapper<binary_node<tags::minus> >,
|
||||
boost::recursive_wrapper<binary_node<tags::mult> >,
|
||||
|
@ -185,6 +194,7 @@ boost::recursive_wrapper<regex_replace_node>
|
|||
> expr_node;
|
||||
|
||||
template <typename Tag> struct make_op;
|
||||
template <> struct make_op<tags::negate> { typedef std::negate<value_type> type;};
|
||||
template <> struct make_op<tags::plus> { typedef std::plus<value_type> type;};
|
||||
template <> struct make_op<tags::minus> { typedef std::minus<value_type> type;};
|
||||
template <> struct make_op<tags::mult> { typedef std::multiplies<value_type> type;};
|
||||
|
@ -289,6 +299,11 @@ struct function_call
|
|||
|
||||
// ops
|
||||
|
||||
inline expr_node& operator- (expr_node& expr)
|
||||
{
|
||||
return expr = unary_node<tags::negate>(expr);
|
||||
}
|
||||
|
||||
inline expr_node & operator += ( expr_node &left ,const expr_node &right)
|
||||
{
|
||||
return left = binary_node<tags::plus>(left,right);
|
||||
|
|
|
@ -33,6 +33,31 @@
|
|||
namespace mapnik
|
||||
{
|
||||
MAPNIK_DECL std::string to_expression_string(expr_node const& node);
|
||||
|
||||
/*
|
||||
The following two templates are intentionally invalid and will prompt
|
||||
a compile error if ever instanciated. This should prevent accidentally
|
||||
passing a pointer (either raw or shared) as the argument. Without them,
|
||||
the compiler could construct a temporary expr_node(bool) using
|
||||
implicit pointer-to-bool conversion, thus any non-null pointer
|
||||
would yield "true".
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
std::string to_expression_string(T const* x)
|
||||
{
|
||||
x = 0;
|
||||
throw std::logic_error("to_expression_string() called with pointer argument");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string to_expression_string(boost::shared_ptr<T> const& x)
|
||||
{
|
||||
x = 0;
|
||||
throw std::logic_error("to_expression_string() called with pointer argument");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MAPNIK_EXPRESSION_STRING_HPP
|
||||
|
|
|
@ -68,7 +68,9 @@ enum composite_mode_e
|
|||
exclusion,
|
||||
contrast,
|
||||
invert,
|
||||
invert_rgb
|
||||
invert_rgb,
|
||||
grain_merge,
|
||||
grain_extract
|
||||
};
|
||||
|
||||
MAPNIK_DECL boost::optional<composite_mode_e> comp_op_from_string(std::string const& name);
|
||||
|
|
|
@ -196,7 +196,11 @@ void process_channel (Src const& src, Dst & dst, mapnik::filter::sobel)
|
|||
template <typename Src, typename Dst, typename FilterTag>
|
||||
void apply_convolution_3x3(Src const& src_view, Dst & dst_view, FilterTag filter_tag)
|
||||
{
|
||||
typename Src::xy_locator src_loc = src_view.xy_at(1,1);
|
||||
// p0 p1 p2
|
||||
// p3 p4 p5
|
||||
// p6 p7 p8
|
||||
|
||||
typename Src::xy_locator src_loc = src_view.xy_at(0,0);
|
||||
typename Src::xy_locator::cached_location_t loc00 = src_loc.cache_location(-1,-1);
|
||||
typename Src::xy_locator::cached_location_t loc10 = src_loc.cache_location( 0,-1);
|
||||
typename Src::xy_locator::cached_location_t loc20 = src_loc.cache_location( 1,-1);
|
||||
|
@ -207,34 +211,147 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, FilterTag filter
|
|||
typename Src::xy_locator::cached_location_t loc12 = src_loc.cache_location( 0, 1);
|
||||
typename Src::xy_locator::cached_location_t loc22 = src_loc.cache_location( 1, 1);
|
||||
|
||||
for (int y = 1; y<src_view.height()-1; ++y)
|
||||
{
|
||||
typename Src::x_iterator dst_it = dst_view.row_begin(y);
|
||||
for (int x = 0; x<src_view.width(); ++x)
|
||||
typename Src::x_iterator dst_it = dst_view.row_begin(0);
|
||||
|
||||
// top row
|
||||
for (int x = 0 ; x < src_view.width(); ++x)
|
||||
{
|
||||
*dst_it = src_loc[loc11];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
bits32f p[9];
|
||||
p[0] = src_loc[loc00][i];
|
||||
p[1] = src_loc[loc10][i];
|
||||
p[2] = src_loc[loc20][i];
|
||||
p[3] = src_loc[loc01][i];
|
||||
|
||||
p[4] = src_loc[loc11][i];
|
||||
p[5] = src_loc[loc21][i];
|
||||
p[6] = src_loc[loc02][i];
|
||||
p[7] = src_loc[loc12][i];
|
||||
p[8] = src_loc[loc22][i];
|
||||
process_channel(p, (*dst_it)[i], filter_tag);
|
||||
|
||||
if (x == 0)
|
||||
{
|
||||
p[3] = p[4];
|
||||
p[6] = p[7];
|
||||
}
|
||||
else
|
||||
{
|
||||
p[3] = src_loc[loc01][i];
|
||||
p[6] = src_loc[loc02][i];
|
||||
}
|
||||
|
||||
if ( x == src_view.width()-1)
|
||||
{
|
||||
p[5] = p[4];
|
||||
p[8] = p[7];
|
||||
}
|
||||
else
|
||||
{
|
||||
p[5] = src_loc[loc21][i];
|
||||
p[8] = src_loc[loc22][i];
|
||||
}
|
||||
|
||||
|
||||
p[0] = p[6];
|
||||
p[1] = p[7];
|
||||
p[2] = p[8];
|
||||
|
||||
process_channel(p, (*dst_it)[i], filter_tag);
|
||||
}
|
||||
++src_loc.x();
|
||||
++dst_it;
|
||||
}
|
||||
// carrige-return
|
||||
src_loc += point2<std::ptrdiff_t>(-src_view.width(),1);
|
||||
|
||||
// 1... height-1 rows
|
||||
for (int y = 1; y<src_view.height()-1; ++y)
|
||||
{
|
||||
for (int x = 0; x < src_view.width(); ++x)
|
||||
{
|
||||
*dst_it = src_loc[loc11];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
bits32f p[9];
|
||||
|
||||
p[1] = src_loc[loc10][i];
|
||||
p[4] = src_loc[loc11][i];
|
||||
p[7] = src_loc[loc12][i];
|
||||
|
||||
if (x == 0)
|
||||
{
|
||||
p[0] = p[1];
|
||||
p[3] = p[4];
|
||||
p[6] = p[7];
|
||||
}
|
||||
else
|
||||
{
|
||||
p[0] = src_loc[loc00][i];
|
||||
p[3] = src_loc[loc01][i];
|
||||
p[6] = src_loc[loc02][i];
|
||||
}
|
||||
|
||||
if ( x == src_view.width() - 1)
|
||||
{
|
||||
p[2] = p[1];
|
||||
p[5] = p[4];
|
||||
p[8] = p[7];
|
||||
}
|
||||
else
|
||||
{
|
||||
p[2] = src_loc[loc20][i];
|
||||
p[5] = src_loc[loc21][i];
|
||||
p[8] = src_loc[loc22][i];
|
||||
}
|
||||
process_channel(p, (*dst_it)[i], filter_tag);
|
||||
}
|
||||
++dst_it;
|
||||
++src_loc.x();
|
||||
}
|
||||
// carrige-return
|
||||
src_loc += point2<std::ptrdiff_t>(-src_view.width(),1);
|
||||
}
|
||||
}
|
||||
|
||||
// bottom row
|
||||
//src_loc = src_view.xy_at(0,src_view.height()-1);
|
||||
for (int x = 0 ; x < src_view.width(); ++x)
|
||||
{
|
||||
*dst_it = src_loc[loc11];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
bits32f p[9];
|
||||
|
||||
p[1] = src_loc[loc10][i];
|
||||
p[4] = src_loc[loc11][i];
|
||||
|
||||
if (x == 0)
|
||||
{
|
||||
p[0] = p[1];
|
||||
p[3] = p[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
p[0] = src_loc[loc00][i];
|
||||
p[3] = src_loc[loc01][i];
|
||||
}
|
||||
|
||||
if ( x == src_view.width()-1)
|
||||
{
|
||||
p[2] = p[1];
|
||||
p[5] = p[4];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
p[2] = src_loc[loc20][i];
|
||||
p[5] = src_loc[loc21][i];
|
||||
}
|
||||
|
||||
p[6] = p[0];
|
||||
p[7] = p[1];
|
||||
p[8] = p[2];
|
||||
|
||||
process_channel(p, (*dst_it)[i], filter_tag);
|
||||
}
|
||||
++src_loc.x();
|
||||
++dst_it;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Src, typename Dst,typename FilterTag>
|
||||
void apply_filter(Src const& src, Dst & dst, FilterTag filter_tag)
|
||||
|
@ -285,6 +402,33 @@ void apply_filter(Src & src, gray)
|
|||
boost::gil::copy_and_convert_pixels(color_converted_view<gray_pixel_t>(src_view), src_view);
|
||||
}
|
||||
|
||||
template <typename Src, typename Dst>
|
||||
void x_gradient_impl(Src const& src_view, Dst const& dst_view)
|
||||
{
|
||||
for (int y=0; y<src_view.height(); ++y)
|
||||
{
|
||||
typename Src::x_iterator src_it = src_view.row_begin(y);
|
||||
typename Dst::x_iterator dst_it = dst_view.row_begin(y);
|
||||
|
||||
dst_it[0][0] = 128 + (src_it[0][0] - src_it[1][0]) / 2;
|
||||
dst_it[0][1] = 128 + (src_it[0][1] - src_it[1][1]) / 2;
|
||||
dst_it[0][2] = 128 + (src_it[0][2] - src_it[1][2]) / 2;
|
||||
|
||||
dst_it[dst_view.width()-1][0] = 128 + (src_it[src_view.width()-2][0] - src_it[src_view.width()-1][0]) / 2;
|
||||
dst_it[dst_view.width()-1][1] = 128 + (src_it[src_view.width()-2][1] - src_it[src_view.width()-1][1]) / 2;
|
||||
dst_it[dst_view.width()-1][2] = 128 + (src_it[src_view.width()-2][2] - src_it[src_view.width()-1][2]) / 2;
|
||||
|
||||
dst_it[0][3] = dst_it[src_view.width()-1][3] = 255;
|
||||
|
||||
for (int x=1; x<src_view.width()-1; ++x)
|
||||
{
|
||||
dst_it[x][0] = 128 + (src_it[x-1][0] - src_it[x+1][0]) / 2;
|
||||
dst_it[x][1] = 128 + (src_it[x-1][1] - src_it[x+1][1]) / 2;
|
||||
dst_it[x][2] = 128 + (src_it[x-1][2] - src_it[x+1][2]) / 2;
|
||||
dst_it[x][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
void apply_filter(Src & src, x_gradient)
|
||||
|
@ -297,20 +441,8 @@ void apply_filter(Src & src, x_gradient)
|
|||
|
||||
rgba8_image_t temp_buffer(src_view.dimensions());
|
||||
rgba8_view_t dst_view = view(temp_buffer);
|
||||
for (int y=0; y<src_view.height(); ++y)
|
||||
{
|
||||
rgba8_view_t::x_iterator src_it = src_view.row_begin(y);
|
||||
rgba8_view_t::x_iterator dst_it = dst_view.row_begin(y);
|
||||
|
||||
for (int x=1; x<src_view.width()-1; ++x)
|
||||
{
|
||||
dst_it[x][0] = 127 + (src_it[x-1][0] - src_it[x+1][0]) / 2;
|
||||
dst_it[x][1] = 127 + (src_it[x-1][1] - src_it[x+1][1]) / 2;
|
||||
dst_it[x][2] = 127 + (src_it[x-1][2] - src_it[x+1][2]) / 2;
|
||||
dst_it[x][3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
x_gradient_impl(src_view, dst_view);
|
||||
boost::gil::copy_pixels(view(temp_buffer), src_view);
|
||||
}
|
||||
|
||||
|
@ -318,29 +450,13 @@ template <typename Src>
|
|||
void apply_filter(Src & src, y_gradient)
|
||||
{
|
||||
using namespace boost::gil;
|
||||
|
||||
rgba8_view_t in = interleaved_view(src.width(),src.height(),
|
||||
rgba8_view_t src_view = interleaved_view(src.width(),src.height(),
|
||||
(rgba8_pixel_t*) src.raw_data(),
|
||||
src.width()*4);
|
||||
rgba8_image_t temp_buffer(in.dimensions());
|
||||
dynamic_xy_step_type<rgba8_view_t>::type src_view = rotated90ccw_view(in);
|
||||
dynamic_xy_step_type<rgba8_view_t>::type dst_view = rotated90ccw_view(view(temp_buffer));
|
||||
|
||||
for (int y=0; y<src_view.height(); ++y)
|
||||
{
|
||||
dynamic_xy_step_type<rgba8_view_t>::type::x_iterator src_it = src_view.row_begin(y);
|
||||
dynamic_xy_step_type<rgba8_view_t>::type::x_iterator dst_it = dst_view.row_begin(y);
|
||||
|
||||
for (int x=1; x<src_view.width()-1; ++x)
|
||||
{
|
||||
dst_it[x][0] = 127 + (src_it[x-1][0] - src_it[x+1][0]) / 2;
|
||||
dst_it[x][1] = 127 + (src_it[x-1][1] - src_it[x+1][1]) / 2;
|
||||
dst_it[x][2] = 127 + (src_it[x-1][2] - src_it[x+1][2]) / 2;
|
||||
dst_it[x][3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
boost::gil::copy_pixels(view(temp_buffer), in);
|
||||
rgba8_image_t temp_buffer(src_view.dimensions());
|
||||
rgba8_view_t dst_view = view(temp_buffer);
|
||||
x_gradient_impl(rotated90ccw_view(src_view), rotated90ccw_view(dst_view));
|
||||
boost::gil::copy_pixels(view(temp_buffer), src_view);
|
||||
}
|
||||
|
||||
template <typename Src>
|
||||
|
|
|
@ -77,9 +77,9 @@ struct image_filter_grammar :
|
|||
lit("y-gradient")[push_back(_val,construct<mapnik::filter::y_gradient>())]
|
||||
|
|
||||
(lit("agg-stack-blur")[_a = 1, _b = 1]
|
||||
>> -( lit(':') >> lit("rx") >> lit('=') >> radius_[_a = _1]
|
||||
>> -( lit(':') >> radius_[_a = _1]
|
||||
>> lit(',')
|
||||
>> lit("ry") >> lit('=') >> radius_[_b = _1])
|
||||
>> radius_[_b = _1])
|
||||
[push_back(_val,construct<mapnik::filter::agg_stack_blur>(_a,_b))])
|
||||
|
|
||||
lit("invert")[push_back(_val,construct<mapnik::filter::invert>())]
|
||||
|
|
|
@ -41,9 +41,9 @@ struct agg_stack_blur
|
|||
{
|
||||
agg_stack_blur(unsigned rx_, unsigned ry_)
|
||||
: rx(rx_),ry(ry_) {}
|
||||
// an attemp to support older boost spirit (< 1.46)
|
||||
// an attempt to support older boost spirit (< 1.46)
|
||||
agg_stack_blur()
|
||||
: rx(0),ry(0) {}
|
||||
: rx(1),ry(1) {}
|
||||
unsigned rx;
|
||||
unsigned ry;
|
||||
};
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/palette.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <mapnik/graphics.hpp>
|
||||
#endif
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
class metawriter
|
||||
{
|
||||
public:
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
metawriter(metawriter_properties dflt_properties) :
|
||||
dflt_properties_(dflt_properties),
|
||||
width_(0),
|
||||
|
|
|
@ -47,8 +47,8 @@ class string_info;
|
|||
class text_path;
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> ClippedPathType;
|
||||
typedef coord_transform2<CoordTransform,geometry_type> PathType;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> ClippedPathType;
|
||||
typedef coord_transform<CoordTransform,geometry_type> PathType;
|
||||
|
||||
typedef label_collision_detector4 DetectorType;
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ void save_as_png8_oct(T1 & file, T2 const& image, const unsigned max_colors = 25
|
|||
else if (palette.size() == 1)
|
||||
{
|
||||
// 1 color image -> write 1-bit color depth PNG
|
||||
unsigned image_width = width > 7 ? (int(0.125*width) + 1)&~1 : 1;
|
||||
unsigned image_width = ((width + 15) >> 3) & ~1U; // 1-bit image, round up to 16-bit boundary
|
||||
unsigned image_height = height;
|
||||
image_data_8 reduced_image(image_width,image_height);
|
||||
reduce_1(image,reduced_image,trees, limits, alphaTable);
|
||||
|
@ -441,7 +441,7 @@ void save_as_png8_oct(T1 & file, T2 const& image, const unsigned max_colors = 25
|
|||
else
|
||||
{
|
||||
// <=16 colors -> write 4-bit color depth PNG
|
||||
unsigned image_width = width > 3 ? (int(0.5*width) + 3)&~3 : 4;
|
||||
unsigned image_width = ((width + 7) >> 1) & ~3U; // 4-bit image, round up to 32-bit boundary
|
||||
unsigned image_height = height;
|
||||
image_data_8 reduced_image(image_width,image_height);
|
||||
reduce_4(image, reduced_image, trees, limits, TRANSPARENCY_LEVELS, alphaTable);
|
||||
|
@ -478,7 +478,7 @@ void save_as_png8(T1 & file, T2 const& image, T3 const & tree,
|
|||
else if (palette.size() == 1)
|
||||
{
|
||||
// 1 color image -> write 1-bit color depth PNG
|
||||
unsigned image_width = width > 7 ? (int(0.125*width) + 1)&~1 : 1;
|
||||
unsigned image_width = ((width + 15) >> 3) & ~1U; // 1-bit image, round up to 16-bit boundary
|
||||
unsigned image_height = height;
|
||||
image_data_8 reduced_image(image_width, image_height);
|
||||
reduced_image.set(0);
|
||||
|
@ -487,7 +487,7 @@ void save_as_png8(T1 & file, T2 const& image, T3 const & tree,
|
|||
else
|
||||
{
|
||||
// <=16 colors -> write 4-bit color depth PNG
|
||||
unsigned image_width = width > 3 ? (int(0.5*width) + 3)&~3 : 4;
|
||||
unsigned image_width = ((width + 7) >> 1) & ~3U; // 4-bit image, round up to 32-bit boundary
|
||||
unsigned image_height = height;
|
||||
image_data_8 reduced_image(image_width, image_height);
|
||||
for (unsigned y = 0; y < height; ++y)
|
||||
|
|
|
@ -206,7 +206,7 @@ private:
|
|||
template <class T>
|
||||
void copy_height_ptr(T & sym) const
|
||||
{
|
||||
std::string height_expr = to_expression_string(sym.height());
|
||||
std::string height_expr = to_expression_string(*sym.height());
|
||||
sym.set_height(parse_expression(height_expr,"utf8"));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
class svg_generator : private boost::noncopyable
|
||||
{
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> path_type;
|
||||
|
||||
typedef svg::svg_root_attributes_grammar<OutputIterator> root_attributes_grammar;
|
||||
typedef svg::svg_rect_attributes_grammar<OutputIterator> rect_attributes_grammar;
|
||||
|
|
|
@ -94,7 +94,7 @@ BOOST_FUSION_ADAPT_STRUCT(
|
|||
*/
|
||||
namespace boost { namespace spirit { namespace traits {
|
||||
|
||||
typedef mapnik::coord_transform2<mapnik::CoordTransform, mapnik::geometry_type> path_type;
|
||||
typedef mapnik::coord_transform<mapnik::CoordTransform, mapnik::geometry_type> path_type;
|
||||
|
||||
template <>
|
||||
struct is_container<path_type const>
|
||||
|
|
|
@ -174,7 +174,7 @@ private:
|
|||
* Each coordinate is stored twice to match the needs of the grammar.
|
||||
*/
|
||||
typedef path_iterator<boost::tuple<unsigned, geometry_type::value_type, geometry_type::value_type>,
|
||||
coord_transform2<CoordTransform, geometry_type> > path_iterator_type;
|
||||
coord_transform<CoordTransform, geometry_type> > path_iterator_type;
|
||||
|
||||
}}
|
||||
|
||||
|
|
|
@ -269,8 +269,6 @@ public:
|
|||
|
||||
transform *= mtx;
|
||||
double scl = transform.scale();
|
||||
curved_stroked_trans.transformer(transform);
|
||||
curved_trans.transformer(transform);
|
||||
//curved_.approximation_method(curve_inc);
|
||||
curved_.approximation_scale(scl);
|
||||
curved_.angle_tolerance(0.0);
|
||||
|
@ -377,8 +375,6 @@ public:
|
|||
|
||||
transform *= mtx;
|
||||
double scl = transform.scale();
|
||||
curved_stroked_trans.transformer(transform);
|
||||
curved_trans.transformer(transform);
|
||||
//curved_.approximation_method(curve_inc);
|
||||
curved_.approximation_scale(scl);
|
||||
curved_.angle_tolerance(0.0);
|
||||
|
|
|
@ -524,6 +524,29 @@ struct mod: public boost::static_visitor<V>
|
|||
}
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct negate : public boost::static_visitor<V>
|
||||
{
|
||||
typedef V value_type;
|
||||
|
||||
template <typename T>
|
||||
value_type operator() (T val) const
|
||||
{
|
||||
return -val;
|
||||
}
|
||||
|
||||
value_type operator() (value_null const& val) const
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
value_type operator() (UnicodeString const& ustr) const
|
||||
{
|
||||
UnicodeString inplace(ustr);
|
||||
return inplace.reverse();
|
||||
}
|
||||
};
|
||||
|
||||
struct to_bool : public boost::static_visitor<bool>
|
||||
{
|
||||
bool operator() (bool val) const
|
||||
|
@ -763,6 +786,11 @@ public:
|
|||
return boost::apply_visitor(impl::less_or_equal(),base_,other.base_);
|
||||
}
|
||||
|
||||
value operator- () const
|
||||
{
|
||||
return boost::apply_visitor(impl::negate<value>(), base_);
|
||||
}
|
||||
|
||||
value_base const& base() const
|
||||
{
|
||||
return base_;
|
||||
|
|
|
@ -76,7 +76,7 @@ struct converter_traits
|
|||
typedef T0 geometry_type;
|
||||
typedef geometry_type conv_type;
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
throw "BOOM!";
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ struct converter_traits<T,mapnik::smooth_tag>
|
|||
typedef typename agg::conv_smooth_poly1_curve<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
geom.smooth_value(boost::fusion::at_c<2>(args).smooth());
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ struct converter_traits<T, mapnik::clip_line_tag>
|
|||
typedef typename agg::conv_clip_polyline<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<0> >::type box = boost::fusion::at_c<0>(args);
|
||||
geom.clip_box(box.minx(),box.miny(),box.maxx(),box.maxy());
|
||||
|
@ -118,8 +118,9 @@ struct converter_traits<T, mapnik::dash_tag>
|
|||
typedef typename agg::conv_dash<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
double scale_factor = boost::fusion::at_c<5>(args);
|
||||
stroke const& stroke_ = sym.get_stroke();
|
||||
|
@ -142,7 +143,7 @@ struct converter_traits<T, mapnik::stroke_tag>
|
|||
typedef typename agg::conv_stroke<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
stroke const& stroke_ = sym.get_stroke();
|
||||
|
@ -161,7 +162,7 @@ struct converter_traits<T,mapnik::clip_poly_tag>
|
|||
typedef typename agg::conv_clip_polygon<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<0> >::type box = boost::fusion::at_c<0>(args);
|
||||
geom.clip_box(box.minx(),box.miny(),box.maxx(),box.maxy());
|
||||
|
@ -173,10 +174,10 @@ template <typename T>
|
|||
struct converter_traits<T,mapnik::transform_tag>
|
||||
{
|
||||
typedef T geometry_type;
|
||||
typedef coord_transform2<CoordTransform, geometry_type> conv_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<3> >::type tr = boost::fusion::at_c<3>(args);
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<4> >::type prj_trans = boost::fusion::at_c<4>(args);
|
||||
|
@ -190,16 +191,21 @@ template <typename T>
|
|||
struct converter_traits<T,mapnik::affine_transform_tag>
|
||||
{
|
||||
typedef T geometry_type;
|
||||
typedef typename agg::conv_transform<geometry_type> conv_type;
|
||||
|
||||
struct conv_type : public agg::conv_transform<geometry_type>
|
||||
{
|
||||
agg::trans_affine trans_;
|
||||
|
||||
conv_type(geometry_type& geom)
|
||||
: agg::conv_transform<geometry_type>(geom, trans_) {}
|
||||
};
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
agg::trans_affine tr;
|
||||
boost::array<double,6> const& m = sym.get_transform();
|
||||
tr.load_from(&m[0]);
|
||||
geom.transformer(tr);
|
||||
geom.trans_.load_from(&m[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -210,7 +216,7 @@ struct converter_traits<T,mapnik::offset_transform_tag>
|
|||
typedef offset_converter<geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args & args)
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
{
|
||||
typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
|
||||
geom.set_offset(sym.offset());
|
||||
|
@ -221,7 +227,7 @@ template <bool>
|
|||
struct converter_fwd
|
||||
{
|
||||
template <typename Base, typename T0,typename T1,typename T2, typename Iter,typename End>
|
||||
static void forward(Base& base, T0 & geom,T1 & args)
|
||||
static void forward(Base& base, T0 & geom,T1 const& args)
|
||||
{
|
||||
typedef T0 geometry_type;
|
||||
typedef T2 conv_tag;
|
||||
|
@ -236,7 +242,7 @@ template <>
|
|||
struct converter_fwd<true>
|
||||
{
|
||||
template <typename Base, typename T0,typename T1,typename T2, typename Iter,typename End>
|
||||
static void forward(Base& base, T0 & geom,T1 & args)
|
||||
static void forward(Base& base, T0 & geom,T1 const& args)
|
||||
{
|
||||
base.template dispatch<Iter,End>(geom, typename boost::is_same<Iter,End>::type());
|
||||
}
|
||||
|
@ -249,7 +255,7 @@ struct dispatcher
|
|||
typedef A args_type;
|
||||
typedef C conv_types;
|
||||
|
||||
dispatcher(args_type args)
|
||||
dispatcher(args_type const& args)
|
||||
: args_(args)
|
||||
{
|
||||
std::memset(&vec_[0], 0, sizeof(unsigned)*vec_.size());
|
||||
|
@ -328,11 +334,8 @@ struct vertex_converter : private boost::noncopyable
|
|||
void apply(Geometry & geom)
|
||||
{
|
||||
typedef Geometry geometry_type;
|
||||
//BOOST_FOREACH(geometry_type & geom, cont)
|
||||
{
|
||||
disp_.template apply<geometry_type>(geom);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Conv>
|
||||
void set()
|
||||
|
|
|
@ -47,7 +47,7 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base;
|
||||
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgba order_type;
|
||||
typedef agg::pixel32_type pixel_type;
|
||||
|
|
|
@ -53,7 +53,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
||||
ras_ptr->reset();
|
||||
|
@ -108,10 +108,9 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
unsigned h=(*pat)->height();
|
||||
agg::rendering_buffer pattern_rbuf((agg::int8u*)(*pat)->getBytes(),w,h,w*4);
|
||||
agg::pixfmt_rgba32 pixf_pattern(pattern_rbuf);
|
||||
pixf_pattern.premultiply();
|
||||
img_source_type img_src(pixf_pattern);
|
||||
|
||||
unsigned num_geometries = feature->num_geometries();
|
||||
|
||||
|
||||
pattern_alignment_e align = sym.get_alignment();
|
||||
unsigned offset_x=0;
|
||||
|
@ -119,16 +118,17 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
|
||||
if (align == LOCAL_ALIGNMENT)
|
||||
{
|
||||
double x0=0,y0=0;
|
||||
if (num_geometries>0)
|
||||
double x0 = 0;
|
||||
double y0 = 0;
|
||||
if (feature->num_geometries() > 0)
|
||||
{
|
||||
clipped_geometry_type clipped(feature->get_geometry(0));
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
path.vertex(&x0,&y0);
|
||||
}
|
||||
offset_x = unsigned(width_-x0);
|
||||
offset_y = unsigned(height_-y0);
|
||||
offset_x = unsigned(width_ - x0);
|
||||
offset_y = unsigned(height_ - y0);
|
||||
}
|
||||
|
||||
span_gen_type sg(img_src, offset_x, offset_y);
|
||||
|
@ -162,4 +162,3 @@ template void agg_renderer<image_32>::process(polygon_pattern_symbolizer const&,
|
|||
proj_transform const&);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -75,10 +75,7 @@ if env['RUNTIME_LINK'] == 'static':
|
|||
lib_env['LIBS'].append('icudata')
|
||||
lib_env['LIBS'].append('icui18n')
|
||||
else:
|
||||
if env['INTERNAL_LIBAGG']:
|
||||
lib_env['LIBS'].insert(0, 'agg')
|
||||
else:
|
||||
lib_env['LIBS'].append([lib for lib in env['LIBS'] if lib.startswith('agg')])
|
||||
|
||||
if env['PLATFORM'] == 'Darwin':
|
||||
mapnik_libname = env.subst(env['MAPNIK_LIB_NAME'])
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <cairomm/context.h>
|
||||
#include <cairomm/surface.h>
|
||||
#include <cairo-ft.h>
|
||||
#include <cairo-version.h>
|
||||
|
||||
// boost
|
||||
#include <boost/utility.hpp>
|
||||
|
@ -382,6 +383,8 @@ public:
|
|||
case minus:
|
||||
case invert:
|
||||
case invert_rgb:
|
||||
case grain_merge:
|
||||
case grain_extract:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +857,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
|
||||
cairo_context context(context_);
|
||||
context.set_operator(sym.comp_op());
|
||||
|
@ -864,7 +867,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
if (height_expr)
|
||||
{
|
||||
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(*feature), *height_expr);
|
||||
height = 0.7071 * result.to_double();
|
||||
height = result.to_double(); //scale_factor is always 1.0 atm
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < feature->num_geometries(); ++i)
|
||||
|
@ -946,10 +949,10 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
}
|
||||
}
|
||||
|
||||
path_type path(t_, *frame, prj_trans);
|
||||
context.set_color(128, 128, 128, sym.get_opacity());
|
||||
context.add_path(path);
|
||||
context.stroke();
|
||||
//path_type path(t_, *frame, prj_trans);
|
||||
//context.set_color(128, 128, 128, sym.get_opacity());
|
||||
//context.add_path(path);
|
||||
//context.stroke();
|
||||
|
||||
path_type roof_path(t_, *roof, prj_trans);
|
||||
context.set_color(sym.get_fill(), sym.get_opacity());
|
||||
|
@ -1023,7 +1026,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
||||
}
|
||||
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
agg::trans_affine transform;
|
||||
mapnik::path_ptr vmarker = *marker.get_vector_data();
|
||||
using namespace mapnik::svg;
|
||||
|
@ -1072,12 +1075,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
}
|
||||
else if(attr.fill_flag)
|
||||
{
|
||||
context.set_color(attr.fill_color.r,attr.fill_color.g,attr.fill_color.b,attr.opacity*opacity);
|
||||
double fill_opacity = attr.opacity * opacity * attr.fill_color.opacity();
|
||||
context.set_color(attr.fill_color.r,attr.fill_color.g,attr.fill_color.b, fill_opacity);
|
||||
context.fill();
|
||||
}
|
||||
}
|
||||
|
||||
if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT || attr.stroke_flag)
|
||||
if (attr.stroke_gradient.get_gradient_type() != NO_GRADIENT || attr.stroke_flag)
|
||||
{
|
||||
context.add_agg_path(svg_path,attr.index);
|
||||
if(attr.stroke_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
|
@ -1090,9 +1094,10 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
context.set_gradient(g,bbox);
|
||||
context.stroke();
|
||||
}
|
||||
else if(attr.stroke_flag)
|
||||
else if (attr.stroke_flag)
|
||||
{
|
||||
context.set_color(attr.stroke_color.r,attr.stroke_color.g,attr.stroke_color.b,attr.opacity*opacity);
|
||||
double stroke_opacity = attr.opacity * opacity * attr.stroke_color.opacity();
|
||||
context.set_color(attr.stroke_color.r,attr.stroke_color.g,attr.stroke_color.b, stroke_opacity);
|
||||
context.set_line_width(attr.stroke_width);
|
||||
context.set_line_cap(line_cap_enum(attr.line_cap));
|
||||
context.set_line_join(line_join_enum(attr.line_join));
|
||||
|
@ -1202,7 +1207,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
|
||||
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
|
||||
|
@ -1363,7 +1368,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
double scale_factor_ = 1;
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
agg::trans_affine tr;
|
||||
boost::array<double,6> const& m = sym.get_image_transform();
|
||||
|
|
|
@ -106,7 +106,7 @@ struct feature_style_processor<Processor>::symbol_dispatch : public boost::stati
|
|||
}
|
||||
|
||||
Processor & output_;
|
||||
mapnik::feature_ptr f_;
|
||||
mapnik::feature_ptr const& f_;
|
||||
proj_transform const& prj_trans_;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void expression_format::to_xml(boost::property_tree::ptree &xml) const
|
|||
ptree &new_node = xml.push_back(ptree::value_type("ExpressionFormat", ptree()))->second;
|
||||
if (face_name) set_attr(new_node, "face-name", to_expression_string(*face_name));
|
||||
if (text_size) set_attr(new_node, "size", to_expression_string(*text_size));
|
||||
if (character_spacing) set_attr(new_node, "character-spacing", to_expression_string*character_spacing);
|
||||
if (character_spacing) set_attr(new_node, "character-spacing", to_expression_string(*character_spacing));
|
||||
if (line_spacing) set_attr(new_node, "line-spacing", to_expression_string(*line_spacing));
|
||||
if (text_opacity) set_attr(new_node, "opacity", to_expression_string(*text_opacity));
|
||||
if (wrap_before) set_attr(new_node, "wrap-before", to_expression_string(*wrap_before));
|
||||
|
|
|
@ -104,7 +104,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
|
|||
{
|
||||
if (marker.is_vector())
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -46,7 +46,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -45,7 +45,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -45,7 +45,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -55,7 +55,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -44,7 +44,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -44,7 +44,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -67,7 +67,10 @@ static const comp_op_lookup_type comp_lookup = boost::assign::list_of<comp_op_lo
|
|||
(exclusion,"exclusion")
|
||||
(contrast,"contrast")
|
||||
(invert,"invert")
|
||||
(invert_rgb,"invert-rgb");
|
||||
(invert_rgb,"invert-rgb")
|
||||
(grain_merge,"grain-merge")
|
||||
(grain_extract,"grain-extract")
|
||||
;
|
||||
|
||||
boost::optional<composite_mode_e> comp_op_from_string(std::string const& name)
|
||||
{
|
||||
|
|
|
@ -936,7 +936,7 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & sym)
|
|||
}
|
||||
boost::array<double,6> matrix;
|
||||
tr.store_to(&matrix[0]);
|
||||
symbol.set_transform(matrix);
|
||||
symbol.set_image_transform(matrix);
|
||||
}
|
||||
}
|
||||
catch (image_reader_exception const & ex)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// agg
|
||||
#include "agg_basics.h"
|
||||
#include "agg_conv_clip_polyline.h"
|
||||
#include "agg_trans_affine.h"
|
||||
// stl
|
||||
#include <cmath>
|
||||
|
||||
|
@ -191,18 +192,23 @@ bool markers_placement<Locator, Detector>::get_point(
|
|||
template <typename Locator, typename Detector>
|
||||
box2d<double> markers_placement<Locator, Detector>::perform_transform(double angle, double dx, double dy)
|
||||
{
|
||||
double c = cos(angle), s = sin(angle);
|
||||
double x1 = size_.minx();
|
||||
double x2 = size_.maxx();
|
||||
double y1 = size_.miny();
|
||||
double y2 = size_.maxy();
|
||||
|
||||
double x1_ = dx + x1 * c - y1 * s;
|
||||
double y1_ = dy + x1 * s + y1 * c;
|
||||
double x2_ = dx + x2 * c - y2 * s;
|
||||
double y2_ = dy + x2 * s + y2 * c;
|
||||
agg::trans_affine tr = agg::trans_affine_rotation(angle).translate(dx, dy);
|
||||
|
||||
return box2d<double>(x1_, y1_, x2_, y2_);
|
||||
double xA = x1, yA = y1, xB = x2, yB = y1, xC = x2, yC = y2, xD = x1, yD = y2;
|
||||
tr.transform(&xA, &yA);
|
||||
tr.transform(&xB, &yB);
|
||||
tr.transform(&xC, &yC);
|
||||
tr.transform(&xD, &yD);
|
||||
|
||||
box2d<double> result(xA, yA, xB, yB);
|
||||
result.expand_to_include(xC, yC);
|
||||
result.expand_to_include(xD, yD);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename Locator, typename Detector>
|
||||
|
@ -226,8 +232,8 @@ void markers_placement<Locator, Detector>::set_spacing_left(double sl, bool allo
|
|||
}
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> clipped_path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> clipped_path_type;
|
||||
|
||||
template class markers_placement<path_type, label_collision_detector4>;
|
||||
template class markers_placement<clipped_path_type, label_collision_detector4>;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
// STL
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
@ -334,7 +333,10 @@ void metawriter_json::start(metawriter_property_map const& properties)
|
|||
void metawriter_json::write_header()
|
||||
{
|
||||
f_.open(filename_.c_str(), std::fstream::out | std::fstream::trunc);
|
||||
if (f_.fail()) perror((std::string("Metawriter JSON: Failed to open file ") + filename_).c_str());
|
||||
if (f_.fail())
|
||||
{
|
||||
MAPNIK_LOG_DEBUG(metawriter) << "metawriter_json: Failed to open file " << filename_;
|
||||
}
|
||||
set_stream(&f_);
|
||||
metawriter_json_stream::write_header();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ bool svg_renderer<OutputIterator>::process(rule::symbolizers const& syms,
|
|||
{
|
||||
// svg renderer supports processing of multiple symbolizers.
|
||||
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> path_type;
|
||||
|
||||
// process each symbolizer to collect its (path) information.
|
||||
// path information (attributes from line_ and polygon_ symbolizers)
|
||||
|
|
|
@ -53,7 +53,7 @@ bool text_symbolizer_helper<FaceManagerT, DetectorT>::next_line_placement()
|
|||
}
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
clipped_geometry_type clipped(**geo_itr_);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_, clipped, prj_trans_);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/text_symbolizer.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
#include <mapnik/formatting/text.hpp>
|
||||
|
||||
|
||||
// boost
|
||||
|
@ -137,7 +138,9 @@ text_symbolizer& text_symbolizer::operator=(text_symbolizer const& other)
|
|||
|
||||
expression_ptr text_symbolizer::get_name() const
|
||||
{
|
||||
return expression_ptr();
|
||||
formatting::text_node *node = dynamic_cast<formatting::text_node *>(placement_options_->defaults.format_tree().get());
|
||||
if (!node) return expression_ptr();
|
||||
return node->get_text();
|
||||
}
|
||||
|
||||
void text_symbolizer::set_name(expression_ptr name)
|
||||
|
|
19
tests/data/good_maps/raster-alpha-gradient.xml
Normal file
19
tests/data/good_maps/raster-alpha-gradient.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE Map[]>
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="transparent">
|
||||
|
||||
<Style name="white" filter-mode="first">
|
||||
<Rule>
|
||||
<RasterSymbolizer opacity="1" scaling="bilinear" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="white"
|
||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
<StyleName>white</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file">../raster/transp.tiff</Parameter>
|
||||
<Parameter name="type">gdal</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
19
tests/data/good_maps/raster-alpha.xml
Normal file
19
tests/data/good_maps/raster-alpha.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE Map[]>
|
||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="red">
|
||||
|
||||
<Style name="white" filter-mode="first">
|
||||
<Rule>
|
||||
<RasterSymbolizer opacity="1" scaling="bilinear" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="white"
|
||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||
<StyleName>white</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file">../raster/white-alpha.tiff</Parameter>
|
||||
<Parameter name="type">gdal</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
|
||||
</Map>
|
BIN
tests/data/raster/transp.tiff
Normal file
BIN
tests/data/raster/transp.tiff
Normal file
Binary file not shown.
BIN
tests/data/raster/white-alpha.tiff
Normal file
BIN
tests/data/raster/white-alpha.tiff
Normal file
Binary file not shown.
BIN
tests/python_tests/images/support/raster-alpha.png
Normal file
BIN
tests/python_tests/images/support/raster-alpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
29
tests/python_tests/raster_alpha_test.py
Normal file
29
tests/python_tests/raster_alpha_test.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from copy import deepcopy
|
||||
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
# from another directory we need to chdir()
|
||||
os.chdir(execution_path('.'))
|
||||
|
||||
def test_map_alpha_compare():
|
||||
m = mapnik.Map(600,400)
|
||||
mapnik.load_map(m,'../data/good_maps/raster-alpha.xml')
|
||||
m.zoom_all()
|
||||
actual = '/tmp/mapnik-raster-alpha.png'
|
||||
expected = 'images/support/raster-alpha.png'
|
||||
im = mapnik.Image(m.width,m.height)
|
||||
mapnik.render(m,im)
|
||||
im.save(actual)
|
||||
expected_im = mapnik.Image.open(expected)
|
||||
eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
|
@ -56,8 +56,8 @@ ldflags = config_env['CUSTOM_LDFLAGS'] + ''.join([' -L%s' % i for i in config_en
|
|||
|
||||
dep_libs = ''.join([' -l%s' % i for i in env['LIBMAPNIK_LIBS']])
|
||||
|
||||
if env['INTERNAL_LIBAGG']:
|
||||
dep_libs = dep_libs.replace('-lagg','')
|
||||
# remove local agg from public linking
|
||||
dep_libs = dep_libs.replace('-lagg','')
|
||||
|
||||
git_revision = os.popen("git rev-list --max-count=1 HEAD").read()
|
||||
|
||||
|
|
Loading…
Reference in a new issue