From 559f251d504e6c23ecfd3c0ea865556050d28b69 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 21 Jul 2011 23:25:59 -0500 Subject: [PATCH] Add mapzoomin attribute, to adjust zoom in levels beyond native tile resolution --- src/main/java/org/dynmap/flat/FlatMap.java | 1 + src/main/java/org/dynmap/hdmap/HDMap.java | 1 + .../dynmap/kzedmap/DefaultTileRenderer.java | 1 + templates.txt | 20 +++++++++++++++++++ web/js/flatmap.js | 3 ++- web/js/hdmap.js | 3 ++- web/js/kzedmaps.js | 3 ++- 7 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index 4296371c..8e0eee35 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -518,6 +518,7 @@ public class FlatMap extends MapType { s(o, "backgroundday", c.getString("backgroundday")); s(o, "backgroundnight", c.getString("backgroundnight")); s(o, "bigmap", this.isBigWorldMap(world)); + s(o, "mapzoomin", c.getInteger("mapzoomin", 3)); s(o, "compassview", "S"); /* Always from south */ a(worldObject, "maps", o); } diff --git a/src/main/java/org/dynmap/hdmap/HDMap.java b/src/main/java/org/dynmap/hdmap/HDMap.java index 8ecd015f..15b6004c 100644 --- a/src/main/java/org/dynmap/hdmap/HDMap.java +++ b/src/main/java/org/dynmap/hdmap/HDMap.java @@ -144,6 +144,7 @@ public class HDMap extends MapType { s(o, "backgroundnight", c.getString("backgroundnight")); s(o, "bigmap", true); s(o, "mapzoomout", (world.getExtraZoomOutLevels()+mapzoomout)); + s(o, "mapzoomin", c.getInteger("mapzoomin", 2)); perspective.addClientConfiguration(o); shader.addClientConfiguration(o); lighting.addClientConfiguration(o); diff --git a/src/main/java/org/dynmap/kzedmap/DefaultTileRenderer.java b/src/main/java/org/dynmap/kzedmap/DefaultTileRenderer.java index dc6d4d28..0e374c64 100644 --- a/src/main/java/org/dynmap/kzedmap/DefaultTileRenderer.java +++ b/src/main/java/org/dynmap/kzedmap/DefaultTileRenderer.java @@ -579,6 +579,7 @@ public class DefaultTileRenderer implements MapTileRenderer { s(o, "backgroundday", c.getString("backgroundday")); s(o, "backgroundnight", c.getString("backgroundnight")); s(o, "bigmap", map.isBigWorldMap(world)); + s(o, "mapzoomin", c.getInteger("mapzoomin", 3)); s(o, "compassview", "SE"); /* Always from southeast */ a(worldObject, "maps", o); } diff --git a/templates.txt b/templates.txt index 588e947e..b777baad 100644 --- a/templates.txt +++ b/templates.txt @@ -40,6 +40,8 @@ templates: # backgroundnight: "#000000" # # Background color for map (independent of night/day) # background: "#000000" + # # Adjust extra zoom in levels - default is 3 + # mapzoomin: 3 - class: org.dynmap.kzedmap.KzedMap renderers: - class: org.dynmap.kzedmap.DefaultTileRenderer @@ -64,6 +66,8 @@ templates: # background: "#000000" # # Sets the icon to 'images/block_custom.png' # icon: custom + # # Adjust extra zoom in levels - default is 3 + # mapzoomin: 3 # # Biome-based mapping # - class: org.dynmap.kzedmap.DefaultTileRenderer # name: biome @@ -185,6 +189,8 @@ templates: # backgroundnight: "#000000" # # Background color for map (independent of night/day) # background: "#000000" + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 - class: org.dynmap.hdmap.HDMap name: surface title: "Surface" @@ -206,6 +212,8 @@ templates: # background: "#000000" # # Sets the icon to 'images/block_custom.png' # icon: custom + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 # # Biome-based mapping # - class: org.dynmap.hdmap.HDMap # name: biome @@ -215,6 +223,8 @@ templates: # lighting: default # # Biome-based shading : biome=biome type, temperature=biome-temperature, rainfall=biome-rainfall # shader: biome + # # Adjust extra zoom in levels - default is 2 + # mapzoomin: 2 - class: org.dynmap.hdmap.HDMap name: cave title: "Cave" @@ -222,6 +232,8 @@ templates: perspective: iso_SE_60_lowres shader: cave lighting: default + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 # Nether world template (HDMap) nether-HDMap: @@ -244,6 +256,8 @@ templates: lighting: default # Map background color (day or night) background: "#300806" + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 - class: org.dynmap.hdmap.HDMap name: nether title: "Surface" @@ -253,6 +267,8 @@ templates: lighting: default # Map background color (day or night) background: "#300806" + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 # Skylands world template (HDMap) skylands-HDMap: enabled: true @@ -276,6 +292,8 @@ templates: backgroundday: "#153E7E" # Background color for map during the night backgroundnight: "#000000" + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 - class: org.dynmap.hdmap.HDMap name: skylands title: "Surface" @@ -287,4 +305,6 @@ templates: backgroundday: "#153E7E" # Background color for map during the night backgroundnight: "#000000" + # Adjust extra zoom in levels - default is 2 + mapzoomin: 2 \ No newline at end of file diff --git a/web/js/flatmap.js b/web/js/flatmap.js index 7904f643..a771d4ad 100644 --- a/web/js/flatmap.js +++ b/web/js/flatmap.js @@ -72,8 +72,9 @@ FlatMapType.prototype = $.extend(new DynMapType(), { updateTileSize: function(zoom) { var size; var extrazoom = this.dynmap.world.extrazoomout; + var mapzoomin = this.dynmap.world.mapzoomin; this.projection.extrazoom = extrazoom; - this.maxZoom = 3 + extrazoom; + this.maxZoom = mapzoomin + extrazoom; if (zoom <= extrazoom) { size = 128; } diff --git a/web/js/hdmap.js b/web/js/hdmap.js index e3b991e8..57cab961 100644 --- a/web/js/hdmap.js +++ b/web/js/hdmap.js @@ -73,9 +73,10 @@ HDMapType.prototype = $.extend(new DynMapType(), { updateTileSize: function(zoom) { var size; var extrazoom = this.mapzoomout; + var mapzoomin = this.mapzoomin; this.projection.extrazoom = extrazoom; this.projection.worldtomap = this.worldtomap; - this.maxZoom = 2 + extrazoom; + this.maxZoom = mapzoomin + extrazoom; if (zoom <= extrazoom) { size = 128; } diff --git a/web/js/kzedmaps.js b/web/js/kzedmaps.js index 7f3a816a..f61482a6 100644 --- a/web/js/kzedmaps.js +++ b/web/js/kzedmaps.js @@ -115,8 +115,9 @@ KzedMapType.prototype = $.extend(new DynMapType(), { updateTileSize: function(zoom) { var size; var extrazoom = this.dynmap.world.extrazoomout; + var mapzoomin = this.dynmap.world.mapzoomin; this.projection.extrazoom = extrazoom; - this.maxZoom = 3 + extrazoom; + this.maxZoom = mapzoomin + extrazoom; if (zoom <= extrazoom) { size = 128; } else {