Added prefix to flatmap.
This commit is contained in:
parent
36685c5950
commit
e613a59aa3
2 changed files with 9 additions and 4 deletions
|
|
@ -18,9 +18,11 @@ import org.dynmap.MapType;
|
||||||
import org.dynmap.debug.Debug;
|
import org.dynmap.debug.Debug;
|
||||||
|
|
||||||
public class FlatMap extends MapType {
|
public class FlatMap extends MapType {
|
||||||
|
private String prefix;
|
||||||
private ColorScheme colorScheme;
|
private ColorScheme colorScheme;
|
||||||
|
|
||||||
public FlatMap(Map<String, Object> configuration) {
|
public FlatMap(Map<String, Object> configuration) {
|
||||||
|
prefix = (String)configuration.get("prefix");
|
||||||
colorScheme = ColorScheme.getScheme((String)configuration.get("colorscheme"));
|
colorScheme = ColorScheme.getScheme((String)configuration.get("colorscheme"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,13 +102,14 @@ public class FlatMap extends MapType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FlatMapTile extends MapTile {
|
public static class FlatMapTile extends MapTile {
|
||||||
|
FlatMap map;
|
||||||
public int x;
|
public int x;
|
||||||
public int y;
|
public int y;
|
||||||
public int size;
|
public int size;
|
||||||
|
|
||||||
public FlatMapTile(World world, FlatMap map, int x, int y, int size) {
|
public FlatMapTile(World world, FlatMap map, int x, int y, int size) {
|
||||||
super(world, map);
|
super(world, map);
|
||||||
|
this.map = map;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
@ -114,7 +117,7 @@ public class FlatMap extends MapType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFilename() {
|
public String getFilename() {
|
||||||
return "flat_" + size + "_" + x + "_" + y + ".png";
|
return map.prefix + "_" + size + "_" + x + "_" + y + ".png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,19 @@ FlatProjection.prototype = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function FlatMapType(configuration) { $.extend(this, configuration); }
|
function FlatMapType(configuration) {
|
||||||
|
$.extend(this, configuration); }
|
||||||
FlatMapType.prototype = $.extend(new DynMapType(), {
|
FlatMapType.prototype = $.extend(new DynMapType(), {
|
||||||
constructor: FlatMapType,
|
constructor: FlatMapType,
|
||||||
projection: new FlatProjection(),
|
projection: new FlatProjection(),
|
||||||
tileSize: new google.maps.Size(128.0, 128.0),
|
tileSize: new google.maps.Size(128.0, 128.0),
|
||||||
minZoom: 0,
|
minZoom: 0,
|
||||||
maxZoom: 0,
|
maxZoom: 0,
|
||||||
|
prefix: null,
|
||||||
getTile: function(coord, zoom, doc) {
|
getTile: function(coord, zoom, doc) {
|
||||||
var tileName;
|
var tileName;
|
||||||
var tile = $('<img/>')
|
var tile = $('<img/>')
|
||||||
.attr('src', this.dynmap.getTileUrl(tileName = 'flat_128_' + coord.x + '_' + coord.y + '.png'))
|
.attr('src', this.dynmap.getTileUrl(tileName = this.prefix + '_128_' + coord.x + '_' + coord.y + '.png'))
|
||||||
.error(function() { tile.hide(); })
|
.error(function() { tile.hide(); })
|
||||||
.bind('load', function() { tile.show(); })
|
.bind('load', function() { tile.show(); })
|
||||||
.css({
|
.css({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue