Commit 63d77256 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

debug funcitons refactorized

parent 0a4967cc
......@@ -78,7 +78,10 @@
"_searchMissingConnections" : false,
"_updateCommentList" : false,
/* JSF objects */
"_tabViewVar" : false,
"_overviewDialog" : false,
/* jQuery */
"$" : false,
......
......@@ -96,6 +96,8 @@ function AbstractCustomMap(options) {
this._bigLogo = options.isBigLogo();
this._customTouchInterface = options.isCustomTouchInterface();
this.setDebug(options.isDebug());
}
// define super constructor
......
......@@ -892,23 +892,8 @@ CustomMap.prototype.showOverview = function(overviewImageId) {
canvas.onclick = onclickevent;
// in debug mode draw clickable shapes
if (DEBUG_ON) {
var ctx = canvas.getContext("2d");
// clear canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < this.overviewImage.links.length; i++) {
ctx.beginPath();
var polygon = this.overviewImage.links[i].polygon;
for (var j = 0; j < polygon.length; j++) {
var x = polygon[j].x * ratio;
var y = polygon[j].y * ratio;
ctx.moveTo(x, y);
x = polygon[(j + 1) % polygon.length].x * ratio;
y = polygon[(j + 1) % polygon.length].y * ratio;
ctx.lineTo(x, y);
}
ctx.stroke();
}
if (this.isDebug()) {
this.drawClickableShapes(canvas, ratio);
}
this.overviewImage.mousePos = {
......@@ -961,6 +946,25 @@ CustomMap.prototype.showOverview = function(overviewImageId) {
}
};
CustomMap.prototype.drawClickableShapes = function(canvas, ratio) {
var ctx = canvas.getContext("2d");
// clear canvas
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < this.overviewImage.links.length; i++) {
ctx.beginPath();
var polygon = this.overviewImage.links[i].polygon;
for (var j = 0; j < polygon.length; j++) {
var x = polygon[j].x * ratio;
var y = polygon[j].y * ratio;
ctx.moveTo(x, y);
x = polygon[(j + 1) % polygon.length].x * ratio;
y = polygon[(j + 1) % polygon.length].y * ratio;
ctx.lineTo(x, y);
}
ctx.stroke();
}
};
CustomMap.prototype.showModel = function(id, point, zoomLevel) {
if (point !== undefined) {
this.setCenter(id, point);
......
......@@ -29,7 +29,11 @@ function create(params) {
if (global.GuiConnector === undefined) {
global.GuiConnector = OriginalGuiConnector;
global.ServerConnector = OriginalServerConnector;
logger.setLevel("info");
if (params.debug) {
logger.setLevel("debug");
} else {
logger.setLevel("info");
}
} else {
logger.warn("global GuiConnector found");
}
......@@ -49,14 +53,14 @@ function create(params) {
logger.warn(message);
}
}
processUrlGetParams(params.configuration);
var result = new CustomMap(params);
ServerConnector.setCustomMap(result);
GuiConnector.setCustomMap(result);
GuiConnector.showGoogleMap();
if (params.dataCollections !== undefined) {
......
......@@ -27,8 +27,6 @@
<script type="text/javascript">
//<![CDATA[
var DEBUG_ON =false;
function initMap(){
var configuration = new minerva.Configuration(document.getElementById('configurationForm:configurationGson').value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment