Skip to content

Commit da4a778

Browse files
committed
Merge remote-tracking branch 'origin/feature/mercator' into feature/geopackage
2 parents 714d607 + c21702a commit da4a778

File tree

4 files changed

+107
-0
lines changed

4 files changed

+107
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package gov.nasa.worldwind.layer.mercator.google;
2+
3+
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer;
4+
5+
public class GoogleLayer extends MercatorTiledImageLayer {
6+
7+
public GoogleLayer(Type type) {
8+
super(type.layerName, 22, 0, 256, type.overlay);
9+
this.lyrs = type.lyrs;
10+
}
11+
12+
private final String lyrs;
13+
14+
public enum Type {
15+
ROADMAP("Google road map", "m", false),
16+
ROADMAP2("Google road map 2", "r", false),
17+
TERRAIN("Google map w/ terrain", "p", false),
18+
TERRAIN_ONLY("Google terrain only", "t", false),
19+
HYBRID("Google hybrid", "y", false),
20+
SATELLITE("Google satellite", "s", false),
21+
ROADS("Google roads", "h", true),
22+
TRAFFIC("Google traffic", "h,traffic&style=15", true);
23+
24+
private final String layerName;
25+
private final String lyrs;
26+
private final boolean overlay;
27+
28+
Type(String layerName, String lyrs, boolean overlay) {
29+
this.layerName = layerName;
30+
this.lyrs = lyrs;
31+
this.overlay = overlay;
32+
}
33+
}
34+
35+
@Override
36+
public String getImageSourceUrl(int x, int y, int z) {
37+
return "https://mt.google.com/vt/lyrs="+lyrs+"&x="+x+"&y="+y+"&z="+z+"&hl=ru";
38+
}
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package gov.nasa.worldwind.layer.mercator.osm;
2+
3+
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer;
4+
import java.util.*;
5+
6+
public class OSMLayer extends MercatorTiledImageLayer {
7+
8+
public static final String NAME = "OpenStreetMap";
9+
10+
private final Random random = new Random();
11+
12+
public OSMLayer() {
13+
super(NAME, 20, 3, 256, false);
14+
}
15+
16+
@Override
17+
protected String getImageSourceUrl(int x, int y, int z) {
18+
char abc = "abc".charAt(random.nextInt(2));
19+
return "https://"+abc+".tile.openstreetmap.org/"+z+"/"+x+"/"+y+".png";
20+
}
21+
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package gov.nasa.worldwind.layer.mercator.osm;
2+
3+
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer;
4+
import java.util.*;
5+
6+
public class OTMLayer extends MercatorTiledImageLayer {
7+
8+
public static final String NAME = "OpenTopoMap";
9+
10+
private final Random random = new Random();
11+
12+
public OTMLayer() {
13+
super(NAME, 18, 3, 256, false);
14+
}
15+
16+
@Override
17+
protected String getImageSourceUrl(int x, int y, int z) {
18+
char abc = "abc".charAt(random.nextInt(2));
19+
return "https://"+abc+".tile.opentopomap.org/"+z+"/"+x+"/"+y+".png";
20+
}
21+
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package gov.nasa.worldwind.layer.mercator.wiki;
2+
3+
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer;
4+
5+
public class WikiLayer extends MercatorTiledImageLayer {
6+
7+
public enum Type { MAP, HYBRID }
8+
9+
public static final String NAME = "Wiki";
10+
11+
private final Type type;
12+
13+
public WikiLayer(Type type) {
14+
super(NAME + type.name().toLowerCase(), 23, 3, 256, Type.HYBRID == type);
15+
this.type = type;
16+
}
17+
18+
@Override
19+
protected String getImageSourceUrl(int x, int y, int z) {
20+
int i = x % 4 + y % 4 * 4;
21+
return "http://i"+i+".wikimapia.org/?lng=1&x="+x+"&y="+y+"&zoom="+z+"&type="+type.name().toLowerCase();
22+
}
23+
24+
}

0 commit comments

Comments
 (0)