svn commit: r289 - trunk/mapbender/http/javascripts/mod_usemap.php

vera_schulze at osgeo.org vera_schulze at osgeo.org
Mon May 15 08:12:46 EDT 2006


Author: vera_schulze
Date: 2006-05-15 12:12:46+0000
New Revision: 289

Modified:
   trunk/mapbender/http/javascripts/mod_usemap.php   (contents, props changed)

Log:
Code cleaning ready

Modified: trunk/mapbender/http/javascripts/mod_usemap.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_usemap.php?view=diff&rev=289&p1=trunk/mapbender/http/javascripts/mod_usemap.php&p2=trunk/mapbender/http/javascripts/mod_usemap.php&r1=288&r2=289
==============================================================================
--- trunk/mapbender/http/javascripts/mod_usemap.php	(original)
+++ trunk/mapbender/http/javascripts/mod_usemap.php	2006-05-15 12:12:46+0000
@@ -1,5 +1,21 @@
-//$Id: mod_usemap.php,v 1.5 2005/09/13 14:38:11 bjoern_heuser Exp $
-//$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_usemap.php,v 1.5 2005/09/13 14:38:11 bjoern_heuser Exp $
+// $Id$
+// http://www.mapbender.org/index.php/mod_usemap.php
+// Copyright (C) 2002 CCGIS 
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 var mod_usemap_target = 'mapframe1';
 var mod_usemap_wfs = "http://wms1.ccgis.de/cgi-bin/mapserv?map=/data/umn/wfs/germany_wfs_usemap.map&SERVICE=WFS&REQUEST=getFeature&TYPENAME=Staedtepunkte&VERSION=1.0.0";
 var mod_usemap_px = 10;
@@ -34,8 +50,6 @@
 	writeTag(mod_usemap_target, 'um', str);
 }
 
-
-
 /* Opacity for hilighting */
     cw_opacity = 0.5;
 /* Color for polygon boundary */
@@ -43,91 +57,90 @@
 /* Color for polygon fill */
     cw_fillcolor = "#ffff00";
 
+function polyXcoords(coords){
+	var Xcoords = '';
+	for (var z = 0; z<coords.length; z=z+2){
+		if (z > 0){
+			Xcoords += ', '; 
+		}
+		Xcoords += parseInt(coords[z]);
+	}
+	return Xcoords;
+}
+function polyYcoords(coords){
+	var Ycoords = '';
+	for (var z = 1; z<coords.length; z=z+2){
+		if (z > 1){
+			Ycoords += ', ';
+		}
+		Ycoords += parseInt(coords[z]);
+	}
+	return Ycoords;
+}
+function setFocus(objid){
+	if (canvasHasDrawing == true) return true;
+		var coords = objid.coords.split(',');
+		if ((objid.shape.toUpperCase() == 'POLY') || (objid.shape.toUpperCase() == 'POLYGON')){
+			var Xcoords = polyXcoords(coords);
+			var Ycoords = polyYcoords(coords);
+			var pgx = Xcoords.split(',');
+			var pgy = Ycoords.split(',');
+			for (var i=0 ; i<pgx.length ; i++ ){
+				pgx[i] = parseInt(pgx[i]);
+				pgy[i] = parseInt(pgy[i]);
+			}
+			canvas.setColor(cw_fillcolor);
+			canvas.fillPolygon(pgx,pgy);
+			canvas.paint();
+			canvas.setColor(cw_bndcolor);
+			canvas.drawPolygon(pgx,pgy);
+			canvas.paint();
+		}
+		if ((objid.shape.toUpperCase() == 'CIRCLE')){
+			var c = coords;
+			canvas.setColor(cw_fillcolor);
+			canvas.fillEllipse(parseInt(c[0])-mod_usemap_px/2,parseInt(c[1])-mod_usemap_px/2,parseInt(c[2]),parseInt(c[2]));
+			canvas.paint();
+			canvas.setColor(cw_bndcolor);
+			canvas.drawEllipse(parseInt(c[0])-mod_usemap_px/2,parseInt(c[1])-mod_usemap_px/2,parseInt(c[2]),parseInt(c[2]));
+			canvas.paint();            
+		}
+		canvasHasDrawing = true; 
+		return true;
+}
+
+function clearFocus(objid){
+	if (canvasHasDrawing) canvas.clear();
+		canvasHasDrawing = false;
+		return true;
+}
 
