mapstats |
Subversion Repositories: |
Rev 9 | Rev 10 | |
---|---|---|
Line 2... | Line 2... | |
// This script made by JKLIR as. Unreal][ [http://jklir.net] |
// This script made by JKLIR as. Unreal][ [http://jklir.net] | |
// Map engine originally from Emcee Lam [http://sjsutech.com] |
// Map engine originally from Emcee Lam [http://sjsutech.com] | |
// Licence: GNU/GPL |
// Licence: GNU/GPL | Version 4.1 | |
// (c) 2011 All rights reserved |
// (c) 2011 All rights reserved | |
// -------------------------------------------------------- |
// -------------------------------------------------------- | |
|
| |
var mainMap; |
var mainMap; | |
var magnifier; |
var magnifier; | |
Line 13... | Line 13... | |
var file_nodes = new Array(); |
var file_nodes = new Array(); | |
var file_noping = new Array(); |
var file_noping = new Array(); | |
var file_links = new Array(); |
var file_links = new Array(); | |
var file_infopoints = new Array(); |
var file_infopoints = new Array(); | |
var file_state = new Array(); |
var file_state = new Array(); | |
var ann; |
var ann, m1, m2, m3, m4, m5, m6, m7, m8, m9; | |
var m1; |
var m1_a, m2_a, m3_a, m4_a, m5_a, m6_a, m7_a, m8_a, m9_a; | |
var m2; |
||
var m3; |
||
var m4; |
||
var m5; |
||
var m6; |
||
var m7; |
||
var m8; |
||
var m9; |
||
var m1_a; |
||
var m2_a; |
||
var m3_a; |
||
var m4_a; |
||
var m5_a; |
||
var m6_a; |
||
var m7_a; |
||
var m8_a; |
||
var m9_a; |
||
var cntm; |
var cntm; | |
var div_paint; |
var div_paint, div_points, div_wave, div_infopoint, div_name, div_ip, div_status; | |
var div_points; |
||
var div_wave; |
||
var div_infopoint; |
||
var div_name; |
||
var div_ip; |
||
var div_status; |
||
var numoflinks = 0; |
var numoflinks = 0; | |
var maxnumoflinks = 17; |
var maxnumoflinks = 17; | |
var is_ie = false; |
var is_ie = false; | |
if(typeof(G_vmlCanvasManager)!='undefined') { is_ie = true; } |
if(typeof(G_vmlCanvasManager)!='undefined') { is_ie = true; } | |
actual_links = ""; |
actual_links = ""; | |
var drawing_timer; |
var drawing_timer; | |
var is_adding = true; |
var is_adding = true; | |
var visibleTilesMap = new Array(); | ||
|
| |
Array.prototype.max = function() { |
Array.prototype.max = function() { | |
var max = this[0]; |
var max = this[0]; | |
var len = this.length; |
var len = this.length; | |
for(var i=1; i<len; i++) if (this[i] > max) max = this[i]; |
for(var i=1; i<len; i++) if (this[i] > max) max = this[i]; | |
Line 170... | Line 148... | |
|
| |
this.tileSize = 256; |
this.tileSize = 256; | |
this.f_dragging = false; |
this.f_dragging = false; | |
this.innerDiv = document.getElementById("innerDiv"); |
this.innerDiv = document.getElementById("innerDiv"); | |
this.innerDiv.style.cursor = "url('grab.cur'), default"; |
this.innerDiv.style.cursor = "url('grab.cur'), default"; | |
this.tilesX = Math.ceil(inres_x / this.tileSize) + 1; | ||
this.tilesY = Math.ceil(inres_y / this.tileSize) + 1; | ||
|
| |
var outerDiv = document.getElementById("outerDiv"); |
var outerDiv = document.getElementById("outerDiv"); | |
this.outerDiv = outerDiv; |
this.outerDiv = outerDiv; | |
outerDiv.style.width = inres_x + "px"; |
outerDiv.style.width = inres_x + "px"; | |
outerDiv.style.height = inres_y + "px"; |
outerDiv.style.height = inres_y + "px"; | |
Line 204... | Line 184... | |
{ |
{ | |
width:parseInt(full_x * eq_medi), |
width:parseInt(full_x * eq_medi), | |
height:parseInt(full_y * eq_medi), |
height:parseInt(full_y * eq_medi), | |
size:2, |
size:2, | |
nasobek:eq_medi, |
nasobek:eq_medi, | |
numoflinks:12 |
numoflinks:13 | |
}, |
}, | |
{ |
{ | |
width:parseInt(full_x * eq_high), |
width:parseInt(full_x * eq_high), | |
height:parseInt(full_y * eq_high), |
height:parseInt(full_y * eq_high), | |
size:3, |
size:3, | |
nasobek:eq_high, |
nasobek:eq_high, | |
numoflinks:10 |
numoflinks:11 | |
}, |
}, | |
{ |
{ | |
width:parseInt(full_x * eq_orig), |
width:parseInt(full_x * eq_orig), | |
height:parseInt(full_y * eq_orig), |
height:parseInt(full_y * eq_orig), | |
size:4, |
size:4, | |
nasobek:eq_orig, |
nasobek:eq_orig, | |
numoflinks:7 |
numoflinks:8 | |
}, |
}, | |
] |
] | |
|
| |
var zoomElt = this.zoomDim[this.zoom]; |
var zoomElt = this.zoomDim[this.zoom]; | |
this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); |
this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); | |
Line 322... | Line 302... | |
|
| |
MainMap.prototype.checkTiles = function () { |
MainMap.prototype.checkTiles = function () { | |
var innerDiv = this.innerDiv; |
var innerDiv = this.innerDiv; | |
var tileSize = this.tileSize; |
var tileSize = this.tileSize; | |
var visibleTiles = this.getVisibleTiles(); |
var visibleTiles = this.getVisibleTiles(); | |
var visibleTilesMap = {}; |
||
var i; |
var i; | |
|
| |
var size = this.zoomDim[this.zoom].size; |
var size = this.zoomDim[this.zoom].size; | |
for(i=0;i<visibleTiles.length; i++) { |
for(i=0;i<visibleTiles.length; i++) { | |
var tile = visibleTiles[i]; |
var tile = visibleTiles[i]; | |
var xy = "x" + tile.x + "y" + tile.y; |
var xy = "x" + tile.x + "y" + tile.y; | |
var tileName = xy + "z" + this.zoom; |
var tileName = xy + "z" + this.zoom; | |
visibleTilesMap[tileName] = true; |
if (!visibleTilesMap[tileName]) { | |
var img = document.getElementById(tileName); |
var img = document.createElement("img"); | |
if (!img) { |
||
img = document.createElement("img"); |
||
img.src = "size" + size + "/" + xy + ".jpg"; |
img.src = "size" + size + "/" + xy + ".jpg"; | |
img.style.position = "absolute"; |
img.style.position = "absolute"; | |
img.style.left = (tile.x * tileSize) + "px"; |
img.style.left = (tile.x * tileSize) + "px"; | |
img.style.top = (tile.y * tileSize) + "px"; |
img.style.top = (tile.y * tileSize) + "px"; | |
img.setAttribute("id", tileName); |
img.setAttribute("id", tileName); | |
innerDiv.appendChild(img); |
innerDiv.appendChild(img); | |
visibleTilesMap[tileName] = true; | ||
} |
} | |
} |
} | |
|
| |
var imgs = innerDiv.getElementsByTagName("img"); |
var imgs = innerDiv.getElementsByTagName("img"); | |
for(i=0; i<imgs.length; i++) { |
for(i=0; i<imgs.length; i++) { | |
var id = imgs[i].getAttribute("id"); |
var id = imgs[i].getAttribute("id"); | |
if (!visibleTilesMap[id]) { |
if (!visibleTilesMap[id]) { | |
innerDiv.removeChild(imgs[i]); |
innerDiv.removeChild(imgs[i]); | |
i--; |
||
} |
} | |
} |
} | |
} |
} | |
|
| |
MainMap.prototype.getVisibleTiles = function () { |
MainMap.prototype.getVisibleTiles = function () { | |
Line 363... | Line 340... | |
|
| |
var startX = Math.abs(Math.floor(mapX / tileSize)) - 1; |
var startX = Math.abs(Math.floor(mapX / tileSize)) - 1; | |
if (startX < 0) startX = 0; |
if (startX < 0) startX = 0; | |
var startY = Math.abs(Math.floor(mapY / tileSize)) - 1; |
var startY = Math.abs(Math.floor(mapY / tileSize)) - 1; | |
if (startY < 0) startY = 0; |
if (startY < 0) startY = 0; | |
var tilesX = Math.ceil(this.viewPortWidth / tileSize) + 1; |
||
var tilesY = Math.ceil(this.viewPortHeight / tileSize) + 1; |
||
|
| |
var visibleTiles = []; |
var visibleTiles = []; | |
var counter = 0; |
var counter = 0; | |
for (x = startX; x < (tilesX + startX); x++) { |
for (x = startX; x < (this.tilesX + startX); x++) { | |
for (y = startY; y < (tilesY + startY); y++) { |
for (y = startY; y < (this.tilesY + startY); y++) { | |
var tile = {}; |
var tile = {}; | |
tile.x = x; |
tile.x = x; | |
tile.y = y; |
tile.y = y; | |
visibleTiles[counter++] = tile; |
visibleTiles[counter++] = tile; | |
} |
} | |
Line 436... | Line 411... | |
var innerDiv = this.innerDiv; |
var innerDiv = this.innerDiv; | |
var imgs = innerDiv.getElementsByTagName("img"); |
var imgs = innerDiv.getElementsByTagName("img"); | |
while (imgs.length > 0) { |
while (imgs.length > 0) { | |
innerDiv.removeChild(imgs[0]); |
innerDiv.removeChild(imgs[0]); | |
} |
} | |
visibleTilesMap = new Array(); | ||
|
| |
var oldLeft = innerDiv.offsetLeft; |
var oldLeft = innerDiv.offsetLeft; | |
var oldTop = innerDiv.offsetTop; |
var oldTop = innerDiv.offsetTop; | |
var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px |
var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px | |
var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px |
var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px |