diff options
Diffstat (limited to 'web/nms.gathering.org/js/nms-map.js')
| -rw-r--r-- | web/nms.gathering.org/js/nms-map.js | 38 | 
1 files changed, 38 insertions, 0 deletions
diff --git a/web/nms.gathering.org/js/nms-map.js b/web/nms.gathering.org/js/nms-map.js index d595c4a..1f4d6b7 100644 --- a/web/nms.gathering.org/js/nms-map.js +++ b/web/nms.gathering.org/js/nms-map.js @@ -47,6 +47,7 @@ var nmsMap = nmsMap || {  	},  	_color: { }, +	_linknets: {} ,  	_highlight: { },  	_highlightActive: false,  	_c: {} @@ -157,6 +158,7 @@ nmsMap._resizeEvent = function() {  		nmsMap._blurDrawn = false;  		nmsMap._drawBG();  		nmsMap._drawAllSwitches(); +		nmsMap._drawAllLinknets();  		nmsMap.drawNow();  		nmsMap.stats.resizeEvents++;  	} @@ -327,6 +329,40 @@ nmsMap._drawText = function(ctx, text, box, align) {  	ctx.restore();  }; +nmsMap._setLinknetColor = function(l, color1, color2) +{ +	var oldcolor1; +	var oldcolor2; +	try { +		oldcolor1 = nmsMap._linknets[l].sysname1; +		oldcolor2 = nmsMap._linknets[l].sysname2; +		if (oldcolor1 == color1 && oldcolor2 == color2) { +			return ; +		} +	} catch (e) {} +	nmsMap._linknets[l] = {}; +	nmsMap._linknets[l].sysname1 = color1; +	nmsMap._linknets[l].sysname2 = color2; +	nmsMap._drawLinknet(l) +} + +nmsMap._drawLinknet = function(l) { +	try { +		var color1 = blue; +		var color2 = blue; +		try { +			color1 = nmsMap._linknets[l].sysname1; +			color2 = nmsMap._linknets[l].sysname2; +		} catch(e) { } +		nmsMap._connectSwitches(nmsData.switches.linknets[l].sysname1, nmsData.switches.linknets[l].sysname2, color1, color2); +	} catch(e) { } +} + +nmsMap._drawAllLinknets = function() { +	for (var l in nmsData.switches.linknets) { +		nmsMap._drawLinknet(l); +	} +}  nmsMap._drawAllSwitches = function() {  	if (nmsData.switches == undefined) {  		this.stats.earlyDrawAll++; @@ -383,10 +419,12 @@ nmsMap._connectBoxes = function(box1, box2,color1, color2) {  	gradient.addColorStop(0, color1);  	gradient.addColorStop(1, color2);  	ctx.strokeStyle = gradient; +	ctx.beginPath();  	ctx.moveTo(x0,y0);  	ctx.lineTo(x1,y1);   	ctx.lineWidth = 5;  	ctx.stroke(); +	ctx.closePath();  	ctx.restore();  };  | 
