GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — osm2pgsql/src/geom.cpp at master · osm2pgsql-dev/osm2pgsql

Expand file tree

/

geom.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
65 lines (53 loc) · 1.63 KB
/

geom.cpp

Copy path

File metadata and controls

65 lines (53 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* SPDX-License-Identifier: GPL-2.0-or-later
*
* This file is part of osm2pgsql (https://osm2pgsql.org/).
*
* Copyright (C) 2006-2026 by the osm2pgsql developer community.
* For a full list of authors see the git log.
*/
#include "geom.hpp"
#include <algorithm>
#include <numeric>
namespace geom {
void point_list_t::remove_duplicates()
{
auto const it = std::unique(begin(), end());
erase(it, end());
}
bool operator==(polygon_t const &a, polygon_t const &b) noexcept
{
return (a.outer() == b.outer()) && (a.inners() == b.inners());
}
bool operator!=(polygon_t const &a, polygon_t const &b) noexcept
{
return !(a == b);
}
[[nodiscard]] std::size_t polygon_t::n_points() const
{
return m_outer.size() +
std::accumulate(m_inners.cbegin(), m_inners.cend(), std::size_t{0},
[](std::size_t sum, ring_t const &ring) {
return sum + ring.size();
});
}
[[nodiscard]] std::size_t geometry_t::n_points() const
{
return visit([](auto const &input) { return input.n_points(); });
}
std::size_t n_points(geometry_t const &geom)
{
return geom.visit([](auto const &input) { return input.n_points(); });
}
std::size_t dimension(collection_t const &geom)
{
return std::accumulate(geom.cbegin(), geom.cend(), 0ULL,
[](std::size_t max, auto const &member) {
return std::max(max, dimension(member));
});
}
std::size_t dimension(geometry_t const &geom)
{
return geom.visit([](auto const &input) { return dimension(input); });
}
} // namespace geom
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.