diff --git a/.travis.yml b/.travis.yml index 31de8c704..210e9b780 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ compiler: clang before_install: - echo 'yes' | sudo add-apt-repository ppa:mapnik/boost - 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 + - 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 libwebp-dev libz-dev libfreetype6-dev libxml2-dev libproj-dev script: - ./configure DEMO=False BINDINGS='python' CPP_TESTS=False CAIRO=False INPUT_PLUGINS='' OPTIMIZATION=1 FAST=True && JOBS=2 make diff --git a/SConstruct b/SConstruct index efb424080..845539de8 100644 --- a/SConstruct +++ b/SConstruct @@ -336,8 +336,6 @@ opts.AddVariables( # Variables affecting rendering back-ends - 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'), BoolVariable('BENCHMARK', 'Compile the C++ benchmark scripts', 'False'), @@ -1190,14 +1188,15 @@ if not preconfigured: else: env['MISSING_DEPS'].append('libxml2') - LIBSHEADERS = [ + REQUIRED_LIBSHEADERS = [ ['z', 'zlib.h', True,'C'], [env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'], ] + OPTIONAL_LIBSHEADERS = [] + if env['JPEG']: - env.Append(CPPDEFINES = '-DHAVE_JPEG') - LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C']) + OPTIONAL_LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C','-DHAVE_JPEG']) inc_path = env['%s_INCLUDES' % 'JPEG'] lib_path = env['%s_LIBS' % 'JPEG'] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1206,8 +1205,7 @@ if not preconfigured: env['SKIPPED_DEPS'].extend(['jpeg']) if env['PROJ']: - env.Append(CPPDEFINES = '-DMAPNIK_USE_PROJ4') - LIBSHEADERS.append(['proj', 'proj_api.h', False,'C']) + OPTIONAL_LIBSHEADERS.append(['proj', 'proj_api.h', False,'C','-DMAPNIK_USE_PROJ4']) inc_path = env['%s_INCLUDES' % 'PROJ'] lib_path = env['%s_LIBS' % 'PROJ'] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1216,8 +1214,7 @@ if not preconfigured: env['SKIPPED_DEPS'].extend(['proj']) if env['PNG']: - env.Append(CPPDEFINES = '-DHAVE_PNG') - LIBSHEADERS.append(['png', 'png.h', False,'C']) + OPTIONAL_LIBSHEADERS.append(['png', 'png.h', False,'C','-DHAVE_PNG']) inc_path = env['%s_INCLUDES' % 'PNG'] lib_path = env['%s_LIBS' % 'PNG'] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1226,8 +1223,7 @@ if not preconfigured: env['SKIPPED_DEPS'].extend(['png']) if env['WEBP']: - env.Append(CPPDEFINES = '-DHAVE_WEBP') - LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C']) + OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP']) inc_path = env['%s_INCLUDES' % 'WEBP'] lib_path = env['%s_LIBS' % 'WEBP'] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1236,8 +1232,7 @@ if not preconfigured: env['SKIPPED_DEPS'].extend(['webp']) if env['TIFF']: - env.Append(CPPDEFINES = '-DHAVE_TIFF') - LIBSHEADERS.append(['tiff', 'tiff.h', False,'C']) + OPTIONAL_LIBSHEADERS.append(['tiff', 'tiff.h', False,'C','-DHAVE_TIFF']) inc_path = env['%s_INCLUDES' % 'TIFF'] lib_path = env['%s_LIBS' % 'TIFF'] env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) @@ -1250,7 +1245,7 @@ if not preconfigured: conf.prioritize_paths(silent=True) if not env['HOST']: - for libname, headers, required, lang in LIBSHEADERS: + for libname, headers, required, lang in REQUIRED_LIBSHEADERS: if not conf.CheckLibWithHeader(libname, headers, lang): if required: color_print(1, 'Could not find required header or shared library for %s' % libname) @@ -1338,6 +1333,20 @@ if not preconfigured: else: env['SKIPPED_DEPS'].append('boost_regex_icu') + if not env['HOST']: + for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS: + if not conf.CheckLibWithHeader(libname, headers, lang): + if required: + color_print(1, 'Could not find required header or shared library for %s' % libname) + env['MISSING_DEPS'].append(libname) + else: + color_print(4, 'Could not find optional header or shared library for %s' % libname) + env['SKIPPED_DEPS'].append(libname) + else: + env.Append(CPPDEFINES = define) + else: + env.Append(CPPDEFINES = define) + env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] SQLITE_HAS_RTREE = None diff --git a/include/mapnik/attribute_collector.hpp b/include/mapnik/attribute_collector.hpp index 1d4fb374a..5dc9d1328 100644 --- a/include/mapnik/attribute_collector.hpp +++ b/include/mapnik/attribute_collector.hpp @@ -107,8 +107,11 @@ private: struct symbolizer_attributes : public boost::static_visitor<> { - symbolizer_attributes(std::set& names) - : names_(names), f_attr(names) {} + symbolizer_attributes(std::set& names, + double & filter_factor) + : names_(names), + filter_factor_(filter_factor), + f_attr(names) {} template void operator () (T const&) const {} @@ -217,10 +220,15 @@ struct symbolizer_attributes : public boost::static_visitor<> } collect_transform(sym.get_transform()); } - // TODO - support remaining syms + + void operator () (raster_symbolizer const& sym) + { + filter_factor_ = sym.calculate_filter_factor(); + } private: std::set& names_; + double & filter_factor_; expression_attributes > f_attr; void collect_transform(transform_list_ptr const& trans_expr) { @@ -236,18 +244,20 @@ class attribute_collector : public mapnik::noncopyable { private: std::set& names_; + double filter_factor_; expression_attributes > f_attr; public: attribute_collector(std::set& names) - : names_(names), f_attr(names) {} - + : names_(names), + filter_factor_(1.0), + f_attr(names) {} template void operator() (RuleType const& r) { typename RuleType::symbolizers const& symbols = r.get_symbolizers(); typename RuleType::symbolizers::const_iterator symIter=symbols.begin(); - symbolizer_attributes s_attr(names_); + symbolizer_attributes s_attr(names_,filter_factor_); while (symIter != symbols.end()) { boost::apply_visitor(s_attr,*symIter++); @@ -256,22 +266,11 @@ public: expression_ptr const& expr = r.get_filter(); boost::apply_visitor(f_attr,*expr); } -}; -struct directive_collector : public boost::static_visitor<> -{ - directive_collector(double & filter_factor) - : filter_factor_(filter_factor) {} - - template - void operator () (T const&) const {} - - void operator () (raster_symbolizer const& sym) + double get_filter_factor() const { - filter_factor_ = sym.calculate_filter_factor(); + return filter_factor_; } -private: - double & filter_factor_; }; } // namespace mapnik diff --git a/include/mapnik/feature_style_processor.hpp b/include/mapnik/feature_style_processor.hpp index e880c3461..de7fe9fda 100644 --- a/include/mapnik/feature_style_processor.hpp +++ b/include/mapnik/feature_style_processor.hpp @@ -85,11 +85,9 @@ private: /*! * \brief renders a featureset with the given styles. */ - void render_style(layer const& lay, - Processor & p, + void render_style(Processor & p, feature_type_style const* style, rule_cache const& rules, - std::string const& style_name, featureset_ptr features, proj_transform const& prj_trans); diff --git a/include/mapnik/feature_style_processor_impl.hpp b/include/mapnik/feature_style_processor_impl.hpp index b03b8732b..dd8a039d8 100644 --- a/include/mapnik/feature_style_processor_impl.hpp +++ b/include/mapnik/feature_style_processor_impl.hpp @@ -45,6 +45,7 @@ #include #include #include +#include // boost #include @@ -56,12 +57,6 @@ #include #include -#if defined(RENDERING_STATS) -#include -#include -#include -#endif - namespace mapnik { @@ -152,11 +147,6 @@ feature_style_processor::feature_style_processor(Map const& m, double template void feature_style_processor::apply(double scale_denom) { -#if defined(RENDERING_STATS) - std::clog << "\n//-- starting rendering timer...\n"; - mapnik::progress_timer t(std::clog, "total map rendering"); -#endif - Processor & p = static_cast(*this); p.start_map_processing(m_); @@ -186,11 +176,6 @@ void feature_style_processor::apply(double scale_denom) p.end_map_processing(m_); -#if defined(RENDERING_STATS) - t.stop(); - std::clog << "//-- rendering timer stopped...\n\n"; -#endif - } template @@ -250,23 +235,9 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces return; } -#if defined(RENDERING_STATS) - progress_timer layer_timer(std::clog, "rendering total for layer: '" + lay.name() + "'"); -#endif - projection proj1(lay.srs(),true); proj_transform prj_trans(proj0,proj1); -#if defined(RENDERING_STATS) - if (! prj_trans.equal()) - { - std::clog << "notice: reprojecting layer: '" << lay.name() << "' from/to:\n\t'" - << lay.srs() << "'\n\t'" - << m_.srs() << "'\n"; - } -#endif - - box2d query_ext = extent; // unbuffered box2d buffered_query_ext(query_ext); // buffered @@ -285,7 +256,8 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces // clip buffered extent by maximum extent, if supplied boost::optional > const& maximum_extent = m_.maximum_extent(); - if (maximum_extent) { + if (maximum_extent) + { buffered_query_ext.clip(*maximum_extent); } @@ -344,9 +316,6 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces } } } -#if defined(RENDERING_STATS) - layer_timer.discard(); -#endif return; } @@ -384,8 +353,6 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces query q(layer_ext,res,scale_denom,extent); std::vector active_styles; attribute_collector collector(names); - double filt_factor = 1.0; - directive_collector d_collector(filt_factor); boost::ptr_vector rule_caches; // iterate through all named styles collecting active styles and attribute names @@ -410,11 +377,7 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces { rc->add_rule(r); active_rules = true; - if (ds->type() == datasource::Vector) - { - collector(r); - } - // TODO - in the future rasters should be able to be filtered. + collector(r); } } if (active_rules) @@ -442,46 +405,25 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces q.add_property_name(name); } } - - // Update filter_factor for all enabled raster layers. - BOOST_FOREACH (feature_type_style const* style, active_styles) - { - BOOST_FOREACH(rule const& r, style->get_rules()) - { - if (r.active(scale_denom) && - ds->type() == datasource::Raster && - ds->params().get("filter_factor",0.0) == 0.0) - { - BOOST_FOREACH (rule::symbolizers::value_type sym, r.get_symbolizers()) - { - // if multiple raster symbolizers, last will be respected - // should we warn or throw? - boost::apply_visitor(d_collector,sym); - } - q.set_filter_factor(filt_factor); - } - } - } + q.set_filter_factor(collector.get_filter_factor()); // Also query the group by attribute - std::string group_by = lay.group_by(); - if (group_by != "") + std::string const& group_by = lay.group_by(); + if (!group_by.empty()) { q.add_property_name(group_by); } bool cache_features = lay.cache_features() && active_styles.size() > 1; - // Render incrementally when the column that we group by - // changes value. - if (group_by != "") + // Render incrementally when the column that we group by changes value. + if (!group_by.empty()) { featureset_ptr features = ds->features(q); - if (features) { - // Cache all features into the memory_datasource before rendering. - memory_datasource cache(ds->type(),false); + if (features) + { + boost::shared_ptr cache = boost::make_shared(); feature_ptr feature, prev; - while ((feature = features->next())) { if (prev && prev->get(group_by) != feature->get(group_by)) @@ -491,44 +433,46 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces int i = 0; BOOST_FOREACH (feature_type_style const* style, active_styles) { - render_style(lay, p, style, rule_caches[i], style_names[i], - cache.features(q), prj_trans); + cache->prepare(); + render_style(p, style, rule_caches[i], cache, prj_trans); i++; } - cache.clear(); + cache->clear(); } - cache.push(feature); + cache->push(feature); prev = feature; } int i = 0; BOOST_FOREACH (feature_type_style const* style, active_styles) { - render_style(lay, p, style, rule_caches[i], style_names[i], - cache.features(q), prj_trans); + cache->prepare(); + render_style(p, style, rule_caches[i], cache, prj_trans); i++; } } } else if (cache_features) { - memory_datasource cache(ds->type(),false); featureset_ptr features = ds->features(q); - if (features) { + boost::shared_ptr cache = boost::make_shared(); + if (features) + { // Cache all features into the memory_datasource before rendering. feature_ptr feature; while ((feature = features->next())) { - cache.push(feature); + cache->push(feature); } } int i = 0; BOOST_FOREACH (feature_type_style const* style, active_styles) { - render_style(lay, p, style, rule_caches[i], style_names[i], - cache.features(q), prj_trans); + cache->prepare(); + render_style(p, style, rule_caches[i], cache, prj_trans); i++; } + cache->clear(); } // We only have a single style and no grouping. else @@ -536,28 +480,20 @@ void feature_style_processor::apply_to_layer(layer const& lay, Proces int i = 0; BOOST_FOREACH (feature_type_style const* style, active_styles) { - render_style(lay, p, style, rule_caches[i], style_names[i], - ds->features(q), prj_trans); + render_style(p, style, rule_caches[i], ds->features(q), prj_trans); i++; } } } - -#if defined(RENDERING_STATS) - layer_timer.stop(); -#endif - p.end_layer_processing(lay); } template void feature_style_processor::render_style( - layer const& lay, Processor & p, feature_type_style const* style, rule_cache const& rc, - std::string const& style_name, featureset_ptr features, proj_transform const& prj_trans) { @@ -567,49 +503,24 @@ void feature_style_processor::render_style( p.end_style_processing(*style); return; } - -#if defined(RENDERING_STATS) - std::ostringstream s1; - s1 << "rendering style for layer: '" << lay.name() - << "' and style '" << style_name << "'"; - mapnik::progress_timer style_timer(std::clog, s1.str()); - - int feature_processed_count = 0; - int feature_count = 0; -#endif - feature_ptr feature; + bool was_painted = false; while ((feature = features->next())) { -#if defined(RENDERING_STATS) - feature_count++; - bool feat_processed = false; -#endif - bool do_else = true; bool do_also = false; - BOOST_FOREACH(rule const* r, rc.get_if_rules() ) { expression_ptr const& expr=r->get_filter(); value_type result = boost::apply_visitor(evaluate(*feature),*expr); if (result.to_bool()) { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - + was_painted = true; do_else=false; do_also=true; rule::symbolizers const& symbols = r->get_symbolizers(); - - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. if(!p.process(symbols,*feature,prj_trans)) { - BOOST_FOREACH (symbolizer const& sym, symbols) { boost::apply_visitor(symbol_dispatch(p,*feature,prj_trans),sym); @@ -627,15 +538,8 @@ void feature_style_processor::render_style( { BOOST_FOREACH( rule const* r, rc.get_else_rules() ) { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - + was_painted = true; rule::symbolizers const& symbols = r->get_symbolizers(); - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. if(!p.process(symbols,*feature,prj_trans)) { BOOST_FOREACH (symbolizer const& sym, symbols) @@ -649,15 +553,8 @@ void feature_style_processor::render_style( { BOOST_FOREACH( rule const* r, rc.get_also_rules() ) { -#if defined(RENDERING_STATS) - feat_processed = true; -#endif - - p.painted(true); - + was_painted = true; rule::symbolizers const& symbols = r->get_symbolizers(); - // if the underlying renderer is not able to process the complete set of symbolizers, - // process one by one. if(!p.process(symbols,*feature,prj_trans)) { BOOST_FOREACH (symbolizer const& sym, symbols) @@ -667,32 +564,8 @@ void feature_style_processor::render_style( } } } -#if defined(RENDERING_STATS) - if (feat_processed) - feature_processed_count++; -#endif } - -#if defined(RENDERING_STATS) - style_timer.stop(); - - // done with style - std::ostringstream s; - if (feature_count > 0) - { - double perc_processed = ((double)feature_processed_count/(double)feature_count)*100.0; - - s << "percent rendered: " << perc_processed << "% - " << feature_processed_count - << " rendered for " << feature_count << " queried for "; - s << std::setw(15 - (int)s.tellp()) << " layer '" << lay.name() << "' and style '" << style_name << "'\n"; - } - else - { - s << "" << std::setw(15) << "- no features returned from query for layer '" << lay.name() << "' and style '" << style_name << "'\n"; - } - std::clog << s.str(); - style_timer.discard(); -#endif + p.painted(was_painted); p.end_style_processing(*style); } diff --git a/include/mapnik/layer.hpp b/include/mapnik/layer.hpp index a259b9741..985de5ce9 100644 --- a/include/mapnik/layer.hpp +++ b/include/mapnik/layer.hpp @@ -167,7 +167,7 @@ public: /*! * @param column Set the field rendering of this layer is grouped by. */ - void set_group_by(std::string column); + void set_group_by(std::string const& column); /*! * @return The field rendering of this layer is grouped by. diff --git a/include/mapnik/util/featureset_buffer.hpp b/include/mapnik/util/featureset_buffer.hpp new file mode 100644 index 000000000..42a07e8ee --- /dev/null +++ b/include/mapnik/util/featureset_buffer.hpp @@ -0,0 +1,77 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2013 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_FEATURESET_BUFFER_HPP +#define MAPNIK_FEATURESET_BUFFER_HPP + +// mapnik +#include + +#include + +namespace mapnik { + +class featureset_buffer : public Featureset +{ +public: + featureset_buffer() + : features_(), + pos_(), + end_() + {} + + virtual ~featureset_buffer() {} + + feature_ptr next() + { + if (pos_ != end_) + { + return *pos_++; + } + return feature_ptr(); + } + + void push(feature_ptr const& feature) + { + features_.push_back(feature); + } + + void prepare() + { + pos_ = features_.begin(); + end_ = features_.end(); + } + + void clear() + { + features_.clear(); + } + +private: + std::vector features_; + std::vector::iterator pos_; + std::vector::iterator end_; +}; + +} + +#endif // MAPNIK_FEATURESET_BUFFER_HPP diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index aefcfcef3..ceb6fc86d 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -77,7 +77,6 @@ inline GDALDataset* gdal_datasource::open_dataset() const gdal_datasource::gdal_datasource(parameters const& params) : datasource(params), desc_(*params.get("type"), "utf-8"), - filter_factor_(*params.get("filter_factor", 0.0)), nodata_value_(params.get("nodata")) { MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing..."; @@ -228,7 +227,6 @@ featureset_ptr gdal_datasource::features(query const& q) const nbands_, dx_, dy_, - filter_factor_, nodata_value_)); } @@ -250,6 +248,5 @@ featureset_ptr gdal_datasource::features_at_point(coord2d const& pt, double tol) nbands_, dx_, dy_, - filter_factor_, nodata_value_)); } diff --git a/plugins/input/gdal/gdal_datasource.hpp b/plugins/input/gdal/gdal_datasource.hpp index 7bd1f33ed..d73682682 100644 --- a/plugins/input/gdal/gdal_datasource.hpp +++ b/plugins/input/gdal/gdal_datasource.hpp @@ -66,7 +66,6 @@ private: double dy_; int nbands_; bool shared_dataset_; - double filter_factor_; boost::optional nodata_value_; }; diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index f5bbbcf28..14d6956c4 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -61,7 +61,6 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset, int nbands, double dx, double dy, - double filter_factor, boost::optional const& nodata) : dataset_(dataset), ctx_(boost::make_shared()), @@ -73,7 +72,6 @@ gdal_featureset::gdal_featureset(GDALDataset& dataset, dx_(dx), dy_(dy), nbands_(nbands), - filter_factor_(filter_factor), nodata_value_(nodata), first_(true) { @@ -203,21 +201,9 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) int im_width = int(width_res * intersect.width() + 0.5); int im_height = int(height_res * intersect.height() + 0.5); - // if layer-level filter_factor is set, apply it - if (filter_factor_) - { - im_width = int(im_width * filter_factor_ + 0.5); - im_height = int(im_height * filter_factor_ + 0.5); - - MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_; - } - // otherwise respect symbolizer level factor applied to query, default of 1.0 - else - { - double sym_downsample_factor = q.get_filter_factor(); - im_width = int(im_width * sym_downsample_factor + 0.5); - im_height = int(im_height * sym_downsample_factor + 0.5); - } + double sym_downsample_factor = q.get_filter_factor(); + im_width = int(im_width * sym_downsample_factor + 0.5); + im_height = int(im_height * sym_downsample_factor + 0.5); // case where we need to avoid upsampling so that the // image can be later scaled within raster_symbolizer diff --git a/plugins/input/gdal/gdal_featureset.hpp b/plugins/input/gdal/gdal_featureset.hpp index cb6c0b0ff..7315d1279 100644 --- a/plugins/input/gdal/gdal_featureset.hpp +++ b/plugins/input/gdal/gdal_featureset.hpp @@ -49,7 +49,6 @@ public: int nbands, double dx, double dy, - double filter_factor, boost::optional const& nodata); virtual ~gdal_featureset(); mapnik::feature_ptr next(); @@ -72,7 +71,6 @@ private: double dx_; double dy_; int nbands_; - double filter_factor_; boost::optional nodata_value_; bool first_; }; diff --git a/src/build.py b/src/build.py index f702ecfae..68f22e425 100644 --- a/src/build.py +++ b/src/build.py @@ -59,20 +59,26 @@ system = 'boost_system%s' % env['BOOST_APPEND'] # clear out and re-set libs for this env lib_env['LIBS'] = ['freetype',env['ICU_LIB_NAME'],filesystem,system,regex] -if env['PROJ']: +if '-DMAPNIK_USE_PROJ4' in env['CPPDEFINES']: lib_env['LIBS'].append('proj') -if env['PNG']: +enabled_imaging_libraries = [] + +if '-DHAVE_PNG' in env['CPPDEFINES']: lib_env['LIBS'].append('png') + enabled_imaging_libraries.append('png_reader.cpp') -if env['TIFF']: +if '-DHAVE_TIFF' in env['CPPDEFINES']: lib_env['LIBS'].append('tiff') + enabled_imaging_libraries.append('tiff_reader.cpp') -if env['WEBP']: +if '-DHAVE_WEBP' in env['CPPDEFINES']: lib_env['LIBS'].append('webp') + enabled_imaging_libraries.append('webp_reader.cpp') -if env['JPEG']: +if '-DHAVE_JPEG' in env['CPPDEFINES']: lib_env['LIBS'].append('jpeg') + enabled_imaging_libraries.append('jpeg_reader.cpp') if len(env['EXTRA_FREETYPE_LIBS']): lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS'])) @@ -139,6 +145,7 @@ source = Split( transform_expression_grammar.cpp transform_expression.cpp feature_kv_iterator.cpp + feature_style_processor.cpp feature_type_style.cpp font_engine_freetype.cpp font_set.cpp @@ -265,29 +272,9 @@ if env['HAS_SKIA']: source.insert(0,'skia/skia_typeface_cache.cpp') source.insert(0,'skia/skia_font_manager.cpp') -if env['JPEG']: - source += Split( - """ - jpeg_reader.cpp - """) -if env['TIFF']: - source += Split( - """ - tiff_reader.cpp - """) - -if env['PNG']: - source += Split( - """ - png_reader.cpp - """) - -if env['WEBP']: - source += Split( - """ - webp_reader.cpp - """) +for cpp in enabled_imaging_libraries: + source.append(cpp) # agg backend source += Split( @@ -393,18 +380,6 @@ else: """ ) -processor_cpp = 'feature_style_processor.cpp' - -if env['RENDERING_STATS']: - env3 = lib_env.Clone() - env3.Append(CPPDEFINES='-DRENDERING_STATS') - if env['LINKING'] == 'static': - source.insert(0,env3.StaticObject(processor_cpp)) - else: - source.insert(0,env3.SharedObject(processor_cpp)) -else: - source.insert(0,processor_cpp); - # clone the env one more time to isolate mapnik_lib_link_flag lib_env_final = lib_env.Clone() diff --git a/src/layer.cpp b/src/layer.cpp index a2352cc2e..95c2513f5 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -236,7 +236,7 @@ bool layer::cache_features() const return cache_features_; } -void layer::set_group_by(std::string column) +void layer::set_group_by(std::string const& column) { group_by_ = column; } diff --git a/tests/visual_tests/grids/gdal-filter-factor-600-400-1.0-grid-reference.json b/tests/visual_tests/grids/gdal-filter-factor-600-400-1.0-grid-reference.json new file mode 100644 index 000000000..1a15981c2 --- /dev/null +++ b/tests/visual_tests/grids/gdal-filter-factor-600-400-1.0-grid-reference.json @@ -0,0 +1,108 @@ +{ + "keys": [ + "" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/grids/style-level-compositing-tiled-0,0-512-512-1.0-grid-reference.json b/tests/visual_tests/grids/style-level-compositing-tiled-0,0-512-512-1.0-grid-reference.json new file mode 100644 index 000000000..6dd6a4db4 --- /dev/null +++ b/tests/visual_tests/grids/style-level-compositing-tiled-0,0-512-512-1.0-grid-reference.json @@ -0,0 +1,190 @@ +{ + "keys": [ + "", + "71", + "24", + "245", + "207", + "238", + "82", + "132", + "205", + "51", + "65", + "231", + "186", + "165", + "114", + "2", + "120", + "235", + "116", + "13", + "113", + "41", + "234", + "34", + "78", + "48", + "15", + "90", + "173", + "215", + "1", + "75", + "224", + "181", + "79", + "42", + "158", + "208", + "38", + "127", + "70", + "167", + "212", + "76", + "39", + "164", + "183", + "87", + "69", + "104", + "77", + "157", + "59", + "21", + "49" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " !!!!! ", + " !!!!!!!!!! ", + " !!!!! !!!!!! ! ", + " ### #### !!!!!!!!!!!!!! ", + " ### ######### ! !!!!!!!!!!!!!!! ", + " ############ !!!! !!!!!!!!!!!!! ", + " ############## ! !!!!!!!!!!!!!!!!!! ", + " ## ############### !! !! !!!!!!!!!!!!!!!!! ", + " # ################# !!! ! !! !!!!!!!!!!! ", + " ################### !!!!!!!!!!! !!!!!!!!! !!! !! ! ", + " ################## !!!!!!!!!!!!!!!!!!!!!!!!! !!! !!! ", + " ################# # !!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! ", + " ## ################# !!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ", + " ## ######## ######## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### ####### ######## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " #### ## ######### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ###### ######## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ##### ## ######## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " # ################## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ###### ### ##### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ## ########### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ## ##### ####### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### #### # ###### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ## ###### ############# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " #### ## ############# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ", + " # # ## ####### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ## # ## # ##### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ## ## # # ## ## #### ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### # # ####### !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " #### # ### ######## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### # # # ### ############# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### #### ## # ### ## # !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " # ### ### #### ## ### !!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ######## ##### ######### !!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ######## # ## ## ######### !!!!!!!!!!!!!!!!!!!!!!!!!!! ! ", + " ### # ######## !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ### !!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ###### # ##### !!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ###### ### ### #### ### #### !!!!!!!!!!!!!!!!!!!!!!!!!! ", + " ####### ### ####### ## ###### !!!!!!!!!!!!!!!!!!!!!!!! ", + " ######## # #### ######## ###### ## !!!!!!!!!!!!!!!!!!!!!!!!! ", + " ############ ## #### # ### ####### !!!!!!!!!!!!!!!!!!!!!! ! ", + " #### ####### ## ### ############ !!!!!!!!!!!!!!!!!!!!!!!! ", + " $ ### ########## # ## ############## ! !!!!!!!!!!!!!!!!!!!!!! ", + " %%% ########## ## ############# !!!!!!!!!!!!!!!!!!!!!! & ", + " %%%%%%% # # ####### ### ############### !!!!!!!!!!!!!!!!!!!! !! ", + " %%%%%%%%%%%% % # # # ############ ### ###### ######## !!!!!!!!!!!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%%## ###### ## ########## ###### ## ########## !!!!!!!!!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%%%### ############# ##### ### ### ### ### # ###### !!!!!!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%%%%###################### ### # #### #### # ##### !!!!!!!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%%%%################### # ### ############ ######### !!!!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%%###################################### #### ## ###### !!!!!!!!!!!!!!! ", + " %%%%%%%%%%%%%%%########################################### ######### !!!!!!!!!!!!!! ", + " % %%%%%%%%%%%%%%%########################################## ######### !!!!!!!!!!!!!! ' ", + " %%%%%%%%%%%%%%%%%%%####################################### # ##### ## !!!!!!!!!! ! '' '''' ", + " %%%%%%%%%%%%%%%%%%###################################### ## ######## ## !!!!!!!!! ''''''' ", + " $ %%%%%%%%%%%%%%%%%%###################################### ### ######### !!!!!!!!! '''''' ", + " %%%%%%%%%%%%%%###################################### #### ####### !!!!!!!!! ''''' ", + " %% %%%%%%%%%%%%%%%#################################### # # # ###### !!!!!!!! '' ", + " %%%%%%%%%%%%%%%%%################################### # ### # !!!!!!! ", + " %%%%%%%%%%%%%%%%%%################################### # # #### ## !!!!! ( ", + " %%%%%%%%%%%%%%%%%%################################## ##### !!!!! ( ", + " %%%%%%%%%%%%%%%%%################################# ####### !!!! ", + " %%%%%%%%%%%%%%% %%%%%############################### ###### # !! )", + " %%%%%% %% %%%%############################ ###### # ", + " % %%%% %%%############################# ######## ### ) ", + " %%%% %%%############################# ########### ))) ", + " % % %% %%############################## ########### ))) ", + " %%% % %%%############################### ## ########### )))) ", + " %% %%%################################ ############# ))) ", + " %% % %%################################## ############### *) )))", + " % #################################### ################ *** ))", + " % # ##################################################### *** )))", + " % % ################################## ################# *** )))", + " % ################################## ################# * )))", + " ################################################# ## )))", + " ########################################### ## ### +", + " ##%%%%%%%%%%%%%%%%%%%%%##################### #### + +", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%################ ##### +++", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%###########%## # , # +", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%#########%%###### +", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#####%%%%%% ## +", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%####%%%%%% # # +", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##%%%%%% ------", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ------", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% .-----", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% .-----", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% .-----", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% .-----", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - ", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///0", + " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ////0", + " %%%%%%%%%%%%%%%%%%%%%%%%%%% //////", + " 111%%%%%%%%%%%%%%%%%%%%%%% /////00", + " 1 11111%%%%%%%%%%%%%%%%%% ////000", + " 11111111%1%%%%% %% %% //00000", + " 11 11111111%%% %% ---///000000", + " 11 11111111% %% 222300000", + " 11111111111 % 2233333000", + " 1 1111111 4 22233335500", + " 1 111111 666 22233335550", + " % 1111111 666666 7 222333335555", + " 1111111 111 6666 33333335555", + " % 1 111111 111 8 9::: 33333335555", + " 111111111; < : = > ? 33333335555", + " 111111@; A BB333333555", + " 1@@CCCC D BBBB35555555", + " @CCEE BBBB555555FF", + " EEEE GH I BBJB55555FFF", + " EE GGKKK K LLLL55FFFF", + " MMN GGK KKKKKKK OOLPPPPFQ", + " NN NNGGGKKKKKKKKK OORPPPPPQ", + " GGGGKKKKKKKKKS RRRPPPQQ", + " GGGGGGGKKKKKSSSTTU RRPPPPQ", + " GGGGGGGKKKKVVSTTTUU ", + " GGGGGGGGKKKVVVSSTTUV ", + " WGGGGGGVGKKVVVSVVVVVV " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/grids/style-level-compositing-tiled-0,1-512-512-1.0-grid-reference.json b/tests/visual_tests/grids/style-level-compositing-tiled-0,1-512-512-1.0-grid-reference.json new file mode 100644 index 000000000..3f8724276 --- /dev/null +++ b/tests/visual_tests/grids/style-level-compositing-tiled-0,1-512-512-1.0-grid-reference.json @@ -0,0 +1,152 @@ +{ + "keys": [ + "", + "49", + "161", + "38", + "21", + "95", + "64", + "17", + "218", + "196", + "61", + "33", + "160", + "8", + "209", + "62", + "243" + ], + "data": {}, + "grid": [ + " ! !!!#$$$$%%%%%%%%%%%%%%% ", + " !!!##$$$%%%%%%%%%%%%%%%%%% ", + " !!######%%%%%%%%%%%%%%%%%%%%% ", + " & #########%%%%%%%%%%%%%%%%%%%%%%% ", + " & ######%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " #####%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " ####%%%%%%%%%%%%%%%%%%%%%%%%%%%% ", + " & ' #####%%%%%%%%%%%%%%%%%%%%%%%%% ", + " & ######(((%%%%%%%%%%%%%%%%%%%% ", + " ######(((%%%%%%%%%%%%%%%%%% ", + " ) ######(((((%%%%%%%%%%%%%%%% ", + " * ####((((((%%%%%%%%%%%%%%%% ", + "+ ###((((((((%%%%%%%%%%%%%% ", + " #((((((((%%%%%%%%%%%%% ", + " * ,,((((---%%%%%%%%%%%%% ", + " ,,((((---%%%%%%%%%%%%% ", + " ,,((((-----%%%%%%%%%% ", + " ,,,...-----%%%%%%%% ", + " ,,......----%%%%% ", + " ,,.......---%%%% ", + " , ,,.......--.%%%% ", + " ,.........%%%%%% ", + " ,,.........%%%%% ", + " ,,........//%%%% ", + " ,,........///%% ", + " ,,........///% ", + " ,,......../// ", + " ,.......... ", + " ,,.......... ", + " ,,.......... ", + " ,,........ ", + " ,....... ", + " ,....... ", + " ,..... ", + " ,,...... ", + " ,,..... ", + " ,,,.... ", + " ,,,.. ", + " ,,..... ", + " ,,..... ", + " ,,,.... ", + " ,.... ", + " ,,.. ", + " ,,... 00 ", + " ,,,, ", + " ,,,,, ", + " ,,,. 1 ", + " ,,,. ", + " , ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/grids/style-level-compositing-tiled-1,0-512-512-1.0-grid-reference.json b/tests/visual_tests/grids/style-level-compositing-tiled-1,0-512-512-1.0-grid-reference.json new file mode 100644 index 000000000..2ded48389 --- /dev/null +++ b/tests/visual_tests/grids/style-level-compositing-tiled-1,0-512-512-1.0-grid-reference.json @@ -0,0 +1,248 @@ +{ + "keys": [ + "", + "245", + "238", + "154", + "60", + "189", + "142", + "53", + "101", + "45", + "103", + "102", + "72", + "163", + "98", + "205", + "153", + "30", + "207", + "206", + "110", + "65", + "129", + "58", + "136", + "105", + "191", + "57", + "81", + "171", + "86", + "170", + "182", + "80", + "236", + "16", + "210", + "89", + "140", + "22", + "68", + "186", + "4", + "112", + "200", + "202", + "93", + "94", + "74", + "5", + "3", + "84", + "194", + "96", + "31", + "2", + "199", + "190", + "88", + "162", + "44", + "83", + "107", + "100", + "139", + "91", + "175", + "50", + "97", + "155", + "32", + "18", + "168", + "226", + "118", + "14", + "244", + "126", + "214", + "113", + "36", + "188", + "193", + "99", + "131", + "172", + "220", + "54", + "208", + "152", + "56", + "25", + "73", + "19", + "35", + "185", + "197", + "40", + "26", + "63", + "230", + "69", + "119", + "121", + "223", + "229", + "28", + "204", + "92", + "27", + "52", + "67", + "95" + ], + "data": {}, + "grid": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ! !! ", + " ! ", + " !!!! ", + " ! !!! ! ! !! ", + " !!! !! ! !!!! ", + " !! !! !!! !!!! ", + " # ## ! !!!! !!!! ", + " ##### # # !! !! !!!! ", + " # ####### ! !!!!!! ", + " ########### ! ! !!!!! ", + " ########## !!!!!! ", + " ###### !!! !! ", + " ######## ## !! !!! ", + " ######## !!!! ", + " ## ## # !!! ", + " #### ## ", + " #### ### ", + " ### # !!!! ", + " ## !! !!! ! ", + " ## !! !!!!! ", + " !!! !!!!!!!!!! ", + " !!!!! !!!!!!!!!!!! ! ", + " !!!! !!!!!!!!!!!!!!! !! !! ", + " !!!! !!!!!!!!!!!!!!!!! !!!!!!! ", + " !!!! !!!!!!!!!!!!!!!!!!! !!!!! !!!! ", + " !!! !!!!!!!!!!!!!!!!!!! ! ", + " !!! ! !!!!!!!!!!!!!!!!! ! ", + " !!! ! !!!!!!!!!!!!!!!!!!! ! ", + " !! ! !!!!!!!!!!!!!!!!!!!! !!! !!! !! !! ", + " !!! ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! ", + " !!! !!! ! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! ", + " !! !!! !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!! ", + " !!! !!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!! ", + " !!! !!!!!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!! ", + " $$ $ !!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!! !", + " $$$$$$ ! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " $ $$$$$ ! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ", + " $$$$$$%%!!! !!! !!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!! ", + " $$$$%$$$%%!!!!! ! !!!!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!", + " $$$$&%%%%!!!!!!!! !! !! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&%%%%!!!!!!!! !! !!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $&&&&&%%%%!!!!!!!!! !! !!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&&%%%%!!!!!!!!! ! !!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&&&%%%%!!! !!! ! !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&&&&%%%%!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $&&&&&& %%%!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&&& %%%!!!! !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$&&&&&&& %%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " $$$&&&&& %%%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$$$&&&&& %%%%%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", + " $$$$$&&&& %%%%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ", + " $$$$$&&&& %%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !!!!!!! ", + " $$$$$&&&& %%%%%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!! ", + " $$$$$&&&&&'%%%% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! ! ", + " $$$$$&&&&& ((!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! !!! ", + " $$$ &&&&& (((!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! ", + " &&&& )(!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! ", + " ** &&&&& )))))!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!! ", + " ** &&& )+)))!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! ", + " ***&& ++++,,,!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! ", + " --* .!!!++,,,!!!!!!!!!!!!!!!!!!!!!!!!!!///!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !! ", + " ----.......++,,,,!!!!!!!!!!!!!!!!!!!!!!//////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! ", + "0 11----.......,,,,,,!!!!!!!!!!!!!!!!!!!!!////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!2!!!!!!!!!!!!!! !!! ", + "00 111-----......,,,,,,!!!!!!!!!!!!!!!!!!!!!////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!2222!!!!!!!!!!!! !! 3 ", + "0 11------......4444,444!!!!!!!!!!!//!!!!!!/////////////!!!!!!!!!!!!!55!!!!!!!!!!!!!!2222!!!!!!!!!!!! ! 3", + " 6677-----8......44444444!!!!!!!!!!///////!/////////////////!!!!!!!!!!555!!!!!!!!!!!!222222!!!!!!!!! !! ! ", + "66669----8888...444444444444!!!!!!///////////////////////////!!!55555!5555555!!!!55!!222222!!!!!!!!! !! ! ", + "666666----88::::4444444444444!!!!!////////////////////////////2555555555555555555552222222222!!!!!!! ! ", + "666666;---<<=:==444>>4444444!!!!!!///////////////////////////22255555555555555555552522222222!!2!!!! ! ", + "66666;;;?<<<====@@@@>444444 !!!!!!!////////////////////////2/22225555555555555555555552222222222!!! !! ! ", + "66666;????AAB=C@@@@@>4 4 !!!!!!!! /////////////////////222222555555555555555555222222222222!!! ! ", + "66666???? BBDBCC@@@@@@ 44!!!!!!!! ////EEE///////////////22222222555555555555555522222222222!!!!! F ! ", + "666666 ??? BDDCCC@@@@ !!!!!! ////EEEE//////////////222222222255555555555522222222222222!!! FFF ", + "666 ?? BGCCCHHH II!!! ///EEEEEEEE//////////22222222222555555555522222222222222!!! FFF ", + "JJJ 6 ??? KCLHHM MM III!! NENNEEEEE//EOOOOOO222222222222222225522222222222222PPP F ", + "J ? ???? KLQQQM MMMMMMMMMMMRSSS NNNNNNEEEEEEEEEOO22222222222222222222222222222222222PPP F ", + " JJ ? ? ?QQQ QMMMMMMMMMMMMMRSTS NNNNNNNEEEEUUOO222222222222222222222222222222222 22PP F ", + "JJ QQQQMMMMMMMMMMMMMTTT NNNNNNNEEEUUUU2222222222222222222222222222222 2 PPV F ", + " ?? QQQQQMMMMMMMMMMMMTTTT NTTNNNNNNEUWUUU2222222222222222222222222222222 2 PVV V FF ", + " XXXXXYY Q Q QM MMMMZZZ[[[TTTTTTTTTTTNNWWWWW]]]]2222222222222222222222222222222 VVV FFFF ", + "XXXXXXYY QQQ ^ ZZZZ[[[TTTTTTTTTTTNWWWWWW]]]]]222222222222222222222222222222 VVV FFFFFF ", + "XXXXXXYY ZZZ[[[[TTTTTTTTTTTWWWWWW]]]____22222222222222222222222222222 V FFFFF F ", + "XXXXXXYYY` ` aZZ[[[[[TTTTTTTTTTTWWWWWW]]]____22222222222222222222222222222 FF ", + "XXXXXXXY```` ``` bcddd[[[[[TTTTTTTTTWWWW]]]]]]__2222222222222222222222222222222 FF ", + "XXXXXXXY``````````eeeeeeeccdddd[[[[TTTTTTTTTWWW]]]]]]_____22222222222222222222222222222 F ", + "XXXXXXX```````````eeeeeeeddddddd[ff TTTTTTTT]]]]]]]]_____ggg2222222__222222222222222222 ", + "XXXXXXX```````````eeeeeeedddddddddd TTTTTTTT]]]]]]]______gggg2_h2____22222222222222222 F ", + "XXXXXXX```````````eeeeeee dddddddddd TTTTTTT]]]]]___________gg______i2222222222222222 F F ", + "XXXXXXX```````````eeeeeee ddddddddddj kTTT]]]]]]]_________________ii2222222222222222 ", + "XXXXXXXX``````````eeeeeeee dddddddddd kkl ]]]_____________m___ii22222222222222n n F ", + "XXXXXXXXoo````````eeeeeeee dddddddddkkklll _______________m__iiii2222p22222222 n ", + "qXXXXXooooorrr````sssssssss ddddddddddddlll ______________m iiiii22pppp2222 ", + "qqXXXooooooorrrr``sssssssss dddddddddddll __________ iiiiituupp 2 v ", + "qqqooooooooorrrrrssssssssss dddddddddllll _________ iiittuupp 22 w ", + "qqqooooooooorrrrrsssssssssss dddddxxxlll ________ iiitttttp w ", + "qqqoooooooorrrrrrssssssssssy xxdxxxx _______ iiitttttup ww ", + "zoooooooooorrrrrssssssssssyyy xxxxxx ____ ttttttup w ", + "zooo{ooooorrrrrrssssssssss||||yxxxx _____ _ ittt}}}p www ~ ", + "zzo{{{{{{{{rrrrrssssssssss||||| xx ___ _ it t}}pp wwww ", + "z\u007f\u007f{{{{{{{\u0080rrrrrsssssssss||||||\u0081 \u0081\u0081\u0081\u0081 ___ i }ppp wwwww ", + "\u0082\u007f\u007f{{{{{{{rrrrr\u0083\u0083ssssssss||||||\u0081\u0081\u0081\u0081\u0081\u0081 ___\u0084 tt p w www \u0085 \u0086 ", + "\u0087\u0082{{{{{{{\u0080\u0080rr\u0083\u0083\u0083\u0083sssssss|||||||||\u0081\u0081\u0081 _ \u0084 _ tt w www ", + "\u0087\u0082{{{{{{{\u0080\u0080\u0083\u0083\u0083\u0083\u0083\u0083\u0083\u0083ssssss||||||||\u0081\u0081\u0081 \u0088 \u0084\u0084 tt \u0089w ww \u0085 ", + " {{{\u0080\u0080\u0080\u0080\u0083\u0083\u0083\u0083\u0083\u0083\u0083\u0083\u0083ssssss||||||\u0081\u0081\u0081 \u0088 \u008a \u0089\u0089\u0089 \u0089\u0089\u0089 w \u008b ", + " \u0080\u0080\u0080\u0080\u0083\u0083\u0083\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008css\u008d\u008e\u008e||\u008e\u0081\u0081\u0081\u0081 \u0088 \u008a\u008a \u0089\u0089 \u008a \u0089\u008a\u008a \u008a ", + " \u0080\u0080\u0080\u0080\u0080\u008f\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008d\u008d\u008d\u008e\u008e\u008e\u008e\u0081\u0081\u0081\u0081 \u0088 \u008a \u008a\u008a\u0089\u0089\u0089 \u0089\u0089\u0089\u008a\u008a \u008a ", + " \u0090\u0091\u0091\u0091\u008f\u008f\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008c\u008d\u008d\u008d\u008e\u008e\u008e\u008e\u0081\u0081\u0081 \u008a \u008a\u008a \u008a \u008a\u0089\u008a\u008a\u008a\u008a\u008a \u008a\u008a \u008a \u008a \u0092 " + ] +} \ No newline at end of file diff --git a/tests/visual_tests/grids/style-level-compositing-tiled-1,1-512-512-1.0-grid-reference.json b/tests/visual_tests/grids/style-level-compositing-tiled-1,1-512-512-1.0-grid-reference.json new file mode 100644 index 000000000..97fda9272 --- /dev/null +++ b/tests/visual_tests/grids/style-level-compositing-tiled-1,1-512-512-1.0-grid-reference.json @@ -0,0 +1,170 @@ +{ + "keys": [ + "", + "67", + "27", + "28", + "204", + "92", + "185", + "119", + "223", + "52", + "203", + "29", + "166", + "201", + "6", + "177", + "221", + "227", + "20", + "123", + "9", + "122", + "141", + "108", + "151", + "222", + "61", + "216", + "180", + "124", + "178", + "219", + "179", + "159", + "146" + ], + "data": {}, + "grid": [ + " !!!!##$$$$$$$$%%%%&&&&'' ( ))))) )))))) ) ) ))) ", + " * !!!!#$$$$$$$$$%++++&&&& )))) ))))) )) ) )))))) ", + " !!###$$$$$$$$$,+++++&& )))))) )))) ))) ))) )) ))))- -- ", + " ##$$$$$$$$$$$+++++++& ))) ) ) ))))))--- - ", + " $$$$$$$$$$$$+++++++ )) ) )) )))------- - . ", + " ///$$/$$$$$$$+++++++ 0 ))))) ) ))---- ", + " //////$$$$$11+++++ ))))))))22 ) )-- -- 3 3 ", + " //////$$$$$1114++++ ) ) 5 --- 33 ", + " ///////11$11114+++6 55 5 5 - ", + " ////////111111146666 7 8 55555 55 ", + " ///////1111111144666 88 5 555555 55 9 ", + " ///////1111116664666 888 555555555 555 9 ", + " ///////1111::::64666 8888 55555555555555555 ;;", + " <<<<<<<<<::::::666 8888 555555555555555555 ;;", + " <<<<<<====:::::66 888 55555555555555555555 9 ", + " <<<<<=====::::6 8888 5555555555555555555555555 > ", + " <<<<<======::666 8888 555555555555555555555555555 > ", + " <<<<=====???666 888 555555555555555555555555555 ", + " <<<<====????66 888 5555555555555555555555555555 ", + " <<<<==?????@6 5555555555555555555555555555 ", + " <<< + + + + + test + + ../data/Yosemite_L9.tif + gdal + + + + \ No newline at end of file diff --git a/tests/visual_tests/styles/style-level-compositing-tiled-0,0.xml b/tests/visual_tests/styles/style-level-compositing-tiled-0,0.xml new file mode 100644 index 000000000..f1fab7b69 --- /dev/null +++ b/tests/visual_tests/styles/style-level-compositing-tiled-0,0.xml @@ -0,0 +1,30 @@ + + + + style + + ../../data/shp/world_merc + shape + + + + + + mask + + + wkt,name + "Polygon((-10000000 -5000000, -10000000 10000000, -5000000 10000000, -5000000 -5000000, -10000000 -5000000))","bounds" + + csv + + + \ No newline at end of file diff --git a/tests/visual_tests/styles/style-level-compositing-tiled-0,1.xml b/tests/visual_tests/styles/style-level-compositing-tiled-0,1.xml new file mode 100644 index 000000000..f1fab7b69 --- /dev/null +++ b/tests/visual_tests/styles/style-level-compositing-tiled-0,1.xml @@ -0,0 +1,30 @@ + + + + style + + ../../data/shp/world_merc + shape + + + + + + mask + + + wkt,name + "Polygon((-10000000 -5000000, -10000000 10000000, -5000000 10000000, -5000000 -5000000, -10000000 -5000000))","bounds" + + csv + + + \ No newline at end of file diff --git a/tests/visual_tests/styles/style-level-compositing-tiled-1,0.xml b/tests/visual_tests/styles/style-level-compositing-tiled-1,0.xml new file mode 100644 index 000000000..f1fab7b69 --- /dev/null +++ b/tests/visual_tests/styles/style-level-compositing-tiled-1,0.xml @@ -0,0 +1,30 @@ + + + + style + + ../../data/shp/world_merc + shape + + + + + + mask + + + wkt,name + "Polygon((-10000000 -5000000, -10000000 10000000, -5000000 10000000, -5000000 -5000000, -10000000 -5000000))","bounds" + + csv + + + \ No newline at end of file diff --git a/tests/visual_tests/styles/style-level-compositing-tiled-1,1.xml b/tests/visual_tests/styles/style-level-compositing-tiled-1,1.xml new file mode 100644 index 000000000..f1fab7b69 --- /dev/null +++ b/tests/visual_tests/styles/style-level-compositing-tiled-1,1.xml @@ -0,0 +1,30 @@ + + + + style + + ../../data/shp/world_merc + shape + + + + + + mask + + + wkt,name + "Polygon((-10000000 -5000000, -10000000 10000000, -5000000 10000000, -5000000 -5000000, -10000000 -5000000))","bounds" + + csv + + + \ No newline at end of file diff --git a/tests/visual_tests/test.py b/tests/visual_tests/test.py index 98b894e3e..2be5c0bca 100755 --- a/tests/visual_tests/test.py +++ b/tests/visual_tests/test.py @@ -77,6 +77,13 @@ sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100), default_text_box = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) +merc_z1_bboxes = { + '0,0':mapnik.Box2d(-20037508.342,0,0,20037508.342), # upper left + '1,0':mapnik.Box2d(0,0,20037508.342,20037508.342), # upper right + '0,1':mapnik.Box2d(-20037508.342,-20037508.342,0,0), # lower left + '1,1':mapnik.Box2d(0,-20037508.342,20037508.342,0) # lower right +} + dirname = os.path.dirname(__file__) files = { @@ -132,6 +139,7 @@ files = { 'tiff-opaque-edge-gdal2': {'sizes':[(600,400),(969,793)]}, 'tiff-opaque-edge-raster2': {'sizes':[(600,400),(969,793)]}, 'tiff-resampling': {'sizes':[(600,400)]}, + 'gdal-filter-factor': {'sizes':[(600,400)]}, # https://github.com/mapnik/mapnik/issues/1622 'tiff-edge-alignment-gdal1': {'sizes':[(256,256),(255,257)], 'bbox':mapnik.Box2d(-13267022.12540147,4618019.500877209,-13247454.246160466,4637587.380118214) @@ -155,7 +163,11 @@ files = { }, 'road-casings-non-grouped-rendering': {'sizes':[(600,600)], 'bbox':mapnik.Box2d(1477001.12245,6890242.37746,1480004.49012,6892244.62256) - } + }, + 'style-level-compositing-tiled-0,0':{'sizes':[(512,512)],'bbox':merc_z1_bboxes['0,0']}, + 'style-level-compositing-tiled-1,0':{'sizes':[(512,512)],'bbox':merc_z1_bboxes['1,0']}, + 'style-level-compositing-tiled-0,1':{'sizes':[(512,512)],'bbox':merc_z1_bboxes['0,1']}, + 'style-level-compositing-tiled-1,1':{'sizes':[(512,512)],'bbox':merc_z1_bboxes['1,1']} } class Reporting: