Merge branch 'master' of github.com:mapnik/mapnik into bigint-feature-id

This commit is contained in:
Dane Springmeyer 2012-12-19 20:13:19 -08:00
commit 775215e874
15 changed files with 243 additions and 68 deletions

View file

@ -10,4 +10,4 @@ before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev python-nose libicu-dev libpng-dev libjpeg-dev libtiff-dev libz-dev libfreetype6-dev libxml2-dev libproj-dev libpq-dev libgdal-dev libcairomm-1.0-dev python-cairo-dev libsqlite3-dev
script: scons configure JOBS=2 FAST=True CXX="$CXX $CXX_SCONS" WARNING_CXXFLAGS=$WARNING_CXXFLAGS && sudo make install
script: scons configure DEMO=False CPP_TESTS=False CAIRO=False INPUT_PLUGINS=shape,csv,osm OPTIMIZATION=2 JOBS=2 FAST=True CXX="$CXX $CXX_SCONS" WARNING_CXXFLAGS=$WARNING_CXXFLAGS && sudo make install

View file

@ -326,6 +326,7 @@ opts.AddVariables(
BoolVariable('RENDERING_STATS', 'Output rendering statistics during style processing', 'False'),
BoolVariable('SVG_RENDERER', 'build support for native svg renderer', 'False'),
BoolVariable('CPP_TESTS', 'Compile the C++ tests', 'True'),
# Variables for optional dependencies
('GEOS_CONFIG', 'The path to the geos-config executable.', 'geos-config'),
@ -1742,7 +1743,8 @@ if not HELP_REQUESTED:
# build C++ tests
# not ready for release
SConscript('tests/cpp_tests/build.py')
if env['CPP_TESTS']:
SConscript('tests/cpp_tests/build.py')
# not currently maintained
# https://github.com/mapnik/mapnik/issues/1438

View file

@ -165,7 +165,7 @@ struct gray16
static self_type no_color() { return self_type(0,0); }
};
//==================================================================gray16
//==================================================================gray32
struct gray32
{
typedef agg::int32 value_type;
@ -302,6 +302,143 @@ struct gray32
static self_type no_color() { return self_type(0,0); }
};
//==================================================================gray64
struct gray64
{
typedef agg::int64 value_type;
typedef agg::int64u calc_type;
typedef agg::int64 long_type;
enum base_scale_e
{
base_shift = 32,
base_scale = 1 << base_shift,
base_mask = base_scale - 1
};
typedef gray64 self_type;
value_type v;
value_type a;
//--------------------------------------------------------------------
gray64() {}
//--------------------------------------------------------------------
gray64(value_type v_, value_type a_=base_mask) :
v(v_), a(a_) {}
//--------------------------------------------------------------------
gray64(const self_type& c, unsigned a_) :
v(c.v), a(value_type(a_)) {}
//--------------------------------------------------------------------
void clear()
{
v = a = 0;
}
//--------------------------------------------------------------------
const self_type& transparent()
{
a = 0;
return *this;
}
//--------------------------------------------------------------------
void opacity(double a_)
{
if(a_ < 0.0) a_ = 0.0;
if(a_ > 1.0) a_ = 1.0;
a = (value_type)agg::uround(a_ * double(base_mask));
}
//--------------------------------------------------------------------
double opacity() const
{
return double(a) / double(base_mask);
}
//--------------------------------------------------------------------
const self_type& premultiply()
{
if(a == base_mask) return *this;
if(a == 0)
{
v = 0;
return *this;
}
v = value_type((calc_type(v) * a) >> base_shift);
return *this;
}
//--------------------------------------------------------------------
const self_type& premultiply(unsigned a_)
{
if(a == base_mask && a_ >= base_mask) return *this;
if(a == 0 || a_ == 0)
{
v = a = 0;
return *this;
}
calc_type v_ = (calc_type(v) * a_) / a;
v = value_type((v_ > a_) ? a_ : v_);
a = value_type(a_);
return *this;
}
//--------------------------------------------------------------------
const self_type& demultiply()
{
if(a == base_mask) return *this;
if(a == 0)
{
v = 0;
return *this;
}
calc_type v_ = (calc_type(v) * base_mask) / a;
v = value_type((v_ > base_mask) ? base_mask : v_);
return *this;
}
//--------------------------------------------------------------------
self_type gradient(self_type c, double k) const
{
self_type ret;
calc_type ik = agg::uround(k * base_scale);
ret.v = value_type(calc_type(v) + (((calc_type(c.v) - v) * ik) >> base_shift));
ret.a = value_type(calc_type(a) + (((calc_type(c.a) - a) * ik) >> base_shift));
return ret;
}
//--------------------------------------------------------------------
AGG_INLINE void add(const self_type& c, unsigned cover)
{
calc_type cv, ca;
if(cover == agg::cover_mask)
{
if(c.a == base_mask)
{
*this = c;
}
else
{
cv = v + c.v; v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
ca = a + c.a; a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
}
}
else
{
cv = v + ((c.v * cover + agg::cover_mask/2) >> agg::cover_shift);
ca = a + ((c.a * cover + agg::cover_mask/2) >> agg::cover_shift);
v = (cv > calc_type(base_mask)) ? calc_type(base_mask) : cv;
a = (ca > calc_type(base_mask)) ? calc_type(base_mask) : ca;
}
}
//--------------------------------------------------------------------
static self_type no_color() { return self_type(0,0); }
};
}
#endif

