Codebase list mapnik / a9cd399
Imported Upstream version 3.0.13~rc2+ds Bas Couwenberg 7 years ago
14 changed file(s) with 120 addition(s) and 102 deletion(s). Raw diff Collapse all Expand all
8585 - source bootstrap.sh
8686 - |
8787 if [[ $(uname -s) == 'Linux' ]]; then
88 mason install clang++ 3.9.0
89 export PATH=$(mason prefix clang++ 3.9.0)/bin:${PATH}
90 mason install llvm-cov 3.9.0
91 export PATH=$(mason prefix llvm-cov 3.9.0)/bin:${PATH}
88 mason install clang++ 3.9.1
89 export PATH=$(mason prefix clang++ 3.9.1)/bin:${PATH}
90 mason install llvm-cov 3.9.1
91 export PATH=$(mason prefix llvm-cov 3.9.1)/bin:${PATH}
9292 which llvm-cov
93 export LLVM_COV="$(mason prefix llvm-cov 3.9.0)/bin/llvm-cov"
93 export LLVM_COV="$(mason prefix llvm-cov 3.9.1)/bin/llvm-cov"
9494 fi
9595 - ccache --version
9696 - ccache -p || true
77
88 ## 3.0.13
99
10 Released: January xx, 2017
10 Released: February xx, 2017
1111
1212 (Packaged from xxxxxxx)
1313
2525 - Changed `render_thunk_list` to `std::list<render_thunk>` (PR #3585)
2626 - Upgraded to variant `v1.1.5`
2727 - CSV.input - fixed `blank` line test (8a3a380b3b5c64681f2478b4f0d06f6a907f5eed)
28
28 - GeoJSON - handle empty elements in position grammar (ref #3609)
29 - mapnik-index - return failure on invalid bounding box (ref #3611)
2930
3031 ## 3.0.12
3132
1010 - shrink icu data
1111 '
1212
13 MASON_VERSION="3e2944322"
13 MASON_VERSION="v0.5.0"
1414
1515 function setup_mason() {
1616 if [[ ! -d ./.mason ]]; then
1818 (cd ./.mason && git checkout ${MASON_VERSION})
1919 else
2020 echo "Updating to latest mason"
21 (cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull)
21 (cd ./.mason && git fetch && git checkout ${MASON_VERSION} && git pull origin ${MASON_VERSION})
2222 fi
2323 export PATH=$(pwd)/.mason:$PATH
2424 export CXX=${CXX:-clang++}
66 JOBS: 8
77 CCACHE_TEMPDIR: /tmp/.ccache-temp
88 CCACHE_COMPRESS: 1
9 LLVM_VERSION: 3.8
10 pre:
11 - echo "here"
12 post:
13 - echo "there"
9 LLVM_VERSION: 3.9.1
1410
1511 checkout:
1612 post:
3127 database:
3228 pre:
3329 - ./bootstrap.sh
34 - ./.mason/mason install clang ${LLVM_VERSION}.0
35 - ./.mason/mason link clang ${LLVM_VERSION}.0
36 - ./configure CC="$(pwd)/mason_packages/.link/bin/clang-${LLVM_VERSION}" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++-${LLVM_VERSION} -Qunused-arguments"
30 - ./.mason/mason install clang++ ${LLVM_VERSION}
31 - ./.mason/mason link clang++ ${LLVM_VERSION}
32 - ./configure CC="$(pwd)/mason_packages/.link/bin/clang" CXX="$(pwd)/mason_packages/.link/bin/ccache $(pwd)/mason_packages/.link/bin/clang++ -Qunused-arguments"
3733 - make
3834 override:
3935 - psql -c 'create database template_postgis;'
115115 bool valid() const;
116116 void move(T x, T y);
117117 std::string to_string() const;
118 T area() const;
118119
119120 // define some operators
120121 box2d_type& operator+=(box2d_type const& other);
392392 return s.str();
393393 }
394394
395 template <typename T>
396 T box2d<T>::area() const
397 {
398 return width() * height();
399 }
395400
396401 template <typename T>
397402 box2d<T>& box2d<T>::operator+=(box2d<T> const& other)
465470 case -1:
466471 return maxy_;
467472 default:
468 throw std::out_of_range("index out of range, max value is 3, min value is -4 ");
473 throw std::out_of_range(std::string("index out of range, max value is 3, min value is -4 "));
469474 }
470475 }
471476
5050 qi::rule<Iterator, qi::locals<Iterator>, void(boxes_type&), space_type> features;
5151 qi::rule<Iterator, qi::locals<int, box_type>, void(boxes_type&, Iterator const&), space_type> feature;
5252 qi::rule<Iterator, qi::locals<box_type>, box_type(), space_type> coords;
53 qi::rule<Iterator, boost::optional<position_type>(), space_type> pos;
53 qi::rule<Iterator, position_type(), space_type> pos;
5454 qi::rule<Iterator, void(box_type&), space_type> ring;
5555 qi::rule<Iterator, void(box_type&), space_type> rings;
5656 qi::rule<Iterator, void(box_type&), space_type> rings_array;
4141 template <typename T0, typename T1>
4242 result_type operator() (T0 & bbox, T1 const& pos) const
4343 {
44 if (pos)
44 typename T0::value_type x = pos.x;
45 typename T0::value_type y = pos.y;
46 if (!bbox.valid())
4547 {
46 typename T0::value_type x = pos->x;
47 typename T0::value_type y = pos->y;
48 if (!bbox.valid())
49 {
50 bbox.init(x, y);
51 }
52 else
53 {
54 bbox.expand_to_include(x, y);
55 }
48 bbox.init(x, y);
49 }
50 else
51 {
52 bbox.expand_to_include(x, y);
5653 }
5754 }
5855 };
6360 template <typename T0, typename T1, typename T2, typename T3>
6461 void operator() (T0 & boxes, T1 const& begin, T2 const& box, T3 const& range) const
6562 {
66 if (box.valid()) boxes.emplace_back(box,
67 std::make_pair(std::distance(begin,
68 range.begin()),
69 std::distance(range.begin(), range.end())));
63 boxes.emplace_back(box,
64 std::make_pair(std::distance(begin,
65 range.begin()),
66 std::distance(range.begin(), range.end())));
7067 }
7168 };
7269
131128 >> lit(':') >> (rings_array(_a) | rings (_a) | ring(_a) | pos[calculate_bounding_box(_a,_1)])[_val = _a]
132129 ;
133130
134 pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
131 pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']')
135132 ;
136133
137 ring = lit('[') >> pos[calculate_bounding_box(_r1,_1)] % lit(',') > lit(']')
134 ring = lit('[') >> -(pos[calculate_bounding_box(_r1,_1)] % lit(',')) >> lit(']')
138135 ;
139136
140 rings = lit('[') >> ring(_r1) % lit(',') > lit(']')
137 rings = lit('[') >> (ring(_r1) % lit(',') > lit(']'))
141138 ;
142139
143 rings_array = lit('[') >> rings(_r1) % lit(',') > lit(']')
140 rings_array = lit('[') >> (rings(_r1) % lit(',') > lit(']'))
144141 ;
145142
146143 coords.name("Coordinates");
4343 {
4444 positions_grammar(ErrorHandler & error_handler);
4545 qi::rule<Iterator, coordinates(),space_type> coords;
46 qi::rule<Iterator, boost::optional<position>(), space_type> pos;
46 qi::rule<Iterator, position(), space_type> pos;
4747 qi::rule<Iterator, positions(), space_type> ring;
4848 qi::rule<Iterator, std::vector<positions>(), space_type> rings;
4949 qi::rule<Iterator, std::vector<std::vector<positions> >(), space_type> rings_array;
4040 template <typename T0,typename T1>
4141 result_type operator() (T0 & coords, T1 const& pos) const
4242 {
43 if (pos) coords = *pos;
43 coords = pos;
4444 }
4545 };
4646
5050 template <typename T0, typename T1>
5151 result_type operator() (T0 & coords, T1 const& pos) const
5252 {
53 if (pos) coords.emplace_back(*pos);
53 coords.emplace_back(pos);
5454 }
5555 };
5656
7474
7575 coords = rings_array[_val = _1] | rings [_val = _1] | ring[_val = _1] | pos[set_position(_val,_1)]
7676 ;
77 pos = lit('[') > -(double_ > lit(',') > double_) > omit[*(lit(',') > double_)] > lit(']')
77 pos = lit('[') > double_ > lit(',') > double_ > omit[*(lit(',') > double_)] > lit(']')
7878 ;
79 ring = lit('[') >> pos[push_position(_val,_1)] % lit(',') > lit(']')
79 ring = lit('[') >> -(pos[push_position(_val,_1)] % lit(',')) >> lit(']')
8080 ;
81 rings = lit('[') >> ring % lit(',') > lit(']')
81 rings = lit('[') >> (ring % lit(',') > lit(']'))
8282 ;
83 rings_array = lit('[') >> rings % lit(',') > lit(']')
83 rings_array = lit('[') >> (rings % lit(',') > lit(']'))
8484 ;
8585 coords.name("Coordinates");
8686 pos.name("Position");
2626
2727 #define MAPNIK_MAJOR_VERSION 3
2828 #define MAPNIK_MINOR_VERSION 0
29 #define MAPNIK_PATCH_VERSION 12
29 #define MAPNIK_PATCH_VERSION 13
3030
3131 #define MAPNIK_VERSION (MAPNIK_MAJOR_VERSION*100000) + (MAPNIK_MINOR_VERSION*100) + (MAPNIK_PATCH_VERSION)
3232
186186 initialize_points();
187187 }
188188
189 struct largest_bbox_first
190 {
191 bool operator() (geometry::geometry<double> const* g0, geometry::geometry<double> const* g1) const
192 {
193 box2d<double> b0 = geometry::envelope(*g0);
194 box2d<double> b1 = geometry::envelope(*g1);
195 return b0.width() * b0.height() > b1.width() * b1.height();
196 }
197 bool operator() (base_symbolizer_helper::geometry_cref const& g0,
198 base_symbolizer_helper::geometry_cref const& g1) const
199 {
200 // TODO - this has got to be expensive! Can we cache bbox's if there are repeated calls to same geom?
201 box2d<double> b0 = geometry::envelope(g0);
202 box2d<double> b1 = geometry::envelope(g1);
203 return b0.width() * b0.height() > b1.width() * b1.height();
204 }
205 };
189 template <typename It>
190 static It largest_bbox(It begin, It end)
191 {
192 if (begin == end)
193 {
194 return end;
195 }
196 It largest_geom = begin;
197 double largest_bbox = geometry::envelope(*largest_geom).area();
198 for (++begin; begin != end; ++begin)
199 {
200 double bbox = geometry::envelope(*begin).area();
201 if (bbox > largest_bbox)
202 {
203 largest_bbox = bbox;
204 largest_geom = begin;
205 }
206 }
207 return largest_geom;
208 }
206209
207210 void base_symbolizer_helper::initialize_geometries() const
208211 {
215218 type == geometry::geometry_types::MultiPolygon)
216219 {
217220 bool largest_box_only = text_props_->largest_bbox_only;
218 if (largest_box_only)
219 {
220 geometries_to_process_.sort(largest_bbox_first());
221 if (largest_box_only && geometries_to_process_.size() > 1)
222 {
223 auto largest_geom = largest_bbox(
224 geometries_to_process_.begin(),
225 geometries_to_process_.end());
221226 geo_itr_ = geometries_to_process_.begin();
227 if (geo_itr_ != largest_geom)
228 {
229 std::swap(*geo_itr_, *largest_geom);
230 }
222231 geometries_to_process_.erase(++geo_itr_, geometries_to_process_.end());
223232 }
224233 }
513513
514514 for (auto const& c_str : {"./test/data/json/feature-malformed-1.geojson",
515515 "./test/data/json/feature-malformed-2.geojson",
516 "./test/data/json/feature-malformed-3.geojson"})
516 "./test/data/json/feature-malformed-3.geojson",
517 "./test/data/json/feature-malformed-4.geojson"})
517518 {
518519 std::string filename(c_str);
519520 params["file"] = filename;
553554
554555 SECTION("GeoJSON ensure mapnik::featureset::next() throws on malformed input")
555556 {
556 std::string filename{"./test/data/json/featurecollection-malformed.json"};
557557 mapnik::parameters params;
558558 params["type"] = "geojson";
559 params["file"] = filename;
560
561 // cleanup in the case of a failed previous run
562 if (mapnik::util::exists(filename + ".index"))
563 {
564 mapnik::util::remove(filename + ".index");
565 }
566
567 CHECK(!mapnik::util::exists(filename + ".index"));
568 int ret = create_disk_index(filename);
569 int ret_posix = (ret >> 8) & 0x000000ff;
570 INFO(ret);
571 INFO(ret_posix);
572 CHECK(mapnik::util::exists(filename + ".index"));
573
574 for (auto cache_features : {true,false})
575 {
576 params["cache_features"] = cache_features;
577 auto ds = mapnik::datasource_cache::instance().create(params);
578 auto fields = ds->get_descriptor().get_descriptors();
579 mapnik::query query(ds->envelope());
580 auto features = ds->features(query);
581 REQUIRE_THROWS(
582 auto feature = features->next();
583 while (feature != nullptr)
584 {
585 feature = features->next();
586 });
587 }
588
589 // cleanup
590 if (mapnik::util::exists(filename + ".index"))
591 {
592 mapnik::util::remove(filename + ".index");
559 for (auto const& c_str : {"./test/data/json/featurecollection-malformed.json",
560 "./test/data/json/featurecollection-malformed-2.json"})
561 {
562 std::string filename(c_str);
563 params["file"] = filename;
564 // cleanup in the case of a failed previous run
565 if (mapnik::util::exists(filename + ".index"))
566 {
567 mapnik::util::remove(filename + ".index");
568 }
569
570 CHECK(!mapnik::util::exists(filename + ".index"));
571 int ret = create_disk_index(filename);
572 int ret_posix = (ret >> 8) & 0x000000ff;
573 INFO(ret);
574 INFO(ret_posix);
575 CHECK(mapnik::util::exists(filename + ".index"));
576
577 for (auto cache_features : {true,false})
578 {
579 params["cache_features"] = cache_features;
580 auto ds = mapnik::datasource_cache::instance().create(params);
581 auto fields = ds->get_descriptor().get_descriptors();
582 mapnik::query query(ds->envelope());
583 auto features = ds->features(query);
584 REQUIRE_THROWS(
585 auto feature = features->next();
586 while (feature != nullptr)
587 {
588 feature = features->next();
589 });
590 }
591
592 // cleanup
593 if (mapnik::util::exists(filename + ".index"))
594 {
595 mapnik::util::remove(filename + ".index");
596 }
593597 }
594598 }
595599
136136 }
137137 }
138138 }
139 else if (validate_features)
140 {
141 if (verbose) std::clog << "Invalid bbox encountered " << item.first << std::endl;
142 return std::make_pair(false, extent);
143 }
139144 }
140145 return std::make_pair(true, extent);
141146 }