FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tilemaker/src/relation_roles.cpp at master · cyclemap/tilemaker · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cyclemap
/
tilemaker
Public
forked from
systemed/tilemaker
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tilemaker
/
src
/
relation_roles.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (50 loc) · 2.46 KB
Breadcrumbs
tilemaker
/
src
/
relation_roles.cpp
Copy path
File metadata and controls
57 lines (50 loc) · 2.46 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
#
include
"
relation_roles.h
"
RelationRoles::RelationRoles
() {
//
Computed in early 2024 from popular roles: https://gist.github.com/systemed/29ea4c8d797a20dcdffee8ba907d62ea
//
This is just an optimization to avoid taking a lock in the common case.
//
//
The list should be refreshed if the set of popular roles dramatically changes,
//
but tilemaker will still be correct, just slower.
popularRoleStrings = {
"
"
,
"
1700
"
,
"
1800
"
,
"
1900
"
,
"
2700
"
,
"
2800
"
,
"
2900
"
,
"
3000
"
,
"
3100
"
,
"
3200
"
,
"
above
"
,
"
accessfrom
"
,
"
accessto
"
,
"
accessvia
"
,
"
across
"
,
"
address
"
,
"
admin_centre
"
,
"
alternative
"
,
"
associated
"
,
"
attached_to
"
,
"
backward
"
,
"
basket
"
,
"
both
"
,
"
branch_circuit
"
,
"
building
"
,
"
buildingpart
"
,
"
builidingpart
"
,
"
camera
"
,
"
claimed
"
,
"
connection
"
,
"
contains
"
,
"
crossing
"
,
"
destination
"
,
"
device
"
,
"
de_facto
"
,
"
east
"
,
"
edge
"
,
"
empty role
"
,
"
end
"
,
"
endpoint
"
,
"
entrance
"
,
"
entry
"
,
"
ex-camera
"
,
"
exit
"
,
"
extent
"
,
"
facility
"
,
"
force
"
,
"
forward
"
,
"
from
"
,
"
generator
"
,
"
give_way
"
,
"
graph
"
,
"
guidepost
"
,
"
hidden
"
,
"
highway
"
,
"
Hole
"
,
"
hole
"
,
"
house
"
,
"
inner
"
,
"
intersection
"
,
"
in_tunnel
"
,
"
junction
"
,
"
label
"
,
"
lable
"
,
"
landuse
"
,
"
lateral
"
,
"
left
"
,
"
line
"
,
"
location_hint
"
,
"
lower
"
,
"
main
"
,
"
main_stream
"
,
"
marker
"
,
"
member
"
,
"
memorial
"
,
"
mirror
"
,
"
negative
"
,
"
negative:entry
"
,
"
negative:exit
"
,
"
negative:parking
"
,
"
object
"
,
"
on_bridge
"
,
"
outer
"
,
"
outline
"
,
"
part
"
,
"
pedestrian
"
,
"
pin
"
,
"
pit_lane
"
,
"
platform
"
,
"
positive
"
,
"
positive:entry
"
,
"
positive:exit
"
,
"
positive:parking
"
,
"
priority
"
,
"
ridge
"
,
"
right
"
,
"
road_marking
"
,
"
road_sign
"
,
"
room
"
,
"
section
"
,
"
sector
"
,
"
shell
"
,
"
side_stream
"
,
"
sign
"
,
"
signal
"
,
"
start
"
,
"
stop
"
,
"
street
"
,
"
sub-relation
"
,
"
subarea
"
,
"
subbasin
"
,
"
substation
"
,
"
switch
"
,
"
target
"
,
"
tee
"
,
"
through
"
,
"
to
"
,
"
tomb
"
,
"
track
"
,
"
tracksection
"
,
"
traffic_sign
"
,
"
tributary
"
,
"
trunk_circuit
"
,
"
under
"
,
"
upper
"
,
"
via
"
,
"
visible
"
,
"
walk
"
,
"
ways
"
,
"
west
"
};
for
(
const
auto
& s : popularRoleStrings) {
popularRoles[s] = popularRoles.
size
();
}
}
std::string
RelationRoles::getRole
(
uint16_t
role)
const
{
if
(role < popularRoleStrings.
size
())
return
popularRoleStrings[role];
return
rareRoleStrings[role - popularRoleStrings.
size
()];
}
uint16_t
RelationRoles::getOrAddRole
(
const
std::string& role) {
{
const
auto
& pos = popularRoles.
find
(role);
if
(pos != popularRoles.
end
())
return
pos->
second
;
}
std::lock_guard<std::mutex>
lock
(mutex);
const
auto
& pos = rareRoles.
find
(role);
if
(pos != rareRoles.
end
())
return
pos->
second
;
uint16_t
rv = popularRoleStrings.
size
() + rareRoleStrings.
size
();
rareRoles[role] = rv;
rareRoleStrings.
push_back
(role);
return
rv;
}
Back
|
FazBrowse Home
|
New Git URL