View file

@ -638,7 +638,12 @@ typedef pixfmt_alpha_blend_gray<blender_gray16,
typedef blender_gray<gray32> blender_gray32;
typedef pixfmt_alpha_blend_gray<blender_gray32,
mapnik::grid_rendering_buffer> pixfmt_gray32; //----pixfmt_gray16
mapnik::grid_rendering_buffer> pixfmt_gray32; //----pixfmt_gray32
typedef blender_gray<gray64> blender_gray64;
typedef pixfmt_alpha_blend_gray<blender_gray64,
mapnik::grid_rendering_buffer> pixfmt_gray64; //----pixfmt_gray64
}

View file

@ -0,0 +1,36 @@
/*****************************************************************************
*
* 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_GRID_RENDERER_BASE_HPP
#define MAPNIK_GRID_RENDERER_BASE_HPP
#include "agg_renderer_base.h"
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
namespace mapnik {
typedef agg::renderer_base<mapnik::pixfmt_gray32> grid_renderer_base_type;
}
#endif //MAPNIK_AGG_RASTERIZER_HPP

View file

@ -80,7 +80,7 @@ void hit_grid<T>::clear()
template <typename T>
void hit_grid<T>::add_feature(mapnik::feature_impl & feature)
{
int feature_id = feature.id();
value_type feature_id = feature.id();
// avoid adding duplicate features (e.g. in the case of both a line symbolizer and a polygon symbolizer)
typename feature_key_type::const_iterator feature_pos = f_keys_.find(feature_id);
if (feature_pos != f_keys_.end())

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/debug.hpp>
@ -130,15 +129,16 @@ void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned in
if (marker.is_vector())
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
ras_ptr->reset();
@ -156,8 +156,8 @@ void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned in
svg_path_adapter svg_path(stl_storage);
svg_renderer_agg<svg_path_adapter,
agg::pod_bvector<path_attributes>,
renderer,
mapnik::pixfmt_gray32> svg_renderer(svg_path,
renderer_type,
pixfmt_type> svg_renderer(svg_path,
(*marker.get_vector_data())->attributes());
svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox);

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/segment.hpp>
#include <mapnik/expression_evaluator.hpp>
@ -49,16 +48,17 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
typedef coord_transform<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
ras_ptr->reset();
@ -111,7 +111,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
path_type faces_path (t_,*faces,prj_trans);
ras_ptr->add_path(faces_path);
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
ras_ptr->reset();
@ -138,13 +138,13 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
path_type path(t_,*frame,prj_trans);
agg::conv_stroke<path_type> stroke(path);
ras_ptr->add_path(stroke);
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
ras_ptr->reset();
path_type roof_path (t_,*roof,prj_trans);
ras_ptr->add_path(roof_path);
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
}
}

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/line_pattern_symbolizer.hpp>
@ -46,15 +45,16 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
proj_transform const& prj_trans)
{
typedef coord_transform<CoordTransform,geometry_type> path_type;
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
ras_ptr->reset();
@ -75,7 +75,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/line_symbolizer.hpp>
@ -50,17 +49,18 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::renderer_base<mapnik::pixfmt_gray32> renderer_base;
typedef agg::renderer_scanline_bin_solid<renderer_base> renderer_type;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
typedef boost::mpl::vector<clip_line_tag, transform_tag,
offset_transform_tag, affine_transform_tag,
simplify_tag, smooth_tag, dash_tag, stroke_tag> conv_types;
agg::scanline_bin sl;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
renderer_base renb(pixf);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
ras_ptr->reset();
@ -103,7 +103,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
}
// render id
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::render_scanlines(*ras_ptr, sl, ren);
// add feature properties to grid cache

View file

@ -28,7 +28,6 @@ porting notes -->
- current_buffer_ -> pixmap_
- agg::rendering_buffer -> grid_renderering_buffer
- no gamma
- mapnik::pixfmt_gray32
- agg::scanline_bin sl
- grid_rendering_buffer
- agg::renderer_scanline_bin_solid
@ -45,8 +44,7 @@ porting notes -->
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/grid/grid_marker_helpers.hpp>
@ -84,9 +82,9 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
proj_transform const& prj_trans)
{
typedef grid_rendering_buffer buf_type;
typedef mapnik::pixfmt_gray32 pixfmt_type;
typedef agg::renderer_base<pixfmt_type> renderer_base;
typedef agg::renderer_scanline_bin_solid<renderer_base> renderer_type;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
typedef label_collision_detector4 detector_type;
typedef boost::mpl::vector<clip_line_tag,clip_poly_tag,transform_tag,smooth_tag> conv_types;
@ -221,7 +219,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
typedef raster_markers_rasterizer_dispatch_grid<buf_type,
grid_rasterizer,
pixfmt_type,
renderer_base,
grid_renderer_base_type,
renderer_type,
detector_type,
mapnik::grid > dispatch_type;

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/geom_util.hpp>

View file

@ -26,8 +26,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/polygon_pattern_symbolizer.hpp>
#include <mapnik/vertex_converters.hpp>
@ -71,18 +70,18 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
converter.apply(geom);
}
}
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
agg::render_scanlines(*ras_ptr, sl, ren);

View file

@ -26,8 +26,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/polygon_symbolizer.hpp>
#include <mapnik/vertex_converters.hpp>
@ -48,6 +47,10 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
typedef agg::renderer_scanline_bin_solid<grid_renderer_base_type> renderer_type;
typedef typename grid_renderer_base_type::pixfmt_type pixfmt_type;
typedef typename grid_renderer_base_type::pixfmt_type::color_type color_type;
ras_ptr->reset();
agg::trans_affine tr;
@ -73,17 +76,14 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
}
}
typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
mapnik::pixfmt_gray32 pixf(buf);
pixfmt_type pixf(buf);
ren_base renb(pixf);
renderer ren(renb);
grid_renderer_base_type renb(pixf);
renderer_type ren(renb);
// render id
ren.color(mapnik::gray32(feature.id()));
ren.color(color_type(feature.id()));
agg::scanline_bin sl;
agg::render_scanlines(*ras_ptr, sl, ren);

View file

@ -23,8 +23,7 @@
// mapnik
#include <mapnik/grid/grid_rasterizer.hpp>
#include <mapnik/grid/grid_renderer.hpp>
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_renderer_base.hpp>
#include <mapnik/grid/grid.hpp>
#include <mapnik/symbolizer_helpers.hpp>