-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Google, OpenStreetMap, OpenTogographicMap and WikiMap layers supp…
…ort.
- Loading branch information
1 parent
06ee66c
commit c21702a
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
worldwind/src/main/java/gov/nasa/worldwind/layer/mercator/google/GoogleLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package gov.nasa.worldwind.layer.mercator.google; | ||
|
||
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer; | ||
|
||
public class GoogleLayer extends MercatorTiledImageLayer { | ||
|
||
public GoogleLayer(Type type) { | ||
super(type.layerName, 22, 0, 256, type.overlay); | ||
this.lyrs = type.lyrs; | ||
} | ||
|
||
private final String lyrs; | ||
|
||
public enum Type { | ||
ROADMAP("Google road map", "m", false), | ||
ROADMAP2("Google road map 2", "r", false), | ||
TERRAIN("Google map w/ terrain", "p", false), | ||
TERRAIN_ONLY("Google terrain only", "t", false), | ||
HYBRID("Google hybrid", "y", false), | ||
SATELLITE("Google satellite", "s", false), | ||
ROADS("Google roads", "h", true), | ||
TRAFFIC("Google traffic", "h,traffic&style=15", true); | ||
|
||
private final String layerName; | ||
private final String lyrs; | ||
private final boolean overlay; | ||
|
||
Type(String layerName, String lyrs, boolean overlay) { | ||
this.layerName = layerName; | ||
this.lyrs = lyrs; | ||
this.overlay = overlay; | ||
} | ||
} | ||
|
||
@Override | ||
public String getImageSourceUrl(int x, int y, int z) { | ||
return "https://mt.google.com/vt/lyrs="+lyrs+"&x="+x+"&y="+y+"&z="+z+"&hl=ru"; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
worldwind/src/main/java/gov/nasa/worldwind/layer/mercator/osm/OSMLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gov.nasa.worldwind.layer.mercator.osm; | ||
|
||
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer; | ||
import java.util.*; | ||
|
||
public class OSMLayer extends MercatorTiledImageLayer { | ||
|
||
public static final String NAME = "OpenStreetMap"; | ||
|
||
private final Random random = new Random(); | ||
|
||
public OSMLayer() { | ||
super(NAME, 20, 3, 256, false); | ||
} | ||
|
||
@Override | ||
protected String getImageSourceUrl(int x, int y, int z) { | ||
char abc = "abc".charAt(random.nextInt(2)); | ||
return "https://"+abc+".tile.openstreetmap.org/"+z+"/"+x+"/"+y+".png"; | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
worldwind/src/main/java/gov/nasa/worldwind/layer/mercator/osm/OTMLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package gov.nasa.worldwind.layer.mercator.osm; | ||
|
||
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer; | ||
import java.util.*; | ||
|
||
public class OTMLayer extends MercatorTiledImageLayer { | ||
|
||
public static final String NAME = "OpenTopoMap"; | ||
|
||
private final Random random = new Random(); | ||
|
||
public OTMLayer() { | ||
super(NAME, 18, 3, 256, false); | ||
} | ||
|
||
@Override | ||
protected String getImageSourceUrl(int x, int y, int z) { | ||
char abc = "abc".charAt(random.nextInt(2)); | ||
return "https://"+abc+".tile.opentopomap.org/"+z+"/"+x+"/"+y+".png"; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
worldwind/src/main/java/gov/nasa/worldwind/layer/mercator/wiki/WikiLayer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gov.nasa.worldwind.layer.mercator.wiki; | ||
|
||
import gov.nasa.worldwind.layer.mercator.MercatorTiledImageLayer; | ||
|
||
public class WikiLayer extends MercatorTiledImageLayer { | ||
|
||
public enum Type { MAP, HYBRID } | ||
|
||
public static final String NAME = "Wiki"; | ||
|
||
private final Type type; | ||
|
||
public WikiLayer(Type type) { | ||
super(NAME + type.name().toLowerCase(), 23, 3, 256, Type.HYBRID == type); | ||
this.type = type; | ||
} | ||
|
||
@Override | ||
protected String getImageSourceUrl(int x, int y, int z) { | ||
int i = x % 4 + y % 4 * 4; | ||
return "http://i"+i+".wikimapia.org/?lng=1&x="+x+"&y="+y+"&zoom="+z+"&type="+type.name().toLowerCase(); | ||
} | ||
|
||
} |