=v2). Read the file gpl.txt that comes with Mapbender for details. */ require_once(dirname(__FILE__)."/point.js"); require_once(dirname(__FILE__)."/mod_geometryArray.js"); ?> function calculateVisibleDash (p0, p1, width, height) { if (p0.x > p1.x) {var p_temp = p0; p0 = p1; p1 = p_temp; p_temp = null;} var p = p0; var q = p1; var m; if (p1.x != p0.x) { m = -(p1.y-p0.y)/(p1.x-p0.x); if (p0.x < width && p1.x > 0 && !(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height) ) { if (p0.x < 0) { var iy = p0.y - m*(0-p0.x); if (iy > 0 && iy < height) p = new Point(0, iy); else if (iy > height) { var ix = p0.x+((p0.y - height)/m); if (ix > 0 && ix < width) p = new Point(ix, height); else return false; } else if (iy < 0) { var ix = p0.x+(p0.y/m); if (ix > 0 && ix < width) p = new Point(ix, 0); else return false; } else return false; } else if (p0.y >= 0 && p0.y <= height) {p = p0;} else if (p0.y < 0) { var ix = p0.x+(p0.y/m); if (ix > 0 && ix < width) p = new Point(ix, 0); else return false; } else if (p0.y > height && m > 0) { var ix = p0.x+((p0.y - height)/m); if (ix > 0 && ix < width) p = new Point(ix, height); else return false; } else return false; if (p1.x > width) { var iy = p1.y - m*(width-p1.x); if (iy > 0 && iy < height) {q = new Point(width, iy);} else if (iy < 0) { var ix = p0.x+(p0.y/m); if (ix > 0 && ix < width) q = new Point(ix, 0); else return false; } else if (iy > height) { var ix = p0.x+((p0.y - height)/m); if (ix > 0 && ix < width) q = new Point(ix, height); else return false; } else return false; } else if (p1.y >= 0 && p1.y <= height) {q = p1;} else if (p1.y < 0) { var ix = p1.x+(p1.y/m); if (ix > 0 && ix < width) q = new Point(ix, 0); else return false; } else if (p1.y > height) { var ix = p1.x+((p1.y- height)/m); if (ix > 0 && ix < width) q = new Point(ix, height); else return false; } } else return false; } else { if (!(p0.y < 0 && p1.y < 0) && !(p0.y > height && p1.y > height)) { if (p0.y < 0) {p = new Point(p0.x, 0);} else if (p0.y > height) {p = new Point(p0.x, height);} else p = p0; if (p1.y < 0) {q = new Point(p0.x, 0);} else if (p1.y > height) {q = new Point(p0.x, height);} else q = p1; } else return false; } return new Array(new Point(Math.round(q.x), Math.round(q.y)), new Point(Math.round(p.x), Math.round(p.y))); } function Canvas(mapframe, tagname) { this.paint = function(gA) { if (this.checkTag()) { for (var q = 0; q < gA.count(); q++) { var m = gA.get(q); var t = m.geomtype; if (t == geomTypePoint) this.drawGeometry(t,m); else { if (this.isTooSmall(m)){ var newMember = new MultiGeometry(geomTypePoint); newMember.addGeometry(); newMember.get(-1).addPoint(m.getCenter()); this.drawGeometry(geomTypePoint,newMember); } else{ if(t == geomTypeLine) this.drawGeometry(t,m); else if(t == geomTypePolygon) this.drawGeometry(t,m); else alert("unknown geomtype"); } } } this.canvas.paint(); } } this.drawGeometry = function(t,g){ var mapObjInd = getMapObjIndexByName(this.mapframe); width = mb_mapObj[mapObjInd].width; height = mb_mapObj[mapObjInd].height; for(var i=0; i < g.count(); i++){ if(t==geomTypePoint) { var p = realToMap(this.mapframe,g.get(i).get(0)); if (p.x + this.diameter < mb_mapObj[mapObjInd].width && p.x - this.diameter > 0 && p.y + this.diameter < mb_mapObj[mapObjInd].height && p.y - this.diameter > 0) { this.drawCircle(p.x-1,p.y-1,this.diameter,this.lineColor); } } else if(t==geomTypeLine) { for (var j=0; j