-
-
-function polyXcoords(coords) {
-    var Xcoords = '';
-    for (var z = 0; z<coords.length; z=z+2) {
-        if (z > 0) { Xcoords += ', '; }
-            Xcoords += parseInt(coords[z]);
-        }
-        return Xcoords;
-    }
-
-function polyYcoords(coords) {
-   var Ycoords = '';
-   for (var z = 1; z<coords.length; z=z+2) {
-       if (z > 1) { Ycoords += ', '; }
-            Ycoords += parseInt(coords[z]);
-        }
-        return Ycoords;
-}
-
-function setFocus(objid) {
-    if (canvasHasDrawing == true) return true;
-        var coords = objid.coords.split(',');
-        if ((objid.shape.toUpperCase() == 'POLY') || (objid.shape.toUpperCase() == 'POLYGON')) {
-            var Xcoords = polyXcoords(coords);
-            var Ycoords = polyYcoords(coords);
-            var pgx = Xcoords.split(',');
-            var pgy = Ycoords.split(',');
-            for (var i=0 ; i<pgx.length ; i++ ) {
-                pgx[i] = parseInt(pgx[i]);
-                pgy[i] = parseInt(pgy[i]);
-            }
-            canvas.setColor(cw_fillcolor);
-            canvas.fillPolygon(pgx,pgy);
-            canvas.paint();
-            canvas.setColor(cw_bndcolor);
-            canvas.drawPolygon(pgx,pgy);
-            canvas.paint();
-        }
-        if ((objid.shape.toUpperCase() == 'CIRCLE')) {
-            var c = coords;
-            canvas.setColor(cw_fillcolor);
-            canvas.fillEllipse(parseInt(c[0])-mod_usemap_px/2,parseInt(c[1])-mod_usemap_px/2,parseInt(c[2]),parseInt(c[2]));
-            canvas.paint();
-            canvas.setColor(cw_bndcolor);
-            canvas.drawEllipse(parseInt(c[0])-mod_usemap_px/2,parseInt(c[1])-mod_usemap_px/2,parseInt(c[2]),parseInt(c[2]));
-            canvas.paint();            
-        }
-        canvasHasDrawing = true; 
-        return true;
-    }
-
-function clearFocus(objid) {
-    if (canvasHasDrawing) canvas.clear();
-        canvasHasDrawing = false;
-        return true;
-    }
-
-function over(e, id, area) {
+function over(e, id, area){
 	var coords = area.coords.split(',');
-    area.setAttribute('title', "");
-    if (!isOver) {
-        um_title.innerHTML = id;
-        um_title.style.display = "block";
-        isOver = area;
-        setFocus(area);
-    }
-    mb_arrangeElement(mod_usemap_target, 'um_title', parseInt(coords[0])+mod_usemap_px, parseInt(coords[1])+mod_usemap_px);
-    canvasHasDrawing = true;
-}
-
-function out(area) {
-    um_title.innerHTML = "";
-    um_title.style.display = "none";
-    clearFocus(area);
-    isOver = false;
-    canvasHasDrawing = false;
+	area.setAttribute('title', "");
+	if (!isOver){
+		um_title.innerHTML = id;
+		um_title.style.display = "block";
+		isOver = area;
+		setFocus(area);
+	}
+	mb_arrangeElement(mod_usemap_target, 'um_title', parseInt(coords[0])+mod_usemap_px, parseInt(coords[1])+mod_usemap_px);
+	canvasHasDrawing = true;
+}
+
+function out(area){
+	um_title.innerHTML = "";
+	um_title.style.display = "none";
+	clearFocus(area);
+	isOver = false;
+	canvasHasDrawing = false;
 }
 
-function um_init() {
+function um_init(){
 	um_title = window.frames[mod_usemap_target].document.getElementById("um_title"); /* tooltip */
 	um_draw = window.frames[mod_usemap_target].document.getElementById("um_draw"); /* tooltip */
-    canvas = new jsGraphics('um_draw', window.frames['mapframe1']);
-    canvas.setStroke(2);
-    canvasHasDrawing = false;
-    isOver = false;
+	canvas = new jsGraphics('um_draw', window.frames['mapframe1']);
+	canvas.setStroke(2);
+	canvasHasDrawing = false;
+	isOver = false;
 }




More information about the Mapbender_commits mailing list