Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WorldWotMap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pascal Engélibert
WorldWotMap
Commits
1b8d66b2
Commit
1b8d66b2
authored
3 years ago
by
Pascal Engélibert
Browse files
Options
Downloads
Patches
Plain Diff
wip autolocation
parent
8d80db72
Branches
autolocation
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/gencache.py
+24
-15
24 additions, 15 deletions
py/gencache.py
templates/index.html
+2
-1
2 additions, 1 deletion
templates/index.html
templates/worldwotmap.js
+18
-1
18 additions, 1 deletion
templates/worldwotmap.js
with
44 additions
and
17 deletions
py/gencache.py
+
24
−
15
View file @
1b8d66b2
...
@@ -170,7 +170,7 @@ Options:
...
@@ -170,7 +170,7 @@ Options:
certs
=
json
.
loads
(
cindex
.
get
(
pub
).
decode
())
certs
=
json
.
loads
(
cindex
.
get
(
pub
).
decode
())
pubkey
=
idty
[
"
pub
"
]
pubkey
=
idty
[
"
pub
"
]
output
[
"
accounts
"
][
pubkey
]
=
[[
idty
[
"
uid
"
],
int
(
idty
[
"
member
"
]),
None
],
None
,
None
]
output
[
"
accounts
"
][
pubkey
]
=
[[
idty
[
"
uid
"
],
int
(
idty
[
"
member
"
]),
None
],
None
,
None
,
1
,
1
]
if
not
pubkey
in
moredata
:
if
not
pubkey
in
moredata
:
moredata
[
pubkey
]
=
[
0
,
0
,
0
,
0
,
0
,
None
]
moredata
[
pubkey
]
=
[
0
,
0
,
0
,
0
,
0
,
None
]
...
@@ -284,21 +284,30 @@ Options:
...
@@ -284,21 +284,30 @@ Options:
log
(
"
Total accounts: {}
"
.
format
(
len
(
output
[
"
accounts
"
])),
LOG_INFO
)
log
(
"
Total accounts: {}
"
.
format
(
len
(
output
[
"
accounts
"
])),
LOG_INFO
)
log
(
"
Placing non-geolocated accounts
"
)
log
(
"
Placing non-geolocated accounts
"
)
for
_
in
range
(
5
):
for
i
in
range
(
5
):
for
pubkey
in
output
[
"
accounts
"
]:
for
pubkey
in
output
[
"
accounts
"
]:
if
not
pubkey
in
neighbors
:
continue
account
=
output
[
"
accounts
"
][
pubkey
]
account
=
output
[
"
accounts
"
][
pubkey
]
if
account
[
2
]
=
=
None
and
(
account
[
1
]
==
None
or
account
[
1
][
2
]
==
None
):
account
[
3
]
=
account
[
4
]
pos
=
[
0.0
,
0.0
]
pos
=
[
0.0
,
0.0
]
n_neighbors
=
0
n_neighbors
=
0
for
neighbor_pubkey
in
neighbors
[
pubkey
]:
for
neighbor_pubkey
in
neighbors
[
pubkey
]:
neighbor
=
output
[
"
accounts
"
][
neighbor_pubkey
]
neighbor
=
output
[
"
accounts
"
][
neighbor_pubkey
]
neighbor_pos
=
neighbor
[
1
][
2
]
if
neighbor
[
1
]
and
neighbor
[
1
][
2
]
else
(
neighbor
[
2
]
if
neighbor
[
2
]
else
None
)
#neighbor_pos = neighbor[1][2] if neighbor[1] and neighbor[1][2] else (neighbor[2] if neighbor[2] else None)
neighbor_pos
=
neighbor
[
2
]
if
neighbor
[
2
]
else
(
neighbor
[
1
][
2
]
if
neighbor
[
1
]
and
neighbor
[
1
][
2
]
else
None
)
if
neighbor_pos
:
if
neighbor_pos
:
pos
[
0
]
+=
neighbor_pos
[
0
]
pos
[
0
]
+=
neighbor_pos
[
0
]
*
neighbor
[
3
]
pos
[
1
]
+=
neighbor_pos
[
1
]
pos
[
1
]
+=
neighbor_pos
[
1
]
*
neighbor
[
3
]
n_neighbors
+=
1
n_neighbors
+=
neighbor
[
3
]
if
account
[
1
]
and
account
[
1
][
2
]:
pos
[
0
]
+=
account
[
1
][
2
][
0
]
*
account
[
3
]
*
5
pos
[
1
]
+=
account
[
1
][
2
][
1
]
*
account
[
3
]
*
5
n_neighbors
+=
account
[
3
]
*
5
if
n_neighbors
!=
0
:
if
n_neighbors
!=
0
:
account
[
2
]
=
[
pos
[
0
]
/
n_neighbors
,
pos
[
1
]
/
n_neighbors
]
account
[
2
]
=
[
pos
[
0
]
/
n_neighbors
,
pos
[
1
]
/
n_neighbors
]
account
[
4
]
=
n_neighbors
/
2
**
i
if
do_repulsion
:
if
do_repulsion
:
log
(
"
Computing force layout
"
)
log
(
"
Computing force layout
"
)
...
@@ -462,5 +471,5 @@ Options:
...
@@ -462,5 +471,5 @@ Options:
"""
"""
pubkey => [[pseudo:str, member:bool, community:uint]?, [title:str?, avatar:bool, [lat:float, lon:float]?]?, [computed_lat:float, computed_lon:float]?]
pubkey => [[pseudo:str, member:bool, community:uint]?, [title:str?, avatar:bool, [lat:float, lon:float]?]?, [computed_lat:float, computed_lon:float]?
, computed_pos_weight
]
"""
"""
This diff is collapsed.
Click to expand it.
templates/index.html
+
2
−
1
View file @
1b8d66b2
...
@@ -58,7 +58,8 @@
...
@@ -58,7 +58,8 @@
<option
value=
"received"
>
{{certs-show-received}}
</option>
<option
value=
"received"
>
{{certs-show-received}}
</option>
<option
value=
"issued"
>
{{certs-show-issued}}
</option>
<option
value=
"issued"
>
{{certs-show-issued}}
</option>
</select><hr
/>
</select><hr
/>
<a
id=
"mapmenu-idcard-cesiumlink"
href=
"#"
target=
"_blank"
>
{{cesium-link}}
</a>
<a
id=
"mapmenu-idcard-cesiumlink"
href=
"#"
target=
"_blank"
>
{{cesium-link}}
</a><br/>
<span
id=
"weight"
></span>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
templates/worldwotmap.js
+
18
−
1
View file @
1b8d66b2
...
@@ -32,7 +32,7 @@ var map_default_zoom = 6;
...
@@ -32,7 +32,7 @@ var map_default_zoom = 6;
var
COMMUNITY_COLORS
=
[
"
#ff0000
"
,
"
#00ff00
"
,
"
#0000ff
"
,
"
#c0c000
"
,
"
#c000c0
"
,
"
#00c0c0
"
,
"
#d05000
"
,
"
#d00050
"
,
"
#50d000
"
,
"
#00d050
"
,
"
#d00050
"
,
"
#00d050
"
];
var
COMMUNITY_COLORS
=
[
"
#ff0000
"
,
"
#00ff00
"
,
"
#0000ff
"
,
"
#c0c000
"
,
"
#c000c0
"
,
"
#00c0c0
"
,
"
#d05000
"
,
"
#d00050
"
,
"
#50d000
"
,
"
#00d050
"
,
"
#d00050
"
,
"
#00d050
"
];
class
Account
{
class
Account
{
constructor
(
pubkey
,
member
=
false
,
uid
=
null
,
title
=
null
,
pos
=
null
,
point
=
null
,
avatar
=
false
,
community
=
null
)
{
constructor
(
pubkey
,
member
=
false
,
uid
=
null
,
title
=
null
,
pos
=
null
,
point
=
null
,
avatar
=
false
,
community
=
null
,
weight
=
null
,
declared_pos
=
null
,
computed_pos
=
null
)
{
this
.
pubkey
=
pubkey
;
this
.
pubkey
=
pubkey
;
this
.
member
=
member
;
this
.
member
=
member
;
this
.
uid
=
uid
this
.
uid
=
uid
...
@@ -43,6 +43,9 @@ class Account {
...
@@ -43,6 +43,9 @@ class Account {
this
.
certsReceived
=
[];
this
.
certsReceived
=
[];
this
.
avatar
=
avatar
;
this
.
avatar
=
avatar
;
this
.
community
=
community
;
this
.
community
=
community
;
this
.
weight
=
weight
;
this
.
declared_pos
=
declared_pos
;
this
.
computed_pos
=
computed_pos
;
}
}
mapActiveAccount
()
{
// `this` is the Leaflet Circle, not the Account
mapActiveAccount
()
{
// `this` is the Leaflet Circle, not the Account
...
@@ -101,6 +104,17 @@ function mapActiveAccount(pubkey) {
...
@@ -101,6 +104,17 @@ function mapActiveAccount(pubkey) {
if
(
line
=
certs
[
account
.
certsReceived
[
cert
]].
line
)
if
(
line
=
certs
[
account
.
certsReceived
[
cert
]].
line
)
line
.
setStyle
({
color
:
"
#f44
"
,
weight
:
3
,
opacity
:
0.6
});
line
.
setStyle
({
color
:
"
#f44
"
,
weight
:
3
,
opacity
:
0.6
});
}
}
$
(
"
#weight
"
).
html
(
account
.
weight
);
if
(
account
.
declared_pos
&&
account
.
computed_pos
)
{
console
.
log
(
geoDist
(
account
.
declared_pos
,
account
.
computed_pos
));
L
.
circle
(
account
.
declared_pos
,
{
color
:
"
#0f0
"
,
fillColor
:
"
#0f0
"
,
fillOpacity
:
0.5
,
radius
:
1000
*
geoDist
(
account
.
declared_pos
,
account
.
computed_pos
)
}).
addTo
(
map
);
// TODO remove circle when deselected
}
showURL
();
showURL
();
}
}
...
@@ -422,6 +436,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
...
@@ -422,6 +436,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
account
.
member
=
account_data
[
0
][
1
];
account
.
member
=
account_data
[
0
][
1
];
account
.
uid
=
account_data
[
0
][
0
];
account
.
uid
=
account_data
[
0
][
0
];
account
.
community
=
account_data
[
0
][
2
];
account
.
community
=
account_data
[
0
][
2
];
account
.
weight
=
account_data
[
3
];
if
(
account
.
member
)
if
(
account
.
member
)
nmembers_total
++
;
nmembers_total
++
;
...
@@ -433,6 +448,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
...
@@ -433,6 +448,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
if
(
account_data
[
1
][
2
])
{
if
(
account_data
[
1
][
2
])
{
account
.
pos
=
account_data
[
1
][
2
];
account
.
pos
=
account_data
[
1
][
2
];
account
.
declared_pos
=
account_data
[
1
][
2
]
var
point
=
L
.
circle
(
account
.
pos
,
{
var
point
=
L
.
circle
(
account
.
pos
,
{
color
:
account
.
member
?
"
#f0f
"
:
"
#ed9a00
"
,
color
:
account
.
member
?
"
#f0f
"
:
"
#ed9a00
"
,
...
@@ -469,6 +485,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
...
@@ -469,6 +485,7 @@ $.get(settings["data_url"]+"mapdata.json", null, function(data) {
if
(
account_data
[
2
])
{
if
(
account_data
[
2
])
{
account
.
pos
=
account_data
[
2
];
account
.
pos
=
account_data
[
2
];
account
.
computed_pos
=
account_data
[
2
];
var
point
=
L
.
circle
(
account
.
pos
,
{
var
point
=
L
.
circle
(
account
.
pos
,
{
color
:
account
.
member
?
"
#f0f
"
:
"
#ed9a00
"
,
color
:
account
.
member
?
"
#f0f
"
:
"
#ed9a00
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment