Merge remote-tracking branch 'origin/2.3.x'
This commit is contained in:
commit
f9e630bbd3
17 changed files with 343 additions and 43 deletions
|
@ -14,6 +14,10 @@ Released ...
|
|||
|
||||
Summary: TODO
|
||||
|
||||
- Fixed rendering of large shapes at high zoom levels, which might dissapear due to integer overflow. This
|
||||
bug was previously fixable when geometries were clipped, but would, until now, re-appear if clipping was turned
|
||||
off for a symbolizer (#2000)
|
||||
|
||||
- Added single color argument support to `colorize-alpha` to allow colorizing alpha with one color.
|
||||
|
||||
- Added `color-to-alpha` `image-filter` to allow for applying alpha in proportion to color similiarity (#2023)
|
||||
|
|
14
benchmark/data/polygon_rendering_clip.xml
Normal file
14
benchmark/data/polygon_rendering_clip.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<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="steelblue">
|
||||
<Style name="style">
|
||||
<Rule>
|
||||
<PolygonSymbolizer clip="true"/>
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="world" 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>style</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file">../../tests/data/shp/world_merc.shp</Parameter>
|
||||
<Parameter name="type">shape</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
</Map>
|
14
benchmark/data/polygon_rendering_no_clip.xml
Normal file
14
benchmark/data/polygon_rendering_no_clip.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<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="steelblue">
|
||||
<Style name="style">
|
||||
<Rule>
|
||||
<PolygonSymbolizer clip="false"/>
|
||||
</Rule>
|
||||
</Style>
|
||||
<Layer name="world" 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>style</StyleName>
|
||||
<Datasource>
|
||||
<Parameter name="file">../../tests/data/shp/world_merc.shp</Parameter>
|
||||
<Parameter name="type">shape</Parameter>
|
||||
</Datasource>
|
||||
</Layer>
|
||||
</Map>
|
|
@ -408,10 +408,88 @@ struct test8
|
|||
}
|
||||
};
|
||||
|
||||
#include "agg_conv_clip_polygon.h"
|
||||
#include <mapnik/wkt/wkt_factory.hpp>
|
||||
#include <mapnik/util/geometry_to_wkt.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
||||
#include "agg_conv_clip_polygon.h"
|
||||
|
||||
struct test11a
|
||||
{
|
||||
unsigned iter_;
|
||||
unsigned threads_;
|
||||
std::string wkt_in_;
|
||||
mapnik::box2d<double> extent_;
|
||||
typedef agg::conv_clip_polygon<mapnik::geometry_type> conv_clip;
|
||||
test11a(unsigned iterations,
|
||||
unsigned threads,
|
||||
std::string wkt_in,
|
||||
mapnik::box2d<double> const& extent)
|
||||
: iter_(iterations),
|
||||
threads_(threads),
|
||||
wkt_in_(wkt_in),
|
||||
extent_(extent) {
|
||||
|
||||
}
|
||||
|
||||
bool validate()
|
||||
{
|
||||
std::string expected_wkt("Polygon((181 286.666667,233 454,315 340,421 446,463 324,559 466,631 321.320755,631 234.386861,528 178,394 229,329 138,212 134,183 228,200 264,181 238.244444),(313 190,440 256,470 248,510 305,533 237,613 263,553 397,455 262,405 378,343 287,249 334,229 191,313 190,313 190))");
|
||||
boost::ptr_vector<geometry_type> paths;
|
||||
if (!mapnik::from_wkt(wkt_in_, paths))
|
||||
{
|
||||
throw std::runtime_error("Failed to parse WKT");
|
||||
}
|
||||
BOOST_FOREACH (geometry_type & geom , paths)
|
||||
{
|
||||
conv_clip clipped(geom);
|
||||
clipped.clip_box(
|
||||
extent_.minx(),
|
||||
extent_.miny(),
|
||||
extent_.maxx(),
|
||||
extent_.maxy());
|
||||
unsigned cmd;
|
||||
double x,y;
|
||||
mapnik::geometry_type geom2(mapnik::Polygon);
|
||||
while ((cmd = clipped.vertex(&x, &y)) != SEG_END) {
|
||||
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
|
||||
}
|
||||
std::string wkt;
|
||||
bool result = mapnik::util::to_wkt(wkt,geom2);
|
||||
if (result) {
|
||||
return (wkt == expected_wkt);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
boost::ptr_vector<geometry_type> paths;
|
||||
if (!mapnik::from_wkt(wkt_in_, paths))
|
||||
{
|
||||
throw std::runtime_error("Failed to parse WKT");
|
||||
}
|
||||
for (unsigned i=0;i<iter_;++i)
|
||||
{
|
||||
BOOST_FOREACH (geometry_type & geom , paths)
|
||||
{
|
||||
conv_clip clipped(geom);
|
||||
clipped.clip_box(
|
||||
extent_.minx(),
|
||||
extent_.miny(),
|
||||
extent_.maxx(),
|
||||
extent_.maxy());
|
||||
unsigned cmd;
|
||||
double x,y;
|
||||
while ((cmd = clipped.vertex(&x, &y)) != SEG_END) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#include "agg_conv_clipper.h"
|
||||
#include "agg_path_storage.h"
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
||||
struct test11
|
||||
{
|
||||
|
@ -433,7 +511,39 @@ struct test11
|
|||
|
||||
bool validate()
|
||||
{
|
||||
return true;
|
||||
std::string expected_wkt("Polygon((212 134,329 138,394 229,528 178,631 234.4,631 321.3,559 466,463 324,421 446,315 340,233 454,181 286.7,181 238.2,200 264,183 228),(313 190,229 191,249 334,343 287,405 378,455 262,553 397,613 263,533 237,510 305,470 248,440 256))");
|
||||
boost::ptr_vector<geometry_type> paths;
|
||||
if (!mapnik::from_wkt(wkt_in_, paths))
|
||||
{
|
||||
throw std::runtime_error("Failed to parse WKT");
|
||||
}
|
||||
agg::path_storage ps;
|
||||
ps.move_to(extent_.minx(), extent_.miny());
|
||||
ps.line_to(extent_.minx(), extent_.maxy());
|
||||
ps.line_to(extent_.maxx(), extent_.maxy());
|
||||
ps.line_to(extent_.maxx(), extent_.miny());
|
||||
ps.close_polygon();
|
||||
BOOST_FOREACH (geometry_type & geom , paths)
|
||||
{
|
||||
poly_clipper clipped(geom,ps,
|
||||
agg::clipper_and,
|
||||
agg::clipper_non_zero,
|
||||
agg::clipper_non_zero,
|
||||
1);
|
||||
clipped.rewind(0);
|
||||
unsigned cmd;
|
||||
double x,y;
|
||||
mapnik::geometry_type geom2(mapnik::Polygon);
|
||||
while ((cmd = clipped.vertex(&x, &y)) != SEG_END) {
|
||||
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
|
||||
}
|
||||
std::string wkt;
|
||||
bool result = mapnik::util::to_wkt(wkt,geom2);
|
||||
if (result) {
|
||||
return (wkt == expected_wkt);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
|
@ -473,7 +583,6 @@ struct test12
|
|||
unsigned iter_;
|
||||
unsigned threads_;
|
||||
std::string wkt_in_;
|
||||
|
||||
mapnik::box2d<double> extent_;
|
||||
typedef mapnik::polygon_clipper<mapnik::geometry_type> poly_clipper;
|
||||
test12(unsigned iterations,
|
||||
|
@ -489,7 +598,28 @@ struct test12
|
|||
|
||||
bool validate()
|
||||
{
|
||||
return true;
|
||||
std::string expected_wkt("Polygon((181 286.666667,233 454,315 340,421 446,463 324,559 466,631 321.320755,631 234.386861,528 178,394 229,329 138,212 134,183 228,200 264,181 238.244444,181 286.666667),(313 190,440 256,470 248,510 305,533 237,613 263,553 397,455 262,405 378,343 287,249 334,229 191,313 190))");
|
||||
boost::ptr_vector<geometry_type> paths;
|
||||
if (!mapnik::from_wkt(wkt_in_, paths))
|
||||
{
|
||||
throw std::runtime_error("Failed to parse WKT");
|
||||
}
|
||||
BOOST_FOREACH ( geometry_type & geom , paths)
|
||||
{
|
||||
poly_clipper clipped(extent_, geom);
|
||||
unsigned cmd;
|
||||
double x,y;
|
||||
mapnik::geometry_type geom2(mapnik::Polygon);
|
||||
while ((cmd = clipped.vertex(&x, &y)) != SEG_END) {
|
||||
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
|
||||
}
|
||||
std::string wkt;
|
||||
bool result = mapnik::util::to_wkt(wkt,geom2);
|
||||
if (result) {
|
||||
return (wkt == expected_wkt);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void operator()()
|
||||
{
|
||||
|
@ -544,6 +674,53 @@ struct test13
|
|||
}
|
||||
};
|
||||
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/agg_renderer.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
|
||||
struct test14
|
||||
{
|
||||
unsigned iter_;
|
||||
unsigned threads_;
|
||||
std::string xml_;
|
||||
mapnik::box2d<double> extent_;
|
||||
test14(unsigned iterations,
|
||||
unsigned threads,
|
||||
std::string const& xml,
|
||||
mapnik::box2d<double> const& extent)
|
||||
: iter_(iterations),
|
||||
threads_(threads),
|
||||
xml_(xml),
|
||||
extent_(extent)
|
||||
{}
|
||||
|
||||
bool validate()
|
||||
{
|
||||
mapnik::Map m(256,256);
|
||||
mapnik::load_map(m,xml_);
|
||||
m.zoom_to_box(extent_);
|
||||
mapnik::image_32 im(m.width(),m.height());
|
||||
mapnik::agg_renderer<mapnik::image_32> ren(m,im);
|
||||
ren.apply();
|
||||
//mapnik::save_to_file(im,"test.png");
|
||||
return true;
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
mapnik::Map m(256,256);
|
||||
mapnik::load_map(m,xml_);
|
||||
m.zoom_to_box(extent_);
|
||||
for (unsigned i=0;i<iter_;++i)
|
||||
{
|
||||
mapnik::image_32 im(m.width(),m.height());
|
||||
mapnik::agg_renderer<mapnik::image_32> ren(m,im);
|
||||
ren.apply();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int argc, char** argv)
|
||||
{
|
||||
if (argc > 0) {
|
||||
|
@ -559,6 +736,7 @@ int main( int argc, char** argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
mapnik::datasource_cache::instance().register_datasources("./plugins/input/");
|
||||
try
|
||||
{
|
||||
std::cout << "starting benchmark…\n";
|
||||
|
@ -669,6 +847,18 @@ int main( int argc, char** argv)
|
|||
// POLYGON ((181 286.6666666666667, 233 454, 315 340, 421 446, 463 324, 559 466, 631 321.3207547169811, 631 234.38686131386862, 528 178, 394 229, 329 138, 212 134, 183 228, 200 264, 181 238.24444444444444, 181 286.6666666666667),(313 190, 440 256, 470 248, 510 305, 533 237, 613 263, 553 397, 455 262, 405 378, 343 287, 249 334, 229 191, 313 190))
|
||||
|
||||
mapnik::box2d<double> clipping_box(181,106,631,470);
|
||||
|
||||
{
|
||||
std::string filename_("benchmark/data/polygon.wkt");
|
||||
std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
if (!in.is_open())
|
||||
throw std::runtime_error("could not open: '" + filename_ + "'");
|
||||
std::string wkt_in( (std::istreambuf_iterator<char>(in) ),
|
||||
(std::istreambuf_iterator<char>()) );
|
||||
test11a runner(10000,10,wkt_in,clipping_box);
|
||||
benchmark(runner,"clipping polygon with conv_clip_polygon");
|
||||
}
|
||||
|
||||
{
|
||||
std::string filename_("benchmark/data/polygon.wkt");
|
||||
std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
|
@ -680,6 +870,7 @@ int main( int argc, char** argv)
|
|||
benchmark(runner,"clipping polygon with agg_conv_clipper");
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
std::string filename_("benchmark/data/polygon.wkt");
|
||||
std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary);
|
||||
|
@ -687,7 +878,6 @@ int main( int argc, char** argv)
|
|||
throw std::runtime_error("could not open: '" + filename_ + "'");
|
||||
std::string wkt_in( (std::istreambuf_iterator<char>(in) ),
|
||||
(std::istreambuf_iterator<char>()) );
|
||||
|
||||
test12 runner(10000,10,wkt_in,clipping_box);
|
||||
benchmark(runner,"clipping polygon with mapnik::polygon_clipper");
|
||||
}
|
||||
|
@ -699,8 +889,38 @@ int main( int argc, char** argv)
|
|||
}
|
||||
unsigned face_count = mapnik::freetype_engine::face_names().size();
|
||||
test13 runner(1000,10);
|
||||
benchmark(runner, (boost::format("font_engihe: created %ld faces in ") % (face_count * 1000 * 10)).str());
|
||||
benchmark(runner, (boost::format("font_engine: created %ld faces in ") % (face_count * 1000 * 10)).str());
|
||||
}
|
||||
|
||||
{
|
||||
test14 runner(500,10,
|
||||
"benchmark/data/polygon_rendering_clip.xml",
|
||||
mapnik::box2d<double>(-20037508.3428,-8317435.0606,20037508.3428,18399242.7298));
|
||||
benchmark(runner, "rendering polygon with clipping at full extent");
|
||||
}
|
||||
|
||||
{
|
||||
test14 runner(500,10,
|
||||
"benchmark/data/polygon_rendering_no_clip.xml",
|
||||
mapnik::box2d<double>(-20037508.3428,-8317435.0606,20037508.3428,18399242.7298));
|
||||
benchmark(runner, "rendering polygon without clipping at full extent");
|
||||
}
|
||||
|
||||
{
|
||||
// note: bbox below is for 16/10491/22911.png
|
||||
test14 runner(500,10,
|
||||
"benchmark/data/polygon_rendering_clip.xml",
|
||||
mapnik::box2d<double>(-13622912.929097254,6026906.8062295765,-13621689.93664469,6028129.79868214));
|
||||
benchmark(runner, "rendering polygon with clipping at z16 extent");
|
||||
}
|
||||
|
||||
{
|
||||
test14 runner(500,10,
|
||||
"benchmark/data/polygon_rendering_no_clip.xml",
|
||||
mapnik::box2d<double>(-13622912.929097254,6026906.8062295765,-13621689.93664469,6028129.79868214));
|
||||
benchmark(runner, "rendering polygon without clipping at z16 extent");
|
||||
}
|
||||
|
||||
std::cout << "...benchmark done\n";
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ void export_color ()
|
|||
.def(self != self)
|
||||
.def_pickle(color_pickle_suite())
|
||||
.def("__str__",&color::to_string)
|
||||
.def("packed",&color::rgba)
|
||||
.def("to_hex_string",&color::to_hex_string,
|
||||
"Returns the hexadecimal representation of this color.\n"
|
||||
"\n"
|
||||
|
|
3
deps/agg/include/agg_array.h
vendored
3
deps/agg/include/agg_array.h
vendored
|
@ -516,10 +516,11 @@ namespace agg
|
|||
if(m_num_blocks)
|
||||
{
|
||||
T** blk = m_blocks + m_num_blocks - 1;
|
||||
while(m_num_blocks--)
|
||||
while(m_num_blocks > 0)
|
||||
{
|
||||
pod_allocator<T>::deallocate(*blk, block_size);
|
||||
--blk;
|
||||
--m_num_blocks;
|
||||
}
|
||||
}
|
||||
pod_allocator<T*>::deallocate(m_blocks, m_max_blocks);
|
||||
|
|
6
deps/agg/include/agg_pixfmt_rgba.h
vendored
6
deps/agg/include/agg_pixfmt_rgba.h
vendored
|
@ -686,9 +686,9 @@ namespace agg
|
|||
}
|
||||
if(sa)
|
||||
{
|
||||
calc_type dr = p[Order::R] - sr;
|
||||
calc_type dg = p[Order::G] - sg;
|
||||
calc_type db = p[Order::B] - sb;
|
||||
calc_type dr = (sr > p[Order::R]) ? 0 : p[Order::R] - sr;
|
||||
calc_type dg = (sg > p[Order::G]) ? 0 : p[Order::G] - sg;
|
||||
calc_type db = (sb > p[Order::B]) ? 0 : p[Order::B] - sb;
|
||||
p[Order::R] = (dr > base_mask) ? 0 : dr;
|
||||
p[Order::G] = (dg > base_mask) ? 0 : dg;
|
||||
p[Order::B] = (db > base_mask) ? 0 : db;
|
||||
|
|
21
deps/agg/include/agg_rasterizer_cells_aa.h
vendored
21
deps/agg/include/agg_rasterizer_cells_aa.h
vendored
|
@ -131,10 +131,11 @@ namespace agg
|
|||
if(m_num_blocks)
|
||||
{
|
||||
cell_type** ptr = m_cells + m_num_blocks - 1;
|
||||
while(m_num_blocks--)
|
||||
while(m_num_blocks > 0)
|
||||
{
|
||||
pod_allocator<cell_type>::deallocate(*ptr, cell_block_size);
|
||||
ptr--;
|
||||
--m_num_blocks;
|
||||
}
|
||||
pod_allocator<cell_type*>::deallocate(m_cells, m_max_blocks);
|
||||
}
|
||||
|
@ -663,23 +664,26 @@ namespace agg
|
|||
cell_type* cell_ptr;
|
||||
unsigned nb = m_num_cells >> cell_block_shift;
|
||||
unsigned i;
|
||||
while(nb--)
|
||||
while(nb > 0)
|
||||
{
|
||||
cell_ptr = *block_ptr++;
|
||||
i = cell_block_size;
|
||||
while(i--)
|
||||
while(i > 0)
|
||||
{
|
||||
m_sorted_y[cell_ptr->y - m_min_y].start++;
|
||||
++cell_ptr;
|
||||
--i;
|
||||
}
|
||||
--nb;
|
||||
}
|
||||
|
||||
cell_ptr = *block_ptr++;
|
||||
i = m_num_cells & cell_block_mask;
|
||||
while(i--)
|
||||
while(i > 0)
|
||||
{
|
||||
m_sorted_y[cell_ptr->y - m_min_y].start++;
|
||||
++cell_ptr;
|
||||
--i;
|
||||
}
|
||||
|
||||
// Convert the Y-histogram into the array of starting indexes
|
||||
|
@ -694,27 +698,30 @@ namespace agg
|
|||
// Fill the cell pointer array sorted by Y
|
||||
block_ptr = m_cells;
|
||||
nb = m_num_cells >> cell_block_shift;
|
||||
while(nb--)
|
||||
while(nb > 0)
|
||||
{
|
||||
cell_ptr = *block_ptr++;
|
||||
i = cell_block_size;
|
||||
while(i--)
|
||||
while(i > 0)
|
||||
{
|
||||
sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
|
||||
m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
|
||||
++curr_y.num;
|
||||
++cell_ptr;
|
||||
--i;
|
||||
}
|
||||
--nb;
|
||||
}
|
||||
|
||||
cell_ptr = *block_ptr++;
|
||||
i = m_num_cells & cell_block_mask;
|
||||
while(i--)
|
||||
while(i > 0)
|
||||
{
|
||||
sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y];
|
||||
m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr;
|
||||
++curr_y.num;
|
||||
++cell_ptr;
|
||||
--i;
|
||||
}
|
||||
|
||||
// Finally arrange the X-arrays
|
||||
|
|
3
deps/agg/include/agg_rendering_buffer.h
vendored
3
deps/agg/include/agg_rendering_buffer.h
vendored
|
@ -186,10 +186,11 @@ namespace agg
|
|||
|
||||
T** rows = &m_rows[0];
|
||||
|
||||
while(height--)
|
||||
while(height > 0)
|
||||
{
|
||||
*rows++ = row_ptr;
|
||||
row_ptr += stride;
|
||||
--height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -895,9 +895,9 @@ namespace agg
|
|||
if(fg[3] < 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::R]) fg[order_type::R] = fg[order_type::R];
|
||||
if(fg[order_type::G] > fg[order_type::G]) fg[order_type::G] = fg[order_type::G];
|
||||
if(fg[order_type::B] > fg[order_type::B]) fg[order_type::B] = fg[order_type::B];
|
||||
if(fg[order_type::R] > fg[order_type::A]) fg[order_type::R] = fg[order_type::A];
|
||||
if(fg[order_type::G] > fg[order_type::A]) fg[order_type::G] = fg[order_type::A];
|
||||
if(fg[order_type::B] > fg[order_type::A]) fg[order_type::B] = fg[order_type::A];
|
||||
|
||||
span->r = (value_type)fg[order_type::R];
|
||||
span->g = (value_type)fg[order_type::G];
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace mapnik {
|
||||
|
||||
struct rasterizer : agg::rasterizer_scanline_aa<>, mapnik::noncopyable {};
|
||||
struct rasterizer : agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_int_sat>, mapnik::noncopyable {};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -98,16 +98,16 @@ private:
|
|||
* \brief prepare features for rendering asynchronously.
|
||||
*/
|
||||
void prepare_layer(layer_rendering_material & mat,
|
||||
feature_style_context_map & ctx_map,
|
||||
Processor & p,
|
||||
projection const& proj0,
|
||||
double scale,
|
||||
double scale_denom,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
box2d<double> const& extent,
|
||||
int buffer_size,
|
||||
std::set<std::string>& names);
|
||||
feature_style_context_map & ctx_map,
|
||||
Processor & p,
|
||||
projection const& proj0,
|
||||
double scale,
|
||||
double scale_denom,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
box2d<double> const& extent,
|
||||
int buffer_size,
|
||||
std::set<std::string>& names);
|
||||
|
||||
/*!
|
||||
* \brief render features list queued when they are available.
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <mapnik/proj_transform.hpp>
|
||||
#include <mapnik/util/featureset_buffer.hpp>
|
||||
|
||||
|
||||
// boost
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#include <boost/variant/static_visitor.hpp>
|
||||
|
@ -519,9 +518,9 @@ void feature_style_processor<Processor>::prepare_layer(layer_rendering_material
|
|||
template <typename Processor>
|
||||
void feature_style_processor<Processor>::render_material(layer_rendering_material & mat, Processor & p )
|
||||
{
|
||||
std::vector<feature_type_style const*> & active_styles = mat.active_styles_;
|
||||
std::vector<featureset_ptr> & featureset_ptr_list = mat.featureset_ptr_list_;
|
||||
if (featureset_ptr_list.empty())
|
||||
std::vector<feature_type_style const*> & active_styles = mat.active_styles_;
|
||||
std::vector<featureset_ptr> & featureset_ptr_list = mat.featureset_ptr_list_;
|
||||
if (featureset_ptr_list.empty())
|
||||
{
|
||||
// The datasource wasn't querried because of early return
|
||||
// but we have to apply compositing operations on styles
|
||||
|
@ -530,7 +529,6 @@ void feature_style_processor<Processor>::render_material(layer_rendering_materia
|
|||
p.start_style_processing(*style);
|
||||
p.end_style_processing(*style);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -608,7 +608,7 @@ void text_renderer<T>::render(pixel_position const& pos)
|
|||
{
|
||||
FT_Error error;
|
||||
FT_Vector start;
|
||||
unsigned height = pixmap_.height();
|
||||
int height = pixmap_.height();
|
||||
|
||||
start.x = static_cast<FT_Pos>(pos.x * (1 << 6));
|
||||
start.y = static_cast<FT_Pos>((height - pos.y) * (1 << 6));
|
||||
|
|
40
tests/python_tests/agg_rasterizer_integer_overflow_test.py
Normal file
40
tests/python_tests/agg_rasterizer_integer_overflow_test.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import run_all
|
||||
import mapnik
|
||||
import json
|
||||
|
||||
# geojson box of the world
|
||||
geojson = { "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -17963313.143242701888084, -6300857.11560364998877 ], [ -17963313.143242701888084, 13071343.332991421222687 ], [ 7396658.353099936619401, 13071343.332991421222687 ], [ 7396658.353099936619401, -6300857.11560364998877 ], [ -17963313.143242701888084, -6300857.11560364998877 ] ] ] } }
|
||||
|
||||
def test_that_coordinates_do_not_overflow_and_polygon_is_rendered():
|
||||
expected_color = mapnik.Color('white')
|
||||
ds = mapnik.MemoryDatasource()
|
||||
context = mapnik.Context()
|
||||
ds.add_feature(mapnik.Feature.from_geojson(json.dumps(geojson),context))
|
||||
s = mapnik.Style()
|
||||
r = mapnik.Rule()
|
||||
sym = mapnik.PolygonSymbolizer()
|
||||
sym.fill = expected_color
|
||||
sym.clip = False
|
||||
r.symbols.append(sym)
|
||||
s.rules.append(r)
|
||||
lyr = mapnik.Layer('Layer')
|
||||
lyr.datasource = ds
|
||||
lyr.styles.append('style')
|
||||
m = mapnik.Map(256,256)
|
||||
m.background_color = mapnik.Color('black')
|
||||
m.append_style('style',s)
|
||||
m.layers.append(lyr)
|
||||
# 17/20864/45265.png
|
||||
m.zoom_to_box(mapnik.Box2d(-13658379.710221574,6197514.253362091,-13657768.213995293,6198125.749588372))
|
||||
# works 15/5216/11316.png
|
||||
#m.zoom_to_box(mapnik.Box2d(-13658379.710221574,6195679.764683247,-13655933.72531645,6198125.749588372))
|
||||
im = mapnik.Image(256,256)
|
||||
mapnik.render(m,im)
|
||||
eq_(im.get_pixel(128,128),expected_color.packed())
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
|
@ -18,9 +18,9 @@ if mapnik.has_webp():
|
|||
os.makedirs(tmp_dir)
|
||||
|
||||
opts = [
|
||||
'webp',
|
||||
'webp:quality=64',
|
||||
'webp:alpha=false'
|
||||
'webp',
|
||||
'webp:quality=64',
|
||||
'webp:alpha=false'
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<PointSymbolizer/>
|
||||
<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="8" fill="blue" placement-type="list">[name]
|
||||
<Placement size="10" dy="-8" fill="red"/>
|
||||
<Placement fill="green">'S'+[nr]</Placement>
|
||||
<Placement fill="orange" dy="8">[nr]</Placement>
|
||||
<Placement fill="green">'S'+[nr]</Placement>
|
||||
<Placement fill="orange" dy="8">[nr]</Placement>
|
||||
</TextSymbolizer>
|
||||
</Rule>
|
||||
</Style>
|
||||
|
|
Loading…
Add table
Reference in a new issue