Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
API
Commits
06b83597
Commit
06b83597
authored
May 10, 2018
by
Tobias Meuser
Browse files
Finished merge
parents
2c70bd4f
b2046e30
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/util/Geohash.java
View file @
06b83597
package
de.tudarmstadt.maki.simonstrator.api.util
;
/*
* Copyright (c) 2005-2010 KOM Multimedia Communications Lab
* Copyright (c) 2005-2010 KOM
�
Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
...
...
@@ -92,8 +92,8 @@ public class Geohash {
*/
public
static
String
getAdjacentGeohash
(
String
pGeohash
,
int
pX
,
int
pY
)
{
/*
* (1,0) right/eastern GeoHash (-1,0) left/western GeoHash (0,1)
lower/southern
* GeoHash (0,-1) upper/northern GeoHash
* (1,0) right/eastern GeoHash (-1,0) left/western GeoHash (0,1)
*
lower/southern
GeoHash (0,-1) upper/northern GeoHash
*/
byte
[]
decode
=
decode
(
pGeohash
);
...
...
@@ -156,37 +156,42 @@ public class Geohash {
public
static
List
<
String
>
getSubscriptionHorizon
(
String
geohash
,
double
heading
)
{
List
<
String
>
adjacentAreas
=
new
ArrayList
<>();
int
direction
=
(
int
)
heading
;
//
System.out.println("Direction of subscription horizon:");
//
System.out.println("Direction of subscription horizon:");
if
(
0
<=
direction
&&
direction
<
45
||
315
<=
direction
&&
direction
<=
360
)
{
// N
// System.out.println("NORTH");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "top", "left"));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "top", "right"));
// System.out.println("NORTH");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
));
// top
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
1
,
0
));
// right
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
));
// left
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
),
1
,
0
));
// top,right
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
),
-
1
,
0
));
// top,left
}
if
(
45
<=
direction
&&
direction
<
135
)
{
// E
// System.out.println("EAST");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
1
,
0
));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "bottom", "right"));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "top", "right"));
// System.out.println("EAST");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
1
,
0
));
// right
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
));
// top
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
1
));
// bottom
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
1
,
0
),
0
,
-
1
));
// right, top
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
1
,
0
),
0
,
1
));
// right, bottom
}
if
(
135
<=
direction
&&
direction
<
225
)
{
// S
// System.out.println("SOUTH");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
1
));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "bottom", "right"));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "bottom", "left"));
// System.out.println("SOUTH");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
1
));
// bottom
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
1
,
0
));
// right
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
));
// left
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
0
,
1
),
1
,
0
));
// bottom, right
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
0
,
1
),
-
1
,
0
));
// bottom, left
}
if
(
225
<=
direction
&&
direction
<
315
)
{
// W
// System.out.println("WEST");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "bottom", "left"));
// adjacentAreas.add(GeoHashExtensions.getAdjacent(geohash, "top", "left"));
// System.out.println("WEST");
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
));
// left
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
1
));
// bottom
adjacentAreas
.
add
(
getAdjacentGeohash
(
geohash
,
0
,
-
1
));
// top
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
),
0
,
-
1
));
// left, top
adjacentAreas
.
add
(
getAdjacentGeohash
(
getAdjacentGeohash
(
geohash
,
-
1
,
0
),
0
,
1
));
// left, bottom
}
return
adjacentAreas
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment