Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into improve-get-geometr…
Browse files Browse the repository at this point in the history
…ies-queries
  • Loading branch information
Hannah Bast committed Jun 17, 2024
2 parents 0ff96f7 + 5ec3bcf commit d612b0e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.1)
cmake_minimum_required (VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)

project (qlever-petrimaps)
Expand Down
45 changes: 16 additions & 29 deletions src/qlever-petrimaps/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ util::http::Answer Server::handleHeatMapReq(const Params& pars,
const auto& lbox = r->getLineBBox(lid - I_OFFSET);
if (!intersects(lbox, bbox)) continue;

uint8_t gi = 0;
size_t gi = 0;

size_t start = r->getLine(lid - I_OFFSET);
size_t end = r->getLineEnd(lid - I_OFFSET);
Expand Down Expand Up @@ -367,36 +367,9 @@ util::http::Answer Server::handleHeatMapReq(const Params& pars,

if (!isects) continue;

mainX = 0;
mainY = 0;

DLine extrLine;
extrLine.reserve(end - start);

gi = 0;

for (size_t i = start; i < end; i++) {
// extract real geom
const auto& cur = r->getLinePoints()[i];

if (isMCoord(cur.getX())) {
mainX = rmCoord(cur.getX());
mainY = rmCoord(cur.getY());
continue;
}

// skip bounding box at beginning
gi++;
if (gi < 3) continue;

DPoint p((mainX * M_COORD_GRANULARITY + cur.getX()) / 10.0,
(mainY * M_COORD_GRANULARITY + cur.getY()) / 10.0);
extrLine.push_back(p);
}

// the factor depends on the render thickness of the line, make
// this configurable!
const auto& denseLine = densify(extrLine, res);
const auto& denseLine = densify(r->extractLineGeom(lid - I_OFFSET), res);

for (const auto& p : denseLine) {
int px = ((p.getX() - bbox.getLowerLeft().getX()) / mercW) * w;
Expand Down Expand Up @@ -1088,13 +1061,27 @@ util::http::Answer Server::handleExportReq(const Params& pars, int sock) const {
first = true;
} catch (std::runtime_error& e) {
}
try {
auto geom = util::geo::multiPointFromWKT<double>(wkt);
if (first) ss << ",";
geoJsonOut.print(geom, dict);
first = true;
} catch (std::runtime_error& e) {
}
try {
auto geom = util::geo::lineFromWKT<double>(wkt);
if (first) ss << ",";
geoJsonOut.print(geom, dict);
first = true;
} catch (std::runtime_error& e) {
}
try {
auto geom = util::geo::multiLineFromWKT<double>(wkt);
if (first) ss << ",";
geoJsonOut.print(geom, dict);
first = true;
} catch (std::runtime_error& e) {
}
ss << "\n";
}

Expand Down

0 comments on commit d612b0e

Please sign in to comment.