GSUtil.extend(GSRubberbandControl,GSControl);function GSRubberbandControl(a){this.options={modifierKey:undefined,fill:"#a80510",fillOpacity:25,stroke:"#a80510",strokeOpacity:100,strokeWidth:1};GSUtil.merge(a,this.options);GSRubberbandControl.baseConstructor.call(this,"rubberband-control");this.dragging=false;this.eventListeners={}}GSRubberbandControl.prototype.getDefaultPosition=function(){return{anchor:GSControl.ANCHOR_CENTER}};GSRubberbandControl.prototype.render=function(a){this.map=a;GSEventManager.bind(a.container,"mousedown",this,this.dragStart);return this.createElement()};GSRubberbandControl.prototype.createElement=function(){var a=GSUtil.createElement("div",{styles:{visibility:"hidden",cursor:"crosshair"}});this.fill=GSUtil.createElement("div",{styles:{position:"absolute",backgroundColor:this.options.fill}});GSUtil.setOpacity(this.fill,this.options.fillOpacity);a.appendChild(this.fill);this.stroke=GSUtil.createElement("div",{styles:{position:"absolute",border:this.options.strokeWidth+"px solid "+this.options.stroke}});GSUtil.setOpacity(this.stroke,this.options.strokeOpacity);a.appendChild(this.stroke);return a};GSRubberbandControl.prototype.dragStart=function(b){if(this.options.modifierKey){var a=this.options.modifierKey.toLowerCase()+"Key";if(!b[a]){return}}GSUtil.cancelEvent(b);this.startPixel=new GSPoint(b.clientX,b.clientY);this.dragging=true;this.eventListeners.mouseup=GSEventManager.bind(document,"mouseup",this,this.dragStop);this.eventListeners.mousemove=GSEventManager.bind(document,"mousemove",this,this.dragMove);this.startPos=GSUtil.getMousePixelCoordinate(b,this.map.container);GSUtil.positionElement(this.element,this.startPos.x,this.startPos.y);this.map.container.style.cursor="crosshair";this.element.style.visibility="visible"};GSRubberbandControl.prototype.dragMove=function(c){if(!this.hasDragged(c)){return}GSUtil.cancelEvent(c);var d=GSUtil.getMousePixelCoordinate(c,this.map.container);var b=d.x-this.startPos.x;var a=d.y-this.startPos.y;this.element.style.width=Math.abs(b)+"px";this.element.style.height=Math.abs(a)+"px";this.fill.style.width=Math.abs(b)+"px";this.fill.style.height=Math.abs(a)+"px";this.stroke.style.width=Math.abs(b)-2+"px";this.stroke.style.height=Math.abs(a)-2+"px";if(b<0){this.element.style.left=(this.startPos.x-Math.abs(b))+"px"}if(a<0){this.element.style.top=(this.startPos.y-Math.abs(a))+"px"}};GSRubberbandControl.prototype.dragStop=function(a){if(this.hasDragged(a)){GSUtil.cancelEvent(a);GSEventManager.release(this.eventListeners.mouseup);GSEventManager.release(this.eventListeners.mousemove);this.zoom(a);this.reset();this.dragging=false}this.startPixel=undefined};GSRubberbandControl.prototype.reset=function(){with(this.element.style){width="0px";height="0px";visibility="hidden"}with(this.fill.style){width="0px";height="0px"}with(this.stroke.style){width="0px";height="0px"}this.map.container.style.cursor="default"};GSRubberbandControl.prototype.hasDragged=function(c){if(!this.startPixel){return false}var b=2;var d=new GSPoint(c.clientX,c.clientY);var a=(Math.abs(this.startPixel.x-d.x)>b)||(Math.abs(this.startPixel.y-d.y)>b);return a};GSRubberbandControl.prototype.zoom=function(d){var b=this.map.translateToRealWorldCoordinate(this.startPos);var a=this.map.getMouseCoordinate(d);var c=new GSBounds(b.x,b.y,a.x,a.y);this.map.setBounds(c)};GSUtil.extend(GSMenuControl,GSControl);function GSMenuControl(b,a){this.options={color:"#ddd",backgroundColor:"rgba(0,0,0,0.65)",menuItemPadding:"3px",menuPadding:"8px",useRollover:false};GSUtil.merge(a,this.options);GSMenuControl.baseConstructor.call(this,b);this.element=GSUtil.createElement("div",{"class":"GSMenuControl"});this.panel=this.createPanel(this.element);this.menu=this.createMenu();this.menu.addListener(this);this.button=new GSButton(this.name,this.element,{active:true});var c=GSUtil.bindAsEventListener(this.onClick,this);this.button.addEventListener("click",c);this.button.addEventListener("dblclick",GSUtil.cancelEvent);this.onmap=false;this.showingMenu=false;if(this.options.open){this.showMenu()}}GSMenuControl.prototype.updatePanelSize=function(){if(this.onmap){this.panel.setSize(new GSDimension(this.menu.getWidth(),this.menu.getHeight()))}};GSMenuControl.prototype.onClick=function(a){this.showingMenu=!this.showingMenu;if(this.showingMenu){this.showMenu()}else{this.hideMenu()}GSUtil.cancelEvent(a)};GSMenuControl.prototype.showMenu=function(){this.panel.setVisible(true);this.menu.show()};GSMenuControl.prototype.hideMenu=function(){this.menu.hide();this.panel.setVisible(false)};GSMenuControl.prototype.render=function(a){this.map=a;return this.element};GSMenuControl.prototype.addItem=function(a){this.menu.addItem(a);this.updatePanelSize()};GSMenuControl.prototype.addItemAt=function(b,a){this.menu.addItemAt(b,a);this.updatePanelSize()};GSMenuControl.prototype.removeItem=function(a){this.menu.removeItem(a);this.updatePanelSize()};GSMenuControl.prototype.removeItemAt=function(a){this.menu.removeItemAt(a);this.updatePanelSize()};GSMenuControl.prototype.createPanel=function(b){var a=new GSPanel(b,{y:22,backgroundColor:this.options.backgroundColor,borderRadius:9,boxShadow:true,visible:false,styles:{padding:this.options.menuPadding}});return a};GSMenuControl.prototype.createMenu=function(){var a=new GSMenu(this.options);this.panel.setContent(a.element);return a};GSMenuControl.prototype.setElement=function(a){GSMenuControl.superClass.setElement.call(this,a);this.onmap=true;this.updatePanelSize()};GSMenuControl.prototype.mapClicked=function(a){if(this.showingMenu){this.hideMenu();this.showingMenu=false}};GSMenuControl.prototype.menuHidden=function(a){if(this.showingMenu){this.panel.setVisible(false);this.showingMenu=false}};try{GSUtil.extend(GSMenu,GSAbstractMenu)}catch(e){throw new Error("Unable to extend GSAbstractMenu. Has the additional-ui module been loaded?")}function GSMenu(a){GSMenu.baseConstructor.call(this,a);this.showing=false;this.initialize()}GSMenu.prototype.initialize=function(){GSMenu.superClass.initialize.call(this);this.element=GSUtil.createElement("div",{styles:{visibility:"hidden",position:"absolute",fontFamily:this.options.fontFamily,fontSize:this.options.fontSize},events:{contextmneu:GSUtil.cancelEvent,click:GSUtil.cancelEvent,dblclick:GSUtil.cancelEvent},"class":"GSMenu"})};GSMenu.prototype.getWidth=function(){return this.element.offsetWidth};GSMenu.prototype.getHeight=function(){return this.element.offsetHeight};GSMenu.prototype.show=function(){GSMenu.superClass.show.call(this);this.element.style.visibility="visible"};GSMenu.prototype.hide=function(){GSMenu.superClass.hide.call(this);this.element.style.visibility="hidden"};if(window.GSModule&&GSModule.moduleLoaded){GSModule.moduleLoaded("additional-controls")};