function af(){this.map;this.polyline=null;this.textbox;this.startpoint=null;this.endpoint=null;this.listener=new Array();this.menuicon=new I();this.menuicon.setImage(aC.urlPortal+"dateien/icon_distance.gif");this.menuicon.setTooltipText("Messwerkzeug zur Bestimmung der Entfernung zwischen 2 Punkten");this.menuicon.setSize(32,32);this.menuicon.setPosition(new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(20,270)));};af.prototype=new GOverlay();af.prototype.initialize=function(map){this.map=map;this.map.addControl(this.menuicon);this.menuicon.show();GEvent.bind(this.menuicon,'click',this,function(){this.menuicon.menuImage.style.cursor="crosshair";this.listener.push(GEvent.bind(this.map,"click",this,this.onMapClick));});};af.prototype.onMapClick=function(overlay,latlng,overlaylatlng){if(this.startpoint!=null){if(this.polyline)this.map.removeOverlay(this.polyline);if(this.textbox)this.map.removeControl(this.textbox);for(var i=0;i<this.listener.length;i++){GEvent.removeListener(this.listener[i]);}this.listener=new Array();this.startpoint=null;this.endpoint=null;this.menuicon.menuImage.style.cursor="pointer";}else{this.startpoint=latlng;this.listener.push(GEvent.bind(this.map,"mousemove",this,function(latlng){if(this.endpoint){var oldPos=this.map.fromLatLngToDivPixel(this.endpoint);var newPos=this.map.fromLatLngToDivPixel(latlng);var dx=Math.abs(oldPos.x-newPos.x);var dy=Math.abs(oldPos.y-newPos.y);if(Math.sqrt(dx*dx+dy*dy)<150){this.endpoint=latlng;}}else{this.endpoint=latlng;}}));this.listener.push(GEvent.bindDom(this.map.getContainer(),"mousemove",this,function(e){if(this.polyline)this.map.removeOverlay(this.polyline);this.polyline=new GPolyline([this.startpoint,this.endpoint],"#000000",2,1);this.map.addOverlay(this.polyline);var meter=this.polyline.getLength();if(meter<1000)var text=Math.round(meter)+" m";else if(meter<100000)var text=Math.round(meter/100)/10+" km";else var text=Math.round(meter/1000)+" km";if(this.textbox)this.map.removeControl(this.textbox);this.textbox=new U(text);this.map.addControl(this.textbox);this.textbox.show({x:e.clientX,y:e.clientY});}));}};af.prototype.remove=function(){if(this.polyline)this.map.removeOverlay(this.polyline);if(this.textbox)this.map.removeControl(this.textbox);for(var i=0;i<this.listener.length;i++){GEvent.removeListener(this.listener[i]);}this.listener=new Array();this.map=null;};af.prototype.redraw=function(force){if(this.polyline){}};af.prototype.copy=function(map){return new af();}