From 2c5905027a5088a89cddead562b78c13e8f8cc3b Mon Sep 17 00:00:00 2001 From: mapsam Date: Fri, 1 Dec 2017 10:45:06 -0800 Subject: [PATCH 1/2] danes suggestion --- src/vtquery.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/vtquery.cpp b/src/vtquery.cpp index ac755151..c330a204 100644 --- a/src/vtquery.cpp +++ b/src/vtquery.cpp @@ -227,30 +227,17 @@ struct Worker : Nan::AsyncWorker { mapbox::geometry::point query_point = utils::create_query_point(data.longitude, data.latitude, data.zoom, extent, tile_obj.x, tile_obj.y); GeomType original_geometry_type = GeomType::unknown; // set to unknown but this will get overwritten while (auto feature = layer.next_feature()) { - mapbox::geometry::geometry query_geometry = mapbox::geometry::point(); switch (feature.geometry_type()) { case vtzero::GeomType::POINT: { - if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::point) { - continue; - } original_geometry_type = GeomType::point; - query_geometry = mapbox::vector_tile::extract_geometry(feature); break; } case vtzero::GeomType::LINESTRING: { - if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::linestring) { - continue; - } original_geometry_type = GeomType::linestring; - query_geometry = mapbox::vector_tile::extract_geometry(feature); break; } case vtzero::GeomType::POLYGON: { - if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != GeomType::polygon) { - continue; - } original_geometry_type = GeomType::polygon; - query_geometry = mapbox::vector_tile::extract_geometry(feature); break; } default: { @@ -258,8 +245,12 @@ struct Worker : Nan::AsyncWorker { } } + if (data.geometry_filter_type != GeomType::all && data.geometry_filter_type != original_geometry_type) { + continue; + } + // implement closest point algorithm on query geometry and the query point - auto const cp_info = mapbox::geometry::algorithms::closest_point(query_geometry, query_point); + auto const cp_info = mapbox::geometry::algorithms::closest_point(mapbox::vector_tile::extract_geometry(feature), query_point); // check if cp_info.distance isn't less than zero, if so, this is an error and we can move on if (cp_info.distance < 0.0) { From ff3b357ca671d5dfe85491d8e03960e2e709050b Mon Sep 17 00:00:00 2001 From: mapsam Date: Fri, 1 Dec 2017 10:58:35 -0800 Subject: [PATCH 2/2] remove verbose asan options --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bd0167a9..2be72ee8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,7 +83,6 @@ matrix: before_script: - export LD_PRELOAD=${MASON_LLVM_RT_PRELOAD} - export ASAN_OPTIONS=fast_unwind_on_malloc=0:${ASAN_OPTIONS} - - export LSAN_OPTIONS=verbosity=1:log_threads=1 - npm test - unset LD_PRELOAD # after successful tests, publish binaries if specified in commit message