MapBuzz.SelectionManager=function SelectionManager(_1){
this.map=_1;
this.selected=new Array();
};
Object.extend(MapBuzz.SelectionManager,{SELECT:"SELECTION_SELECT",UNSELECT:"SELECTION_UNSELECT",CLEAR:"SELECTION_CLEAR"});
Object.extend(MapBuzz.SelectionManager.prototype,{clear:function(){
for(var i=0;i<this.selected.length;i++){
this.selected[i].unselect();
}
this.selected.clear();
MapBuzz.databus.send(this,MapBuzz.SelectionManager.CLEAR);
},select:function(_3){
this.clear();
this.selected.push(_3);
_3.select();
MapBuzz.databus.send(this,MapBuzz.SelectionManager.SELECT,{figure:_3});
},toggle:function(_4){
var _5=this.selected.remove(_4);
if(_5){
_5.unselect();
}else{
this.selected.push(_4);
_4.select();
}
},unselect:function(_6){
this.selected.remove(_6);
_6.unselect();
MapBuzz.databus.send(this,MapBuzz.SelectionManager.UNSELECT,{figure:_6});
return _6;
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Abstract=function ControlsAbstract(_7){
this.controls=_7;
};
Object.extend(MapBuzz.Controls.Abstract.prototype,{display:function(){
NotImplementedError();
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Chooser=function ChooserControl(_8){
this.element=$(_8);
this.initialize();
};
Object.extend(MapBuzz.Controls.Chooser.prototype,{initialize:function(){
var _9=Element.getElementBySelector(this.element,".chooser");
this.clickChooserHandler=this.onClickChooser.bindAsEventListener(this);
Event.observe(_9,"click",this.clickChooserHandler);
},release:function(){
var _a=Element.getElementBySelector(this.element,".chooser");
Event.observe(_a,"click",this.clickChooserHandler);
this.clickChooserHandler=null;
},onClickChooser:function(_b){
Event.stop(_b);
var _c=Element.getElementBySelector(this.element,"ul");
Element.toggle(_c);
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Day=function ControlsDay(_d){
this.applySuper(arguments);
};
MapBuzz.Controls.Day.inherits(MapBuzz.Controls.Chooser);
MapBuzz.Controls.Day.CURRENT_CLASS="current";
Object.extend(MapBuzz.Controls.Day.prototype,{initialize:function(){
this.applySuper(arguments);
var _e=Element.getElementBySelector(this.element,"ul");
this.clickDayHandler=this.onClickDay.bindAsEventListener(this);
Event.observe(_e,"click",this.clickDayHandler);
},release:function(){
this.applySuper(arguments);
var _f=Element.getElementBySelector(this.element,"ul");
Event.stopObserving(_f,"click",this.clickDayHandler);
this.clickDayHandler=null;
},onClickDay:function(_10){
Event.stop(_10);
var _11=Event.element(_10);
while(_11){
if(_11.tagName.match(/li/i)){
break;
}
_11=_11.parentNode;
}
if(!_11){
return;
}
this.updateTime(_11);
},updateTime:function(_12){
var _13=this.getGdAttribute(_12,"startTime");
_13=Date.parseXmlSchema(_13);
var end=this.getGdAttribute(_12,"endTime");
end=Date.parseXmlSchema(end);
MapBuzz.databus.send(this,MapBuzz.Feature.Event.SET_TIME,{start:_13,end:end});
MapBuzz.databus.send(this,MapBuzz.View.RELOAD,{});
this.setCurrent(_12);
},getGdAttribute:function(_15,_16){
return _15.getAttribute(MapBuzz.Namespace.GD_NAMESPACE_PREFIX+":"+_16)||_15.getAttributeNS(MapBuzz.Namespace.GD_NAMESPACE_URI,_16);
},setCurrent:function(_17){
var _18=this.element.getElementsByTagName("li");
for(var i=0;i<_18.length;i++){
_18[i].className="";
}
_17.className=MapBuzz.Controls.Day.CURRENT_CLASS;
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Layers=function LayersControl(_1a){
this.applySuper(arguments);
};
MapBuzz.Controls.Layers.inherits(MapBuzz.Controls.Abstract);
Object.extend(MapBuzz.Controls.Layers.prototype,{display:function(){
var _1b=this.controls.view.panes.getControlPane();
this.element=Element.create("div");
this.element.id="layers_control";
this.element.style.width="8em";
this.element.style.height="8em";
this.element.style.position="absolute";
this.element.style.right="0";
this.element.style.backgroundColor="Gray";
_1b.appendChild(this.element);
var _1c=Element.create("ul");
this.element.appendChild(_1c);
var _1d=this.controls.view.layers.layers;
for(var i=0;i<_1d.length;i++){
this.drawLayers(_1d[i],_1c);
}
},drawLayers:function(_1f,_20){
var _21=_1f.name+"_layer";
var _22=Element.create("li");
_20.appendChild(_22);
var _23=Element.create("input");
_23.type="checkbox";
_23.name=_1f.name;
_23.id=_21;
_22.appendChild(_23);
var _24=Element.create("label");
_24.htmlFor=_21;
_22.appendChild(_24);
var _25=document.createTextNode(_1f.name);
_24.appendChild(_25);
if(_1f.layers){
var _26=Element.create("ul");
_22.appendChild(_26);
for(var i=0;i<_1f.layers.length;i++){
this.drawLayers(_1f.layers[i],_26);
}
}
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Manager=function ControlManager(_28){
this.view=_28;
this.constructors=new Array();
this.controls=new Array();
this.initialize();
};
Object.extend(MapBuzz.Controls.Manager.prototype,{initialize:function(){
this.register(MapBuzz.Controls.Navigation);
this.register(MapBuzz.Controls.Layers);
this.register(MapBuzz.Controls.Scale);
},release:function(){
},register:function(_29){
this.constructors.push(_29);
},unregister:function(_2a){
this.constructors.remove(_2a);
},create:function(){
for(var i=0;i<this.constructors.length;i++){
var _2c=this.constructors[i];
var _2d=new _2c(this);
this.add(_2d);
_2d.display();
}
},add:function(_2e){
},remove:function(_2f){
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Layers2=function Layers2Control(_30){
this.applySuper(arguments);
};
MapBuzz.Controls.Layers2.inherits(MapBuzz.Controls.Chooser);
Object.extend(MapBuzz.Controls.Layers2.prototype,{initialize:function(){
this.applySuper(arguments);
var _31=Element.getElementBySelector(this.element,"ul");
this.changeDataSourceHandler=this.onChangeDataSource.bindAsEventListener(this);
Event.observe(_31,"click",this.changeDataSourceHandler);
},release:function(){
this.applySuper(arguments);
var _32=Element.getElementBySelector(this.element,"ul");
Event.stopObserving(_32,"change",this.changeDataSourceHandler);
this.clickDataSourceHandler=null;
},onClickChooseLayers:function(_33){
Event.stop(_33);
var _34=Element.getElementBySelector(this.element,"ul");
Element.toggle(_34);
},onChangeDataSource:function(_35){
var _36=Event.element(_35);
var _37=null;
if(_36.tagName.match(/label/i)){
_37=$(_36.htmlFor);
}else{
if(_36.tagName.match(/input/i)){
_37=_36;
}else{
return;
}
}
this.setDataSourceVisibility(_37.id,_37.checked);
},setDataSourceVisibility:function(uri,_39){
var _3a=MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_LOOKUP,{uri:uri});
var _3b=_3a[0];
_3b.setVisible(_39);
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Navigation=function NavigationControl(_3c){
this.applySuper(arguments);
};
MapBuzz.Controls.Navigation.inherits(MapBuzz.Controls.Abstract);
Object.extend(MapBuzz.Controls.Navigation,{PAN_NORTH:"navigation_pan_north",PAN_WEST:"navigation_pan_west",PAN_EAST:"navigation_pan_east",PAN_SOUTH:"navigation_pan_south",ZOOM_IN:"navigation_zoom_in",ZOOM_OUT:"navigation_zoom_out",EXTENT:"navigation_extent"});
Object.extend(MapBuzz.Controls.Navigation.prototype,{display:function(){
var _3d=this.controls.view.panes.getControlPane();
new Insertion.Bottom(_3d,this.content());
this.setupEvents();
},setupEvents:function initialize(){
this.clickPanNorthHandler=this.onClickPanNorth.bindAsEventListener(this);
this.clickPanWestHandler=this.onClickPanWest.bindAsEventListener(this);
this.clickPanEastHandler=this.onClickPanEast.bindAsEventListener(this);
this.clickPanSouthHandler=this.onClickPanSouth.bindAsEventListener(this);
this.clickZoomInHandler=this.onClickZoomIn.bindAsEventListener(this);
this.clickZoomOutHandler=this.onClickZoomOut.bindAsEventListener(this);
Event.observe($(MapBuzz.Controls.Navigation.PAN_NORTH),"click",this.clickPanNorthHandler);
Event.observe($(MapBuzz.Controls.Navigation.PAN_WEST),"click",this.clickPanWestHandler);
Event.observe($(MapBuzz.Controls.Navigation.PAN_EAST),"click",this.clickPanEastHandler);
Event.observe($(MapBuzz.Controls.Navigation.PAN_SOUTH),"click",this.clickPanSouthHandler);
Event.observe($(MapBuzz.Controls.Navigation.ZOOM_IN),"click",this.clickZoomInHandler);
Event.observe($(MapBuzz.Controls.Navigation.ZOOM_OUT),"click",this.clickZoomOutHandler);
},content:function(){
var _3e=this.getTemplate();
return _3e.run();
},onClickPanNorth:function(_3f){
Event.stop(_3f);
var _40=this.controls.view;
var _41=_40.getViewBounds();
var _42=0;
var _43=_41.height/2;
_40.pan(_42,_43);
},onClickPanWest:function(_44){
Event.stop(_44);
var _45=this.controls.view;
var _46=_45.getViewBounds();
var _47=_46.width/2;
var _48=0;
_45.pan(_47,_48);
},onClickPanEast:function(_49){
Event.stop(_49);
var _4a=this.controls.view;
var _4b=_4a.getViewBounds();
var _4c=_4b.width/2;
var _4d=0;
_4a.pan(-_4c,_4d);
},onClickPanSouth:function(_4e){
Event.stop(_4e);
var _4f=this.controls.view;
var _50=_4f.getViewBounds();
var _51=0;
var _52=_50.height/2;
_4f.pan(_51,-_52);
},onClickZoomIn:function(_53){
Event.stop(_53);
var _54=this.controls.view;
var _55=_54.getWorldCenter();
var _56=_54.displayExtent.zoom;
var _57=_54.display.getScaleForZoom(_55,_56+1);
_54.setCenterScale(_55,_57);
},onClickZoomOut:function(_58){
Event.stop(_58);
var _59=this.controls.view;
var _5a=_59.getWorldCenter();
var _5b=_59.displayExtent.zoom;
var _5c=_59.display.getScaleForZoom(_5a,_5b-1);
_59.setCenterScale(_5a,_5c);
},getTemplate:function(){
if(!this.constructor.template){
var _5d="<div id=\"navigation_control\">           <table id=\"pan_directions\" class=\"pan_directions\">             <tr>               <td></td>               <td><a id=\"navigation_pan_north\" href=\"#\"><img alt=\"Pan North\" src=\"/images/navigation_pan_north.png\" /></a></td>               <td></td>             </tr>             <tr>               <td><a id=\"navigation_pan_west\" href=\"#\"><img alt=\"Pan West\" src=\"/images/navigation_pan_west.png\" /></a></td>               <!--<td><a id=\"navigation_extent\" href=\"#\"><img alt=\"Exten\" src=\"/images/navigation_extent.png\" /></a></td>-->               <td> </td>               <td><a id=\"navigation_pan_east\" href=\"#\"><img alt=\"Pan East\" src=\"/images/navigation_pan_east.png\" /></a></td>             </tr>             <tr>               <td></td>               <td><a id=\"navigation_pan_south\" href=\"#\"><img alt=\"Pan South\" src=\"/images/navigation_pan_south.png\" /></a></td>               <td></td>             </tr>             <tr>               <td></td>               <td><a id=\"navigation_zoom_in\" href=\"#\"><img alt=\"Zoom In\" src=\"/images/navigation_zoom_in.png\" /></a></td>               <td></td>             </tr>             <tr>               <td></td>               <td><a id=\"navigation_zoom_out\" href=\"#\"><img alt=\"Zoom Out\" src=\"/images/navigation_zoom_out.png\" /></a></td>               <td></td>             </tr>           </table>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_5d);
}
return this.constructor.template;
}});
namespace("MapBuzz.Controls");
MapBuzz.Controls.Scale=function ScaleControl(_5e){
this.applySuper(arguments);
};
MapBuzz.Controls.Scale.inherits(MapBuzz.Controls.Abstract);
Object.extend(MapBuzz.Controls.Scale.prototype,{display:function(){
}});
namespace("MapBuzz.View");
MapBuzz.View.Extent=function Extent(_5f,_60,_61){
this.center=_5f;
this.scale=_60;
this.zoom=_61;
};
Object.extend(MapBuzz.View.Extent.prototype,{copy:function(){
return new this.constructor(this.center.copy(),this.scale,this.zoom);
},equals:function(_62){
if(this===_62){
return true;
}else{
if(this.center.equals(_62.center)&&this.scale==_62.scale&&this.zoom==_62.zoom){
return true;
}else{
return false;
}
}
},getCrs:function(){
return this.center.crs;
}});
MapBuzz.View.Extent.prototype.toString=function toString(){
var _63="Extent [ "+"center: "+this.center+", "+"scale: "+this.scale+", "+"crs: "+this.getCrs()+"]";
return _63;
};
namespace("MapBuzz.View");
MapBuzz.View.Panes=function Panes(_64){
this.view=_64;
this.panes=this.create("map_panes",0,this.view.element);
this.panes.style.width="100%";
this.panes.style.height="100%";
this.panes.style.position="relative";
};
Object.extend(MapBuzz.View.Panes,{SURFACES_ID:"surfaces",CONTROLS_ID:"controls"});
Object.extend(MapBuzz.View.Panes.prototype,{create:function(id,_66,_67){
var _68=Element.create("div");
_68.id=id;
_67=_67||this.panes;
_67.appendChild(_68);
_68.style.position="absolute";
_68.style.left="0px";
_68.style.top="0px";
_68.style.margin="0";
_68.style.padding="0";
_68.style.border="none";
_68.style.zIndex=_66;
_68.style.backgroundColor="transparent";
return _68;
},destroy:function(_69){
_69.parentNode.removeChild(_69);
},getSurfacePane:function(){
if(!this.surfacePane){
this.surfacePane=this.create(MapBuzz.View.Panes.SURFACES_ID,100);
}
this.surfacePane.style.width="100%";
this.surfacePane.style.height="100%";
return this.surfacePane;
},getControlPane:function(){
if(!this.controlPane){
this.controlPane=this.create(MapBuzz.View.Panes.CONTROLS_ID,200);
}
return this.controlPane;
}});
MapBuzz.View.Display=function ViewDisplay(_6a){
this.view=_6a;
};
Object.extend(MapBuzz.View.Display.prototype,{getTileSize:function(){
return 256;
},getNumberTiles:function(_6b){
return Math.pow(2,_6b);
},getCircumference:function(_6c){
return (this.getTileSize()*this.getNumberTiles(_6c));
},getZoomForScale:function(_6d,_6e){
var _6f=_6d.crs.getWidth(_6d);
var _70=_6f*_6e;
var _71=_70*Geometry.DocumentCrs.PIXELS_PER_CM;
var _72=_71/this.getTileSize();
var _73=Math.log2(_72);
if(_73<0){
_73=0;
}
var _74=Math.abs(Math.round(_73)-_73);
if(_74<0.00001){
_73=Math.round(_73);
}else{
_73=Math.floor(_73);
}
_73=Math.max(_73,this.view.map.world.minZoom);
_73=Math.min(_73,this.view.map.world.maxZoom);
return _73;
},getScaleForZoom:function(_75,_76){
var _77=_75.crs.getWidth(_75);
var _78=this.getCircumference(_76);
var _79=_78/Geometry.DocumentCrs.PIXELS_PER_CM;
return (_79/_77);
},createCrs:function(_7a){
var _7b=this.getCircumference(_7a);
var _7c=_7b/(2*Math.PI);
if(isNaN(_7c)){
throw new Error("Invalid radius.");
}
var _7d={radius:_7c,yScale:-1};
return new Geometry.MercatorCrs(_7d);
},getNearestExtent:function(_7e,_7f){
var _80=this.getZoomForScale(_7e,_7f);
var crs=this.createCrs(_80);
var _82=_7e.copy().convertToCrs(crs);
_82.x=Math.round(_82.x);
_82.y=Math.round(_82.y);
var _83=this.getScaleForZoom(_82.copy().convertToCrs(_7e.crs),_80);
return new MapBuzz.View.Extent(_82,_83,_80);
}});
MapBuzz.View.Display.prototype.toString=function toString(){
return "Display";
};
namespace("MapBuzz.View");
Object.extend(MapBuzz.View,{SET_BOUNDS:"VIEW_SET_BOUNDS",SET_CENTER:"VIEW_SET_CENTER",SET_CENTER_SCALE:"VIEW_SET_CENTER_SCALE",CENTER_SCALE_UPDATED:"VIEW_CENTER_SCALE_UPDATED",GET_PARAMS:"VIEW_GET_PARAMS",REDRAW:"VIEW_REDRAW",RELOAD:"VIEW_RELOAD"});
MapBuzz.View.Viewer=function Viewer(map,_85){
this.map=map;
this.element=$(_85);
if(this.element.style.position!="absolute"||this.element.style.position!="relative"){
this.element.style.position="relative";
}
this.initialized=false;
this.id=MapBuzz.View.Viewer.ID;
MapBuzz.View.Viewer.ID-=1;
this.docCrs=Geometry.CrsFactory.instance.documentCrs();
this.viewCrs=new Geometry.ElementCrs(this.element);
this.displayExtent=null;
this.extents=new Array();
this.moveState=MapBuzz.View.Viewer.USER_MOVE_STATE;
this.controls=new MapBuzz.Controls.Manager(this);
this.layers=new MapBuzz.DataSource.LayerManager(this);
this.surfaces=new MapBuzz.Surface.Manager(this);
this.panes=new MapBuzz.View.Panes(this);
this.cursor=new MapBuzz.Cursor(this.element);
this.display=new MapBuzz.View.Display(this);
this.initialize();
};
MapBuzz.View.Viewer.ID=-1;
MapBuzz.View.Viewer.USER_MOVE_STATE="USER_MOVE_STATE";
MapBuzz.View.Viewer.SYSTEM_MOVE_STATE="SYSTEM_MOVE_STATE";
MapBuzz.View.Viewer.MIN_SCALE=1/5000;
Object.extend(MapBuzz.View.Viewer.prototype,{initialize:function(){
this.resizeHandler=this.onResize.bindAsEventListener(this);
Event.observe(window,"resize",this.resizeHandler);
this.dragController=new Event.DragController(this.element);
this.reset();
this.registerListeners();
},release:function(){
this.unregisterListeners();
this.controls.release();
this.surfaces.release();
this.viewCrs.release();
this.dragController.release();
this.element=null;
},registerListeners:function(){
this.setBoundsListener=MapBuzz.databus.registerListener(MapBuzz.View.SET_BOUNDS,function(_86){
this.setBounds(_86.data.bounds);
}.bind(this));
this.setCenterListener=MapBuzz.databus.registerListener(MapBuzz.View.SET_CENTER,function(_87){
this.setCenter(_87.data.center);
}.bind(this));
this.setCenterScaleListener=MapBuzz.databus.registerListener(MapBuzz.View.SET_CENTER_SCALE,function(_88){
this.setCenterScale(_88.data.center,_88.data.scale);
}.bind(this));
this.redrawListener=MapBuzz.databus.registerListener(MapBuzz.View.REDRAW,function(_89){
this.redraw();
}.bind(this));
this.reloadListener=MapBuzz.databus.registerListener(MapBuzz.View.RELOAD,function(_8a){
this.reload();
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.View.SET_BOUNDS,this.setBoundsListener);
MapBuzz.databus.unregisterListener(MapBuzz.View.SET_CENTER_SCALE,this.setCenterScaleListener);
MapBuzz.databus.unregisterListener(MapBuzz.View.RELOAD,this.reloadListener);
},initializeMap:function(){
this.surfaces.create();
this.controls.create();
},onResize:function(){
if(!this.initialized){
return;
}
var _8b=this.getViewBounds();
var _8c=this.getViewToDisplayTransform();
this.viewBounds=null;
this.elementBounds=null;
this.reset();
var _8d=this.getViewBounds();
var _8e=_8d.copy().transformToCrs(_8c,this.displayExtent.getCrs());
this.displayExtent.center=_8e.getCenter();
this.surfaces.resize();
if(_8d.width>_8b.width||_8d.height>_8b.height){
this.load();
}
},reset:function(){
this.worldCenter=null;
this.displayBounds=null;
this.worldBounds=null;
this.viewToDisplayTransform=null;
this.docToWorldTransform=null;
this.worldToViewTransform=null;
this.worldToDisplayTransform=null;
},getWidthInCm:function(){
if(!this.widthInCm){
this.widthInCm=this.getViewBounds().width/Geometry.DocumentCrs.PIXELS_PER_CM;
}
return this.widthInCm;
},getViewBounds:function(){
if(!this.viewBounds){
this.viewBounds=new Geometry.Envelope(0,0,this.element.clientWidth,this.element.clientHeight,this.viewCrs);
}
return this.viewBounds;
},getElementBounds:function(){
if(!this.elementBounds){
this.elementBounds=this.getViewBounds().copy().convertToCrs(Geometry.CrsFactory.instance.documentCrs());
}
return this.elementBounds;
},getDisplayBounds:function(){
if(!this.displayBounds){
var _8f=this.getViewToDisplayTransform();
this.displayBounds=this.getViewBounds().copy().transformToCrs(_8f,this.displayExtent.getCrs());
}
return this.displayBounds;
},getWorldBounds:function(){
if(!this.worldBounds){
this.worldBounds=this.convertDisplayToWorld(this.getDisplayBounds().copy());
}
return this.worldBounds;
},getWorldCenter:function(){
if(!this.worldCenter){
this.worldCenter=this.convertDisplayToWorld(this.displayExtent.center.copy());
}
return this.worldCenter;
},getViewToDisplayTransform:function(){
if(!this.viewToDisplayTransform){
var crs=this.displayExtent.getCrs();
var _91=this.getViewBounds();
this.viewToDisplayTransform=new Geometry.AffineTransform();
this.viewToDisplayTransform.translate(-_91.xCenter,-_91.yCenter).scale((this.viewCrs.isXMirrored()?-1:1),(this.viewCrs.isYMirrored()?-1:1)).scale((crs.isXMirrored()?-1:1),(crs.isYMirrored()?-1:1)).translate(this.displayExtent.center.x,this.displayExtent.center.y);
}
return this.viewToDisplayTransform;
},getDocToViewTransform:function(){
if(!this.docToViewTransform){
this.docToViewTransform=Geometry.Projections.instance.getTransform(Geometry.CrsFactory.instance.documentCrs(),this.viewCrs);
}
return this.docToViewTransform;
},getDocToWorldTransform:function(){
if(!this.docToWorldTransform){
this.docToWorldTransform=new Geometry.Transform();
this.docToWorldTransform.add(Geometry.Projections.instance.getTransform(Geometry.CrsFactory.instance.documentCrs(),this.viewCrs));
this.docToWorldTransform.add(this.getViewToDisplayTransform());
this.docToWorldTransform.add(this.displayExtent.getCrs().getTransformTo(this.map.world.crs));
}
return this.docToWorldTransform;
},getWorldToViewTransform:function(){
if(!this.worldToViewTransform){
this.worldToViewTransform=new Geometry.Transform();
this.worldToViewTransform.add(this.displayExtent.getCrs().getTransformTo(this.map.world.crs).getInverse());
this.worldToViewTransform.add(this.getViewToDisplayTransform().getInverse());
}
return this.worldToViewTransform;
},getWorldToDisplayTransform:function(){
if(!this.worldToDisplayTransform){
this.worldToDisplayTransform=this.displayExtent.getCrs().getTransformTo(this.map.world.crs).getInverse();
}
return this.worldToDisplayTransform;
},convertDocToView:function(_92){
var _93=this.getDocToViewTransform();
return _92.transformToCrs(_93,this.viewCrs);
},convertDocToWorld:function(_94){
var _95=this.getDocToWorldTransform();
return _94.transformToCrs(_95,this.map.world.crs);
},convertViewToWorld:function(_96){
var _97=this.getWorldToViewTransform().getInverse();
return _96.transformToCrs(_97,this.map.world.crs);
},convertWorldToView:function(_98){
var _99=this.getWorldToViewTransform();
return _98.transformToCrs(_99,this.viewCrs);
},convertWorldToDisplay:function(_9a){
var _9b=this.getWorldToDisplayTransform();
return _9a.transformToCrs(_9b,this.displayExtent.getCrs());
},convertWorldToDoc:function(_9c){
var _9d=this.getDocToWorldTransform().getInverse();
return _9c.transformToCrs(_9d,this.docCrs);
},convertDisplayToWorld:function(_9e){
var _9f=this.getWorldToDisplayTransform().getInverse();
return _9e.transformToCrs(_9f,this.map.world.crs);
},setBounds:function(_a0){
var _a1=this.getViewBounds();
var _a2=this.viewCrs.distance(new Geometry.Coordinate(_a1.xMin,_a1.yCenter),new Geometry.Coordinate(_a1.xMax,_a1.yCenter));
var _a3=this.viewCrs.distance(new Geometry.Coordinate(_a1.xCenter,_a1.yMin),new Geometry.Coordinate(_a1.xCenter,_a1.yMax));
var _a4=this.map.world.crs.distance(new Geometry.Coordinate(_a0.xMin,_a0.yCenter),new Geometry.Coordinate(_a0.xMax,_a0.yCenter));
var _a5=this.map.world.crs.distance(new Geometry.Coordinate(_a0.xCenter,_a0.yMin),new Geometry.Coordinate(_a0.xCenter,_a0.yMax));
var _a6=Math.min(_a2/_a4,_a3/_a5);
if(!isFinite(_a6)){
_a6=MapBuzz.View.Viewer.MIN_SCALE;
}
this.setCenterScale(_a0.getCenter(),_a6);
},previous:function(){
if(this.extents.length<2){
return;
}
this.reset();
var _a7=this.extents.pop();
this.displayExtent=this.extents[this.extents.length-1].copy();
this.surfaces.changeDisplayExtent(_a7,this.displayExtent);
if(_a7.scale!=this.displayExtent.scale){
this.surfaces.clear();
}
MapBuzz.databus.send(this,MapBuzz.View.CENTER_SCALE_UPDATED);
this.load();
},internalSetCenterScale:function(_a8,_a9){
if(!_a9){
throw new Error("Invalid scale - scale is null");
}else{
if(_a9<0){
throw new Error("Invalid scale - scale is negative");
}else{
if(!isFinite(_a9)){
throw new Error("Invalid scale - scale is infinite.");
}else{
if(isNaN(_a9)){
throw new Error("Invalid scale - scale is not a number (Nan).");
}
}
}
}
this.reset();
var _aa=this.displayExtent;
this.displayExtent=this.display.getNearestExtent(_a8,_a9);
this.extents.push(this.displayExtent.copy());
this.surfaces.changeDisplayExtent(_aa,this.displayExtent);
},setCenter:function(_ab){
var _ab=this.convertWorldToDisplay(_ab.copy());
var _ac=this.displayExtent.center.x-_ab.x;
var _ad=this.displayExtent.center.y-_ab.y;
this.pan(_ac,_ad);
},setCenterScale:function(_ae,_af){
if(this.initialized){
this.surfaces.clear();
}else{
this.initializeMap();
}
this.internalSetCenterScale(_ae,_af);
this.initialized=true;
MapBuzz.databus.send(this,MapBuzz.View.CENTER_SCALE_UPDATED);
if(this.moveState==MapBuzz.View.Viewer.USER_MOVE_STATE){
this.load();
}
},startPan:function(_b0,_b1){
this.surfaces.startPan(_b0,_b1);
},pan:function(_b2,_b3){
this.doPan(_b2,_b3);
this.surfaces.pan(_b2,_b3);
},endPan:function(_b4,_b5){
this.extents.push(this.displayExtent.copy());
this.surfaces.endPan(_b4,_b5);
MapBuzz.databus.send(this,MapBuzz.View.CENTER_SCALE_UPDATED);
if(this.moveState==MapBuzz.View.Viewer.USER_MOVE_STATE){
this.reload();
}
},doPan:function(_b6,_b7){
var crs=this.displayExtent.getCrs();
var x=-1*_b6*(this.viewCrs.isXMirrored()?-1:1)*(crs.isXMirrored()?-1:1);
var y=-1*_b7*(this.viewCrs.isYMirrored()?-1:1)*(crs.isYMirrored()?-1:1);
this.displayExtent.center.x+=x;
this.displayExtent.center.y+=y;
this.worldCenter=null;
this.displayBounds=null;
this.worldBounds=null;
this.viewToDisplayTransform=null;
this.docToWorldTransform=null;
this.worldToViewTransform=null;
},load:function(){
this.surfaces.load();
},reload:function(){
this.surfaces.reload();
},redraw:function(){
this.surfaces.redraw();
},params:function(){
var _bb=this.getViewBounds();
return new HashTable({center:this.getWorldCenter().toQueryParam(),scale:this.displayExtent.scale,crs:this.map.world.crs.constructor.EPSG,width:_bb.width,height:_bb.height});
},toQueryParams:function(){
var _bc=this.params();
return _bc.toQueryString();
}});
MapBuzz.Map=function Map(_bd,_be){
this.world=_be;
this.defaultExtent=null;
this.defaultBounds=null;
this.dataSources=new MapBuzz.DataSource.Manager(this);
this.selectionManager=new MapBuzz.SelectionManager(this);
this.toolManager=new MapBuzz.Tool.Manager(this);
this.view=new MapBuzz.View.Viewer(this,_bd);
this.toolManager.setView(this.view);
this.initialize();
MapBuzz.Map.instance=this;
};
Object.extend(MapBuzz.Map,{PAN:"MAP_PAN",ZOOM:"MAP_ZOOM",LOADED:"MAP_LOADED"});
Object.extend(MapBuzz.Map.prototype,{initialize:function(){
this.statusElement=$("map_status");
if(this.statusElement){
this.statusMessage=this.statusElement.innerHTML;
this.statusClass=this.statusElement.className;
}
this.onUnloadHandler=this.release.bind(this);
Event.observe(window,"unload",this.onUnloadHandler);
},release:function(){
Event.stopObserving(window,"unload",this.onUnloadHandler);
this.toolManager.release();
this.toolManager=null;
this.view.release();
this.view=null;
},getPoint:function(_bf){
var _c0=null;
if(_bf instanceof Geometry.Coordinate){
_c0=new Geometry.Point(_bf.x,_bf.y,this.world.crs);
}else{
if(_bf instanceof Geometry.Point){
_c0=_bf.copy().convertToCrs(this.world.crs);
}else{
throw new Error("Unknown geometry used to specify center.");
}
}
return _c0;
},gotoDefault:function(_c1){
if(this.defaultExtent){
this.setCenterScale(this.defaultExtent.center,this.defaultExtent.scale);
}else{
if(this.defaultBounds){
this.setBounds(this.defaultBounds);
}
}
},setBounds:function(_c2){
MapBuzz.databus.send(this,MapBuzz.View.SET_BOUNDS,{bounds:_c2});
},setCenterScale:function(_c3,_c4){
var _c5=this.getPoint(_c3);
MapBuzz.databus.send(this,MapBuzz.View.SET_CENTER_SCALE,{center:_c5,scale:_c4});
}});
namespace("MapBuzz.DataSource");
MapBuzz.DataSource.Layer=function DataSourceLayer(_c6,_c7){
this.dataSource=_c6;
this.surface=null;
this.name=_c7;
};
Object.extend(MapBuzz.DataSource.Layer.prototype,{getSurface:function(){
return this.surface;
},setSurface:function(_c8){
this.surface=_c8;
},show:function(){
this.surface.addLayer(this);
},hide:function(){
this.surface.removeLayer(this);
}});
MapBuzz.DataSource.Layer.prototype.toString=function toString(){
return "Layer ["+this.name+"]";
};
MapBuzz.DataSource.Layers=function DataSourceLayers(_c9,_ca){
this.name=_c9;
this.exclusive=_ca||false;
this.layers=new Array();
};
Object.extend(MapBuzz.DataSource.Layers.prototype,{add:function(_cb){
this.layers.push(_cb);
},show:function(){
for(var i=0;i<this.layers.length;i++){
this.layers[i].show();
}
},hide:function(){
for(var i=0;i<this.layers.length;i++){
this.layers[i].hide();
}
}});
MapBuzz.DataSource.Layers.prototype.toString=function toString(){
return "Layers ["+this.name+"]";
};
namespace("MapBuzz.DataSource");
MapBuzz.DataSource.GMapTypeLayer=function GoogleLayer(_ce,_cf){
this.mapType=_cf;
this.callSuper(arguments.callee,_ce,this.mapType.getName());
};
MapBuzz.DataSource.GMapTypeLayer.inherits(MapBuzz.DataSource.Layer);
MapBuzz.DataSource.GMapTypeLayer.prototype.toString=function toString(){
return "GMapTypeLayer ["+this.name+"]";
};
MapBuzz.DataSource.LayerManager=function DataSourceLayerManager(_d0){
this.view=_d0;
this.layers=new Array();
this.initialize();
};
Object.extend(MapBuzz.DataSource.LayerManager.prototype,{initialize:function(){
this.registerListeners();
},release:function(){
this.unregisterListeners();
},registerListeners:function(){
this.datasourceAfterAddListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_AFTER_ADD,function(_d1){
var _d2=_d1.data.dataSource;
if(_d2.dataSources.map===this.view.map&&_d2.getVisible()){
this.addLayers(_d1.data.dataSource.getLayers());
}
}.bind(this));
this.datasourceAfterRemoveListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_AFTER_REMOVE,function(_d3){
var _d4=_d3.data.dataSource;
if(_d4.dataSources.map===this.view.map){
this.removeLayers(_d3.data.dataSource.getLayers());
}
}.bind(this));
this.datasourceShowListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_SHOW,function(_d5){
var _d6=_d5.data.dataSource;
if(_d6.dataSources.map===this.view.map){
this.addLayers(_d5.data.dataSource.getLayers());
}
}.bind(this));
this.datasourceHideListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_HIDE,function(_d7){
var _d8=_d7.data.dataSource;
if(_d8.dataSources.map===this.view.map){
this.removeLayers(_d7.data.dataSource.getLayers());
}
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_AFTER_ADD,this.datasourceAfterAddListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_AFTER_REMOVE,this.datasourceAfterRemoveListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_SHOW,this.datasourceShowListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_HIDE,this.datasourceHideListener);
},addLayers:function(_d9){
this.layers.push(_d9);
if(this.view.initialized){
this.view.surfaces.addLayers(_d9);
}
},removeLayers:function(_da){
this.layers.remove(_da);
if(this.view.initialized&&_da.surface){
this.view.surfaces.removeLayers(_da);
}
}});
MapBuzz.DataSource.LayerManager.prototype.toString=function toString(){
return "Layer Manager";
};
namespace("MapBuzz.Figure");
MapBuzz.Figure.AbstractFigure=function AbstractFigure(_db,_dc,_dd){
this.figures=_db;
this.geom=_dc;
this.links=new MapBuzz.Atom.Links();
this.resource=_dd||MapBuzz.Resource.Local.instance;
this.collection=null;
this.shapes=new Array();
this.styles=new MapBuzz.Figure.Styles(this);
this.initialize();
};
Object.extend(MapBuzz.Figure.AbstractFigure.prototype,{initialize:function(){
},release:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].release();
}
this.shapes=new Array();
},toJSON:function(){
var _df={geom:this.geom,links:this.links,resource:this.resource,styles:this.styles};
return Object.toJSON(_df);
},getRoot:function(){
if(!this.collection){
return this;
}else{
return this.collection.getRoot();
}
},getInternalId:function(){
var _e0=null;
if(this.resource.uri){
var _e1=this.resource.uri.match(/\D*(\d*)$/);
if(_e1){
_e0=_e1[1];
}
}
return _e0;
},getShape:function(_e2){
var _e3=null;
for(var i=0;i<this.shapes.length;i++){
var _e5=this.shapes[i];
if(_e5.surface.view==_e2){
_e3=_e5;
break;
}
}
return _e3;
},display:function(_e6){
var _e7=this.figures.feature.dataSource;
var map=_e7.dataSources.map;
var _e9=new Array();
if(_e6&&_e6.supportsFigure(this)){
_e9.push(_e6);
}else{
if(!_e6){
var _ea=map.view.surfaces.findSurfaceByFigure(this);
if(_ea){
_e9.push(_ea);
}
}
}
for(var j=0;j<_e9.length;j++){
var _ec=_e9[j].createShape(this);
_ec.draw();
this.shapes.push(_ec);
}
},redisplay:function(_ed){
for(var i=0;i<this.shapes.length;i++){
var _ef=this.shapes[i];
if(_ed&&_ed!=_ef.surface){
continue;
}
_ef.redraw();
}
},undisplay:function(_f0){
var _f1=this.shapes;
this.shapes=new Array();
for(var i=0;i<_f1.length;i++){
var _f3=_f1[i];
if(_f0&&_f0!=_f3.surface){
continue;
}
_f3.release();
delete _f1[i];
}
for(var j=0;j<_f1.length;j++){
var _f5=_f1[j];
if(_f5){
this.shapes.push(_f5);
}
}
},getZIndex:function(){
return this.zIndex;
},setZIndex:function(_f6){
this.zIndex=_f6;
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].setZIndex(_f6);
}
},show:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].show();
}
},hide:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].hide();
}
},select:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].select();
}
},unselect:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].unselect();
}
},highlight:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].highlight();
}
},unhighlight:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].unhighlight();
}
},startEdit:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].startEdit();
}
},endEdit:function(){
for(var i=0;i<this.shapes.length;i++){
this.shapes[i].endEdit();
}
},transform:function(_100){
this.geom.transform(_100);
this.redisplay();
},getClassName:function(){
return this.figures.feature.getClassName();
},updateCommand:function(){
var root=this.getRoot();
if(root!==this){
return root.updateCommand();
}
var _102=new MapBuzz.Command.Functor("Update Figure",{execute:function(){
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:"Updating figure",level:MapBuzz.Message.PROCESSING});
var _103={accepts:MapBuzz.Mime.JSON,contentType:MapBuzz.Mime.JSON,postBody:MapBuzz.Figure.io.write(this,MapBuzz.Mime.JSON)};
return _103;
}.bind(this)});
return MapBuzz.Command.Build(_102,this.resource.putCommand(),new MapBuzz.Command.Message("Geometry successfully saved.",MapBuzz.Message.STATUS));
}});
MapBuzz.Figure.AbstractFigure.prototype.toString=function toString(){
return "[Figure "+this.getInternalId()+"]";
};
MapBuzz.Figure.Symbol=function FigureSymbol(_104,geom,_106){
this.callSuper(arguments.callee,_104,geom,_106);
};
MapBuzz.Figure.Symbol.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.Symbol,{WIDTH:22,HEIGHT:32,NORMAL_SYMBOL:"#markerSymbol"});
Object.extend(MapBuzz.Figure.Symbol.prototype,{createHandles:function(_107){
return new MapBuzz.Figure.PointHandleGroup(_107);
}});
MapBuzz.Figure.Image=function FigureImage(_108,geom,_10a){
this.applySuper(arguments);
};
MapBuzz.Figure.Image.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.Image,{WIDTH:32,HEIGHT:32});
Object.extend(MapBuzz.Figure.Image.prototype,{createHandles:function(_10b){
return new MapBuzz.Figure.PointHandleGroup(_10b);
},getIcon:function(_10c){
var _10d=this.figures.feature.iconAlbum;
var _10e=_10d.defaultGroup();
if(!_10e){
var _10f=this.figures.feature;
_10e=_10f.dataSource.defaultIcons[_10f.constructor.TYPE_CATEGORY];
}
return _10e.get(_10c);
}});
MapBuzz.Figure.LineString=function LineString(_110,geom,_112){
this.applySuper(arguments);
};
MapBuzz.Figure.LineString.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.LineString.prototype,{createHandles:function(_113){
return new MapBuzz.Figure.CoordsHandleGroup(_113);
}});
MapBuzz.Figure.Polygon=function FigurePolygon(_114,geom,_116){
this.applySuper(arguments);
};
MapBuzz.Figure.Polygon.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.Polygon.prototype,{createHandles:function(_117){
return new MapBuzz.Figure.CoordsHandleGroup(_117);
}});
MapBuzz.Figure.Envelope=function FigureEnvelope(_118,geom,_11a){
this.applySuper(arguments);
};
MapBuzz.Figure.Envelope.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.Envelope.prototype,{createHandles:function(_11b){
return new MapBuzz.Figure.EnvelopeHandleGroup(_11b);
}});
MapBuzz.Figure.Ellipse=function FigureEllipse(_11c,geom,_11e){
this.applySuper(arguments);
};
MapBuzz.Figure.Ellipse.inherits(MapBuzz.Figure.AbstractFigure);
MapBuzz.Figure.Note=function FigureNote(_11f,geom,_121){
this.applySuper(arguments);
this.styles.normal().width=MapBuzz.Figure.Note.DEFAULT_WIDTH;
this.styles.normal().height=MapBuzz.Figure.Note.DEFAULT_HEIGHT;
this.styles.normal().fontFamily=MapBuzz.Figure.Note.DEFAULT_FONT_FAMILY;
this.styles.normal().fontSize=MapBuzz.Figure.Note.DEFAULT_FONT_SIZE;
this.styles.normal().color=MapBuzz.Figure.Note.DEFAULT_COLOR;
};
MapBuzz.Figure.Note.inherits(MapBuzz.Figure.AbstractFigure);
MapBuzz.Figure.Note.DEFAULT_WIDTH=16;
MapBuzz.Figure.Note.DEFAULT_HEIGHT=3;
MapBuzz.Figure.Note.DEFAULT_FONT_FAMILY="Verdana,Tahoma,Geneva,sans-serif";
MapBuzz.Figure.Note.DEFAULT_FONT_SIZE="12pt";
MapBuzz.Figure.Note.DEFAULT_COLOR="#FF962B";
Object.extend(MapBuzz.Figure.Note.prototype,{createHandles:function(_122){
return new MapBuzz.Figure.PointHandleGroup(_122);
},getIcon:function(_123){
var _124=this.figures.feature.iconAlbum;
var _125=_124.defaultGroup();
return _125.get(_123);
}});
MapBuzz.Figure.Collection=function FigureCollection(_126,geom,_128){
this.applySuper(arguments);
};
MapBuzz.Figure.Collection.inherits(MapBuzz.Figure.AbstractFigure);
Object.extend(MapBuzz.Figure.Collection.prototype,{initialize:function(){
this.applySuper(arguments);
this.subFigures=new MapBuzz.Figure.Manager(this.figures.feature);
for(var i=0;i<this.geom.geoms.length;i++){
var _12a=this.subFigures.create(this.geom.geoms[i],this.resource);
_12a.collection=this;
}
},release:function(){
this.subFigures.release();
this.applySuper(arguments);
},display:function(){
this.subFigures.display();
},undisplay:function(){
this.subFigures.undisplay();
},select:function(){
this.subFigures.select();
},unselect:function(){
this.subFigures.unselect();
},highlight:function(){
this.subFigures.highlight();
},unhighlight:function(){
this.subFigures.unhighlight();
},startEdit:function(){
this.subFigures.startEdit();
},endEdit:function(){
this.subFigures.endEdit();
}});
namespace("MapBuzz.Figure");
MapBuzz.Figure.Styles=function FigureStyles(_12b){
this.figure=_12b;
this.styles=new HashTable();
this.styles[MapBuzz.Figure.Styles.NORMAL_STYLE]=new MapBuzz.Figure.Style();
this.styles[MapBuzz.Figure.Styles.HOVER_STYLE]=new MapBuzz.Figure.Style();
};
MapBuzz.Figure.Styles.NORMAL_STYLE="normal";
MapBuzz.Figure.Styles.HOVER_STYLE="hover";
Object.extend(MapBuzz.Figure.Styles.prototype,{toJSON:function(){
return Object.toJSON(this.styles);
},normal:function(){
return this.styles[MapBuzz.Figure.Styles.NORMAL_STYLE];
},hover:function(){
return this.styles[MapBuzz.Figure.Styles.HOVER_STYLE];
}});
MapBuzz.Figure.Styles.prototype.toString=function toString(){
return "Styles [ "+this.styles.toString()+"]";
};
MapBuzz.Figure.Style=function FigureStyle(data){
};
Object.extend(MapBuzz.Figure.Style.prototype,{update:function(data){
Object.extend(this,data);
},cssText:function(){
var _12e="";
for(var key in this){
var _130=this[key];
if(typeof _130!="function"){
_12e+=(key+": "+_130+"; ");
}
}
return _12e;
},toJSON:function(){
return Object.toJSON(this.cssText());
}});
MapBuzz.Figure.Style.prototype.toString=function toString(){
return "Style [ "+this.cssText()+"]";
};
MapBuzz.Figure.io=new MapBuzz.IO.Manager();
MapBuzz.Figure.io.writers[MapBuzz.Mime.JSON]=new MapBuzz.Figure.Json.Writer();
MapBuzz.Figure.HANDLESIZE=8;
MapBuzz.Figure.AbstractHandle=function AbstractHandle(_131){
this.shape=_131;
this.transform=new Geometry.AffineTransform();
};
Object.extend(MapBuzz.Figure.AbstractHandle.prototype,{getCursor:function(){
return "url(/cursors/handle_move.cur), auto";
},getCoord:function(geom){
NotImplementedError();
},getFigure:function(){
return this.shape.figure;
},isRemovable:function(){
return false;
},moveBy:function(_133,_134){
NotImplementedError();
}});
MapBuzz.Figure.CoordHandle=function CoordHandle(_135,_136){
this.callSuper(arguments.callee,_135);
this.index=_136;
};
MapBuzz.Figure.CoordHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.CoordHandle.prototype,{getCoord:function(){
var geom=this.shape.getHandleGeom();
return geom.coords.getCoord(this.index);
},isRemovable:function(){
return true;
},remove:function(){
var _138=this.getFigure();
_138.geom.coords.remove(this.index);
},moveBy:function(_139,_13a){
this.transform.e=_139;
this.transform.f=_13a;
this.updateGeom();
},updateGeom:function(){
var _13b=this.getCoord();
_13b.transform(this.transform);
var _13c=this.shape.surface.convertSurfaceToWorld(_13b.copy());
var _13d=this.getFigure();
_13d.geom.coords.update(this.index,_13c);
_13d.redisplay();
}});
MapBuzz.Figure.NorthHandle=function NorthHandle(_13e){
this.applySuper(arguments);
};
MapBuzz.Figure.NorthHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.NorthHandle.prototype,{getCursor:function(_13f){
return "n-resize";
},getCoord:function(){
var _140=this.shape.getHandleGeom().getBounds();
var x=_140.xMin+_140.width/2;
var y=_140.top;
return new Geometry.Coordinate(x,y);
},moveBy:function(_143,_144){
this.transform.e=_143;
this.transform.f=_144;
this.updateGeom();
},updateGeom:function(){
var _145=this.getCoord();
_145.transform(this.transform);
var _146=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_146.left,_146.right);
var xMax=Math.max(_146.left,_146.right);
var yMin=Math.min(_146.bottom,_145.y);
var yMax=Math.max(_146.bottom,_145.y);
_146.setBounds(xMin,yMin,xMax,yMax);
var _14b=this.shape.surface.convertSurfaceToWorld(_146);
var _14c=this.getFigure();
_14c.geom.setBounds(_14b.xMin,_14b.yMin,_14b.xMax,_14b.yMax);
_14c.redisplay();
}});
MapBuzz.Figure.NEHandle=function NEHandle(_14d){
this.applySuper(arguments);
};
MapBuzz.Figure.NEHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.NEHandle.prototype,{getCursor:function(_14e){
return "ne-resize";
},getCoord:function(){
var _14f=this.shape.getHandleGeom().getBounds();
var x=_14f.right;
var y=_14f.top;
return new Geometry.Coordinate(x,y);
},moveBy:function(_152,_153){
this.transform.e=_152;
this.transform.f=_153;
this.updateGeom();
},updateGeom:function(){
var _154=this.getCoord();
_154.transform(this.transform);
var _155=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_155.left,_154.x);
var xMax=Math.max(_155.left,_154.x);
var yMin=Math.min(_155.bottom,_154.y);
var yMax=Math.max(_155.bottom,_154.y);
_155.setBounds(xMin,yMin,xMax,yMax);
var _15a=this.shape.surface.convertSurfaceToWorld(_155);
var _15b=this.getFigure();
_15b.geom.setBounds(_15a.xMin,_15a.yMin,_15a.xMax,_15a.yMax);
_15b.redisplay();
}});
MapBuzz.Figure.EastHandle=function EastHandle(_15c){
this.applySuper(arguments);
};
MapBuzz.Figure.EastHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.EastHandle.prototype,{getCursor:function(_15d){
return "e-resize";
},getCoord:function(){
var _15e=this.shape.getHandleGeom().getBounds();
var x=_15e.right;
var y=_15e.yMin+_15e.height/2;
return new Geometry.Coordinate(x,y);
},moveBy:function(_161,_162){
this.transform.e=_161;
this.transform.f=_162;
this.updateGeom();
},updateGeom:function(){
var _163=this.getCoord();
_163.transform(this.transform);
var _164=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_164.left,_163.x);
var xMax=Math.max(_164.left,_163.x);
var yMin=Math.min(_164.bottom,_164.top);
var yMax=Math.max(_164.bottom,_164.top);
_164.setBounds(xMin,yMin,xMax,yMax);
var _169=this.shape.surface.convertSurfaceToWorld(_164);
var _16a=this.getFigure();
_16a.geom.setBounds(_169.xMin,_169.yMin,_169.xMax,_169.yMax);
_16a.redisplay();
}});
MapBuzz.Figure.SEHandle=function SEHandle(_16b){
this.applySuper(arguments);
};
MapBuzz.Figure.SEHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.SEHandle.prototype,{getCursor:function(_16c){
return "se-resize";
},getCoord:function(){
var _16d=this.shape.getHandleGeom().getBounds();
var x=_16d.right;
var y=_16d.bottom;
return new Geometry.Coordinate(x,y);
},moveBy:function(_170,_171){
this.transform.e=_170;
this.transform.f=_171;
this.updateGeom();
},updateGeom:function(){
var _172=this.getCoord();
_172.transform(this.transform);
var _173=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_173.left,_172.x);
var xMax=Math.max(_173.left,_172.x);
var yMin=Math.min(_172.y,_173.top);
var yMax=Math.max(_172.y,_173.top);
_173.setBounds(xMin,yMin,xMax,yMax);
var _178=this.shape.surface.convertSurfaceToWorld(_173);
var _179=this.getFigure();
_179.geom.setBounds(_178.xMin,_178.yMin,_178.xMax,_178.yMax);
_179.redisplay();
}});
MapBuzz.Figure.SouthHandle=function SouthHandle(_17a){
this.applySuper(arguments);
};
MapBuzz.Figure.SouthHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.SouthHandle.prototype,{getCursor:function(_17b){
return "s-resize";
},getCoord:function(){
var _17c=this.shape.getHandleGeom().getBounds();
var x=_17c.xMin+_17c.width/2;
var y=_17c.bottom;
return new Geometry.Coordinate(x,y);
},moveBy:function(_17f,_180){
this.transform.e=_17f;
this.transform.f=_180;
this.updateGeom();
},updateGeom:function(){
var _181=this.getCoord();
_181.transform(this.transform);
var _182=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_182.left,_182.right);
var xMax=Math.max(_182.left,_182.right);
var yMin=Math.min(_181.y,_182.top);
var yMax=Math.max(_181.y,_182.top);
_182.setBounds(xMin,yMin,xMax,yMax);
var _187=this.shape.surface.convertSurfaceToWorld(_182);
var _188=this.getFigure();
_188.geom.setBounds(_187.xMin,_187.yMin,_187.xMax,_187.yMax);
_188.redisplay();
}});
MapBuzz.Figure.SWHandle=function SWHandle(_189){
this.applySuper(arguments);
};
MapBuzz.Figure.SWHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.SWHandle.prototype,{getCursor:function(_18a){
return "sw-resize";
},getCoord:function(){
var _18b=this.shape.getHandleGeom().getBounds();
var x=_18b.left;
var y=_18b.bottom;
return new Geometry.Coordinate(x,y);
},moveBy:function(_18e,_18f){
this.transform.e=_18e;
this.transform.f=_18f;
this.updateGeom();
},updateGeom:function(){
var _190=this.getCoord();
_190.transform(this.transform);
var _191=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_190.x,_191.right);
var xMax=Math.max(_190.x,_191.right);
var yMin=Math.min(_190.y,_191.top);
var yMax=Math.max(_190.y,_191.top);
_191.setBounds(xMin,yMin,xMax,yMax);
var _196=this.shape.surface.convertSurfaceToWorld(_191);
var _197=this.getFigure();
_197.geom.setBounds(_196.xMin,_196.yMin,_196.xMax,_196.yMax);
_197.redisplay();
}});
MapBuzz.Figure.WestHandle=function WestHandle(_198){
this.applySuper(arguments);
};
MapBuzz.Figure.WestHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.WestHandle.prototype,{getCursor:function(_199){
return "w-resize";
},getCoord:function(){
var _19a=this.shape.getHandleGeom().getBounds();
var x=_19a.left;
var y=_19a.yMin+_19a.height/2;
return new Geometry.Coordinate(x,y);
},moveBy:function(_19d,_19e){
this.transform.e=_19d;
this.transform.f=_19e;
this.updateGeom();
},updateGeom:function(){
var _19f=this.getCoord();
_19f.transform(this.transform);
var _1a0=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_19f.x,_1a0.right);
var xMax=Math.max(_19f.x,_1a0.right);
var yMin=Math.min(_1a0.bottom,_1a0.top);
var yMax=Math.max(_1a0.bottom,_1a0.top);
_1a0.setBounds(xMin,yMin,xMax,yMax);
var _1a5=this.shape.surface.convertSurfaceToWorld(_1a0);
var _1a6=this.getFigure();
_1a6.geom.setBounds(_1a5.xMin,_1a5.yMin,_1a5.xMax,_1a5.yMax);
_1a6.redisplay();
}});
MapBuzz.Figure.NWHandle=function NWHandle(_1a7){
this.applySuper(arguments);
};
MapBuzz.Figure.NWHandle.inherits(MapBuzz.Figure.AbstractHandle);
Object.extend(MapBuzz.Figure.NWHandle.prototype,{getCursor:function(_1a8){
return "nw-resize";
},getCoord:function(){
var _1a9=this.shape.getHandleGeom().getBounds();
var x=_1a9.left;
var y=_1a9.top;
return new Geometry.Coordinate(x,y);
},moveBy:function(_1ac,_1ad){
this.transform.e=_1ac;
this.transform.f=_1ad;
this.updateGeom();
},updateGeom:function(){
var _1ae=this.getCoord();
_1ae.transform(this.transform);
var _1af=this.shape.getHandleGeom().getBounds();
var xMin=Math.min(_1ae.x,_1af.right);
var xMax=Math.max(_1ae.x,_1af.right);
var yMin=Math.min(_1af.bottom,_1ae.y);
var yMax=Math.max(_1af.bottom,_1ae.y);
_1af.setBounds(xMin,yMin,xMax,yMax);
var _1b4=this.shape.surface.convertSurfaceToWorld(_1af);
var _1b5=this.getFigure();
_1b5.geom.setBounds(_1b4.xMin,_1b4.yMin,_1b4.xMax,_1b4.yMax);
_1b5.redisplay();
}});
MapBuzz.Figure.CenterHandle=function CenterHandle(_1b6){
this.applySuper(arguments);
};
MapBuzz.Figure.CenterHandle.inherits(MapBuzz.Figure.AbstractHandle);
MapBuzz.Figure.PointHandleGroup=function PointHandleGroup(_1b7){
this.shape=_1b7;
this.handles=new Array();
};
MapBuzz.Figure.CoordsHandleGroup=function CoordsHandleGroup(_1b8){
this.shape=_1b8;
this.handles=new Array();
this.createHandles();
};
Object.extend(MapBuzz.Figure.CoordsHandleGroup.prototype,{createHandles:function(){
var geom=this.shape.getHandleGeom();
for(var i=0;i<geom.coords.getNumberOfCoords();i++){
this.handles.push(new MapBuzz.Figure.CoordHandle(this.shape,i));
}
}});
MapBuzz.Figure.EnvelopeHandleGroup=function EnvelopeHandleGroup(_1bb){
this.shape=_1bb;
this.handles=new Array();
this.createHandles();
};
Object.extend(MapBuzz.Figure.EnvelopeHandleGroup.prototype,{createHandles:function(){
this.handles.push(new MapBuzz.Figure.NWHandle(this.shape));
this.handles.push(new MapBuzz.Figure.NorthHandle(this.shape));
this.handles.push(new MapBuzz.Figure.NEHandle(this.shape));
this.handles.push(new MapBuzz.Figure.EastHandle(this.shape));
this.handles.push(new MapBuzz.Figure.SEHandle(this.shape));
this.handles.push(new MapBuzz.Figure.SouthHandle(this.shape));
this.handles.push(new MapBuzz.Figure.SWHandle(this.shape));
this.handles.push(new MapBuzz.Figure.WestHandle(this.shape));
}});
MapBuzz.Figure.EditorSEResizeHandle=function EditorSEResizeHandle(_1bc){
this.editor=_1bc;
this.transform=new Geometry.AffineTransform();
};
Object.extend(MapBuzz.Figure.EditorSEResizeHandle.prototype,{getCursor:function(){
return "se-resize";
},getCoord:function(){
var _1bd=this.editor.getBounds();
var x=_1bd.right;
var y=_1bd.bottom;
return new Geometry.Coordinate(x,y);
},moveBy:function(_1c0,_1c1){
this.transform.e=_1c0;
this.transform.f=_1c1;
this.updateGeom();
},updateGeom:function(){
var _1c2=this.getCoord();
_1c2.transform(this.transform);
var _1c3=this.editor.getBounds().copy();
var _1c4=_1c3.width;
var _1c5=_1c3.height;
var xMin=Math.min(_1c3.left,_1c2.x);
var xMax=Math.max(_1c3.left,_1c2.x);
var yMin=Math.min(_1c3.top,_1c2.y);
var yMax=Math.max(_1c3.top,_1c2.y);
_1c3.setBounds(xMin,yMin,xMax,yMax);
this.editor.setBounds(_1c3);
},getFigure:function(){
return this.editor;
}});
namespace("MapBuzz.Figure");
MapBuzz.Figure.Manager=function FigureManager(_1ca){
this.feature=_1ca;
this.values=new Array();
};
Object.extend(MapBuzz.Figure.Manager.prototype,{initialize:function(){
},release:function(){
for(var i=0;i<this.values.length;i++){
this.values[i].release();
}
this.values=new Array();
},create:function(geom,_1cd){
var _1ce=this.feature.getFigureFactory();
var _1cf=_1ce.create(this,geom,_1cd);
this.add(_1cf);
return _1cf;
},add:function(_1d0){
this.values.push(_1d0);
return _1d0;
},remove:function(_1d1){
_1d1=this.values.remove(_1d1);
if(_1d1){
_1d1.release();
}
},display:function(_1d2){
for(var i=0;i<this.values.length;i++){
this.values[i].display(_1d2);
}
},redisplay:function(_1d4){
for(var i=0;i<this.values.length;i++){
this.values[i].redisplay(_1d4);
}
},undisplay:function(_1d6){
for(var i=0;i<this.values.length;i++){
this.values[i].undisplay(_1d6);
}
},select:function(){
for(var i=0;i<this.values.length;i++){
var _1d9=this.values[i];
_1d9.select();
}
},unselect:function(){
for(var i=0;i<this.values.length;i++){
var _1db=this.values[i];
_1db.unselect();
}
},highlight:function(){
for(var i=0;i<this.values.length;i++){
var _1dd=this.values[i];
_1dd.highlight();
}
},unhighlight:function(){
for(var i=0;i<this.values.length;i++){
var _1df=this.values[i];
_1df.unhighlight();
}
},bounds:function(){
var _1e0=null;
for(var i=0;i<this.values.length;i++){
var _1e2=this.values[i];
var _1e3=_1e2.geom.getBounds();
_1e0=_1e0?_1e0.union(_1e3):_1e3;
}
return _1e0;
}});
MapBuzz.Figure.Factory=function FigureFactory(){
this.mappings=new HashTable();
};
Object.extend(MapBuzz.Figure.Factory.prototype,{create:function(_1e4,geom,_1e6){
var _1e7=this.mappings[geom.getGeomTypeId()];
if(!_1e7){
throw new Error("Geometry type not supported: "+geom.getGeomType()+".");
}
return new _1e7(_1e4,geom,_1e6);
}});
MapBuzz.Figure.Factory.instance=new MapBuzz.Figure.Factory();
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Point]=MapBuzz.Figure.Image;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.LineString]=MapBuzz.Figure.LineString;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Envelope]=MapBuzz.Figure.Envelope;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Ellipse]=MapBuzz.Figure.Ellipse;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Polygon]=MapBuzz.Figure.Polygon;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Text]=MapBuzz.Figure.Note;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.Collection]=MapBuzz.Figure.Collection;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.MultiPoint]=MapBuzz.Figure.Collection;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.MultiLineString]=MapBuzz.Figure.Collection;
MapBuzz.Figure.Factory.instance.mappings[Geometry.GeometryTypes.MultiPolygon]=MapBuzz.Figure.Collection;
namespace("MapBuzz.Feature");
MapBuzz.Feature.Factory=function FeatureFactory(_1e8,_1e9){
this.dataSource=_1e8;
this.typeCategory=_1e9;
};
Object.extend(MapBuzz.Feature.Factory,{constructors:new HashTable(),register:function(_1ea){
MapBuzz.Feature.Factory.constructors[_1ea.TYPE_CATEGORY.uri()]=_1ea;
},unregister:function(_1eb){
delete MapBuzz.Feature.Factory.constructors[_1eb.TYPE_CATEGORY.uri()];
}});
Object.extend(MapBuzz.Feature.Factory.prototype,{getConstructor:function(_1ec){
return MapBuzz.Feature.Factory.constructors[_1ec];
},create:function(_1ed){
_1ed=_1ed||this.typeCategory.id();
var _1ee=this.getConstructor(_1ed);
return new _1ee(this.dataSource);
}});
namespace("MapBuzz.Feature");
MapBuzz.Feature.Abstract=function AbstractFeature(_1ef){
this.dataSource=_1ef;
this.resource=MapBuzz.Resource.Local.instance;
this.categories=new HashTable();
this.title=null;
this.figures=new MapBuzz.Figure.Manager(this);
this.id=null;
this.content=null;
this.links=new MapBuzz.Atom.Links();
this.addCategory(this.constructor.TYPE_CATEGORY);
this.author=MapBuzz.user;
this.iconAlbum=new MapBuzz.Media.Album(MapBuzz.Resource.Local.instance,MapBuzz.Editor.ImageBrowser.DEFAULT_RESOURCE,MapBuzz.Media.Album.ICON_TYPE);
this.images=new MapBuzz.Media.Album(MapBuzz.Resource.Local.instance,MapBuzz.Editor.ImageBrowser.DEFAULT_RESOURCE,MapBuzz.Media.Album.IMAGE_TYPE);
this.initialize();
};
Object.extend(MapBuzz.Feature.Abstract.prototype,{});
Object.extend(MapBuzz.Feature.Abstract.prototype,{initialize:function(){
},release:function(){
this.figures.release();
},releaseCommand:function(_1f0){
return new MapBuzz.Command.Functor("Release Feature",{execute:this.release.bind(this)});
},copy:function(_1f1){
if(!(_1f1 instanceof this.constructor)){
throw new Error("Cannot copy an object of a different type.  Object: "+_1f1.toString());
}
this.figures.release();
Object.extend(this,_1f1);
this.figures.feature=this;
this.figures.display();
return this;
},copyCommand:function(){
return new MapBuzz.Command.Functor("Copy Feature",{execute:this.copy.bind(this)});
},getFigureFactory:function(){
return MapBuzz.Figure.Factory.instance;
},addCategory:function(_1f2){
var _1f3=this.getCategories(_1f2.scheme);
if(!_1f3){
_1f3=this.categories[_1f2.scheme]=new Array();
}
_1f3.push(_1f2);
},getCategories:function(_1f4){
return this.categories[_1f4];
},setCategories:function(_1f5,_1f6){
return this.categories[_1f5]=_1f6;
},clearCategories:function(_1f7){
return this.categories[_1f7]=new Array();
},setTitle:function(_1f8){
this.title=_1f8;
},getToolTipPanel:function(){
var map=this.dataSource.dataSources.map;
if(map.world.crs.constructor.EPSG==-1){
return new MapBuzz.UI.ToolTipInsidePanel(this);
}else{
return new MapBuzz.UI.ToolTipPanel(this);
}
},getBounds:function(){
var _1fa=null;
var _1fb=this.figures.values;
for(var i=0;i<_1fb.length;i++){
var _1fd=_1fb[i].geom.getBounds();
if(!_1fa){
_1fa=_1fd;
}else{
_1fa=_1fa.union(_1fd);
}
}
return _1fd;
},isNew:function(){
return (this.id==null);
},isReadOnly:function(){
return !this.dataSource.resource.isUpdatable()||(!this.resource.isUpdatable()&&!this.isNew());
},openEditor:function(_1fe,_1ff,_200,_201){
NotImplementedError();
},openTooltip:function(_202,_203){
var _204=this.figures.values[0];
if(_204&&!_202){
_202=_204.shapes[0];
}
if(_202&&!_203){
_203=_202.getViewGeom().getCenter();
}
if(_202&&_203){
var _205=this.getToolTipPanel();
this.tooltip=new MapBuzz.Editor.TooltipViewer(_205);
this.tooltip.open(_202,_203);
}
return this.tooltip;
},getHintPanel:function(){
},getClassName:function(){
return "feature";
},highlight:function(){
for(var i=0;i<this.figures.values.length;i++){
this.figures.values[i].highlight();
}
},unhighlight:function(){
for(var i=0;i<this.figures.values.length;i++){
this.figures.values[i].unhighlight();
}
},updateCommand:function(){
NotImplementedError();
},removeCommand:function(){
NotImplementedError();
}});
MapBuzz.Feature.Abstract.prototype.toString=function toString(){
return "Feature";
};
namespace("MapBuzz.Feature");
MapBuzz.Feature.MapBuzz=function MapBuzzFeature(_208){
this.author=new MapBuzz.Atom.Person("","",false);
this.replies=new MapBuzz.Atom.Replies();
this.ranks=new MapBuzz.Rank.MapBuzz();
this.applySuper(arguments);
};
MapBuzz.Feature.MapBuzz.inherits(MapBuzz.Feature.Abstract);
MapBuzz.Feature.MapBuzz.TAG_SCHEME="http://www.mapbuzz.com/tag";
MapBuzz.Feature.MapBuzz.TYPE_SCHEME="http://www.mapbuzz.com/item/type";
MapBuzz.Feature.MapBuzz.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.MapBuzz.TYPE_SCHEME,"feature","Feature");
MapBuzz.Feature.MapBuzz.PREVIOUS_TITLE="New Feature";
MapBuzz.Feature.MapBuzz.PREVIOUS_TAGS=null;
Object.extend(MapBuzz.Feature.MapBuzz.prototype,{initialize:function(){
this.title=this.constructor.PREVIOUS_TITLE;
this.setupCategories();
this.setupRanks();
},setupCategories:function(){
if(!this.constructor.PREVIOUS_TAGS&&MapBuzz.user.isAuthenticated()){
var _209=new MapBuzz.Atom.Category(this.constructor.TAG_SCHEME,MapBuzz.user.name);
this.constructor.PREVIOUS_TAGS=[_209];
}
},setupRanks:function(){
var rank=new MapBuzz.Rank.Rank(MapBuzz.Rank.MapBuzz.RANK_AVERAGE_SCHEME,0,"all",null);
this.ranks.add(rank);
rank=new MapBuzz.Rank.Rank(MapBuzz.Rank.MapBuzz.RANK_RATINGS_SCHEME,0,"buzzes",null);
this.ranks.add(rank);
if(MapBuzz.user.isAuthenticated()){
rank=new MapBuzz.Rank.Rank(MapBuzz.Rank.MapBuzz.RANK_USER_SCHEME,0,"user",null);
this.ranks.add(rank);
}
},setTitle:function(_20b){
this.applySuper(arguments);
this.constructor.PREVIOUS_TITLE=_20b;
},getTags:function(){
var _20c=this.getCategories(this.constructor.TAG_SCHEME);
if(!_20c&&this.isNew()&&this.constructor.PREVIOUS_TAGS){
_20c=this.constructor.PREVIOUS_TAGS.slice();
this.setTags(_20c);
}
return _20c;
},setTags:function(_20d){
if(this.isNew()&&this.constructor.PREVIOUS_TAGS){
this.constructor.PREVIOUS_TAGS=_20d.slice();
}
this.setCategories(this.constructor.TAG_SCHEME,_20d);
},openEditor:function(_20e,_20f,_210,_211){
var _212=null;
if(this.isNew()){
_212=new MapBuzz.Editor.FeatureCreator(this);
}else{
if(!this.isNew()&&!this.isReadOnly()){
_212=new MapBuzz.Editor.FeatureEditor(this);
}else{
_212=new MapBuzz.Editor.FeatureViewer(this);
}
}
return _212.open(_20e,_20f,_210,_211);
},updateCommand:function(){
var _213=new MapBuzz.Command.Functor("Update Feature",{execute:function(){
var _214={accept:[MapBuzz.Mime.ATOM.ENTRY,MapBuzz.Mime.JSON].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.dataSource.io.write(this,MapBuzz.Mime.ATOM)};
return _214;
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Updating feature",MapBuzz.Message.PROCESSING),_213,this.resource.putCommand(),this.dataSource.io.readCommand(),this.copyCommand(),new MapBuzz.Command.Message("Successfully saved feature.",MapBuzz.Message.STATUS));
},removeCommand:function(){
var _215=new MapBuzz.Command.Functor("Remove Feature",{execute:function(){
var _216=window.confirm("Are you sure you want to delete this feature?");
if(!_216){
throw new MapBuzz.Command.Canceled();
}else{
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:"Deleting feature",level:MapBuzz.Message.PROCESSING});
}
}.bind(this)});
return MapBuzz.Command.Build(_215,new MapBuzz.Command.Message("Removing feature",MapBuzz.Message.PROCESSING),this.resource.deleteCommand(),this.releaseCommand(),new MapBuzz.Command.Message("Successfully removed feature.",MapBuzz.Message.STATUS));
}});
MapBuzz.Feature.MapBuzz.prototype.toString=function toString(){
var _217="Feature ["+"Title: "+this.title+", "+"Id: "+this.id+"]";
return _217;
};
MapBuzz.Feature.Factory.register(MapBuzz.Feature.MapBuzz);
MapBuzz.Feature.Note=function Note(_218,_219){
this.replies=new MapBuzz.Atom.Replies();
this.applySuper(arguments);
};
MapBuzz.Feature.Note.inherits(MapBuzz.Feature.Abstract);
MapBuzz.Feature.Note.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.MapBuzz.TYPE_SCHEME,"note","Note");
Object.extend(MapBuzz.Feature.Note.prototype,{initialize:function(){
this.applySuper(arguments);
this.title="Note";
this.content="Click here to edit this note";
},getFigureFactory:function(){
return MapBuzz.Feature.Note.figureFactory;
},getToolTipPanel:function(){
return null;
},openEditor:function(_21a,_21b,_21c,_21d){
var _21e=null;
if(this.isReadOnly()){
_21e=new MapBuzz.Editor.NoteViewer(this);
}else{
_21e=new MapBuzz.Editor.NoteEditor(this);
}
return _21e.open(_21a,_21b,_21c,_21d);
},updateCommand:function(){
var _21f=new MapBuzz.Command.Functor("Update Note",{execute:function(){
var _220={accept:[MapBuzz.Mime.JSON,MapBuzz.Mime.ATOM.ENTRY].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.dataSource.io.write(this,MapBuzz.Mime.ATOM)};
return _220;
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Updating note",MapBuzz.Message.PROCESSING),_21f,this.resource.putCommand(),this.dataSource.io.readCommand(),this.copyCommand(),new MapBuzz.Command.Message("Successfully saved note.",MapBuzz.Message.STATUS));
},removeCommand:function(){
var _221=new MapBuzz.Command.Functor("Remove Note",{execute:function(){
var _222=window.confirm("Are you sure you want to delete this note?");
if(!_222){
throw new MapBuzz.Command.Canceled();
}
this.figures.undisplay();
}.bind(this)});
return MapBuzz.Command.Build(_221,new MapBuzz.Command.Message("Removing note",MapBuzz.Message.PROCESSING),this.resource.deleteCommand(),this.releaseCommand(),new MapBuzz.Command.Message("Successfully removed note.",MapBuzz.Message.STATUS));
}});
MapBuzz.Feature.Note.prototype.toString=function toString(){
var _223="Note ["+"Title: "+this.title+", "+"Id: "+this.id+", "+"]";
return _223;
};
MapBuzz.Feature.Factory.register(MapBuzz.Feature.Note);
MapBuzz.Feature.Note.figureFactory=new MapBuzz.Figure.Factory();
MapBuzz.Feature.Note.figureFactory.mappings[Geometry.GeometryTypes.Point]=MapBuzz.Figure.Note;
MapBuzz.Feature.Yelp=function Yelp(_224,_225){
this.applySuper(arguments);
this.address=new MapBuzz.Atom.Address();
var _226=new Geometry.Point(null,null,Geometry.CrsFactory.instance.latLongCrs());
this.figures.create(_226);
};
MapBuzz.Feature.Yelp.inherits(MapBuzz.Feature.Abstract);
MapBuzz.Feature.Yelp.DEFAULT_ICON=new MapBuzz.Atom.Icon("/icons_production/icon_4_64.png",4);
Object.extend(MapBuzz.Feature.Yelp.prototype,{openEditor:function(_227,_228,_229,_22a){
var _22b=new MapBuzz.Feature.YelpViewer(this);
return _22b.open(_227,_228,_229,_22a);
}});
MapBuzz.Feature.Yelp.prototype.toString=function toString(){
var _22c="Yelp ["+"Title: "+this.title+"]";
return _22c;
};
MapBuzz.Feature.YelpFactory=function YelpFactory(_22d){
this.dataSource=_22d;
};
Object.extend(MapBuzz.Feature.YelpFactory.prototype,{create:function(){
return new MapBuzz.Feature.Yelp(this.dataSource);
}});
namespace("MapBuzz.Feature");
MapBuzz.Feature.Event=function MapBuzzEvent(_22e){
this.venue=null;
this.start=new Date();
this.end=new Date(this.start.getTime()+Date.MILLISECONDS_PER_HOUR);
this.applySuper(arguments);
};
MapBuzz.Feature.Event.inherits(MapBuzz.Feature.MapBuzz);
MapBuzz.Feature.Event.SET_TIME="EVENT_SET_TIME";
MapBuzz.Feature.Event.TAG_SCHEME="http://www.mapbuzz.com/tag";
MapBuzz.Feature.Event.TYPE_SCHEME="http://www.mapbuzz.com/item/type";
MapBuzz.Feature.Event.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.Event.TYPE_SCHEME,"event","Event");
MapBuzz.Feature.Event.PREVIOUS_TITLE="New Event";
MapBuzz.Feature.Event.PREVIOUS_TAGS=null;
Object.extend(MapBuzz.Feature.Event.prototype,{getToolTipPanel:function(){
return new MapBuzz.UI.ToolTipEventPanel(this);
},formatDayString:function(date){
var _230=null;
if(date.isToday()){
_230="Today";
}else{
if(date.isTomorrow()){
_230="Tomorrow";
}else{
if(date.isThisWeek()){
_230=date.strftime("%A");
}else{
if(date.isThisYear()){
_230=date.strftime("%A, %B %e");
}else{
_230=date.strftime("%B %e, %Y");
}
}
}
}
return _230;
},timeString:function(date){
return date.strftime("%l:%M %p");
},toWhenString:function(){
if(!this.start){
return "Event start time is not specified";
}
var _232=this.formatDayString(this.start);
if(!this.end||this.start.getTime()==this.end.getTime()){
_232+=" at ";
_232+=this.timeString(this.start);
}else{
if(this.start.isSameDay(this.end)){
_232+=" from ";
_232+=this.timeString(this.start);
_232+=" to ";
_232+=this.timeString(this.end);
}else{
_232+=" at ";
_232+=this.timeString(this.start);
_232+=" to ";
_232+=this.formatDayString(this.end);
_232+=" at ";
_232+=this.timeString(this.end);
}
}
return _232;
},openEditor:function(_233,_234,_235,_236){
var _237=null;
if(this.isNew()){
_237=new MapBuzz.Editor.EventCreator(this);
}else{
if(!this.isNew()&&!this.isReadOnly()){
_237=new MapBuzz.Editor.EventEditor(this);
}else{
_237=new MapBuzz.Editor.EventViewer(this);
}
}
return _237.open(_233,_234,_235,_236);
}});
MapBuzz.Feature.Event.prototype.toString=function toString(){
var _238="Event ["+"Title: "+this.title+", "+"Id: "+this.id+"]";
return _238;
};
MapBuzz.Feature.Factory.register(MapBuzz.Feature.Event);
namespace("MapBuzz.Feature");
MapBuzz.Feature.MapBuzzMap=function MapBuzzMap(_239){
this.author=new MapBuzz.Atom.Person("","",false);
this.replies=new MapBuzz.Atom.Replies();
this.ranks=new MapBuzz.Rank.MapBuzz();
this.applySuper(arguments);
};
MapBuzz.Feature.MapBuzzMap.inherits(MapBuzz.Feature.Abstract);
MapBuzz.Feature.MapBuzzMap.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.MapBuzz.TYPE_SCHEME,"map","Map");
Object.extend(MapBuzz.Feature.MapBuzzMap.prototype,{initialize:function(){
},getTags:function(){
return this.getCategories(MapBuzz.Feature.MapBuzz.TAG_SCHEME);
},setTags:function(_23a){
this.setCategories(MapBuzz.Feature.MapBuzz.TAG_SCHEME,_23a);
},openEditor:function(_23b,_23c,_23d,_23e){
if(!this.alternateResource){
return;
}
window.location=this.alternateResource.uri;
}});
MapBuzz.Feature.MapBuzzMap.prototype.toString=function toString(){
var _23f="Map ["+"Title: "+this.title+", "+"Id: "+this.id+"]";
return _23f;
};
MapBuzz.Feature.Factory.register(MapBuzz.Feature.MapBuzzMap);
namespace("MapBuzz.Feature");
MapBuzz.Feature.Exhibitor=function MapBuzzExhibitor(_240){
this.applySuper(arguments);
this.booth=null;
};
MapBuzz.Feature.Exhibitor.inherits(MapBuzz.Feature.MapBuzz);
MapBuzz.Feature.Exhibitor.TAG_SCHEME="http://www.mapbuzz.com/tag";
MapBuzz.Feature.Exhibitor.TYPE_SCHEME="http://www.mapbuzz.com/item/type";
MapBuzz.Feature.Exhibitor.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.Exhibitor.TYPE_SCHEME,"exhibitor","Exhibitor");
MapBuzz.Feature.Exhibitor.PREVIOUS_TITLE="New Exhibitor";
MapBuzz.Feature.Exhibitor.PREVIOUS_TAGS=null;
MapBuzz.Feature.Factory.register(MapBuzz.Feature.Exhibitor);
Object.extend(MapBuzz.Feature.Exhibitor.prototype,{getToolTipPanel:function(){
return new MapBuzz.UI.ToolTipExhibitorPanel(this);
},getToolTipText:function(){
var _241=this.title;
if(this.booth){
_241=_241+" ("+this.booth+")";
}
return _241;
},openEditor:function(_242,_243,_244,_245){
var _246=new MapBuzz.Editor.ExhibitorViewer(this);
return _246.open(_242,_243,_244,_245);
}});
namespace("MapBuzz.Feature");
MapBuzz.Feature.Booth=function MapBuzzBooth(_247){
this.applySuper(arguments);
};
MapBuzz.Feature.Booth.inherits(MapBuzz.Feature.MapBuzz);
MapBuzz.Feature.Booth.TAG_SCHEME="http://www.mapbuzz.com/tag";
MapBuzz.Feature.Booth.TYPE_SCHEME="http://www.mapbuzz.com/item/type";
MapBuzz.Feature.Booth.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.Booth.TYPE_SCHEME,"booth","Booth");
Object.extend(MapBuzz.Feature.Booth,{BOOTH_AFTER_ADD:"BOOTH_AFTER_ADD"});
MapBuzz.Feature.Booth.PREVIOUS_TITLE="New Booth";
MapBuzz.Feature.Booth.PREVIOUS_TAGS=null;
Object.extend(MapBuzz.Feature.Booth.prototype,{myBooth:function(){
if(this.dataSource.options.exhibitor_id&&this.product.exhibitor&&this.product.exhibitor.uri){
var id=parseInt(this.product.exhibitor.uri.match(/\d*$/));
if(id==this.dataSource.options.exhibitor_id){
return true;
}
}
return false;
},copy:function(_249){
this.applySuper(arguments);
MapBuzz.databus.send(this,MapBuzz.Feature.Booth.BOOTH_AFTER_ADD,{booth:this});
return this;
},updateCommand:function(){
var _24a=new MapBuzz.Command.Functor("Select Booth",{execute:function(){
var _24b={accept:[MapBuzz.Mime.ATOM.ENTRY,MapBuzz.Mime.JSON].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.dataSource.io.write(this,MapBuzz.Mime.ATOM)};
if(this.dataSource.options.exhibitor_id){
_24b["parameters"]="exhibitor_id="+this.dataSource.options.exhibitor_id;
}
if(this.dataSource.options.order_id){
_24b["parameters"]="order_id="+this.dataSource.options.order_id;
}
return _24b;
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Selecting Booth",MapBuzz.Message.PROCESSING),_24a,this.resource.putCommand(),this.dataSource.io.readCommand(),this.copyCommand(),new MapBuzz.Command.Message("Successfully selected booth.",MapBuzz.Message.STATUS));
},removeCommand:function(){
var _24c=new MapBuzz.Command.Functor("Remove Booth",{execute:function(){
var _24d={accept:[MapBuzz.Mime.ATOM.ENTRY,MapBuzz.Mime.JSON].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.dataSource.io.write(this,MapBuzz.Mime.ATOM)};
if(this.dataSource.options.exhibitor_id){
_24d["parameters"]="exhibitor_id="+this.dataSource.options.exhibitor_id;
}
if(this.dataSource.options.order_id){
_24d["parameters"]="order_id="+this.dataSource.options.order_id;
}
return _24d;
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Removing Booth",MapBuzz.Message.PROCESSING),_24c,this.resource.deleteCommand(),this.dataSource.io.readCommand(),this.copyCommand(),new MapBuzz.Command.Message("Successfully removed booth.",MapBuzz.Message.STATUS));
},openEditor:function(_24e,_24f,_250,_251){
var _252=null;
if(!this.isReadOnly()){
_252=new MapBuzz.Editor.BoothEditor(this);
}else{
_252=new MapBuzz.Editor.BoothViewer(this);
}
return _252.open(_24e,_24f,_250,_251);
},getToolTipPanel:function(){
return new MapBuzz.UI.ToolTipBoothPanel(this);
},getClassName:function(){
if(this.product&&this.product.available){
var name=this.product.name.underscore();
if(name.match(/^\d/)){
name="_"+name;
}
return name;
}else{
if(this.myBooth()){
return "booth_owner";
}else{
return "unavailable";
}
}
}});
MapBuzz.Feature.Factory.register(MapBuzz.Feature.Booth);
MapBuzz.Feature.Yahoo=function YahooLocal(_254,_255){
this.applySuper(arguments);
this.address=new MapBuzz.Atom.Address();
this.author=new MapBuzz.Atom.Person("Yahoo","http://local.yahoo.com",false);
this.ranks=new MapBuzz.Rank.Yahoo();
this.replies=new MapBuzz.Atom.Replies();
var _256=new Geometry.Point(null,null,Geometry.CrsFactory.instance.latLongCrs());
this.figures.create(_256);
this.setupIcons();
};
MapBuzz.Feature.Yahoo.inherits(MapBuzz.Feature.Abstract);
Object.extend(MapBuzz.Feature.Yahoo.prototype,{isNew:function(){
false;
},getTags:function(){
return this.getCategories(MapBuzz.Feature.MapBuzz.TAG_SCHEME);
},openEditor:function(_257,_258,_259,_25a){
var _25b=new MapBuzz.Feature.Viewer(this);
return _25b.open(_257,_258,_259,_25a);
}});
MapBuzz.Feature.Yahoo.prototype.toString=function toString(){
var _25c="Yahoo ["+"Title: "+this.title+"]";
return _25c;
};
MapBuzz.Feature.YahooFactory=function YahooFactory(_25d){
this.dataSource=_25d;
};
Object.extend(MapBuzz.Feature.YahooFactory.prototype,{create:function(){
return new MapBuzz.Feature.Yahoo(this.dataSource);
}});
MapBuzz.Feature.Location=function Location(_25e,_25f){
this.applySuper(arguments);
};
MapBuzz.Feature.Location.inherits(MapBuzz.Feature.Abstract);
MapBuzz.Feature.Location.TYPE_CATEGORY=new MapBuzz.Atom.Category(MapBuzz.Feature.MapBuzz.TYPE_SCHEME,"location","Location");
Object.extend(MapBuzz.Feature.Location.prototype,{getIcon:function(){
return MapBuzz.Feature.Location.DEFAULT_ICON;
},openEditor:function(_260,_261,_262,_263){
var _264=new MapBuzz.Editor.LocationViewer(this);
return _264.open(_260,_261,_262,_263);
},getToolTipPanel:function(){
return new MapBuzz.UI.LocationToolTipPanel(this);
}});
MapBuzz.Feature.Location.prototype.toString=function toString(){
var _265="Location ["+"Title: "+this.title+", "+"Id: "+this.id+", "+"]";
return _265;
};
MapBuzz.Feature.Factory.register(MapBuzz.Feature.Location);
namespace("MapBuzz.DataSource");
MapBuzz.DataSource.Abstract=function AbstractDataSource(name,_267,_268){
this.dataSources=null;
this.name=name;
this.defaultIcons=new HashTable();
this.resource=_267||MapBuzz.Resource.Local.instance;
this.options=_268||new HashTable();
this.zIndex=null;
this.visible=this.options.visible;
if(this.visible==null){
this.visible=true;
}
};
Object.extend(MapBuzz.DataSource.Abstract.prototype,{getType:function(){
for(var key in MapBuzz.DataSource){
if(MapBuzz.DataSource[key]===this.constructor){
return key;
}
}
throw new Error("Unknown datasource type: "+this.constructor);
},getVisibleKey:function(){
return "MapBuzz.DataSource.Visible#"+this.resource.uri;
},getVisible:function(){
return this.visible;
},setVisible:function(_26a){
this.visible=_26a;
if(_26a){
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_SHOW,{dataSource:this});
}else{
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_HIDE,{dataSource:this});
}
return _26a;
},getSurfaceConstructor:function(){
NotImplementedError();
},getLayers:function(){
NotImplementedError();
},getZIndex:function(){
return this.zIndex;
},setZIndex:function(_26b){
this.zIndex=_26b;
},find:function(id){
var _26d=this.findByProperty("id",id);
if(_26d.length==1){
return _26d[0];
}else{
return null;
}
},findByProperty:function(_26e,_26f){
return new Array();
},toJSON:function(){
var data={name:this.name,resource:this.resource,options:this.options};
return Object.toJSON(data);
}});
MapBuzz.DataSource.Abstract.prototype.toString=function toString(){
return "DataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Image=function ImageDataSource(name,_272,_273){
this.applySuper(arguments);
};
MapBuzz.DataSource.Image.inherits(MapBuzz.DataSource.Abstract);
Object.extend(MapBuzz.DataSource.Image.prototype,{getSurfaceConstructor:function(){
return MapBuzz.Surface.Html;
}});
MapBuzz.DataSource.Image.prototype.toString=function toString(){
return "ImageDataSource ["+this.resource.toString()+"]";
};
namespace("MapBuzz.DataSource");
Object.extend(MapBuzz.DataSource,{FEATURES_READ:"FEATURES_READ",FEATURE_INSERTED:"FEATURE_INSERTED",FEATURE_UPDATED:"FEATURE_UPDATED",FEATURE_REMOVED:"FEATURE_REMOVED"});
MapBuzz.DataSource.AbstractFeature=function FeatureDataSource(name,_275,_276,_277){
this.callSuper(arguments.callee,name,_275,_277);
this.features=new Array();
this.factory=_276;
this.loaded=false;
this.initialize();
};
MapBuzz.DataSource.AbstractFeature.inherits(MapBuzz.DataSource.Abstract);
Object.extend(MapBuzz.DataSource.AbstractFeature.prototype,{initialize:function(){
},getFeatures:function(){
return this.features;
},findByProperty:function(_278,_279){
var _27a=new Array();
var _27b=this.getFeatures();
for(var i=0;i<_27b.length;i++){
var _27d=_27b[i];
var _27e=_27d[_278];
if((typeof _279=="string")&&_27e&&_27e.toString()==_279){
_27a.push(_27d);
}else{
if(_27e&&_27e.toString().match(_279)){
_27a.push(_27d);
}
}
}
return _27a;
},loadCommand:function(){
NotImplementedError();
},reloadCommand:function(){
return new MapBuzz.Command.Empty();
},loadLocalCommand:function(){
return MapBuzz.Command.Build(this.io.readCommand(),this.loadFeaturesCommand());
},loadFeaturesCommand:function(){
return new MapBuzz.Command.MultiFunctor("Load Features",{execute:function(_27f){
var _280=this.features;
this.features=_27f||new Array();
this.loaded=true;
MapBuzz.databus.send(this,MapBuzz.DataSource.FEATURES_READ,{dataSource:this,features:_27f});
return [this.features,_280];
}.bind(this)});
},loadFeatureCommand:function(){
var _281=new MapBuzz.Command.MultiFunctor("Load Feature",{execute:function(_282){
this.features.push(_282);
return [this,_282];
}.bind(this)});
return _281;
},insertCommand:function(_283){
NotImplementedError();
}});
MapBuzz.DataSource.AbstractFeature.prototype.toString=function toString(){
return "FeatureDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.MapBuzz=function MapBuzzDataSource(name,_285,_286,_287){
var _288=new MapBuzz.Feature.Factory(this,_286);
this.callSuper(arguments.callee,name,_285,_288,_287);
};
MapBuzz.DataSource.MapBuzz.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.MapBuzz.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzWriter(this.factory);
},getSurfaceConstructor:function(){
return MapBuzz.Surface[this.options.vectorSurface]||MapBuzz.Surface.Vector;
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,"MapBuzz");
}
return this.layers;
},loadCommand:function(){
requestOptions={accept:(this.options.format||MapBuzz.Mime.ATOM.MAPBUZZ)};
var _289="Loading "+this.factory.typeCategory.term+"s";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_289,MapBuzz.Message.PROCESSING),this.resource.getCommand(requestOptions),this.io.readCommand(),this.loadFeaturesCommand());
},reloadCommand:function(){
return this.loadCommand();
},insertCommand:function(_28a){
var _28b=new MapBuzz.Command.Functor("Insert Feature",{execute:function(){
var _28c={accept:[MapBuzz.Mime.JSON,MapBuzz.Mime.ATOM.ENTRY].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.io.write(_28a,MapBuzz.Mime.ATOM)};
return _28c;
}.bind(this)});
var _28d="Creating "+this.factory.typeCategory.term;
var _28e="Successfully created "+this.factory.typeCategory.term+".";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_28d,MapBuzz.Message.PROCESSING),_28b,this.resource.postCommand(),this.io.readCommand(),_28a.copyCommand(),this.loadFeatureCommand(),new MapBuzz.Command.Message(_28e,MapBuzz.Message.STATUS));
}});
MapBuzz.DataSource.MapBuzz.prototype.toString=function toString(){
return "MapBuzzDataSource ["+this.resource.toString()+"]";
};
namespace("MapBuzz.DataSource");
MapBuzz.DataSource.Memory=function MemoryDataSource(uri,_290){
this.surfaceConstructor=MapBuzz.Surface.Vector;
var _291=new MapBuzz.Resource.Local(uri);
var _292=new MapBuzz.Feature.Factory(this,MapBuzz.Feature.MapBuzz.TYPE_CATEGORY);
this.callSuper(arguments.callee,uri,_291,_292,_290);
};
MapBuzz.DataSource.Memory.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.Memory.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzWriter(this.factory);
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,"Results");
}
return this.layers;
},getSurfaceConstructor:function(){
return this.surfaceConstructor;
},loadCommand:function(){
return new MapBuzz.Command.MultiFunctor("Read Features From Memory",{execute:function(_293){
return [this.features,this.features];
}.bind(this)});
},insertCommand:function(_294){
return new MapBuzz.Command.MultiFunctor("Insert Memory",{execute:function(){
_294.dataSource=this;
this.features.push(_294);
return [this,_294];
}.bind(this)});
}});
MapBuzz.DataSource.Memory.prototype.toString=function toString(){
return "MemoryDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Tile=function TileDataSource(name,_296,_297){
this.googleDataSource=new MapBuzz.DataSource.Google();
this.applySuper(arguments);
};
MapBuzz.DataSource.Tile.inherits(MapBuzz.DataSource.Image);
Object.extend(MapBuzz.DataSource.Tile.prototype,{getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,this.name);
}
return this.layers;
},getTitle:function(){
this.options.title;
},getSurfaceConstructor:function(){
return MapBuzz.Surface.Tile;
},getTileSize:function(){
if(this.options.tile_size){
return parseInt(this.options.tile_size);
}else{
return 256;
}
}});
MapBuzz.DataSource.Tile.prototype.toString=function toString(){
return "TileDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Note=function NoteDataSource(_298,_299){
this.callSuper(arguments.callee,"Note",_298,MapBuzz.Feature.Note.TYPE_CATEGORY,_299);
};
MapBuzz.DataSource.Note.inherits(MapBuzz.DataSource.MapBuzz);
MapBuzz.DataSource.Note.prototype.toString=function toString(){
return "NoteDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.GoogleLayer=function GoogleLayerDataSource(name,_29b,_29c){
this.googleDataSource=new MapBuzz.DataSource.Google();
this.applySuper(arguments);
};
MapBuzz.DataSource.GoogleLayer.inherits(MapBuzz.DataSource.Image);
Object.extend(MapBuzz.DataSource.GoogleLayer.prototype,{getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,this.name);
}
return this.layers;
},getTitle:function(){
this.options.title;
},getSurfaceConstructor:function(){
return MapBuzz.Surface.GoogleLayer;
},getTileUri:function(_29d,_29e){
}});
MapBuzz.DataSource.GoogleLayer.prototype.toString=function toString(){
return "GoogleLayerDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Yelp=function YelpDataSource(){
var _29f=new MapBuzz.Resource.Permissions(false,false,false);
var _2a0=new MapBuzz.Resource.Remote(MapBuzz.DataSource.Yelp.URI,_29f);
var _2a1=new MapBuzz.Feature.YelpFactory(this);
var io=new MapBuzz.IO.Manager(this);
io.readers[MapBuzz.Mime.TEXT]=new MapBuzz.IO.YelpReader(_2a1);
this.callSuper(arguments.callee,"Yelp",_2a0,io,_2a1);
};
MapBuzz.DataSource.Yelp.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.Yelp,{URI:"/yelp"});
Object.extend(MapBuzz.DataSource.Yelp.prototype,{loadCommand:function(_2a3){
var _2a4=new MapBuzz.Command.Functor("Read Features",{execute:function(_2a5){
}.bind(this)});
return MapBuzz.Command.Build(_2a4,this.resource.getCommand(),this.io.readCommand(),this.loadFeaturesCommand());
}});
MapBuzz.DataSource.Yelp.prototype.toString=function toString(){
return "YelpDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Zvents=function ZventsDataSource(_2a6,_2a7){
var _2a8=new MapBuzz.Feature.Factory(this,MapBuzz.Feature.Event.TYPE_CATEGORY);
this.start=null;
this.end=null;
this.callSuper(arguments.callee,"Zvents",_2a6,_2a8,_2a7);
};
MapBuzz.DataSource.Zvents.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.Zvents.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.ZventsReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.ZventsReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzWriter();
this.registerListeners();
},release:function(){
this.unregisterListeners();
},registerListeners:function(){
this.setTimeListener=MapBuzz.databus.registerListener(MapBuzz.Feature.Event.SET_TIME,function(_2a9){
this.start=_2a9.data.start;
this.end=_2a9.data.end;
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.Feature.Event.SET_TIME,this.setTimeListener);
},getSurfaceConstructor:function(){
return MapBuzz.Surface.Vector;
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,"Zvents");
}
return this.layers;
},loadCommand:function(){
var _2aa=new MapBuzz.Command.Functor("Read Features",{execute:function(_2ab){
_2ab=_2ab||{};
_2ab.accept=MapBuzz.Mime.ATOM;
var _2ac=new HashTable();
if(this.start){
_2ac.start=this.start.toXmlSchema();
}
if(this.end){
_2ac.end=this.end.toXmlSchema();
}
_2ab.parameters=_2ac.toQueryString();
return _2ab;
}.bind(this)});
var _2ad="Loading "+this.factory.typeCategory.term+"s";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_2ad,MapBuzz.Message.PROCESSING),_2aa,this.resource.getCommand(),this.io.readCommand(),this.loadFeaturesCommand());
}});
MapBuzz.DataSource.Zvents.prototype.toString=function toString(){
return "Zvents DataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Wms=function WmsDataSource(name,_2af,_2b0){
this.applySuper(arguments);
this.options.bgcolor=this.options.bgcolor||"0xFFFFFF";
};
MapBuzz.DataSource.Wms.inherits(MapBuzz.DataSource.Image);
Object.extend(MapBuzz.DataSource.Wms.prototype,{getTitle:function(){
this.options.title;
},getSurfaceConstructor:function(){
return MapBuzz.Surface.Wms;
},getMapParameters:function(){
var _2b1=new HashTable();
_2b1["SERVICE"]="WMS";
_2b1["REQUEST"]="GetMap";
_2b1["VERSION"]="1.1.1";
_2b1["BGCOLOR"]=this.options.bgcolor;
_2b1["FORMAT"]=this.options.format;
_2b1["TRANSPARENT"]=this.options.transparent;
_2b1["LAYERS"]=this.options.layers;
return _2b1;
},getLayers:function(){
if(!this.layers){
var _2b2=this.options.layers;
this.layers=new MapBuzz.DataSource.Layers("WMS");
for(var i=0;i<_2b2.length;i++){
var _2b4=_2b2[i];
var _2b5=new MapBuzz.DataSource.Layer(this,_2b4);
this.layers.add(_2b5);
}
}
return this.layers;
},getTileSize:function(){
return 256;
}});
MapBuzz.DataSource.Wms.prototype.toString=function toString(){
return "WmsDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Exhibitor=function ExhibitorDataSource(_2b6,_2b7){
var _2b8=new MapBuzz.Feature.Factory(this,MapBuzz.Feature.Exhibitor.TYPE_CATEGORY);
this.callSuper(arguments.callee,"Exhibitor",_2b6,_2b8,_2b7);
};
MapBuzz.DataSource.Exhibitor.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.Exhibitor.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzWriter(this.factory);
},getSurfaceConstructor:function(){
return MapBuzz.Surface[this.options.vectorSurface]||MapBuzz.Surface.Vector;
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,"MapBuzz");
}
return this.layers;
},loadCommand:function(){
requestOptions={accept:(this.options.format||MapBuzz.Mime.ATOM.MAPBUZZ)};
var _2b9="Loading "+this.factory.typeCategory.term+"s";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_2b9,MapBuzz.Message.PROCESSING),this.resource.getCommand(requestOptions),this.io.readCommand(),this.loadFeaturesCommand());
},reloadCommand:function(){
return new MapBuzz.Command.Empty();
},insertCommand:function(_2ba){
var _2bb=new MapBuzz.Command.Functor("Insert Feature",{execute:function(){
var _2bc={accept:[MapBuzz.Mime.JSON,MapBuzz.Mime.ATOM.ENTRY].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.io.write(_2ba,MapBuzz.Mime.ATOM)};
return _2bc;
}.bind(this)});
var _2bd="Creating "+this.factory.typeCategory.term;
var _2be="Successfully created "+this.factory.typeCategory.term+".";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_2bd,MapBuzz.Message.PROCESSING),_2bb,this.resource.postCommand(),this.io.readCommand(),_2ba.copyCommand(),this.loadFeatureCommand(),new MapBuzz.Command.Message(_2be,MapBuzz.Message.STATUS));
}});
MapBuzz.DataSource.MapBuzz.prototype.toString=function toString(){
return "MapBuzzDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Booth=function BoothDataSource(_2bf,_2c0){
var _2c1=new MapBuzz.Feature.Factory(this,MapBuzz.Feature.Booth.TYPE_CATEGORY);
this.callSuper(arguments.callee,"Booth",_2bf,_2c1,_2c0);
};
MapBuzz.DataSource.Booth.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.Booth.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.MapBuzzReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.MapBuzzWriter(this.factory);
},getSurfaceConstructor:function(){
return MapBuzz.Surface[this.options.vectorSurface]||MapBuzz.Surface.Vector;
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layer(this,"MapBuzz");
}
return this.layers;
},loadCommand:function(){
requestOptions={accept:(this.options.format||MapBuzz.Mime.ATOM.MAPBUZZ)};
var _2c2="Loading "+this.factory.typeCategory.term+"s";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_2c2,MapBuzz.Message.PROCESSING),this.resource.getCommand(requestOptions),this.io.readCommand(),this.loadFeaturesCommand());
},reloadCommand:function(){
return new MapBuzz.Command.Empty();
},insertCommand:function(_2c3){
var _2c4=new MapBuzz.Command.Functor("Insert Feature",{execute:function(){
var _2c5={accept:[MapBuzz.Mime.JSON,MapBuzz.Mime.ATOM.ENTRY].join(", "),contentType:MapBuzz.Mime.ATOM,postBody:this.io.write(_2c3,MapBuzz.Mime.ATOM)};
return _2c5;
}.bind(this)});
var _2c6="Creating "+this.factory.typeCategory.term;
var _2c7="Successfully created "+this.factory.typeCategory.term+".";
return MapBuzz.Command.Build(new MapBuzz.Command.Message(_2c6,MapBuzz.Message.PROCESSING),_2c4,this.resource.postCommand(),this.io.readCommand(),_2c3.copyCommand(),this.loadFeatureCommand(),new MapBuzz.Command.Message(_2c7,MapBuzz.Message.STATUS));
}});
MapBuzz.DataSource.MapBuzz.prototype.toString=function toString(){
return "MapBuzzDataSource ["+this.resource.toString()+"]";
};
namespace("MapBuzz.DataSource");
MapBuzz.DataSource.Manager=function DataSourceManager(map){
this.map=map;
this.dataSources=new Array();
this.activeDataSource=null;
this.initialize();
};
Object.extend(MapBuzz.DataSource,{DATASOURCE_ADD:"DATASOURCE_ADD",DATASOURCE_BEFORE_ADD:"DATASOURCE_BEFORE_ADD",DATASOURCE_AFTER_ADD:"DATASOURCE_AFFTER_ADD",DATASOURCE_REMOVE:"DATASOURCE_REMOVE",DATASOURCE_BEFORE_REMOVE:"DATASOURCE_BEFORE_REMOVE",DATASOURCE_AFTER_REMOVE:"DATASOURCE_AFTER_REMOVE",DATASOURCE_ACTIVATED:"DATASOURCE_ACTIVATED",DATASOURCE_SHOW:"DATASOURCE_SHOW",DATASOURCE_HIDE:"DATASOURCE_HIDE",DATASOURCE_LOOKUP:"DATASOURCE_LOOKUP",DATASOURCE_FIND:"DATASOURCE_FIND",DATASOURCE_FIND_FIRST:"DATASOURCE_FIND_FIRST"});
Object.extend(MapBuzz.DataSource.Manager.prototype,{initialize:function(){
this.registerListeners();
},release:function(){
this.unregisterListeners();
},registerListeners:function(){
this.addDataSourceListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_ADD,function(_2c9){
this.add(_2c9.data.dataSource);
}.bind(this));
this.removeDataSourceListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_REMOVE,function(_2ca){
this.remove(_2ca.data.dataSource);
}.bind(this));
this.lookupDataSourceListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_LOOKUP,function(_2cb){
var uri=_2cb.data.uri;
return this.getDataSource(uri);
}.bind(this));
this.findDataSourceListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_FIND,function(_2cd){
var id=_2cd.data.id;
return this.find(id);
}.bind(this));
this.findDataSourceListener=MapBuzz.databus.registerListener(MapBuzz.DataSource.DATASOURCE_FIND_FIRST,function(_2cf){
var id=_2cf.data.id;
return this.findFirst(id);
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_ADD,this.addDataSourceListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_REMOVE,this.removeDataSourceListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_LOOKUP,this.lookupDataSourceListener);
MapBuzz.databus.unregisterListener(MapBuzz.DataSource.DATASOURCE_LOOKUP,this.findDataSourceListener);
},add:function(_2d1){
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_BEFORE_ADD,{dataSource:_2d1});
_2d1.dataSources=this;
this.dataSources.push(_2d1);
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_AFTER_ADD,{dataSource:_2d1});
return _2d1;
},remove:function(_2d2){
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_BEFORE_REMOVE,{dataSource:_2d3});
var _2d3=this.dataSources.remove(_2d2);
if(_2d3){
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_AFTER_REMOVE,{dataSource:_2d3});
}
if(_2d3==this.activeDataSource){
this.activeDataSource=null;
}
return _2d3;
},activate:function(_2d4){
this.activeDataSource=_2d4;
MapBuzz.databus.send(this,MapBuzz.DataSource.DATASOURCE_ACTIVATED,{dataSource:_2d4});
return _2d4;
},getActive:function(){
return this.activeDataSource;
},getDataSources:function(){
return this.dataSources;
},getDataSource:function(uri){
for(var i=0;i<this.dataSources.length;i++){
var _2d7=this.dataSources[i];
if(_2d7.resource.uri==uri){
return _2d7;
}
}
return null;
},findDataSourcesByClass:function(_2d8){
var _2d9=new Array();
for(var i=0;i<this.dataSources.length;i++){
var _2db=this.dataSources[i];
if(_2db instanceof _2d8){
_2d9.push(_2db);
}
}
return _2d9;
},find:function(id){
return this.findByProperty("id",id);
},findFirst:function(id){
var _2de=this.find(id);
if(_2de&&_2de.length>0){
return _2de[0];
}else{
return null;
}
},findByProperty:function(_2df,_2e0){
var _2e1=new Array();
var _2e2=this.getDataSources();
for(var i=0;i<_2e2.length;i++){
var _2e4=_2e2[i];
var _2e5=_2e4.findByProperty(_2df,_2e0);
_2e1=_2e1.concat(_2e5);
}
return _2e1;
}});
MapBuzz.DataSource.YahooLocal=function YahooLocalDataSource(_2e6){
this.terms=_2e6;
var _2e7=new MapBuzz.Resource.Permissions(false,false,false);
var _2e8=new MapBuzz.Resource.Remote(MapBuzz.DataSource.YahooLocal.URI,_2e7);
var _2e9=new MapBuzz.Feature.YahooFactory(this);
var io=new MapBuzz.IO.Manager();
io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.YahooLocalReader(_2e9);
this.callSuper(arguments.callee,"YahooLocal",_2e8,io,_2e9);
};
MapBuzz.DataSource.YahooLocal.inherits(MapBuzz.DataSource.AbstractFeature);
Object.extend(MapBuzz.DataSource.YahooLocal,{URI:"/yahoo"});
Object.extend(MapBuzz.DataSource.YahooLocal.prototype,{loadCommand:function(_2eb){
var _2ec=new MapBuzz.Command.Functor("Read Features",{execute:function(_2ed){
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:"Loading features",level:MapBuzz.Message.PROCESSING});
var _2ee=_2ed.getCenter();
var _2ef=new Geometry.Point(_2ed.xMin,_2ed.yMin,_2ed.crs);
var _2f0=_2ed.crs.distance(_2ef,_2ee);
var _2f1=(_2f0/100/1000)/1.609344;
var _2f2={accept:MapBuzz.Mime.XML,parameters:"query="+this.terms+"&"+"results=20"+"&"+"crs="+_2ed.crs.epsg+"&"+"longitude="+_2ee.x+"&"+"latitude="+_2ee.y+"&"+"radius="+_2f1};
return _2f2;
}.bind(this)});
return MapBuzz.Command.Build(_2ec,this.resource.getCommand(),this.io.readCommand(),this.loadFeaturesCommand());
}});
MapBuzz.DataSource.YahooLocal.prototype.toString=function toString(){
return "YahooLocalDataSource ["+this.resource.toString()+"]";
};
MapBuzz.DataSource.Location=function LocationDataSource(name,_2f4,_2f5){
var _2f6=new MapBuzz.Feature.Factory(this,MapBuzz.Feature.MapBuzz.TYPE_CATEGORY);
this.callSuper(arguments.callee,name,_2f4,_2f6,_2f5);
};
MapBuzz.DataSource.Location.inherits(MapBuzz.DataSource.AbstractFeature);
MapBuzz.DataSource.Location.prototype.toString=function toString(){
return "MapBuzzDataSource ["+this.resource.toString()+"]";
};
Object.extend(MapBuzz.DataSource.Location.prototype,{initialize:function(){
this.io=new MapBuzz.IO.Manager();
this.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.FeatureReader(this.factory);
this.io.readers[MapBuzz.Mime.XML]=new MapBuzz.IO.FeatureReader(this.factory);
this.io.writers[MapBuzz.Mime.ATOM]=new MapBuzz.IO.AtomWriter();
}});
MapBuzz.DataSource.Google=function GoogleDataSource(_2f7){
this.callSuper(arguments.callee,"Google",_2f7,null);
};
MapBuzz.DataSource.Google.inherits(MapBuzz.DataSource.Abstract);
MapBuzz.DataSource.Google.DEFAULT_MAX_ZOOM_LEVEL=17;
Object.extend(MapBuzz.DataSource.Google.prototype,{getSurfaceConstructor:function(){
return MapBuzz.Surface.Google;
},getLayers:function(){
if(!this.layers){
this.layers=new MapBuzz.DataSource.Layers("Google",true);
var _2f8=new MapBuzz.DataSource.GMapTypeLayer(this,G_NORMAL_MAP);
this.layers.add(_2f8);
_2f8=new MapBuzz.DataSource.GMapTypeLayer(this,G_SATELLITE_MAP);
this.layers.add(_2f8);
_2f8=new MapBuzz.DataSource.GMapTypeLayer(this,G_HYBRID_MAP);
this.layers.add(_2f8);
_2f8=new MapBuzz.DataSource.GMapTypeLayer(this,G_PHYSICAL_MAP);
this.layers.add(_2f8);
}
return this.layers;
}});
MapBuzz.DataSource.Google.prototype.toString=function toString(){
return "GoogleDataSource";
};
namespace("MapBuzz.Surface");
MapBuzz.Surface.Abstract=function AbstractSurface(_2f9,_2fa){
this.manager=_2f9;
this.dataSource=_2fa;
this.view=_2f9.view;
this.layers=new Array();
this.id=this.getName()+Math.round(Math.random()*100);
this.initialize();
};
Object.extend(MapBuzz.Surface.Abstract.prototype,{initialize:function(){
this.createRootElement();
this.createContentElement();
if(this.view.initialized){
this.changeDisplayExtent(this.view.displayExtent,this.view.displayExtent);
}
this.resetTransforms();
},release:function(){
this.rootElement=null;
this.contentElement=null;
},addLayer:function(_2fb){
this.layers.push(_2fb);
_2fb.setSurface(this);
},removeLayer:function(_2fc){
this.layers.remove(_2fc);
_2fc.setSurface(null);
},findLayerByName:function(name){
for(var i=0;i<this.layers.length;i++){
if(this.layers[i].name==name){
return this.layers[i];
}
}
return null;
},showLayer:function(_2ff){
NotImplementedError();
},hideLayer:function(_300){
NotImplementedError();
},contains:function(_301){
while(_301){
if(_301===this.contentElement){
return true;
}
_301=_301.parentNode;
}
return false;
},supportsFigure:function(_302){
return false;
},getType:function(){
for(var key in MapBuzz.Surface){
if(MapBuzz.Surface[key]===this.constructor){
return key;
}
}
throw new Error("Unknown surface type: "+this.constructor);
},createElement:function(_304,id){
var _306=null;
if(document.createElementNS){
_306=document.createElementNS(this.getNamespace(),_304);
}else{
_306=document.createElement(_304);
}
if(id){
_306.id=id;
}
return _306;
},getNamespace:function(){
NotImplementedError();
},createRootElement:function(){
NotImplementedError();
},createContentElement:function(){
NotImplementedError();
},getZIndex:function(){
return this.zIndex;
},setZIndex:function(_307){
this.zIndex=_307;
this.rootElement.style.zIndex=_307;
},isTransparent:function(){
return false;
},getClassName:function(){
if(this.isTransparent()){
return "surface_transparent";
}else{
return "surface_opaque";
}
},getName:function(){
for(var key in MapBuzz.Surface){
if(MapBuzz.Surface[key]===this.constructor){
return key;
}
}
throw new Error("Unknown surface: "+this.constructor);
},isHosted:function isHost(){
return this.rootElement.parentNode.id!=MapBuzz.View.Panes.SURFACES_ID;
},getSurfaceToDisplayTransform:function(){
if(!this.surfaceToDisplayTransform){
this.surfaceToDisplayTransform=new Geometry.Transform();
this.surfaceToDisplayTransform.add(this.manager.surfaceToViewTransform);
this.surfaceToDisplayTransform.add(this.view.getViewToDisplayTransform().copy());
}
return this.surfaceToDisplayTransform;
},getSurfaceToWorldTransform:function(){
if(!this.surfaceToWorldTransform){
this.surfaceToWorldTransform=this.getSurfaceToDisplayTransform();
this.surfaceToWorldTransform.add(this.view.getWorldToDisplayTransform().getInverse());
}
return this.surfaceToWorldTransform;
},resetTransforms:function(){
this.surfaceToDisplayTransform=null;
this.surfaceToWorldTransform=null;
},convertDisplayToSurface:function(geom){
var _30a=this.getSurfaceToDisplayTransform().getInverse();
return geom.transformToCrs(_30a,this.view.viewCrs);
},convertSurfaceToDisplay:function(geom){
var _30c=this.getSurfaceToDisplayTransform();
return geom.transformToCrs(_30c,this.view.displayExtent.getCrs());
},convertWorldToSurface:function(geom){
var _30e=this.getSurfaceToWorldTransform().getInverse();
return geom.transformToCrs(_30e,this.view.viewCrs);
},convertSurfaceToWorld:function(geom){
var _310=this.getSurfaceToWorldTransform();
return geom.transformToCrs(_310,this.view.map.world.crs);
},getViewBounds:function(){
var xMin=this.contentElement.offsetLeft;
var yMin=this.contentElement.offsetTop;
var xMax=xMin+this.contentElement.clientWidth;
var yMax=yMin+this.contentElement.clientHeight;
return new Geometry.Envelope(xMin,yMin,xMax,yMax,this.tiles.surface.view.viewCrs);
},getDisplayBounds:function(){
var _315=this.view.getViewToDisplayTransform().getInverse();
return this.getViewBounds().transformToCrs(_315,this.view.displayExtent.getCrs());
},changeDisplayExtent:function(_316,_317){
this.resetTransforms();
},startPan:function(_318,_319){
},pan:function(_31a,_31b){
},endPan:function(_31c,_31d){
},resize:function(){
},getMaximumScale:function(_31e){
NotImplementedError();
},clear:function(){
},load:function(){
},reload:function(){
},redraw:function(){
}});
namespace("MapBuzz.Surface");
MapBuzz.Surface.ShapeFactory=function ShapeFactory(_31f){
this.surface=_31f;
this.shapeConstructors=new HashTable();
};
Object.extend(MapBuzz.Surface.ShapeFactory.prototype,{register:function(_320,_321){
this.shapeConstructors[_320]=_321;
},supports:function(_322){
var _323=this.shapeConstructors[_322.constructor];
return (!!_323);
},create:function(_324){
var _325=this.shapeConstructors[_324.constructor];
if(!_325){
return null;
}else{
return new _325(this.surface,_324);
}
}});
MapBuzz.Surface.AbstractShape=function AbstractShape(_326,_327){
this.surface=_326;
this.figure=_327;
this.handleImpls=new Array();
this.mode=MapBuzz.Surface.AbstractShape.MODE_NORMAL;
this.initialize();
};
Object.extend(MapBuzz.Surface.AbstractShape,{MODE_NORMAL:"normal",MODE_EDITING:"edit",TEXT_NODE:3});
Object.extend(MapBuzz.Surface.AbstractShape.prototype,{initialize:function(){
this.setupElement(this.element);
},setupElement:function(_328){
if(!_328.id){
var _329=this.figure.getInternalId();
if(_329){
_328.id="shape_"+_329;
}
}
this.setupChildElements(_328);
},setupChildElements:function(_32a){
var _32b=_32a.firstChild;
while(_32b){
this.setupChildElements(_32b);
_32b=_32b.nextSibling;
}
if(_32a.nodeType!=MapBuzz.Surface.AbstractShape.TEXT_NODE){
_32a.mbShape=this;
_32a.figure=this.figure;
}
},getRootElement:function(){
return this.element;
},setZIndex:function(_32c){
if(_32c){
this.element.style.zIndex=_32c;
}else{
this.element.style.zIndex="";
}
},release:function(){
this.removeHandles();
this.element.mbShape=null;
this.element.parentNode.removeChild(this.element);
this.element=null;
},getTool:function(){
return new MapBuzz.Tool.InfoTool(this.surface.view.map.toolManager,this);
},getElementId:function(){
return "shape_"+this.id;
},getGeom:function(){
var _32d=this.figure.geom.copy();
return this.surface.convertWorldToSurface(_32d);
},getViewGeom:function(){
var _32e=this.figure.geom.copy();
return this.surface.view.convertWorldToView(_32e);
},getBounds:function(){
if(!this.bounds){
this.bounds=this.getGeom().getBounds();
}
return this.bounds;
},startEdit:function(){
if(this.mode==MapBuzz.Surface.AbstractShape.MODE_EDITING){
return;
}
this.mode=MapBuzz.Surface.AbstractShape.MODE_EDITING;
this.createHandles();
this.drawHandles();
},endEdit:function(){
this.removeHandles();
this.unselect();
this.mode=MapBuzz.Surface.AbstractShape.MODE_NORMAL;
this.bounds=null;
},getHandleGeom:function(){
return this.getGeom();
},createHandles:function(){
var _32f=this.figure.createHandles(this);
for(var i=0;i<_32f.handles.length;i++){
var _331=_32f.handles[i];
var _332=this.surface.createHandleImpl(_331);
this.handleImpls.push(_332);
}
},drawHandles:function(){
for(var i=0;i<this.handleImpls.length;i++){
var _334=this.handleImpls[i];
_334.draw();
}
},removeHandles:function(){
for(var i=0;i<this.handleImpls.length;i++){
this.handleImpls[i].release();
}
this.handleImpls.length=0;
},draw:function(){
NotImplementedError();
},redraw:function(){
this.draw();
},highlight:function(){
},unhighlight:function(){
},select:function(){
this.highlight();
},unselect:function(){
this.unhighlight();
},hide:function(){
Element.hide(this.element);
},show:function(){
Element.show(this.element);
}});
MapBuzz.Surface.Collection=function SurfaceCollection(_336,_337){
this.applySuper(arguments);
};
MapBuzz.Surface.Collection.inherits(MapBuzz.Surface.AbstractShape);
Object.extend(MapBuzz.Surface.Collection.prototype,{release:function(){
},draw:function(){
}});
namespace("MapBuzz.Surface");
namespace("MapBuzz.Surface.Tile");
MapBuzz.Surface.Tile=function TileSurface(_338,_339){
this.tileToSurfaceTransform=new Geometry.AffineTransform();
this.applySuper(arguments);
};
MapBuzz.Surface.Tile.inherits(MapBuzz.Surface.Abstract);
Object.extend(MapBuzz.Surface.Tile.prototype,{getNamespace:function(){
return MapBuzz.Namespace.XHTML_NAMESPACE_URI;
},createRootElement:function(){
this.rootElement=this.createElement("div");
this.rootElement.id=this.id;
var _33a=this.manager.view.panes.getSurfacePane();
_33a.appendChild(this.rootElement);
this.rootElement.style.position="absolute";
this.rootElement.style.left="0px";
this.rootElement.style.top="0px";
this.rootElement.style.width="100%";
this.rootElement.style.height="100%";
return this.rootElement;
},createContentElement:function(){
this.contentElement=this.rootElement;
return this.contentElement;
},getSurfaceToDisplayTransform:function(){
if(!this.surfaceToDisplayTransform){
this.surfaceToDisplayTransform=new Geometry.Transform();
this.surfaceToDisplayTransform.add(this.tileToSurfaceTransform);
this.surfaceToDisplayTransform.add(this.manager.surfaceToViewTransform);
this.surfaceToDisplayTransform.add(this.view.getViewToDisplayTransform().copy());
}
return this.surfaceToDisplayTransform;
},createTiles:function(){
return new MapBuzz.Surface.Tile.Tiles(this);
},getTiles:function(){
if(!this.tiles){
this.tiles=this.createTiles();
}
return this.tiles;
},getTileSize:function(){
return this.dataSource.getTileSize();
},pan:function(_33b,_33c){
this.getTiles().pan(_33b,_33c);
},changeDisplayExtent:function(_33d,_33e){
this.applySuper(arguments);
this.getTiles().positionTiles();
this.getTiles().updateTiles();
},getTileUri:function(tile){
var _340=tile.getDisplayBounds();
var x=Math.round(_340.xMin/this.getTileSize());
var y=Math.round(_340.yMin/this.getTileSize());
var zoom=this.view.displayExtent.zoom;
var uri=this.dataSource.resource.uri;
return uri.replace(/{Z}/i,zoom).replace(/{X}/i,x).replace(/{Y}/i,y);
},isTransparent:function(){
false;
}});
MapBuzz.Surface.Tile.Tiles=function TileTiles(_345){
this.surface=_345;
this.panOffset=new Geometry.Coordinate(0,0);
this.initialize();
};
Object.extend(MapBuzz.Surface.Tile.Tiles.prototype,{initialize:function(){
this.createTiles();
},getTileUri:function(tile){
NotImplementedError();
},createTiles:function(){
var _347=this.surface.getTileSize();
var _348=this.surface.view.getViewBounds();
this.columns=Math.ceil(_348.width/_347)+2;
this.rows=Math.ceil(_348.height/_347)+2;
this.tiles=new Array();
for(var _349=0;_349<this.columns;_349++){
var _34a=new Array();
this.tiles.push(_34a);
for(var row=0;row<this.rows;row++){
var tile=this.createTile();
_34a.push(tile);
tile.setPosition(_349*_347,row*_347);
}
}
},createTile:function(){
var _34d=this.surface.dataSource.options.format;
var _34e=_34d?MapBuzz.Mime.lookup(_34d):null;
if(Browser.instance.isIE()&&Browser.instance.majorVersion==6&&_34e===MapBuzz.Mime.PNG){
return new MapBuzz.Surface.Tile.IEPngImage(this);
}else{
return new MapBuzz.Surface.Tile.Image(this);
}
},positionTiles:function(){
this.surface.tileToSurfaceTransform.reset();
var _34f=this.surface.getTileSize();
var _350=this.surface.view.getDisplayBounds();
var _351=Math.floor(_350.xCenter/_34f);
var _352=Math.floor(_350.yCenter/_34f);
var _353=_351-Math.round(this.columns/2)+1;
var _354=_352-Math.round(this.rows/2)+1;
var _355=new Geometry.Envelope(_353*_34f,_354*_34f,(_353+this.columns)*_34f,(_354+this.rows)*_34f,this.surface.view.displayExtent.center.crs);
var _356=this.surface.convertDisplayToSurface(_355);
var _357=new Geometry.AffineTransform();
_357.translate(_34f*Math.round(this.surface.manager.surfaceToViewTransform.e/_34f),_34f*Math.round(this.surface.manager.surfaceToViewTransform.f/_34f));
_356.transform(_357);
this.surface.contentElement.style.left=(Math.floor(_356.xMin)+"px");
this.surface.contentElement.style.top=(Math.floor(_356.yMin)+"px");
this.surface.tileToSurfaceTransform.translate(_356.xMin,_356.yMin);
},updateTiles:function(){
for(var _358=0;_358<this.columns;_358++){
for(var row=0;row<this.rows;row++){
var tile=this.getTile(_358,row);
tile.update();
}
}
},getTile:function(_35b,row){
return this.tiles[_35b][row];
},pan:function(_35d,_35e){
this.panOffset.x+=_35d;
this.panOffset.y+=_35e;
this.checkRotation();
},checkRotation:function(){
var _35f=this.surface.getTileSize();
if(Math.abs(this.panOffset.x)>_35f){
this.surface.resetTransforms();
this.panOffset.x<0?this.rotateRight():this.rotateLeft();
this.panOffset.x=0;
}
if(Math.abs(this.panOffset.y)>_35f){
this.surface.resetTransforms();
this.panOffset.y>0?this.rotateTop():this.rotateBottom();
this.panOffset.y=0;
}
},rotateTop:function(){
var _360=this.surface.getTileSize();
for(var i=0;i<this.tiles.length;i++){
var _362=this.tiles[i];
var tile=_362.pop();
_362.unshift(tile);
var left=tile.element.offsetLeft;
var top=tile.element.offsetTop-(this.rows*_360);
tile.setPosition(left,top);
tile.update();
}
},rotateBottom:function(){
var _366=this.surface.getTileSize();
for(var i=0;i<this.tiles.length;i++){
var _368=this.tiles[i];
var tile=_368.shift();
_368.push(tile);
var left=tile.element.offsetLeft;
var top=tile.element.offsetTop+(this.rows*_366);
tile.setPosition(left,top);
tile.update();
}
},rotateLeft:function(){
var _36c=this.surface.getTileSize();
var _36d=this.tiles.pop();
this.tiles.unshift(_36d);
for(var i=0;i<_36d.length;i++){
var tile=_36d[i];
var left=tile.element.offsetLeft-(this.columns*_36c);
var top=tile.element.offsetTop;
tile.setPosition(left,top);
tile.update();
}
},rotateRight:function(){
var _372=this.surface.getTileSize();
var _373=this.tiles.shift();
this.tiles.push(_373);
for(var i=0;i<_373.length;i++){
var tile=_373[i];
var left=tile.element.offsetLeft+(this.columns*_372);
var top=tile.element.offsetTop;
tile.setPosition(left,top);
tile.update();
}
}});
MapBuzz.Surface.Tile.Abstract=function TileAbstractTile(_378){
this.tiles=_378;
this.createElement();
this.setupElement();
};
Object.extend(MapBuzz.Surface.Tile.Abstract.prototype,{createElement:function(){
NotImplementedError();
},setupElement:function(){
var _379=this.tiles.surface.getTileSize();
this.element.style.position="absolute";
this.element.style.width=_379+"px";
this.element.style.height=_379+"px";
var _37a=this.tiles.surface.dataSource.options.opacity;
if(_37a){
if(Browser.instance.isIE()){
this.element.style.filter="alpha(opacity="+(_37a*100)+")";
}else{
this.element.style.opacity=_37a;
}
}
this.tiles.surface.contentElement.appendChild(this.element);
},update:function(){
var uri=this.tiles.surface.getTileUri(this);
this.setUri(uri);
},setUri:function(uri){
throw NotImplemented();
},getElementBounds:function(){
var _37d=this.surface.getTileSize();
var xMin=this.element.offsetLeft;
var yMin=this.element.offsetTop;
var xMax=xMin+this.rows*_37d;
var yMax=yMin+this.columns*_37d;
return new Geometry.Envelope(xMin,yMin,xMax,yMax,this.surface.view.viewCrs);
},getSurfaceBounds:function(){
var _382=this.tiles.surface.getTileSize();
var xMin=this.element.offsetLeft;
var yMin=this.element.offsetTop;
var xMax=xMin+(_382-1);
var yMax=yMin+(_382-1);
return new Geometry.Envelope(xMin,yMin,xMax,yMax,this.tiles.surface.view.viewCrs);
},getDisplayBounds:function(){
return this.tiles.surface.convertSurfaceToDisplay(this.getSurfaceBounds());
},getWorldBounds:function(){
return this.tiles.surface.convertSurfaceToWorld(this.getSurfaceBounds());
},setPosition:function(left,top){
this.element.style.left=left+"px";
this.element.style.top=top+"px";
}});
MapBuzz.Surface.Tile.Image=function ImageTile(_389){
this.loadHandler=this.onLoad.bindAsEventListener(this);
this.applySuper(arguments);
};
MapBuzz.Surface.Tile.Image.inherits(MapBuzz.Surface.Tile.Abstract);
MapBuzz.Surface.Tile.Image.TRANSPARENT_IMAGE=new Image();
MapBuzz.Surface.Tile.Image.TRANSPARENT_IMAGE.src="/images/transparent.gif";
Object.extend(MapBuzz.Surface.Tile.Image.prototype,{createElement:function(){
this.element=Element.create("img");
this.element.style.visibility="hidden";
Event.observe(this.element,"load",this.loadHandler);
},onLoad:function(_38a){
this.element.style.visibility="visible";
},setUri:function(uri){
this.element.style.visibility="hidden";
this.element.alt=uri.match(/[^\/]*$/).toString();
this.element.src=uri;
}});
MapBuzz.Surface.Tile.IEPngImage=function IEPngImageTile(_38c){
this.applySuper(arguments);
};
MapBuzz.Surface.Tile.IEPngImage.inherits(MapBuzz.Surface.Tile.Image);
Object.extend(MapBuzz.Surface.Tile.IEPngImage.prototype,{onLoad:function(_38d){
fixPng(this.element);
this.element.style.visibility="visible";
},setUri:function(uri){
unFixPng(this.element);
this.element.src=uri;
}});
MapBuzz.Surface.Tile.VmlImage=function VmlImageTile(_38f){
this.applySuper(arguments);
};
MapBuzz.Surface.Tile.VmlImage.inherits(MapBuzz.Surface.Tile.Image);
Object.extend(MapBuzz.Surface.Tile.VmlImage.prototype,{createElement:function(){
var _390=this.tiles.surface.getTileSize();
this.element=Element.create("vml:image");
},setupElement:function(){
var _391=this.tiles.surface.getTileSize();
this.element.coordsize=_391+","+_391;
this.applySuper(arguments);
}});
namespace("MapBuzz.Surface");
MapBuzz.Surface.AbstractVector=function AbstractVectorSurface(_392){
this.shapeFactory=new MapBuzz.Surface.ShapeFactory(this);
this.applySuper(arguments);
};
MapBuzz.Surface.AbstractVector.inherits(MapBuzz.Surface.Abstract);
MapBuzz.Surface.AbstractVector.Z_ORDERING=[Geometry.GeometryTypes.Polygon,Geometry.GeometryTypes.Envelope,Geometry.GeometryTypes.Ellipse,Geometry.GeometryTypes.LineString,Geometry.GeometryTypes.Point];
Object.extend(MapBuzz.Surface,{FEATURES_LOADED:"features_loaded",BEFORE_DRAW_MODELS:"SURFACE_BEFORE_DRAW_MODELS",AFTER_DRAW_MODELS:"SURFACE_AFTER_DRAW_MODELS",BEFORE_CLEAR_MODELS:"SURFACE_BEFORE_CLEAR_MODELS",AFTER_CLEAR_MODELS:"SURFACE_AFTER_CLEAR_MODELS"});
Object.extend(MapBuzz.Surface.AbstractVector.prototype,{initialize:function(){
this.setupFactory();
this.applySuper(arguments);
},release:function(){
this.clear();
this.applySuper(arguments);
},remove:function(){
this.rootElement.parentNode.removeChild(this.rootElement);
},setupFactory:function(_393){
NotImplementedError();
},addLayer:function(_394){
this.applySuper(arguments);
if(this.view.initialized){
if(_394.dataSource.loaded){
this.drawEntries(_394.dataSource.features);
}else{
var _395=_394.dataSource.loadCommand();
this.loadLayerEntries(_394);
}
}
},removeLayer:function(_396){
this.clear(_396);
this.applySuper(arguments);
},supportsFigure:function(_397){
return this.shapeFactory.supports(_397);
},createShape:function(_398){
return this.shapeFactory.create(_398);
},clear:function(_399){
var _39a;
if(_399){
_39a=[_399];
}else{
_39a=this.layers;
}
this.lock();
try{
for(var i=0;i<_39a.length;i++){
this.clearEntries(_39a[i].dataSource.features);
}
}
finally{
this.unlock();
}
},load:function(){
for(var i=0;i<this.layers.length;i++){
var _39d=this.layers[i];
var _39e=_39d.dataSource.loadCommand();
this.loadLayerEntries(_39e,this.layers[i]);
}
},reload:function(){
for(var i=0;i<this.layers.length;i++){
var _3a0=this.layers[i];
var _3a1=_3a0.dataSource.reloadCommand();
this.loadLayerEntries(_3a1,this.layers[i]);
}
},loadLayerEntries:function(_3a2,_3a3){
var _3a4=new MapBuzz.Command.Functor("Draw",{execute:function(_3a5,_3a6){
if(_3a5){
this.internalRedraw(_3a6,_3a5);
}
}.bind(this)});
var _3a7=new MapBuzz.Command.Databus(MapBuzz.Surface.FEATURES_LOADED,{dataSource:_3a3.dataSource,surface:this});
var _3a2=MapBuzz.Command.Build(_3a2,_3a4,_3a7);
_3a2.execute();
},redraw:function(){
for(var i=0;i<this.layers.length;i++){
layer=this.layers[i];
this.internalRedraw(layer.dataSource.features,layer.dataSource.features);
}
},internalRedraw:function(_3a9,_3aa){
_3a9=_3a9||new Array();
this.lock();
try{
this.clearEntries(_3a9);
this.drawEntries(_3aa);
}
finally{
this.unlock();
}
},drawEntries:function(_3ab){
MapBuzz.databus.send(this,MapBuzz.Surface.BEFORE_DRAW_MODELS,{models:_3ab});
for(var i=0;i<_3ab.length;i++){
var _3ad=_3ab[i];
_3ad.figures.display(this);
}
MapBuzz.databus.send(this,MapBuzz.Surface.AFTER_DRAW_MODELS,{models:_3ab});
},clearEntries:function(_3ae){
MapBuzz.databus.send(this,MapBuzz.Surface.BEFORE_CLEAR_MODELS,{models:_3ae});
for(var i=0;i<_3ae.length;i++){
var _3b0=_3ae[i];
_3b0.figures.undisplay(this);
}
MapBuzz.databus.send(this,MapBuzz.Surface.AFTER_CLEAR_MODELS,{models:_3ae});
},lock:function(){
},unlock:function(){
},createHandleProxy:function(_3b1,_3b2){
return new MapBuzz.Surface.HandleProxy(this,_3b1,_3b2);
}});
MapBuzz.Surface.HandleProxy=function HandleProxy(_3b3,_3b4,_3b5){
this.surface=_3b3;
this.handle=_3b4;
this.handleElement=_3b5;
this.initialize();
};
Object.extend(MapBuzz.Surface.HandleProxy.prototype,{initialize:function(){
this.handleElement.handle=this.handle;
this.handleElement.mbShape=this.handle.shape;
},release:function(_3b6){
},draw:function(){
}});
namespace("MapBuzz.Surface");
MapBuzz.Surface.Composite=function CompositeSurface(_3b7,_3b8){
this.surfaceConstructors=_3b8;
this.surfaces=new Array();
this.applySuper(arguments);
};
MapBuzz.Surface.Composite.inherits(MapBuzz.Surface.AbstractVector);
Object.extend(MapBuzz.Surface.Composite.prototype,{initialize:function(){
var _3b9=this.manager.view.panes.getSurfacePane();
for(var i=0;i<this.surfaceConstructors.length;i++){
var _3bb=this.surfaceConstructors[i];
var _3bc=new _3bb(this.manager);
this.surfaces.push(_3bc);
}
},release:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].release();
}
},setZIndex:function(_3be){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].setZIndex(_3be+i);
}
},resize:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].resize();
}
},changeDisplayExtent:function(_3c1,_3c2){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].changeDisplayExtent(_3c1,_3c2);
}
},startPan:function(_3c4,_3c5){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].startPan(_3c4,_3c5);
}
},pan:function(_3c7,_3c8){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].pan(_3c7,_3c8);
}
},endPan:function(_3ca,_3cb){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].endPan(_3ca,_3cb);
}
},lock:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].lock();
}
},unlock:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].unlock();
}
},createShape:function(_3cf){
var _3d0=null;
for(var i=0;i<this.surfaces.length;i++){
var _3d2=this.surfaces[i];
_3d0=_3d2.shapeFactory.create(_3cf);
if(_3d0){
break;
}
}
return _3d0;
},supportsFigure:function(_3d3){
var _3d4=false;
for(var i=0;i<this.surfaces.length;i++){
var _3d6=this.surfaces[i];
_3d4=_3d6.shapeFactory.supports(_3d3);
if(_3d4){
break;
}
}
return _3d4;
},clearEntries:function(_3d7){
MapBuzz.databus.send(this,MapBuzz.Surface.BEFORE_CLEAR_MODELS,{models:_3d7});
for(var i=0;i<_3d7.length;i++){
var _3d9=_3d7[i];
for(var j=0;j<this.surfaces.length;j++){
var _3db=this.surfaces[j];
_3d9.figures.undisplay(_3db);
}
}
MapBuzz.databus.send(this,MapBuzz.Surface.AFTER_CLEAR_MODELS,{models:_3d7});
}});
MapBuzz.Surface.CreateCompositeConstructor=function(_3dc){
var _3dd=function CompositeConstructor(_3de){
this.callSuper(arguments.callee,_3de,_3dc);
};
_3dd.inherits(MapBuzz.Surface.Composite);
return _3dd;
};
namespace("MapBuzz.Surface");
MapBuzz.Surface.Html=function HtmlSurface(_3df,_3e0){
this.applySuper(arguments);
};
MapBuzz.Surface.Html.inherits(MapBuzz.Surface.AbstractVector);
Object.extend(MapBuzz.Surface.Html.prototype,{getNamespace:function(){
return MapBuzz.Namespace.XHTML_NAMESPACE_URI;
},setupFactory:function(){
this.shapeFactory.register(MapBuzz.Figure.Note,MapBuzz.Surface.HtmlNote);
this.shapeFactory.register(MapBuzz.Figure.Image,MapBuzz.Surface.HtmlImage);
this.shapeFactory.register(MapBuzz.Figure.Envelope,MapBuzz.Surface.HtmlEnvelope);
},createRootElement:function(){
this.rootElement=this.createElement("div");
this.rootElement.id=this.id;
var _3e1=this.manager.view.panes.getSurfacePane();
_3e1.appendChild(this.rootElement);
this.rootElement.style.position="absolute";
this.rootElement.style.left="0px";
this.rootElement.style.top="0px";
this.rootElement.style.width="0px";
this.rootElement.style.height="0px";
this.rootElement.style.overflow="visible";
return this.rootElement;
},createContentElement:function(){
this.contentElement=this.rootElement;
this.contentElement.className=this.getClassName();
return this.contentElement;
},createHandleImpl:function(_3e2){
return new MapBuzz.Surface.HtmlHandle(this,_3e2);
}});
MapBuzz.Surface.HtmlHandle=function HtmlHandle(_3e3,_3e4){
this.surface=_3e3;
this.handle=_3e4;
this.handleElement=null;
this.initialize();
};
Object.extend(MapBuzz.Surface.HtmlHandle.prototype,{initialize:function(){
this.handleElement=this.surface.createElement("div");
this.surface.contentElement.appendChild(this.handleElement);
this.handleElement.handle=this.handle;
this.handleElement.mbShape=this.handle.shape;
this.handleElement.style.position="absolute";
this.handleElement.style.width=MapBuzz.Figure.HANDLESIZE+"px";
this.handleElement.style.height=MapBuzz.Figure.HANDLESIZE+"px";
this.handleElement.style.border="1px solid black";
this.handleElement.style.backgroundColor="white";
this.draw();
},release:function(_3e5){
this.handleElement.handle=null;
this.handleElement.parentNode.removeChild(this.handleElement);
},draw:function(){
var _3e6=this.handle.getCoord();
this.handleElement.style.left=(_3e6.x-MapBuzz.Figure.HANDLESIZE/2)+"px";
this.handleElement.style.top=(_3e6.y-MapBuzz.Figure.HANDLESIZE/2)+"px";
}});
MapBuzz.Surface.HtmlImage=function HtmlImage(_3e7,_3e8){
this.applySuper(arguments);
};
MapBuzz.Surface.HtmlImage.inherits(MapBuzz.Surface.AbstractShape);
Object.extend(MapBuzz.Surface.HtmlImage.prototype,{initialize:function(){
this.element=this.surface.createElement("img");
this.element.style.position="absolute";
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element.width=this.icon.imageType.size;
this.element.height=this.icon.imageType.size;
this.draw();
this.element.src=this.icon.resource.uri;
this.surface.contentElement.appendChild(this.element);
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
var x=geom.x-this.icon.hotSpot.x;
var y=geom.y-this.icon.hotSpot.y;
this.element.style.left=Math.round(x)+"px";
this.element.style.top=Math.round(y)+"px";
},redraw:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element.src=this.icon.resource.uri;
this.draw();
},highlight:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL_HOVER);
this.element.src=this.icon.resource.uri;
this.draw();
},unhighlight:function(){
this.redraw();
}});
MapBuzz.Surface.HtmlEnvelope=function HtmlEnvelope(_3ec,_3ed){
this.applySuper(arguments);
};
MapBuzz.Surface.HtmlEnvelope.inherits(MapBuzz.Surface.AbstractShape);
Object.extend(MapBuzz.Surface.HtmlEnvelope.prototype,{initialize:function(){
this.element=this.surface.createElement("div");
this.element.style.position="absolute";
this.surface.contentElement.appendChild(this.element);
this.element.className=this.figure.getClassName();
this.applySuper(arguments);
},draw:function(){
var _3ee=this.getGeom().getBounds();
var _3ef=parseInt(Element.getStyle(this.element,"borderWidth"));
_3ef=isNaN(_3ef)?0:_3ef;
this.element.style.left=Math.round(_3ee.xMin)+"px";
this.element.style.top=Math.round(_3ee.yMin)+"px";
if((2*_3ef)<Math.round(_3ee.width)){
this.element.style.width=(Math.round(_3ee.width)-(2*_3ef))+"px";
}else{
this.element.style.width=Math.round(_3ee.width)+"px";
}
if((2*_3ef)<Math.round(_3ee.height)){
this.element.style.height=(Math.round(_3ee.height)-(2*_3ef))+"px";
}else{
this.element.style.height=Math.round(_3ee.height)+"px";
}
this.drawHandles();
},highlight:function(){
Element.addClassName(this.element,"highlight");
},unhighlight:function(){
Element.removeClassName(this.element,"highlight");
}});
MapBuzz.Surface.HtmlEnvelope.prototype.toString=function toString(){
return "HtmlEnvelope ["+this.figure.toString()+"]";
};
MapBuzz.Surface.HtmlNote=function HtmlNote(_3f0,_3f1){
this.applySuper(arguments);
};
MapBuzz.Surface.HtmlNote.inherits(MapBuzz.Surface.AbstractShape);
MapBuzz.Surface.HtmlNote.BASE_URI="/images/note/note_";
MapBuzz.Surface.HtmlNote.DEFAULT_WIDTH=32;
MapBuzz.Surface.HtmlNote.DEFAULT_HEIGHT=32;
MapBuzz.Surface.HtmlNote.X_HOT_SPOT=16;
MapBuzz.Surface.HtmlNote.Y_HOT_SPOT=16;
Object.extend(MapBuzz.Surface.HtmlNote.prototype,{initialize:function(){
this.element=this.surface.createElement("img");
this.element.style.position="absolute";
this.element.width=MapBuzz.Surface.HtmlNote.DEFAULT_WIDTH;
this.element.height=MapBuzz.Surface.HtmlNote.DEFAULT_HEIGHT;
this.draw();
this.element.src=this.getUri();
this.surface.contentElement.appendChild(this.element);
this.applySuper(arguments);
},getTool:function(){
return new MapBuzz.Tool.NoteInfoTool(this.surface.view.map.toolManager,this);
},draw:function(){
var geom=this.getGeom();
var x=geom.x-MapBuzz.Surface.HtmlNote.X_HOT_SPOT;
var y=geom.y-MapBuzz.Surface.HtmlNote.Y_HOT_SPOT;
this.element.style.left=Math.round(x)+"px";
this.element.style.top=Math.round(y)+"px";
},highlight:function(){
this.element.src=this.getUri(MapBuzz.Media.PSEUDO_CLASS_HOVER);
},unhighlight:function(){
this.element.src=this.getUri(MapBuzz.Media.PSEUDO_CLASS_NORMAL);
},getUri:function(_3f5){
var uri=MapBuzz.Surface.HtmlNote.BASE_URI;
var _3f7=this.figure.styles.normal();
var _3f8=_3f7.color.toLowerCase().substr(1);
uri+=_3f8;
if(this.figure.figures.feature.author.equals(MapBuzz.user)){
uri+="_star";
}
if(_3f5==MapBuzz.Media.PSEUDO_CLASS_HOVER){
uri+="_active";
}
uri+=".png";
return uri;
}});
if(!MapBuzz.Surface.Vector){
MapBuzz.Surface.Vector=MapBuzz.Surface.Html;
}
MapBuzz.Surface.VML=function VMLSurface(_3f9){
this.applySuper(arguments);
};
MapBuzz.Surface.VML.inherits(MapBuzz.Surface.AbstractVector);
Object.extend(MapBuzz.Namespace,{VML_NAMESPACE_PREFIX:"vml",VML_NAMESPACE_URI:"urn:schemas-microsoft-com:vml"});
MapBuzz.Namespace.register(MapBuzz.Namespace.VML_NAMESPACE_PREFIX,MapBuzz.Namespace.VML_NAMESPACE_URI);
Object.extend(MapBuzz.Surface.VML.prototype,{initialize:function(){
this.applySuper(arguments);
this.createSymbols();
this.createGeomGroups();
},setupFactory:function(){
this.shapeFactory.register(MapBuzz.Figure.Symbol,MapBuzz.Surface.VMLSymbol);
this.shapeFactory.register(MapBuzz.Figure.Image,MapBuzz.Surface.VMLImage);
this.shapeFactory.register(MapBuzz.Figure.LineString,MapBuzz.Surface.VMLLineString);
this.shapeFactory.register(MapBuzz.Figure.Envelope,MapBuzz.Surface.VMLEnvelope);
this.shapeFactory.register(MapBuzz.Figure.Ellipse,MapBuzz.Surface.VMLEllipse);
this.shapeFactory.register(MapBuzz.Figure.Polygon,MapBuzz.Surface.VMLPolygon);
this.shapeFactory.register(MapBuzz.Figure.Collection,MapBuzz.Surface.Collection);
},createRootElement:function(){
var _3fa=this.view.getViewBounds();
this.rootElement=this.createElement("group");
var _3fb=this.manager.view.panes.getSurfacePane();
_3fb.appendChild(this.rootElement);
this.rootElement.style.position="absolute";
this.rootElement.style.left="0px";
this.rootElement.style.top="0px";
this.rootElement.style.width=_3fa.width;
this.rootElement.style.height=_3fa.height;
this.rootElement.coordorigin="0,0";
this.rootElement.coordsize=this.view.element.clientWidth+","+this.view.element.clientHeight;
return this.rootElement;
},createContentElement:function(){
this.contentElement=this.rootElement;
if(MapBuzz.ENVIRONMENT=="development"||MapBuzz.ENVIRONMENT=="selenium"){
this.debugElement=this.createElement("rect");
this.debugElement.style.position="absolute";
this.debugElement.style.height="100%";
this.debugElement.style.width="100%";
this.debugElement.filled=false;
this.debugElement.stroked=true;
this.debugElement.strokecolor="red";
this.debugElement.strokeweight="1px";
this.rootElement.appendChild(this.debugElement);
}
},createGeomGroups:function(){
this.geomGroups=new HashTable();
for(var i=0;i<MapBuzz.Surface.AbstractVector.Z_ORDERING.length;i++){
var _3fd=MapBuzz.Surface.AbstractVector.Z_ORDERING[i];
var id="geom_type_"+_3fd;
var _3ff=this.createElement("group");
_3ff.style.height="100%";
_3ff.style.width="100%";
_3ff.id=id;
this.contentElement.appendChild(_3ff);
this.geomGroups[_3fd]=_3ff;
}
},getGroup:function(geom){
return this.geomGroups[geom.getGeomTypeId()];
},createSymbols:function(){
var _401=this.createElement("shapetype","markerSymbol");
this.rootElement.appendChild(_401);
_401.coordsize="22,34";
_401.stroked=true;
_401.strokecolor="black";
_401.filled=true;
_401.fillcolor="#ff766a";
var path=this.createElement("path");
path.v="wa 0,0 19,19, 4,17, 15,17 c 11,20 11,25 10,33 l 9,33 c 8,25, 8,20, 4,17 ar 7,7 13,13 7,10 7,10";
_401.appendChild(path);
},createElement:function(_403,id){
var _405=document.createElement(MapBuzz.Namespace.VML_NAMESPACE_PREFIX+":"+_403);
if(id){
_405.id=id;
}
return _405;
},createHandleImpl:function(_406){
return new MapBuzz.Surface.VmlHandle(this,_406);
},getCssStyle:function(_407,_408){
var _409=_407.nodeName;
switch(_409){
case "shape":
_409="polygon";
break;
}
var _40a=_407.className;
var _40b=_409+"_"+_40a;
if(_408){
_409+="_"+_408;
_40a+="_"+_408;
_40b+="_"+_408;
}
return MapBuzz.Surface.CSS_STYLES[_40b]||MapBuzz.Surface.CSS_STYLES[_40a]||MapBuzz.Surface.CSS_STYLES[_409];
}});
MapBuzz.Surface.VmlHandle=function VmlHandle(_40c,_40d){
this.surface=_40c;
this.handle=_40d;
this.handleElement=null;
this.initialize();
};
Object.extend(MapBuzz.Surface.VmlHandle.prototype,{initialize:function(){
this.handleElement=this.surface.createElement("rect");
this.surface.contentElement.appendChild(this.handleElement);
this.handleElement.handle=this.handle;
this.handleElement.mbShape=this.handle.shape;
this.handleElement.style.position="absolute";
this.handleElement.style.width=MapBuzz.Figure.HANDLESIZE*1.25;
this.handleElement.style.height=MapBuzz.Figure.HANDLESIZE*1.25;
this.handleElement.stroked=true;
this.handleElement.strokeColor="black";
this.handleElement.filled=true;
this.handleElement.fillColor="white";
this.draw();
},release:function(_40e){
this.handleElement.handle=null;
this.handleElement.parentNode.removeChild(this.handleElement);
},draw:function(){
var _40f=this.handle.getCoord();
this.handleElement.style.left=_40f.x-(1.25*MapBuzz.Figure.HANDLESIZE/2);
this.handleElement.style.top=_40f.y-(1.25*MapBuzz.Figure.HANDLESIZE/2);
}});
MapBuzz.Surface.VMLShape=function VMLShape(_410,_411){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLShape.inherits(MapBuzz.Surface.AbstractShape);
Object.extend(MapBuzz.Surface.VMLShape.prototype,{highlight:function(){
Element.addClassName(this.element,"highlight");
},unhighlight:function(){
Element.removeClassName(this.element,"highlight");
}});
MapBuzz.Surface.VMLSymbol=function VMLSymbol(_412,_413){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLSymbol.inherits(MapBuzz.Surface.VMLShape);
Object.extend(MapBuzz.Surface.VMLSymbol.prototype,{initialize:function(){
this.fill="#ff766a";
this.element=this.surface.createElement("shape");
var _414=this.surface.getGroup(this.figure.geom);
_414.appendChild(this.element);
this.element.mbShape=this;
this.element.coordorigin="0,0";
this.element.coordsize="22,34";
this.element.style.width="22px";
this.element.style.height="34px";
this.element.stroked=true;
this.element.strokeColor="black";
this.element.filled=true;
this.element.fillcolor=this.fill;
this.element.type=MapBuzz.Figure.Symbol.NORMAL_SYMBOL;
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
var x=geom.x-MapBuzz.Figure.Symbol.WIDTH/2;
var y=geom.y-MapBuzz.Figure.Symbol.HEIGHT;
this.element.style.left=x;
this.element.style.top=y;
},highlight:function(){
this.element.fillColor="yellow";
},unhighlight:function(){
this.element.fillColor=this.fill;
}});
MapBuzz.Surface.VMLSymbol.prototype.toString=function toString(){
return "VMLSymbol ["+this.figure.toString()+"]";
};
MapBuzz.Surface.VMLImage=function VMLImage(_418,_419){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLImage.inherits(MapBuzz.Surface.VMLShape);
Object.extend(MapBuzz.Surface.VMLImage.prototype,{initialize:function(){
this.element=this.surface.createElement("image");
var _41a=this.surface.getGroup(this.figure.geom);
_41a.appendChild(this.element);
this.element.mbShape=this;
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element.style.width=this.icon.imageType.size;
this.element.style.height=this.icon.imageType.size;
this.element.src=this.icon.resource.uri;
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
var x=geom.x-this.icon.hotSpot.x;
var y=geom.y-this.icon.hotSpot.y;
this.element.style.left=Math.round(x);
this.element.style.top=Math.round(y);
},redraw:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element.src=this.icon.resource.uri;
this.draw();
},highlight:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL_HOVER);
this.element.src=this.icon.resource.uri;
this.draw();
},unhighlight:function(){
this.redraw();
}});
MapBuzz.Surface.VMLImage.prototype.toString=function toString(){
return "VMLImage ["+this.figure.toString()+"]";
};
MapBuzz.Surface.VMLLineString=function VMLLineString(_41e,_41f){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLLineString.inherits(MapBuzz.Surface.VMLShape);
Object.extend(MapBuzz.Surface.VMLLineString.prototype,{initialize:function(){
this.element=this.surface.createElement("polyline");
this.element.className=this.figure.getClassName();
var _420=this.surface.getGroup(this.figure.geom);
_420.appendChild(this.element);
this.element.mbShape=this;
this.element.points.value="";
var _421=this.surface.getCssStyle(this.element);
var _422=this.surface.createElement("stroke");
_422.color=_421.stroke;
_422.weight=_421.stroke_width;
_422.opacity=_421.stroke_opacity;
this.element.appendChild(_422);
this.element.filled=false;
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
var _424=geom.coords;
this.element.points.value=_424.coordsAsString(" "," ",null,null,true);
this.drawHandles();
},highlight:function(){
var _425=this.surface.getCssStyle(this.element,"hover");
this.element.strokecolor=_425.stroke;
},unhighlight:function(){
var _426=this.surface.getCssStyle(this.element);
this.element.strokecolor=_426.stroke;
}});
MapBuzz.Surface.VMLLineString.prototype.toString=function toString(){
return "VMLLineString ["+this.figure.toString()+"]";
};
MapBuzz.Surface.VMLPolygon=function VMLPolygon(_427,_428){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLPolygon.inherits(MapBuzz.Surface.VMLLineString);
Object.extend(MapBuzz.Surface.VMLPolygon.prototype,{initialize:function(){
var _429=this.surface.view.getViewBounds();
this.element=this.surface.createElement("shape");
this.element.className=this.figure.getClassName();
this.element.style.width=_429.width;
this.element.style.height=_429.height;
this.element.coordorigin="0,0";
this.element.coordsize=_429.width+","+_429.height;
var _42a=this.surface.getGroup(this.figure.geom);
_42a.appendChild(this.element);
this.element.mbShape=this;
var _42b=this.surface.getCssStyle(this.element);
var _42c=this.surface.createElement("stroke");
_42c.color=_42b.stroke;
_42c.weight=_42b.stroke_width;
_42c.opacity=_42b.stroke_opacity;
this.element.appendChild(_42c);
var _42b=this.surface.getCssStyle(this.element);
var fill=this.surface.createElement("fill");
fill.color=_42b.fill;
fill.opacity=_42b.fill_opacity;
this.element.appendChild(fill);
this.element.mbShape=this;
this.element.figure=this.figure;
},draw:function(){
var geom=this.getGeom();
this.element.path="m "+Math.round(geom.coords.getX(0))+" "+Math.round(geom.coords.getY(0))+" "+"l "+geom.coords.coordsAsString(" "," ",1,null,true)+" x e";
this.drawHandles();
},highlight:function(){
var _42f=this.surface.getCssStyle(this.element,"hover");
this.element.strokecolor=_42f.stroke;
this.element.fillColor=_42f.fill;
},unhighlight:function(){
var _430=this.surface.getCssStyle(this.element);
this.element.strokecolor=_430.stroke;
this.element.fillColor=_430.fill;
}});
MapBuzz.Surface.VMLPolygon.prototype.toString=function toString(){
return "VMLPolygon ["+this.figure.toString()+"]";
};
MapBuzz.Surface.VMLEnvelope=function VMLEnvelope(_431,_432){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLEnvelope.inherits(MapBuzz.Surface.VMLShape);
Object.extend(MapBuzz.Surface.VMLEnvelope.prototype,{initialize:function(){
this.element=this.surface.createElement("rect");
this.element.className=this.figure.getClassName();
var _433=this.surface.getGroup(this.figure.geom);
_433.appendChild(this.element);
this.element.mbShape=this;
var _434=this.surface.getCssStyle(this.element);
var fill=this.surface.createElement("fill");
fill.color=_434.fill;
fill.opacity=_434.fill_opacity;
this.element.appendChild(fill);
var _436=this.surface.createElement("stroke");
_436.color=_434.stroke;
_436.weight=_434.stroke_width;
_436.opacity=_434.stroke_opacity;
this.element.appendChild(_436);
this.applySuper(arguments);
},draw:function(){
var _437=this.getGeom().getBounds();
this.element.style.left=_437.xMin;
this.element.style.top=_437.yMin;
this.element.style.width=_437.width;
this.element.style.height=_437.height;
this.drawHandles();
},highlight:function(){
var _438=this.surface.getCssStyle(this.element,"hover");
this.element.strokecolor=_438.stroke;
this.element.fillColor=_438.fill;
},unhighlight:function(){
var _439=this.surface.getCssStyle(this.element);
this.element.strokecolor=_439.stroke;
this.element.fillColor=_439.fill;
}});
MapBuzz.Surface.VMLEnvelope.prototype.toString=function toString(){
return "VMLEnvelope ["+this.figure.toString()+"]";
};
MapBuzz.Surface.VMLEllipse=function VMLEllipse(_43a,_43b){
this.applySuper(arguments);
};
MapBuzz.Surface.VMLEllipse.inherits(MapBuzz.Surface.VMLShape);
Object.extend(MapBuzz.Surface.VMLEllipse.prototype,{initialize:function(){
this.element=this.surface.createElement("oval");
this.element.className=this.figure.getClassName();
var _43c=this.surface.getGroup(this.figure.geom);
_43c.appendChild(this.element);
this.element.mbShape=this;
var _43d=this.surface.getCssStyle(this.element);
var _43e=this.surface.createElement("stroke");
_43e.color=_43d.stroke;
_43e.weight=_43d.stroke_width;
_43e.opacity=_43d.stroke_opacity;
this.element.appendChild(_43e);
this.element.filled=false;
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
this.element.style.left=geom.getCenter().x-geom.rx;
this.element.style.top=geom.getCenter().y-geom.ry;
this.element.style.width=2*geom.rx;
this.element.style.height=2*geom.ry;
this.drawHandles();
},highlight:function(){
var _440=this.surface.getCssStyle(this.element,"hover");
this.element.strokecolor=_440.stroke;
this.element.fillColor=_440.fill;
},unhighlight:function(){
var _441=this.surface.getCssStyle(this.element);
this.element.strokecolor=_441.stroke;
this.element.fillColor=_441.fill;
}});
MapBuzz.Surface.VMLEllipse.prototype.toString=function toString(){
return "VMLEllipse ["+this.figure.toString()+"]";
};
if(Browser.instance.isIE()){
document.namespaces.add(MapBuzz.Namespace.VML_NAMESPACE_PREFIX,MapBuzz.Namespace.VML_NAMESPACE_URI);
var vmlStyle="behavior: url(#default#VML);display:inline-block";
var stylesheet=document.createStyleSheet();
stylesheet.addRule("vml\\:fill",vmlStyle);
stylesheet.addRule("vml\\:group",vmlStyle);
stylesheet.addRule("vml\\:image",vmlStyle);
stylesheet.addRule("vml\\:marker",vmlStyle);
stylesheet.addRule("vml\\:oval",vmlStyle);
stylesheet.addRule("vml\\:path",vmlStyle);
stylesheet.addRule("vml\\:polyline",vmlStyle);
stylesheet.addRule("vml\\:rect",vmlStyle);
stylesheet.addRule("vml\\:shape",vmlStyle);
stylesheet.addRule("vml\\:shapetype",vmlStyle);
stylesheet.addRule("vml\\:stroke",vmlStyle);
MapBuzz.Surface.Vector=MapBuzz.Surface.CreateCompositeConstructor([MapBuzz.Surface.Html,MapBuzz.Surface.VML]);
}
namespace("MapBuzz.Surface");
MapBuzz.Surface.GoogleLayer=function GoogleLayer(_442,_443,_444){
this.applySuper(arguments);
};
MapBuzz.Surface.GoogleLayer.inherits(MapBuzz.Surface.Tile);
Object.extend(MapBuzz.Surface.GoogleLayer.prototype,{addDataSource:function(_445){
this.applySuper(arguments);
this.contentElement.className=this.getClassName();
},createTiles:function(){
return new MapBuzz.Surface.Tile.GoogleTiles(this);
},getTileUri:function(tile){
var _447=tile.getDisplayBounds();
var x=Math.round(_447.xMin/this.getTileSize());
var y=Math.round(_447.yMin/this.getTileSize());
var zoom=this.view.displayExtent.zoom;
var uri=this.dataSource.resource.uri;
return uri.replace(/{Z}/,zoom).replace(/{X}/,x).replace(/{Y}/,y);
},isTransparent:function(){
false;
}});
MapBuzz.Surface.Tile.GoogleTiles=function GoogleTiles(_44c){
this.applySuper(arguments);
};
MapBuzz.Surface.Tile.GoogleTiles.inherits(MapBuzz.Surface.Tile.Tiles);
Object.extend(MapBuzz.Namespace,{SVG_NAMESPACE_PREFIX:"svg",SVG_NAMESPACE_URI:"http://www.w3.org/2000/svg",XLINK_NAMESPACE_PREFIX:"xlink",XLINK_NAMESPACE_URI:"http://www.w3.org/1999/xlink"});
Geometry.AffineTransform.prototype.toSVGMatrix=function toSVGMatrix(svg){
var _44e=svg.createSVGMatrix();
_44e.a=this.a;
_44e.b=this.b;
_44e.c=this.c;
_44e.d=this.d;
_44e.e=this.e;
_44e.f=this.f;
return _44e;
};
function SVGSVGElementGetBounds(_44f){
var _450=_44f.width.baseVal.value;
var _451=_44f.height.baseVal.value;
var crs=new Geometry.SVGElementCrs(_44f);
return new Geometry.Envelope([0,0,_450,_451],crs);
}
function SVGElementToEnvelope(_453){
var bbox=_453.getBBox();
var _455=_453.ownerSVGElement.createSVGPoint();
_455.x=bbox.x;
_455.y=bbox.y;
var _456=_453.ownerSVGElement.createSVGPoint();
_456.x=bbox.x+bbox.width;
_456.y=bbox.y+bbox.height;
var _457=_453.transform.baseVal.getItem(0);
var _458=_457.matrix;
_455=_455.matrixTransform(_458);
_456=_456.matrixTransform(_458);
var crs=new Geometry.SVGElementCrs(_453);
var _45a=new Geometry.Envelope(_455.x,_455.y,_456.x,_456.y,crs);
return _45a;
}
MapBuzz.Surface.SVG=function SVGSurface(_45b){
this.applySuper(arguments);
};
MapBuzz.Surface.SVG.inherits(MapBuzz.Surface.AbstractVector);
Object.extend(MapBuzz.Surface.SVG,{FILL_OPACITY:0.2,HIGHLIGHT_FILL_OPACITY:0.5});
MapBuzz.Namespace.register(MapBuzz.Namespace.SVG_NAMESPACE_PREFIX,MapBuzz.Namespace.SVG_NAMESPACE_URI);
MapBuzz.Namespace.register(MapBuzz.Namespace.XLINK_NAMESPACE_PREFIX,MapBuzz.Namespace.XLINK_NAMESPACE_URI);
Object.extend(MapBuzz.Surface.SVG.prototype,{initialize:function(){
this.applySuper(arguments);
this.createSymbols();
this.createGeomGroups();
},setupFactory:function(){
this.shapeFactory.register(MapBuzz.Figure.Symbol,MapBuzz.Surface.SVGSymbol);
this.shapeFactory.register(MapBuzz.Figure.Image,MapBuzz.Surface.SVGImage);
this.shapeFactory.register(MapBuzz.Figure.LineString,MapBuzz.Surface.SVGLineString);
this.shapeFactory.register(MapBuzz.Figure.Envelope,MapBuzz.Surface.SVGEnvelope);
this.shapeFactory.register(MapBuzz.Figure.Ellipse,MapBuzz.Surface.SVGEllipse);
this.shapeFactory.register(MapBuzz.Figure.Polygon,MapBuzz.Surface.SVGPolygon);
this.shapeFactory.register(MapBuzz.Figure.Collection,MapBuzz.Surface.Collection);
},getNamespace:function(){
return MapBuzz.Namespace.SVG_NAMESPACE_URI;
},createRootElement:function(){
this.rootElement=this.createElement("svg");
this.rootElement.id=this.id;
var _45c=this.manager.view.panes.getSurfacePane();
_45c.appendChild(this.rootElement);
this.rootElement.style.position="absolute";
this.rootElement.style.left="0px";
this.rootElement.style.top="0px";
this.rootElement.setAttribute("width",this.view.element.scrollWidth);
this.rootElement.setAttribute("height",this.view.element.scrollHeight);
this.rootElement.setAttribute("overflow","hidden");
if(MapBuzz.ENVIRONMENT=="development"||MapBuzz.ENVIRONMENT=="selenium"||MapBuzz.ENVIRONMENT=="staging"){
this.debugElement=this.createElement("rect");
this.debugElement.setAttribute("width",this.view.element.scrollWidth);
this.debugElement.setAttribute("height",this.view.element.scrollHeight);
this.debugElement.setAttribute("x","0");
this.debugElement.setAttribute("y","0");
this.debugElement.setAttribute("stroke","orange");
this.debugElement.setAttribute("stroke-width","1");
this.debugElement.setAttribute("fill","none");
this.rootElement.appendChild(this.debugElement);
}
return this.rootElement;
},createSymbols:function(){
var defs=this.createElement("defs");
this.rootElement.insertBefore(defs,this.contentElement);
var _45e=this.createElement("g");
_45e.setAttribute("id","markerSymbol");
_45e.setAttribute("stroke","black");
var path=this.createElement("path");
path.setAttributeNS(null,"d","M 4,17 A 9, 9 0 1 1 16,17 C 11,22 11,25 11,33 L 9,33 C 9,25 9,22 4,17");
_45e.appendChild(path);
var _460=this.createElement("circle");
_460.setAttributeNS(null,"r","2.5");
_460.setAttributeNS(null,"cx","10");
_460.setAttributeNS(null,"cy","10");
_460.setAttributeNS(null,"fill","black");
_45e.appendChild(_460);
defs.appendChild(_45e);
},createContentElement:function(){
this.contentElement=this.createElement("g");
var _461=this.rootElement.createSVGMatrix();
var _462=this.rootElement.createSVGTransformFromMatrix(_461);
this.contentElement.transform.baseVal.initialize(_462);
this.rootElement.appendChild(this.contentElement);
},getSurfaceToDisplayTransform:function(){
if(!this.surfaceToDisplayTransform){
this.surfaceToDisplayTransform=new Geometry.Transform();
this.surfaceToDisplayTransform.add(this.view.getViewToDisplayTransform().copy());
}
return this.surfaceToDisplayTransform;
},createGeomGroups:function(){
this.geomGroups=new HashTable();
for(var i=0;i<MapBuzz.Surface.AbstractVector.Z_ORDERING.length;i++){
var _464=MapBuzz.Surface.AbstractVector.Z_ORDERING[i];
var id="geom_type_"+_464;
var _466=this.createElement("g");
_466.id=id;
this.contentElement.appendChild(_466);
this.geomGroups[_464]=_466;
}
},getGroup:function(geom){
return this.geomGroups[geom.getGeomTypeId()];
},resetSvgTransform:function(){
var _468=this.view.getViewBounds();
this.rootElement.style.width=_468.width+"px";
this.rootElement.style.height=_468.height+"px";
var _469=this.contentElement.transform.baseVal.getItem(0);
_469.setTranslate(0,0);
},resize:function(){
this.rootElement.setAttribute("width",this.view.element.scrollWidth);
this.rootElement.setAttribute("height",this.view.element.scrollHeight);
if(this.debugElement){
this.debugElement.setAttribute("width",this.view.element.scrollWidth);
this.debugElement.setAttribute("height",this.view.element.scrollHeight);
}
},changeDisplayExtent:function(_46a,_46b){
this.clear();
this.resetSvgTransform();
this.resetTransforms();
this.applySuper(arguments);
},endPan:function(_46c,_46d){
var left=this.rootElement.style.left.match(/^(.+?)\D/)[1];
left=Number(left);
left-=_46c;
var top=this.rootElement.style.top.match(/^(.+?)\D/)[1];
top=Number(top);
top-=_46d;
this.rootElement.style.left=left+"px";
this.rootElement.style.top=top+"px";
var _470=this.contentElement.transform.baseVal.getItem(0);
var _471=_470.matrix;
_471=_471.translate(_46c,_46d);
_470.setMatrix(_471);
},lock:function(){
this.rootElement.suspendRedraw(10);
},unlock:function(){
this.rootElement.unsuspendRedrawAll();
},createHandleImpl:function(_472){
return new MapBuzz.Surface.SVGHandle(this,_472);
}});
MapBuzz.Surface.SVGHandle=function SVGHandle(_473,_474){
this.surface=_473;
this.handle=_474;
this.handleElement=null;
this.initialize();
};
Object.extend(MapBuzz.Surface.SVGHandle.prototype,{initialize:function(){
this.handleElement=this.surface.createElement("rect");
this.handleElement.setAttributeNS(null,"stroke","black");
this.handleElement.setAttributeNS(null,"fill","white");
this.handleElement.setAttribute("pointer-events","visible");
this.handleElement.handle=this.handle;
this.handleElement.mbShape=this.handle.shape;
this.handleElement.setAttributeNS(null,"width",MapBuzz.Figure.HANDLESIZE);
this.handleElement.setAttributeNS(null,"height",MapBuzz.Figure.HANDLESIZE);
this.draw();
this.surface.contentElement.appendChild(this.handleElement);
},release:function(){
this.handleElement.handle=null;
this.handleElement.parentNode.removeChild(this.handleElement);
},draw:function(){
var _475=this.handle.getCoord();
this.handleElement.setAttributeNS(null,"x",_475.x-MapBuzz.Figure.HANDLESIZE/2);
this.handleElement.setAttributeNS(null,"y",_475.y-MapBuzz.Figure.HANDLESIZE/2);
}});
MapBuzz.Surface.SVGShape=function SVGShape(_476,_477){
this.applySuper(arguments);
};
MapBuzz.Surface.SVGShape.inherits(MapBuzz.Surface.AbstractShape);
Object.extend(MapBuzz.Surface.SVGShape.prototype,{setZIndex:function(_478){
this.zIndex=_478;
var _479=this.element.parentNode;
if(_478){
this.previousIndex=this.getIndex();
_479.appendChild(this.element);
}else{
if(this.previousIndex){
var _47a=_479.childNodes[this.previousIndex];
_479.insertBefore(this.element,_47a);
this.previousIndex=null;
}
}
},getIndex:function(){
var node=this.element.parentNode.firstChild;
var i=0;
while(node){
if(node===this.element){
return i;
}
i++;
node=node.nextSibling;
}
return null;
},highlight:function(){
Element.addClassName(this.element,"highlight");
},unhighlight:function(){
Element.removeClassName(this.element,"highlight");
}});
MapBuzz.Surface.SVGSymbol=function SVGSymbol(_47d,_47e){
this.fill="#ff766a";
this.preDrawn=false;
this.applySuper(arguments);
};
MapBuzz.Surface.SVGSymbol.inherits(MapBuzz.Surface.SVGShape);
Object.extend(MapBuzz.Surface.SVGSymbol.prototype,{initialize:function(){
this.element=this.surface.createElement("use");
var _47f=this.surface.getGroup(this.figure.geom);
_47f.appendChild(this.element);
this.draw();
this.preDrawn=true;
this.element.setAttributeNS(MapBuzz.Namespace.XLINK_NAMESPACE_URI,"href",MapBuzz.Figure.Symbol.NORMAL_SYMBOL);
this.element.setAttribute("fill",this.fill);
this.element.setAttribute("pointer-events","visible");
this.applySuper(arguments);
},draw:function(){
if(this.preDrawn){
this.preDrawn=false;
}else{
var geom=this.getGeom();
var x=geom.x-MapBuzz.Figure.Symbol.WIDTH/2;
var y=geom.y-MapBuzz.Figure.Symbol.HEIGHT;
this.element.setAttribute("x",x);
this.element.setAttribute("y",y);
}
},highlight:function(){
this.element.setAttribute("fill","yellow");
},unhighlight:function(){
this.element.setAttribute("fill",this.fill);
}});
MapBuzz.Surface.SVGSymbol.prototype.toString=function toString(){
return "SVGSymbol ["+this.figure.toString()+"]";
};
MapBuzz.Surface.SVGImage=function SVGImage(_483,_484){
this.highlightBorderWidth=2;
this.preDrawn=false;
this.applySuper(arguments);
};
MapBuzz.Surface.SVGImage.inherits(MapBuzz.Surface.SVGShape);
Object.extend(MapBuzz.Surface.SVGImage.prototype,{initialize:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element=this.surface.createElement("image");
this.element.setAttribute("width",this.icon.imageType.size);
this.element.setAttribute("height",this.icon.imageType.size);
var _485=this.surface.getGroup(this.figure.geom);
_485.appendChild(this.element);
this.draw();
this.preDrawn=true;
this.element.setAttributeNS(MapBuzz.Namespace.XLINK_NAMESPACE_URI,"href",this.icon.resource.uri);
this.element.setAttribute("pointer-events","visible");
this.applySuper(arguments);
},draw:function(){
if(this.preDrawn){
this.preDrawn=false;
}else{
var geom=this.getGeom();
var x=geom.x-this.icon.hotSpot.x;
var y=geom.y-this.icon.hotSpot.y;
this.element.setAttribute("x",x);
this.element.setAttribute("y",y);
}
},redraw:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL);
this.element.setAttributeNS(MapBuzz.Namespace.XLINK_NAMESPACE_URI,"href",this.icon.resource.uri);
this.draw();
},highlight:function(){
this.icon=this.figure.getIcon(MapBuzz.Media.ImageType.SMALL_HOVER);
this.element.setAttributeNS(MapBuzz.Namespace.XLINK_NAMESPACE_URI,"href",this.icon.resource.uri);
this.draw();
},unhighlight:function(){
this.redraw();
}});
MapBuzz.Surface.SVGImage.prototype.toString=function toString(){
return "SVGImage ["+this.figure.toString()+"]";
};
MapBuzz.Surface.SVGLineString=function SVGLineString(_489,_48a){
this.applySuper(arguments);
};
MapBuzz.Surface.SVGLineString.inherits(MapBuzz.Surface.SVGShape);
Object.extend(MapBuzz.Surface.SVGLineString.prototype,{initialize:function(){
this.element=this.surface.createElement("polyline");
this.element.setAttribute("class",this.figure.getClassName());
var _48b=this.surface.getGroup(this.figure.geom);
_48b.appendChild(this.element);
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
var _48d=geom.coords;
var _48e=this.element.points;
var _48f=null;
for(var i=0;i<_48d.getNumberOfCoords();i++){
var x=_48d.coords[i*2];
var y=_48d.coords[(i*2)+1];
if(i<_48e.numberOfItems){
_48f=_48e.getItem(i);
_48f.x=x;
_48f.y=y;
}else{
_48f=this.element.ownerSVGElement.createSVGPoint();
_48f.x=x;
_48f.y=y;
_48e.appendItem(_48f);
}
}
for(var j=_48e.numberOfItems;j>geom.coords.getNumberOfCoords();j--){
_48e.removeItem(j-1);
}
this.drawHandles();
}});
MapBuzz.Surface.SVGLineString.prototype.toString=function toString(){
return "SVGLineString ["+this.figure.toString()+"]";
};
MapBuzz.Surface.SVGPolygon=function SVGPolygon(_494,_495){
this.applySuper(arguments);
};
MapBuzz.Surface.SVGPolygon.inherits(MapBuzz.Surface.SVGLineString);
Object.extend(MapBuzz.Surface.SVGPolygon.prototype,{initialize:function(){
this.element=this.surface.createElement("polygon");
this.element.setAttribute("class",this.figure.getClassName());
this.element.setAttribute("pointer-events","visible");
var _496=this.surface.getGroup(this.figure.geom);
_496.appendChild(this.element);
this.element.mbShape=this;
this.element.figure=this.figure;
}});
MapBuzz.Surface.SVGPolygon.prototype.toString=function toString(){
return "SVGPolygon ["+this.figure.toString()+"]";
};
MapBuzz.Surface.SVGEnvelope=function SVGEnvelope(_497,_498){
this.applySuper(arguments);
};
MapBuzz.Surface.SVGEnvelope.inherits(MapBuzz.Surface.SVGShape);
Object.extend(MapBuzz.Surface.SVGEnvelope.prototype,{initialize:function(){
this.element=this.surface.createElement("rect");
this.element.setAttribute("class",this.figure.getClassName());
this.element.setAttribute("pointer-events","visible");
var _499=this.surface.getGroup(this.figure.geom);
_499.appendChild(this.element);
this.applySuper(arguments);
},draw:function(){
var _49a=this.getGeom().getBounds();
this.element.setAttribute("x",_49a.xMin);
this.element.setAttribute("y",_49a.yMin);
this.element.setAttribute("width",_49a.width);
this.element.setAttribute("height",_49a.height);
this.drawHandles();
}});
MapBuzz.Surface.SVGEnvelope.prototype.toString=function toString(){
return "SVGEnvelope ["+this.figure.toString()+"]";
};
MapBuzz.Surface.SVGEllipse=function SVGEllipse(_49b,_49c){
this.applySuper(arguments);
};
MapBuzz.Surface.SVGEllipse.inherits(MapBuzz.Surface.SVGShape);
Object.extend(MapBuzz.Surface.SVGEllipse.prototype,{initialize:function(){
this.element=this.surface.createElement("ellipse");
this.element.setAttribute("class",this.figure.getClassName());
this.element.setAttribute("pointer-events","visible");
var _49d=this.surface.getGroup(this.figure.geom);
_49d.appendChild(this.element);
this.applySuper(arguments);
},draw:function(){
var geom=this.getGeom();
this.element.setAttribute("cx",geom.getCenter().x);
this.element.setAttribute("cy",geom.getCenter().y);
this.element.setAttribute("rx",geom.rx);
this.element.setAttribute("ry",geom.ry);
this.drawHandles();
}});
MapBuzz.Surface.SVGEllipse.prototype.toString=function toString(){
return "SVGEllipse ["+this.figure.toString()+"]";
};
if(Browser.instance.isWebkit()&&Browser.instance.majorVersion<525){
MapBuzz.Surface.Vector=MapBuzz.Surface.Html;
}else{
if(document.implementation.hasFeature("org.w3c.dom.svg","1.0")||document.implementation.hasFeature("org.w3c.dom.svg","1.1")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")){
MapBuzz.Surface.Vector=MapBuzz.Surface.CreateCompositeConstructor([MapBuzz.Surface.SVG,MapBuzz.Surface.Html]);
}
}
namespace("MapBuzz.Surface");
MapBuzz.Surface.Wms=function WmsSurface(_49f,_4a0){
this.applySuper(arguments);
};
MapBuzz.Surface.Wms.inherits(MapBuzz.Surface.Tile);
Object.extend(MapBuzz.Surface.Wms.prototype,{addDataSource:function(_4a1){
this.applySuper(arguments);
this.contentElement.className=this.getClassName();
},getTileUri:function(tile){
var _4a3=this.dataSource.getMapParameters();
var _4a4=tile.getSurfaceBounds();
var _4a5=tile.getWorldBounds();
_4a3["SRS"]="EPSG:"+_4a5.crs.constructor.EPSG;
_4a3["BBOX"]=_4a5.xMin+","+_4a5.yMin+","+_4a5.xMax+","+_4a5.yMax;
_4a3["WIDTH"]=_4a4.width;
_4a3["HEIGHT"]=_4a4.height;
var _4a6=_4a3.toQueryString();
if(_4a6.length>0){
_4a6="?"+_4a6;
}
return this.dataSource.resource.uri+_4a6;
},isTransparent:function(){
return this.dataSource.options.transparent;
}});
namespace("MapBuzz.Surface");
MapBuzz.Surface.Manager=function SurfaceManager(view){
this.id=MapBuzz.Surface.Manager.ID;
MapBuzz.Surface.Manager.ID-=1;
this.isMaster=true;
this.view=view;
this.surfaces=new Array();
this.surfaceToViewTransform=new Geometry.AffineTransform();
this.initialize();
};
Object.extend(MapBuzz.Surface.Manager,{ID:-1,BASE_Z_INDEX:1000,BEFORE_CLEAR:"SURFACE_MANAGER_BEFORE_CLEAR",AFTER_CLEAR:"SURFACE_MANAGER_AFTER_CLEAR",BEFORE_LOAD:"SURFACE_MANAGER_BEFORE_LOAD",AFTER_LOAD:"SURFACE_MANAGER_AFTER_LOAD",BEFORE_RELOAD:"SURFACE_MANAGER_BEFORE_RELOAD",AFTER_RELOAD:"SURFACE_MANAGER_AFTER_RELOAD"});
Object.extend(MapBuzz.Surface.Manager.prototype,{initialize:function(){
},release:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].release();
}
},getSurfacePane:function(){
if(!this.surfacePane){
this.surfacePane=this.view.panes.getSurfacePane();
}
return this.surfacePane;
},create:function(){
for(var i=0;i<this.view.layers.layers.length;i++){
var _4aa=this.view.layers.layers[i];
this.addLayers(_4aa);
}
},getSurfaceForLayer:function(_4ab,_4ac){
var _4ad=null;
var _4ae=_4ab.dataSource.getSurfaceConstructor();
if(_4ac&&_4ab.dataSource===_4ac.dataSource&&_4ae===_4ac.dataSource.getSurfaceConstructor()){
_4ad=_4ac.getSurface();
}else{
if(_4ae===MapBuzz.Surface.Vector){
_4ad=this.getVectorSurface();
}else{
_4ad=new _4ae(this,_4ab.dataSource);
this.surfaces.push(_4ad);
}
}
var _4af=this.surfaces.length+MapBuzz.Surface.Manager.BASE_Z_INDEX;
_4ad.setZIndex(_4af);
return _4ad;
},addLayers:function(_4b0,_4b1){
if(!_4b0.layers){
var _4b2=this.getSurfaceForLayer(_4b0,_4b1);
_4b2.addLayer(_4b0);
return _4b0;
}else{
for(var i=0;i<_4b0.layers.length;i++){
_4b1=this.addLayers(_4b0.layers[i],_4b1);
}
return _4b1;
}
},removeLayers:function(_4b4){
if(!_4b4.layers){
_4b4.surface.removeLayer(_4b4);
}else{
for(var i=0;i<_4b4.layers.length;i++){
this.removeLayers(_4b4.layers[i]);
}
}
},getVectorSurface:function(){
if(!this.vectorSurface){
this.vectorSurface=new MapBuzz.Surface.Vector(this,this.surfaceContainer);
this.surfaces.push(this.vectorSurface);
}
return this.vectorSurface;
},findSurfaceByType:function(_4b6){
for(var i=0;i<this.surfaces.length;i++){
var _4b8=this.surfaces[i];
if(_4b8.constructor===_4b6){
return _4b8;
}
}
return null;
},findSurfaceByFigure:function(_4b9){
var _4ba=null;
for(var i=0;i<this.surfaces.length;i++){
if(this.surfaces[i].supportsFigure(_4b9)){
_4ba=this.surfaces[i];
break;
}
}
return _4ba;
},getContainer:function(_4bc){
for(var i=0;i<this.surfaces.length;i++){
var _4be=this.surfaces[i];
if(_4be.contains(_4bc)){
return _4be;
}
}
return null;
},clear:function(){
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.BEFORE_CLEAR,{manager:this});
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].clear();
}
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.AFTER_CLEAR,{manager:this});
},resize:function(){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].resize();
}
},changeDisplayExtent:function(_4c1,_4c2){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].changeDisplayExtent(_4c1,_4c2);
}
},startPan:function(_4c4,_4c5){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].startPan(_4c4,_4c5);
}
},pan:function(_4c7,_4c8){
this.surfaceToViewTransform.translate(_4c7,_4c8);
if(this.isMaster){
var _4c9=this.getSurfacePane();
_4c9.style.left=this.surfaceToViewTransform.e+"px";
_4c9.style.top=this.surfaceToViewTransform.f+"px";
}
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].pan(_4c7,_4c8);
}
},endPan:function(_4cb,_4cc){
for(var i=0;i<this.surfaces.length;i++){
this.surfaces[i].endPan(_4cb,_4cc);
}
},load:function(){
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.BEFORE_LOAD,{manager:this});
for(var i=0;i<this.surfaces.length;i++){
var _4cf=this.surfaces[i];
_4cf.load();
}
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.AFTER_LOAD,{manager:this});
},reload:function(){
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.BEFORE_RELOAD,{manager:this});
for(var i=0;i<this.surfaces.length;i++){
var _4d1=this.surfaces[i];
_4d1.reload();
}
MapBuzz.databus.send(this,MapBuzz.Surface.Manager.AFTER_RELOAD,{manager:this});
},redraw:function(){
for(var i=0;i<this.surfaces.length;i++){
var _4d3=this.surfaces[i];
_4d3.redraw();
}
}});
MapBuzz.Surface.GoogleAdditions=function(gMap){
GLatLng.prototype.toPoint=function toPoint(){
return new Geometry.Point(this.lng(),this.lat(),Geometry.CrsFactory.instance.latLongCrs());
};
Geometry.Point.prototype.toGLatLng=function toGLatLng(){
var _4d5=this.copy().convertToCrs(Geometry.CrsFactory.instance.latLongCrs());
return new GLatLng(_4d5.y,_4d5.x);
};
function updateGCopyRight(){
if(!window.GAddCopyright){
window.setTimeout(arguments.callee,200);
}
var _4d6=GAddCopyright;
window.GAddCopyright=function(aa,sb,Mb,Cc,cd,dd,Nb,ec,Dc){
ec=ec.replace(/&trade;/,"&#8482;");
_4d6(aa,sb,Mb,Cc,cd,dd,Nb,ec);
};
}
GMap2.prototype.getDiv=function getDiv(){
var _4e0=this.getPane(G_MAP_MAP_PANE);
return _4e0.parentNode;
};
};
MapBuzz.Surface.GoogleFixes=function(gMap){
window.__gjsload_maps2_api_mb__=window.__gjsload_maps2_api__;
window.__gjsload_maps2_api__=function(code){
window.__gjsload_maps2_api_mb__(code);
if(code.match(/b=a\.button==0\|\|a\.button==1/)){
GDraggableObject.prototype.WB=function WB(a){
var b=(a.button==0||a.button==1);
if(this.ub||!b){
return false;
}
return true;
};
}
};
};
MapBuzz.Surface.Google=function GoogleSurface(_4e5,_4e6){
this.controls=new Array();
this.applySuper(arguments);
this.manager.isMaster=false;
};
MapBuzz.Surface.Google.inherits(MapBuzz.Surface.Abstract);
Object.extend(MapBuzz.Surface.Google.prototype,{initialize:function(){
this.applySuper(arguments);
this.moveEndHandle=GEvent.addListener(this.gMap,"moveend",this.internalPan.bind(this));
this.mapTypeChangeHandle=GEvent.addListener(this.gMap,"maptypechanged",this.onMapTypeChange.bind(this));
this.getControls();
},release:function(){
GEvent.removeListener(this.moveEndHandle);
GEvent.removeListener(this.mapTypeChangeHandle);
GUnload();
this.applySuper(arguments);
},getControls:function(){
var _4e7=this.manager.view.controls;
for(var i=_4e7.constructors.length-1;i>=0;i--){
var _4e9=_4e7.constructors[i];
if(_4e9===MapBuzz.Controls.Navigation){
this.controls.push(GLargeMapControl);
_4e7.unregister(_4e9);
}else{
if(_4e9===MapBuzz.Controls.Layers){
this.controls.push(GMapTypeControl);
_4e7.unregister(_4e9);
}else{
if(_4e9===MapBuzz.Controls.Scale){
this.controls.push(GScaleControl);
_4e7.unregister(_4e9);
}
}
}
}
},createControls:function(){
for(var i=0;i<this.controls.length;i++){
var _4eb=this.controls[i];
this.gMap.addControl(new _4eb());
}
},createRootElement:function(){
var _4ec=Element.create("div");
_4ec.id=this.id;
var _4ed=this.manager.view.panes.getSurfacePane();
_4ed.appendChild(_4ec);
_4ec.style.width="100%";
_4ec.style.height="100%";
this.gMap=new GMap2(_4ec,{mapTypes:[]});
MapBuzz.Surface.GoogleAdditions(this.gMap);
MapBuzz.Surface.GoogleFixes(this.gMap);
this.gMap.disableDragging();
this.gMap.enableDoubleClickZoom();
this.rootElement=_4ec;
this.manager.view.panes.surfacePane=this.gMap.getDiv();
this.divPos=Position.positionedOffset(this.gMap.getDiv());
return this.rootElement;
},createContentElement:function(){
this.contentElement=this.gMap.getDiv();
return this.contentElement;
},isHosted:function isHost(){
return true;
},onMapTypeChange:function(){
var _4ee=this.gMap.getCurrentMapType();
MapBuzz.Storage.setItem("MapBuzz.Surface.GoogleSurface.mapTypeName",_4ee.getName());
},setZIndex:function(_4ef){
this.zIndex=_4ef;
},getName:function(){
return "Google";
},addLayer:function(_4f0){
this.layers.push(_4f0);
_4f0.setSurface(this);
this.gMap.addMapType(_4f0.mapType);
},removeLayer:function(_4f1){
this.layers.remove(_4f1);
_4f1.setSurface(null);
this.gMap.removeMapType(_4f1.mapType);
},showLayer:function(_4f2){
this.gMap.setMapType(_4f2.mapType);
},hideLayer:function(_4f3){
},onZoomEnd:function(_4f4,_4f5){
if(this.processing){
return;
}
try{
this.processing=true;
var _4f6=this.gMap.getCenter().toPoint();
var _4f7=this.manager.view.display.getScaleForZoom(_4f6,_4f5);
this.view.setCenterScale(_4f6,_4f7);
}
finally{
this.processing=false;
}
},gMapSetCenterScale:function(_4f8,zoom,_4fa){
this.gMap.setCenter(_4f8.toGLatLng(),zoom,_4fa);
},internalPan:function(){
if(this.processing){
return;
}
try{
this.processing=true;
var _4fb=this.gMap.getCenter().toPoint();
var zoom=this.gMap.getZoom();
var _4fd=this.manager.view.display.getScaleForZoom(_4fb,zoom);
this.view.setCenterScale(_4fb,_4fd);
}
finally{
this.processing=false;
}
},changeDisplayExtent:function(_4fe,_4ff){
if(this.processing){
return;
}
try{
this.processing=true;
var _500=this.view.getWorldCenter();
var zoom=this.manager.view.display.getZoomForScale(_500,_4ff.scale);
if(this.gMap.isLoaded()){
this.gMapSetCenterScale(_500,zoom);
}else{
this.createControls();
var _502=MapBuzz.Storage.getItem("MapBuzz.Surface.GoogleSurface.mapTypeName");
var _503=this.findLayerByName(_502);
var _504=_503?_503.mapType:G_NORMAL_MAP;
this.gMapSetCenterScale(_500,zoom,_504);
}
}
finally{
this.processing=false;
}
},pan:function(_505,_506){
if(this.processing){
return;
}
try{
this.processing=true;
if(!this.internalEvent){
var size=new GSize(_505,_506);
var _508=this.gMap.getDragObject();
_508.moveBy(size);
}
}
finally{
this.processing=false;
}
},endPan:function(_509,_50a){
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.Manager=function ToolManager(map){
this.map=map;
this.activeTools=new Array();
this.activeTool=null;
this.initialize();
};
Object.extend(MapBuzz.Tool.Manager,{TOOL_ACTIVATED:"TOOL_MANAGER_TOOL_ACTIVATED",TOOL_RESUMED:"TOOL_MANAGER_TOOL_RESUMED",TOOL_SUSPENDED:"TOOL_MANAGER_TOOL_SUSPENDED",TOOL_DEACTIVATED:"TOOL_MANAGER_TOOL_DEACTIVATED"});
Object.extend(MapBuzz.Tool.Manager.prototype,{initialize:function(){
this.dragging=false;
this.eventHandler=this.onEvent.bindAsEventListener(this);
this.dragStartHandler=this.onDragStart.bindAsEventListener(this);
this.dragEndHandler=this.onDragEnd.bindAsEventListener(this);
this.mouseMoveHandler=this.onMouseMove.bindAsEventListener(this);
},release:function(){
this.unsetView();
this.eventHandler=null;
},setView:function(view){
this.unsetView();
this.view=view;
if(this.view){
Event.observe(this.view.element,"click",this.eventHandler);
Event.observe(this.view.element,"dblclick",this.eventHandler);
Event.observe(this.view.element,"mouseup",this.eventHandler);
Event.observe(this.view.element,"mousedown",this.eventHandler);
Event.observe(this.view.element,"mousemove",this.mouseMoveHandler);
Event.observe(this.view.element,"mouseover",this.eventHandler);
Event.observe(this.view.element,"mouseout",this.eventHandler);
Event.observe(this.view.element,"dragstart_",this.dragStartHandler);
Event.observe(this.view.element,"dragend_",this.dragEndHandler);
Event.observe(document,"keypress",this.eventHandler);
Event.observe(document,"keyup",this.eventHandler);
Event.observe(window,"blur",this.eventHandler);
Event.observe(window,"focus",this.eventHandler);
}
},unsetView:function(){
if(!this.view){
return;
}
Event.stopObserving(this.view.element,"click",this.eventHandler);
Event.stopObserving(this.view.element,"dblclick",this.eventHandler);
Event.stopObserving(this.view.element,"mouseup",this.eventHandler);
Event.stopObserving(this.view.element,"mousedown",this.eventHandler);
Event.stopObserving(this.view.element,"mousemove",this.mouseMoveHandler);
Event.stopObserving(this.view.element,"mouseover",this.eventHandler);
Event.stopObserving(this.view.element,"mouseout",this.eventHandler);
Event.stopObserving(this.view.element,"dragstart_",this.dragStartHandler);
Event.stopObserving(this.view.element,"dragend_",this.dragEndHandler);
Event.stopObserving(document,"keypress",this.eventHandler);
Event.stopObserving(document,"keyup",this.eventHandler);
Event.stopObserving(window,"blur",this.eventHandler);
Event.stopObserving(window,"focus",this.eventHandler);
},wrapTool:function(tool,_50e){
_50e=_50e||function(){
return false;
};
return {tool:tool,deactivateFunction:_50e};
},pushTool:function(tool,_510){
if(this.activeTool){
this.internalSuspendTool(this.activeTool.tool);
}
this.activeTool=this.wrapTool(tool,_510);
this.activeTools.push(this.activeTool);
this.internalActivateTool(this.activeTool.tool);
return tool;
},popTool:function(){
var _511=this.activeTools.pop();
this.activeTool=this.activeTools.top();
if(_511){
this.internalDeactivateTool(_511.tool);
}
if(this.activeTool){
this.internalResumeTool(this.activeTool.tool,_511.tool);
}
return (_511?_511.tool:null);
},activateTool:function(tool){
while(this.popTool()!=null){
}
this.pushTool(tool);
return tool;
},activateDefaultTool:function(){
if(this.defaultTool){
this.activateTool(this.defaultTool);
}
},setDefaultTool:function(tool){
this.defaultTool=tool;
this.activateTool(this.defaultTool);
},getActiveTool:function(){
if(this.activeTool){
return this.activeTool.tool;
}else{
return null;
}
},internalActivateTool:function(tool){
tool.activate();
MapBuzz.databus.send(this,MapBuzz.Tool.Manager.TOOL_ACTIVATED,{tool:tool});
},internalDeactivateTool:function(tool){
tool.deactivate();
MapBuzz.databus.send(this,MapBuzz.Tool.Manager.TOOL_DEACTIVATED,{tool:tool});
},internalSuspendTool:function(tool){
tool.suspend();
MapBuzz.databus.send(this,MapBuzz.Tool.Manager.TOOL_SUSPENDED,{tool:tool});
},internalResumeTool:function(tool,_518){
tool.resume(_518);
MapBuzz.databus.send(this,MapBuzz.Tool.Manager.TOOL_RESUMED,{tool:tool});
},onDragStart:function(_519){
this.onEvent(_519,"dragstart");
this.dragging=true;
},onDragEnd:function(_51a){
this.onEvent(_51a,"dragend");
this.dragging=false;
},onMouseMove:function(_51b){
if(this.dragging){
this.onEvent(_51b,"drag");
}else{
this.onEvent(_51b,"mousemove");
}
},onEvent:function(_51c,_51d){
_51d=_51d||_51c.type;
var _51e=this.activeTool;
if(!_51e){
return;
}
this.fireEvent(_51e,_51c,_51d);
if(_51e.deactivateFunction(_51c,_51d)){
this.popTool();
_51e=this.activeTool;
if(_51e){
this.fireEvent(_51e,_51c,_51d);
}
}else{
if(this.activeTool&&this.activeTool!=_51e){
this.fireEvent(this.activeTool,_51c,_51d);
}
}
},fireEvent:function(tool,_520,_521){
var _522=tool.tool[_521];
if(_522){
_522.call(tool.tool,_520);
}
},getEventDocCoord:function(_523){
return new Geometry.Coordinate(Event.pointerX(_523),Event.pointerY(_523));
},getEventViewCoord:function(_524){
var _525=this.getEventDocCoord(_524);
return this.view.convertDocToView(_525);
},getEventWorldCoord:function(_526){
var _527=this.getEventDocCoord(_526);
return this.view.convertDocToWorld(_527);
}});
namespace("MapBuzz.Tool");
MapBuzz.Command.ActivateTool=function ActivateToolCommand(tool){
this.tool=tool;
this.callSuper(arguments.callee,"Activate Tool");
};
MapBuzz.Command.ActivateTool.inherits(MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.ActivateTool.prototype,{execute:function(){
if(this.tool.enabled){
this.tool.toolManager.activateTool(this.tool);
}
this.executeNext.apply(this,arguments);
}});
MapBuzz.Tool.AbstractTool=function AbstractTool(_529,_52a){
this.toolManager=_529;
var name=this.figureName();
var _52c=new MapBuzz.Command.ActivateTool(this);
_52a=_52a||new MapBuzz.UI.Images(name.underscore(),"/images/tools/");
this.callSuper(arguments.callee,name,_52c,_52a);
this.cursor=this.toolManager.view.cursor;
};
MapBuzz.Tool.AbstractTool.inherits(MapBuzz.Command.Action);
Object.extend(MapBuzz.Tool.AbstractTool.prototype,{figureName:function(){
for(var key in MapBuzz.Tool){
if(this.constructor===MapBuzz.Tool[key]){
return key;
}
}
throw new Error("Unknown tool: "+this.constructor);
},toJSON:function(){
var data={name:this.name,images:this.images};
return Object.toJSON(data);
},getView:function(){
return this.toolManager.view;
},getDescription:function(){
},getToolTipContent:function(){
var _52f="<h3 class=\"tool_name\">"+this.name+"</h3>"+"<div class=\"tool_description\">"+this.getDescription()+"</div>";
return _52f;
},getDataSource:function(){
return this.toolManager.map.dataSources.getActive();
},keyup:function(_530){
var _531=Key.keyCode(_530);
if(_531==KeyEvent.DOM_VK_ESCAPE){
this.reset();
}
},reset:function(){
},blur:function(_532){
this.getToolTip().hide();
},getToolTip:function(){
return MapBuzz.ToolTip.instance;
}});
MapBuzz.Tool.AbstractEditTool=function AbstractEditTool(_533){
this.applySuper(arguments);
this.initialize();
};
MapBuzz.Tool.AbstractEditTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.AbstractEditTool.prototype,{initialize:function(){
var _534=this.getDataSource();
this.enabled=Boolean(_534&&!_534.resource.isReadOnly());
}});
MapBuzz.Tool.NothingTool=function NothingTool(_535){
this.applySuper(arguments);
};
MapBuzz.Tool.NothingTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.NothingTool.prototype,{activate:function(){
this.applySuper(arguments);
},deactivate:function(){
this.applySuper(arguments);
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.AbstractFeatureTool=function AbstractFeatureTool(_536){
this.applySuper(arguments);
};
MapBuzz.Tool.AbstractFeatureTool.inherits(MapBuzz.Tool.AbstractEditTool);
Object.extend(MapBuzz.Tool.AbstractFeatureTool.prototype,{deactivate:function(){
this.getToolTip().hide();
this.reset();
this.applySuper(arguments);
},suspend:function(){
this.getToolTip().hide();
this.applySuper(arguments);
},reset:function(){
if(this.figure){
this.figure.release();
}
this.figure=null;
this.feature=null;
},getTypeCategory:function(){
return MapBuzz.Feature.MapBuzz.TYPE_CATEGORY.uri();
},createEditorTool:function(_537,_538){
return new MapBuzz.Tool.FeatureEditorTool(this.toolManager,_537,_538);
},mousemove:function(_539){
MapBuzz.Tool.ScrollTool.checkScroll(this.toolManager,_539);
},createFeature:function(uri,geom){
var _53c=this.getDataSource();
this.feature=_53c.factory.create(uri);
this.figure=this.feature.figures.create(geom);
this.figure.display();
this.figure.highlight();
this.shape=this.figure.getShape(this.toolManager.view);
},activateEditorTool:function(_53d){
var tool=this.createEditorTool(this.shape,_53d);
this.feature=null;
this.figure=null;
this.shape=null;
this.toolManager.pushTool(tool);
}});
MapBuzz.Tool.SymbolTool=function SymbolTool(_53f){
this.applySuper(arguments);
};
MapBuzz.Tool.SymbolTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.SymbolTool.prototype,{activate:function(){
this.cursor.push("url(/cursors/symbol.cur), auto");
this.applySuper(arguments);
},deactivate:function(){
this.cursor.pop();
this.applySuper(arguments);
},getDescription:function(){
var _540="<p>";
_540+="Add a new point feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_540+=" (requires login to use)";
}
_540+=".";
_540+="</p>";
return _540;
},getHintContent:function(){
if(!this.hintContent){
this.hintContent="<p><strong>Click</strong> to add a new feature to the map.</p>"+"<p>Press <strong>Esc</strong> to cancel.</p>";
}
return this.hintContent;
},mouseover:function(_541){
this.getToolTip().show(_541);
this.getToolTip().setContent(this.getHintContent());
},mouseout:function(_542){
this.getToolTip().hide();
},mousemove:function(_543){
this.applySuper(arguments);
this.getToolTip().show(_543);
this.getToolTip().setContent(this.getHintContent());
},click:function(_544){
Event.stop(_544);
var _545=this.toolManager.getEventWorldCoord(_544);
var geom=new Geometry.Point(_545.x,_545.y,this.toolManager.view.map.world.crs);
this.createFeature(this.getTypeCategory(),geom);
this.activateEditorTool(geom);
}});
MapBuzz.Tool.PathTool=function PathTool(_547){
this.applySuper(arguments);
};
MapBuzz.Tool.PathTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.PathTool.prototype,{activate:function(){
this.cursor.push("url(/cursors/pencil.cur), auto");
this.applySuper(arguments);
},deactivate:function(){
this.cursor.pop();
this.applySuper(arguments);
},getDescription:function(){
var _548="<p>";
_548+="Draw a new feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_548+=" (requires login to use)";
}
_548+=".";
_548+="</p>";
return _548;
},dragstart:function(_549){
var _54a=this.toolManager.getEventWorldCoord(_549);
var _54b=new Geometry.CoordinateArray([_54a.x,_54a.y]);
var geom=new Geometry.LineString(_54b,this.toolManager.view.map.world.crs);
this.createFeature(MapBuzz.Feature.MapBuzz.TYPE_CATEGORY.uri(),geom);
},drag:function(_54d){
var _54e=this.toolManager.getEventWorldCoord(_54d);
this.figure.geom.coords.push(_54e);
this.figure.redisplay();
},dragend:function(_54f){
var _550=this.toolManager.getEventWorldCoord(_54f);
var _551=new Geometry.Point(_550.x,_550.y,this.toolManager.view.map.world.crs);
this.activateEditorTool(_551);
}});
MapBuzz.Tool.LineTool=function LineTool(_552){
this.applySuper(arguments);
};
MapBuzz.Tool.LineTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.LineTool.prototype,{activate:function(){
this.cursor.push("url(/cursors/cross_hair.cur), auto");
this.applySuper(arguments);
},deactivate:function(){
this.cursor.pop();
this.applySuper(arguments);
},getDescription:function(){
var _553="<p>";
_553+="Draw a new line feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_553+=" (requires login to use)";
}
_553+=".";
_553+="</p>";
return _553;
},getHintContent:function(){
var _554="";
if(!this.figure){
_554="<p><strong>Click</strong> to start drawing a line.</p>";
}else{
if(this.figure.geom.coords.getNumberOfCoords()==1){
_554="<p><strong>Click</strong> to add a point to the current line.</p>"+"<p>Press <strong>Delete</strong> to remove the last point.</p>";
}else{
_554="<p><strong>Click</strong> to add a point to the current line.</p>"+"<p><strong>Double click</strong> or press <strong>Enter</strong> to end this line.</p>"+"<p>Press <strong>Delete</strong> to remove the last point.</p>";
}
}
_554+="<p>Press <strong>Esc</strong> to cancel.</p>";
return _554;
},createGeometry:function(_555){
return new Geometry.LineString(_555,this.toolManager.view.map.world.crs);
},mousemove:function(_556){
this.getToolTip().show(_556);
this.getToolTip().setContent(this.getHintContent());
if(MapBuzz.Tool.ScrollTool.checkScroll(this.toolManager,_556)){
return;
}
if(!this.figure){
return;
}
this.lastDocCoord=this.toolManager.getEventDocCoord(_556);
var _557=this.toolManager.getEventWorldCoord(_556);
var geom=this.figure.geom;
geom.coords.update(geom.coords.getNumberOfCoords()-1,_557);
this.figure.redisplay();
},mousedown:function(_559){
var _55a=this.toolManager.getEventWorldCoord(_559);
if(!this.figure){
var _55b=new Geometry.CoordinateArray([_55a.x,_55a.y]);
var geom=this.createGeometry(_55b);
this.createFeature(MapBuzz.Feature.MapBuzz.TYPE_CATEGORY.uri(),geom);
}
this.figure.geom.coords.push(_55a);
this.figure.redisplay();
},dragstart:function(_55d){
var _55e=this.toolManager.getEventWorldCoord(_55d);
this.figure.geom.coords.push(_55e);
},click:function(_55f){
Event.stop(_55f);
this.getToolTip().setContent(this.getHintContent());
},keyup:function(_560){
if(!this.feature){
return;
}
var _561=Key.keyCode(_560);
if(_561==KeyEvent.DOM_VK_DELETE){
this.removeLastPoint(_560);
}else{
if(_561==KeyEvent.DOM_VK_RETURN){
var _562=this.figure.geom.coords.top();
var _563=new Geometry.Point(_562.x,_562.y,this.toolManager.view.map.world.crs);
this.activateEditorTool(_563);
}else{
this.applySuper(arguments);
}
}
},dblclick:function(_564){
if(!this.figure){
return;
}
var _565=this.figure.geom.coords.pop();
if(Browser.instance.isGecko()){
this.figure.geom.coords.pop();
}
if(this.figure.geom.coords.getNumberOfCoords()<=this.figure.geom.getDimension()){
this.figure.geom.coords.push(_565);
}else{
var _566=this.toolManager.getEventWorldCoord(_564);
var _567=new Geometry.Point(_566.x,_566.y,this.toolManager.view.map.world.crs);
this.activateEditorTool(_567);
}
},removeLastPoint:function(_568){
var geom=this.figure.geom;
geom.coords.pop();
var _56a=geom.coords.getNumberOfCoords();
if(_56a>0){
var _56b=this.toolManager.view.convertDocToWorld(this.lastDocCoord.copy());
geom.coords.update(_56a-1,_56b);
this.figure.redisplay();
}else{
this.feature.release();
this.feature=null;
this.figure=null;
}
this.getToolTip().setContent(this.getHintContent());
}});
MapBuzz.Tool.PolygonTool=function PolygonTool(_56c){
this.applySuper(arguments);
};
MapBuzz.Tool.PolygonTool.inherits(MapBuzz.Tool.LineTool);
Object.extend(MapBuzz.Tool.PolygonTool.prototype,{getDescription:function(){
var _56d="<p>";
_56d+="Draw a new area feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_56d+=" (requires login to use)";
}
_56d+=".";
_56d+="</p>";
return _56d;
},createGeometry:function(_56e){
return new Geometry.Polygon(_56e,null,this.toolManager.view.map.world.crs);
}});
MapBuzz.Tool.RectangleTool=function RectangleTool(_56f){
this.applySuper(arguments);
};
MapBuzz.Tool.RectangleTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.RectangleTool.prototype,{activate:function(){
this.cursor.push("url(/cursors/cross_hair.cur), auto");
this.applySuper(arguments);
},deactivate:function(){
this.cursor.pop();
this.applySuper(arguments);
},getDescription:function(){
var _570="<p>";
_570+="Draw a new rectangle feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_570+=" (requires login to use)";
}
_570+=".";
_570+="</p>";
return _570;
},dragstart:function(_571){
this.startCoord=this.toolManager.getEventWorldCoord(_571);
var geom=new Geometry.Envelope(this.startCoord.x,this.startCoord.y,this.startCoord.x,this.startCoord.y,this.toolManager.view.map.world.crs);
this.createFeature(MapBuzz.Feature.MapBuzz.TYPE_CATEGORY.uri(),geom);
},drag:function(_573){
var _574=this.toolManager.getEventWorldCoord(_573);
var xMin=Math.min(this.startCoord.x,_574.x);
var xMax=Math.max(this.startCoord.x,_574.x);
var yMin=Math.min(this.startCoord.y,_574.y);
var yMax=Math.max(this.startCoord.y,_574.y);
this.figure.geom.setBounds(xMin,yMin,xMax,yMax);
this.figure.redisplay();
},dragend:function(_579){
var _57a=this.toolManager.getEventWorldCoord(_579);
var _57b=new Geometry.Point(_57a.x,_57a.y,this.toolManager.view.map.world.crs);
this.activateEditorTool(_57b);
}});
MapBuzz.Tool.EllipseTool=function EllipseTool(_57c){
this.applySuper(arguments);
};
MapBuzz.Tool.EllipseTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.EllipseTool.prototype,{getDescription:function(){
var _57d="<p>";
_57d+="Draw a new circular feature on the map";
if(!MapBuzz.user.isAuthenticated()){
_57d+=" (requires login to use)";
}
_57d+=".";
_57d+="</p>";
return _57d;
},dragstart:function(_57e){
this.startCoord=this.toolManager.getEventWorldCoord(_57e);
var geom=new Geometry.Ellipse(this.startCoord.x,this.startCoord.y,this.toolManager.view.map.world.crs);
this.createFeature(MapBuzz.Feature.MapBuzz.TYPE_CATEGORY.uri(),geom);
},drag:function(_580){
var _581=this.toolManager.getEventWorldCoord(_580);
var rx=Math.abs(_581.x-this.startCoord.x);
var ry=Math.abs(_581.y-this.startCoord.y);
this.figuregeom.setRadius(rx,ry);
this.figure.redisplay();
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.EditTool=function EditTool(_584,_585){
this.figure=_585;
this.callSuper(arguments.callee,_584);
};
MapBuzz.Tool.EditTool.inherits(MapBuzz.Tool.AbstractEditTool);
MapBuzz.Tool.EditTool.MAX_DISTANCE=10;
Object.extend(MapBuzz.Tool.EditTool.prototype,{activate:function(){
this.applySuper(arguments);
if(this.figure){
this.startEdit(this.figure);
}
},deactivate:function(){
this.endEdit();
this.figure=null;
this.feature=null;
this.applySuper(arguments);
},getDescription:function(){
var _586="<p>";
_586+="Move or edit an existing feature";
if(!MapBuzz.user.isAuthenticated()){
_586+=" (requires login to use)";
}
_586+=".";
_586+="</p>";
return _586;
},getHintPanel:function(){
return this.figure.figures.feature.getToolTipPanel();
},startEdit:function(_587){
if(_587!==this.figure){
this.endEdit();
}
this.figure=_587;
this.cursor.push("move");
this.figure.getRoot().highlight();
this.figure.startEdit();
},endEdit:function(){
if(!this.figure){
return;
}
this.cursor.pop();
this.figure.getRoot().unhighlight();
this.figure.endEdit();
this.getToolTip().hide();
this.figure=null;
},mouseover:function(_588){
var _589=Event.element(_588);
var _58a=_589.figure;
var _58b=_589.handle;
var note=_589.note;
if(_58b){
var tool=new MapBuzz.Tool.HandleTool(this.toolManager,_58b);
this.toolManager.pushTool(tool);
}else{
if(_58a){
this.lastCoord=this.toolManager.getEventDocCoord(_588);
this.startEdit(_58a);
}else{
if(note){
this.toolManager.pushTool(new MapBuzz.Tool.TextTool(this.toolManager,note));
}else{
this.getToolTip().hide();
this.endEdit();
}
}
}
},mousedown:function(_58e){
var _58f=this.toolManager.map.selectionManager;
if(this.figure&&_58e.shiftKey){
_58f.toggle(this.figure);
}else{
if(this.figure&&_58e.ctrlKey){
_58f.toggle(this.figure);
}else{
if(this.figure){
_58f.select(this.figure);
}else{
if(!this.figure&&!_58e.shiftKey){
_58f.clear();
}
}
}
}
},dragstart:function(_590){
var tool=null;
if(_590.shiftKey){
tool=new MapBuzz.Tool.ZoomTool(this.toolManager);
this.toolManager.pushTool(tool,function(_592,_593){
if(_593=="dragend"){
return true;
}
});
}else{
if(this.figure){
tool=new MapBuzz.Tool.MoveTool(this.toolManager);
this.toolManager.pushTool(tool,function(_594,_595){
if(_595=="dragend"){
return true;
}
});
}else{
tool=new MapBuzz.Tool.PanTool(this.toolManager);
this.toolManager.pushTool(tool,function(_596,_597){
if(_597=="dragend"){
return true;
}
});
}
}
}});
MapBuzz.Tool.MoveTool=function MoveTool(_598,_599){
this.figures=_599;
this.callSuper(arguments.callee,_598);
};
MapBuzz.Tool.MoveTool.inherits(MapBuzz.Tool.AbstractEditTool);
Object.extend(MapBuzz.Tool.MoveTool.prototype,{dragstart:function(_59a){
this.startCoord=this.toolManager.getEventWorldCoord(_59a);
this.figures=this.figures||this.toolManager.map.selectionManager.selected;
this.translateTransform=new Geometry.AffineTransform();
},drag:function(_59b){
this.endCoord=this.toolManager.getEventWorldCoord(_59b);
this.translateTransform.e=this.endCoord.x-this.startCoord.x;
this.translateTransform.f=this.endCoord.y-this.startCoord.y;
for(var i=0;i<this.figures.length;i++){
var _59d=this.figures[i];
_59d.transform(this.translateTransform);
}
this.startCoord=this.endCoord;
},dragend:function(_59e){
for(var i=0;i<this.figures.length;i++){
var _5a0=this.figures[i];
_5a0.updateCommand().execute();
}
}});
MapBuzz.Tool.HandleTool=function HandleTool(_5a1,_5a2){
this.handle=_5a2;
this.dragging=false;
this.callSuper(arguments.callee,_5a1);
};
MapBuzz.Tool.HandleTool.inherits(MapBuzz.Tool.AbstractEditTool);
Object.extend(MapBuzz.Tool.HandleTool.prototype,{activate:function(){
this.applySuper(arguments);
var _5a3=this.handle.getCursor();
this.cursor.push(_5a3);
},deactivate:function(){
this.getToolTip().hide();
this.cursor.pop();
this.applySuper(arguments);
},getHintContent:function(){
if(!this.hintContent){
this.hintContent="<p><strong>Drag</strong> to move this point.</p>"+"<p>Press <strong>Delete</strong> to remove this point.</p>";
}
return this.hintContent;
},dragstart:function(_5a4){
this.dragging=true;
this.startCoord=this.toolManager.getEventDocCoord(_5a4);
},drag:function(_5a5){
this.endCoord=this.toolManager.getEventDocCoord(_5a5);
this.handle.moveBy(this.endCoord.x-this.startCoord.x,this.endCoord.y-this.startCoord.y);
this.startCoord=this.endCoord;
},dragend:function(_5a6){
this.dragging=false;
var _5a7=this.handle.getFigure();
_5a7.updateCommand().execute();
var _5a8=Event.element(_5a6);
if(!_5a8.handle){
this.finish();
}
},mousemove:function(_5a9){
if(!this.handle){
return;
}
this.getToolTip().show(_5a9);
this.getToolTip().setContent(this.getHintContent());
MapBuzz.Tool.ScrollTool.checkScroll(this.toolManager,_5a9);
},mouseout:function(_5aa){
this.getToolTip().hide();
if(!this.dragging){
this.finish();
}
},keyup:function(_5ab){
var _5ac=this.handle.getFigure();
if(!_5ac){
return;
}
var _5ad=Key.keyCode(_5ab);
if(_5ad==KeyEvent.DOM_VK_DELETE){
this.handle.remove();
_5ac.endEdit();
_5ac.redisplay();
_5ac.select();
this.handle=null;
_5ac.updateCommand().execute();
this.finish();
}
},finish:function(){
this.toolManager.popTool();
}});
MapBuzz.Tool.FeatureEditorTool=function FeatureEditorTool(_5ae,_5af,_5b0,_5b1,_5b2){
this.callSuper(arguments.callee,_5ae);
this.shape=_5af;
this.closeCommand=_5b1;
this.cancelCommand=_5b2;
this.openEditor(_5b0);
};
MapBuzz.Tool.FeatureEditorTool.inherits(MapBuzz.Tool.AbstractEditTool);
Object.extend(MapBuzz.Tool.FeatureEditorTool.prototype,{activate:function(){
this.applySuper(arguments);
this.cursor.push("default");
},deactivate:function(){
this.cursor.pop();
if(this.editor){
this.editor.cancel();
this.editor=null;
}
this.applySuper(arguments);
},openEditor:function(_5b3){
var _5b4=new MapBuzz.Command.Bind("On Close Editor",this.onCloseEditor.bind(this));
var _5b5=new MapBuzz.Command.Bind("On Cancel Editor",this.onCancelEditor.bind(this));
if(this.closeCommand){
_5b4.next(this.closeCommand);
}
if(this.cancelCommand){
_5b4.next(this.cancelCommand);
}
var _5b6=this.shape.figure.figures.feature;
this.editor=_5b6.openEditor(this.shape,_5b3,_5b4,_5b5);
},onCloseEditor:function(){
this.editor=null;
this.toolManager.popTool();
},onCancelEditor:function(){
var _5b7=this.shape.figure.figures.feature;
if(_5b7.isNew()){
_5b7.release();
}else{
_5b7.figures.unhighlight();
}
this.editor=null;
this.toolManager.popTool();
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.PanTool=function PanTool(_5b8){
this.applySuper(arguments);
};
MapBuzz.Tool.PanTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.PanTool.prototype,{activate:function(){
this.applySuper(arguments);
this.cursor.push("url(/cursors/scroll.cur), auto");
},deactivate:function(){
this.cursor.pop();
this.applySuper(arguments);
},dragstart:function(_5b9){
this.xStart=this.xLast=Event.pointerX(_5b9);
this.yStart=this.yLast=Event.pointerY(_5b9);
this.toolManager.view.startPan(this.xStart,this.yStart);
this.translateTransform=new Geometry.AffineTransform();
},drag:function(_5ba){
var x=Event.pointerX(_5ba);
var y=Event.pointerY(_5ba);
this.toolManager.view.pan(x-this.xLast,y-this.yLast);
this.xLast=x;
this.yLast=y;
},dragend:function(_5bd){
this.xLast=Event.pointerX(_5bd);
this.yLast=Event.pointerY(_5bd);
this.toolManager.view.endPan(this.xLast-this.xStart,this.yLast-this.yStart);
}});
MapBuzz.Tool.ScrollTool=function ScrollTool(_5be,_5bf,_5c0,_5c1,_5c2,_5c3){
this.callSuper(arguments.callee,_5be);
this.scrollTimeoutId=null;
this.scrolling=false;
this.viewCoord=_5bf;
this.mouseX=_5c0;
this.mouseY=_5c1;
this.deltaX=_5c2;
this.deltaY=_5c3;
};
MapBuzz.Tool.ScrollTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.ScrollTool,{SCROLL_AMOUNT:4,SCROLL_BORDER:40,checkScroll:function(_5c4,_5c5){
var _5c6=Event.element(_5c5);
var _5c7=_5c4.view.surfaces.getContainer(_5c6);
if(!_5c7){
return false;
}
var _5c8=Event.pointerX(_5c5);
var _5c9=Event.pointerY(_5c5);
var _5ca=this.figureScrollDelta(_5c4,_5c8,_5c9);
if(_5ca[0]!=0||_5ca[1]!=0){
var _5cb=_5c4.getEventViewCoord(_5c5);
var tool=new MapBuzz.Tool.ScrollTool(_5c4,_5cb,_5c8,_5c9,_5ca[0],_5ca[1]);
_5c4.pushTool(tool);
return true;
}
return false;
},figureScrollDelta:function(_5cd,_5ce,_5cf){
var _5d0=0;
var _5d1=0;
var _5d2=_5cd.view.getElementBounds();
var _5d3=1;
if(_5ce<=_5d2.left+_5d3||_5ce>=_5d2.right-_5d3||_5cf<=_5d2.top+_5d3||_5cf>=_5d2.bottom-_5d3){
return [_5d0,_5d1];
}
if(_5ce<_5d2.left+MapBuzz.Tool.ScrollTool.SCROLL_BORDER){
_5d0=MapBuzz.Tool.ScrollTool.SCROLL_AMOUNT;
}else{
if(_5ce>_5d2.right-MapBuzz.Tool.ScrollTool.SCROLL_BORDER){
_5d0=-MapBuzz.Tool.ScrollTool.SCROLL_AMOUNT;
}
}
if(_5cf<_5d2.top+MapBuzz.Tool.ScrollTool.SCROLL_BORDER){
_5d1=MapBuzz.Tool.ScrollTool.SCROLL_AMOUNT;
}else{
if(_5cf>_5d2.bottom-MapBuzz.Tool.ScrollTool.SCROLL_BORDER){
_5d1=-MapBuzz.Tool.ScrollTool.SCROLL_AMOUNT;
}
}
return [_5d0,_5d1];
}});
Object.extend(MapBuzz.Tool.ScrollTool.prototype,{activate:function(){
this.applySuper(arguments);
this.getToolTip().showAt(this.mouseX,this.mouseY);
this.getToolTip().setContent(this.getHintContent());
this.startScrollTimeout=window.setTimeout(function(){
this.startScroll();
}.bind(this),200);
},deactivate:function(){
window.clearTimeout(this.startScrollTimeout);
this.cancelScroll();
this.getToolTip().hide();
this.applySuper(arguments);
},getHintContent:function(){
if(!this.hintContent){
this.hintContent="<p>To stop scrolling move the mouse towards the center of the map.</p>";
}
return this.hintContent;
},startScroll:function(){
this.scrolling=true;
this.toolManager.view.moveState=MapBuzz.View.Viewer.SYSTEM_MOVE_STATE;
var _5d4=this.figureCursor();
this.cursor.push(_5d4);
this.scrollTimeoutId=window.setInterval(function(){
this.scroll();
}.bind(this),5);
},cancelScroll:function(){
this.scrolling=false;
if(this.scrollTimeoutId){
window.clearInterval(this.scrollTimeoutId);
}
this.toolManager.view.moveState=MapBuzz.View.Viewer.USER_MOVE_STATE;
this.cursor.pop();
},scroll:function(){
var _5d5=this.toolManager;
if(_5d5.getActiveTool()!==this){
this.cancelScroll();
}
var view=_5d5.view;
view.startPan(this.viewCoord.x,this.viewCoord.y);
view.pan(this.deltaX,this.deltaY);
view.endPan(this.deltaX,this.deltaY);
},figureCursor:function(){
var _5d7=null;
if(this.deltaX>0&&this.deltaY==0){
_5d7="scroll_w";
}else{
if(this.deltaX>0&&this.deltaY<0){
_5d7="scroll_sw";
}else{
if(this.deltaX==0&&this.deltaY<0){
_5d7="scroll_s";
}else{
if(this.deltaX<0&&this.deltaY<0){
_5d7="scroll_se";
}else{
if(this.deltaX<0&&this.deltaY==0){
_5d7="scroll_e";
}else{
if(this.deltaX<0&&this.deltaY>0){
_5d7="scroll_ne";
}else{
if(this.deltaX==0&&this.deltaY>0){
_5d7="scroll_n";
}else{
if(this.deltaX>0&&this.deltaY>0){
_5d7="scroll_nw";
}else{
throw new Error("Unknown scroll direction");
}
}
}
}
}
}
}
}
return "url(/cursors/"+_5d7+".cur), auto";
},verifyScroll:function(_5d8){
this.mouseX=Event.pointerX(_5d8);
this.mouseY=Event.pointerY(_5d8);
var _5d9=MapBuzz.Tool.ScrollTool.figureScrollDelta(this.toolManager,this.mouseX,this.mouseY);
this.deltaX=_5d9[0];
this.deltaY=_5d9[1];
if(this.deltaX==0&&this.deltaY==0){
this.toolManager.popTool();
return false;
}else{
return true;
}
},mousemove:function(_5da){
if(!this.scrolling){
return;
}
if(!this.verifyScroll(_5da)){
return;
}
this.getToolTip().show(_5da);
var _5db=this.figureCursor();
this.cursor.replace(_5db);
},mouseover:function(_5dc){
var _5dd=Event.element(_5dc);
var _5de=this.toolManager.view.surfaces.getContainer(_5dd);
if(!_5de){
var tool=new MapBuzz.Tool.NothingTool(this.toolManager);
this.toolManager.pushTool(tool,function(_5e0,_5e1){
if(_5e1=="mouseout"){
return true;
}
});
}
},mouseout:function(_5e2){
if(this.verifyScroll(_5e2)&&this.scrolling){
var _5e3=this.figureCursor();
this.cursor.replace(_5e3);
}
},mousedown:function(_5e4){
this.toolManager.popTool();
},blur:function(_5e5){
this.toolManager.popTool();
}});
MapBuzz.Tool.ZoomTool=function ZoomTool(_5e6){
this.applySuper(arguments);
this.zoomMode=MapBuzz.Tool.ZoomTool.IN;
this.element=$("zoom_box_outer");
this.zoomBoxCursor=new MapBuzz.Cursor(this.element);
this.labelElement=$("zoom_box_label");
this.dragHandler=this.drag.bindAsEventListener(this);
};
MapBuzz.Tool.ZoomTool.inherits(MapBuzz.Tool.AbstractTool);
Event.observe(window,"load",function(){
var _5e7=Element.create("div");
_5e7.id="zoom_box_outer";
_5e7.style.display="none";
_5e7.style.position="absolute";
_5e7.style.left="0px";
_5e7.style.top="0px";
_5e7.style.width="150px";
_5e7.style.height="150px";
var _5e8=Element.create("div");
_5e8.id="zoom_box_inner";
_5e7.appendChild(_5e8);
var _5e9=Element.create("div");
_5e9.id="zoom_box_label";
_5e9.innerHTML="In";
_5e8.appendChild(_5e9);
document.getBodyElement().appendChild(_5e7);
MapBuzz.Tool.ZoomTool.zoomBox=_5e7;
});
Object.extend(MapBuzz.Tool.ZoomTool,{IN:"ZOOM_TOOL_IN",OUT:"ZOOM_TOOL_OUT",PREVIOUS:"ZOOM_TOOL_PREVIOUS",CANCEL:"ZOOM_TOOL_CANCEL"});
Object.extend(MapBuzz.Tool.ZoomTool.prototype,{activate:function(){
var _5ea=this.figureCursor();
this.cursor.push(_5ea);
this.zoomBoxCursor.push(_5ea);
},deactivate:function(){
this.hideZoomBox();
this.cursor.pop();
this.zoomBoxCursor.pop();
this.applySuper(arguments);
},getHintContent:function(){
if(!this.hintContent){
this.hintContent="<p>Drag to the <strong>bottom right</strong> to zoom in.</p>"+"<p>Drag to the <strong>top left</strong> to zoom out.</p>"+"<p>Drag to the <strong>bottom left</strong> to cancel.</p>"+"<p>Drag to the <strong>top left</strong> to go to previous view.</p>";
}
return this.hintContent;
},updateZoomBox:function(){
var left=Math.min(this.startCoord.x,this.endCoord.x);
var top=Math.min(this.startCoord.y,this.endCoord.y);
var _5ed=Math.abs(this.endCoord.x-this.startCoord.x);
var _5ee=Math.abs(this.endCoord.y-this.startCoord.y);
if(left!=this.previousLeft){
this.element.style.left=left+"px";
}
if(top!=this.previousTop){
this.element.style.top=top+"px";
}
if(_5ed!=this.previousWidth){
this.element.style.width=_5ed+"px";
}
if(_5ee!=this.previousHeight){
this.element.style.height=_5ee+"px";
this.labelElement.style.lineHeight=_5ee+"px";
}
this.previousLeft=left;
this.previousTop=top;
this.previousWidth=_5ed;
this.previousHeight=_5ee;
},removeZoomBox:function(){
if(!this.element){
return;
}
this.element.parentNode.removeChild(this.element);
this.element=null;
},showZoomBox:function(){
Element.show(this.element);
},hideZoomBox:function(){
Element.hide(this.element);
Element.setText(this.labelElement,"");
},getZoomMode:function(){
if(this.endCoord.x>this.startCoord.x&&this.endCoord.y>this.startCoord.y){
return MapBuzz.Tool.ZoomTool.IN;
}else{
if(this.endCoord.x<this.startCoord.x&&this.endCoord.y<this.startCoord.y){
return MapBuzz.Tool.ZoomTool.OUT;
}else{
if(this.endCoord.x>this.startCoord.x&&this.endCoord.y<this.startCoord.y){
return MapBuzz.Tool.ZoomTool.PREVIOUS;
}else{
return MapBuzz.Tool.ZoomTool.CANCEL;
}
}
}
},updateZoomText:function(){
if(this.zoomMode==MapBuzz.Tool.ZoomTool.IN){
this.labelElement.innerHTML="In";
}else{
if(this.zoomMode==MapBuzz.Tool.ZoomTool.OUT){
this.labelElement.innerHTML="Out";
}else{
if(this.zoomMode==MapBuzz.Tool.ZoomTool.PREVIOUS){
this.labelElement.innerHTML="Previous";
}else{
if(this.zoomMode==MapBuzz.Tool.ZoomTool.CANCEL){
this.labelElement.innerHTML="Cancel";
}
}
}
}
},updateCursor:function(){
var _5ef=this.figureCursor();
this.cursor.replace(_5ef);
this.zoomBoxCursor.replace(_5ef);
},dragstart:function(_5f0){
this.startCoord=this.endCoord=this.toolManager.getEventDocCoord(_5f0);
this.zoomMode=MapBuzz.Tool.ZoomTool.IN;
this.updateZoomBox();
this.updateZoomText();
this.updateCursor();
Event.observe(this.element,"mousemove",this.dragHandler);
this.showZoomBox();
},drag:function(_5f1){
this.endCoord=this.toolManager.getEventDocCoord(_5f1);
this.updateZoomBox();
var _5f2=this.getZoomMode();
if(_5f2!=this.zoomMode){
this.zoomMode=_5f2;
this.updateZoomText();
this.updateCursor();
}
},dragend:function(_5f3){
Event.stopObserving(this.element,"mousemove",this.dragHandler);
var _5f4=this.toolManager.view.getViewBounds();
var _5f5=this.element.offsetWidth/_5f4.width;
var _5f6=this.element.offsetHeight/_5f4.height;
var _5f7=Element.getDimensions(this.element);
var _5f8=Position.positionedOffset(this.element);
var _5f9=new Geometry.Envelope(_5f8[0],_5f8[1],_5f8[0]+_5f7.width,_5f8[1]+_5f7.height,Geometry.CrsFactory.instance.documentCrs());
_5f9=this.toolManager.view.convertDocToWorld(_5f9);
this.hideZoomBox();
var _5fa=new Geometry.Point(_5f9.xCenter,_5f9.yCenter,this.toolManager.view.map.world.crs);
var _5fb=null;
var _5fc=null;
switch(this.zoomMode){
case MapBuzz.Tool.ZoomTool.IN:
_5fb=1/Math.min(_5f5,_5f6);
_5fc=this.toolManager.view.displayExtent.scale*_5fb;
this.toolManager.view.setCenterScale(_5fa,_5fc);
break;
case MapBuzz.Tool.ZoomTool.OUT:
_5fb=Math.min(_5f5,_5f6);
_5fc=this.toolManager.view.displayExtent.scale*_5fb;
this.toolManager.view.setCenterScale(_5fa,_5fc);
break;
case MapBuzz.Tool.ZoomTool.PREVIOUS:
this.toolManager.view.previous();
break;
default:
break;
}
}});
if(Browser.instance.isGecko()){
MapBuzz.Tool.ZoomTool.prototype.figureCursor=function figureCursor(){
var _5fd=null;
switch(this.zoomMode){
case MapBuzz.Tool.ZoomTool.IN:
_5fd="-moz-zoom-in";
break;
case MapBuzz.Tool.ZoomTool.OUT:
_5fd="-moz-zoom-out";
break;
case MapBuzz.Tool.ZoomTool.PREVIOUS:
_5fd="default";
break;
case MapBuzz.Tool.ZoomTool.CANCEL:
_5fd="url(/cursors/cancel.cur), auto";
break;
default:
break;
}
return _5fd;
};
}else{
MapBuzz.Tool.ZoomTool.prototype.figureCursor=function figureCursor(){
var _5fe=null;
switch(this.zoomMode){
case MapBuzz.Tool.ZoomTool.IN:
_5fe="url(/cursors/zoom_in.cur), auto";
break;
case MapBuzz.Tool.ZoomTool.OUT:
_5fe="url(/cursors/zoom_out.cur), auto";
break;
case MapBuzz.Tool.ZoomTool.PREVIOUS:
_5fe="default";
break;
case MapBuzz.Tool.ZoomTool.CANCEL:
_5fe="url(/cursors/cancel.cur), auto";
break;
default:
break;
}
return _5fe;
};
}
MapBuzz.Tool.ZoomToBoundsTool=function ZoomToBoundsTool(){
this.applySuper(arguments);
};
MapBuzz.Tool.ZoomToBoundsTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.ZoomToBoundsTool.prototype,{activate:function(){
var map=this.toolManager.view.map;
map.gotoDefault();
this.toolManager.activateTool(this.toolManager.defaultTool);
},getDescription:function(){
return "<p><strong>Click</strong> to zoom to the map bounds.</p>";
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.DeleteTool=function DeleteTool(_600){
this.applySuper(arguments);
};
MapBuzz.Tool.DeleteTool.inherits(MapBuzz.Tool.AbstractEditTool);
Object.extend(MapBuzz.Tool.DeleteTool.prototype,{activate:function(){
this.cursor.push("url(/cursors/pointer_delete.cur), auto");
this.applySuper(arguments);
},deactivate:function(){
this.cursor.pop();
this.closeTooltip();
this.applySuper(arguments);
},getDescription:function(){
var _601="<p>";
_601+="Delete a feature by clicking on it";
if(!MapBuzz.user.isAuthenticated()){
_601+=" (requires login to use)";
}
_601+=".";
_601+="</p>";
return _601;
},getHintPanel:function(){
return this.figure.figures.feature.getToolTipPanel();
},openTooltip:function(_602){
this.closeTooltip();
var _603=this.getHintPanel();
if(!_603){
return;
}
var _604=Event.element(_602);
var _605=_604.mbShape;
if(!_605){
return;
}
var _606=this.toolManager.getEventViewCoord(_602);
var _607=new Geometry.Point(_606.x,_606.y,this.toolManager.view.viewCrs);
this.tooltip=new MapBuzz.Editor.TooltipViewer(_603);
this.tooltip.open(_605,_607);
},closeTooltip:function(_608){
if(this.tooltip){
this.tooltip.close();
}
this.tooltip=null;
},mouseover:function(_609){
var _60a=Event.element(_609);
var _60b=_60a.figure;
if(_60b&&_60b.figures.feature.resource.isRemovable()){
this.figure=_60b;
this.figure.highlight();
this.openTooltip(_609);
}
},mousemove:function(_60c){
if(MapBuzz.Tool.ScrollTool.checkScroll(this.toolManager,_60c)){
return;
}
},mouseout:function(_60d){
var _60e=Event.element(_60d);
if(this.figure&&this.figure==_60e.figure){
this.figure.unhighlight();
}
this.closeTooltip();
this.figure=null;
},click:function(_60f){
this.closeTooltip();
var _610=Event.element(_60f);
var _611=_610.figure;
if(_611&&_611.figures.feature.resource.isRemovable()){
_611.figures.feature.removeCommand().execute();
}
this.figure=null;
Event.stop(_60f);
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.PointerTool=function PointerTool(_612){
this.applySuper(arguments);
};
MapBuzz.Tool.PointerTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.PointerTool.prototype,{deactivate:function(){
this.applySuper(arguments);
},getDescription:function(){
return "<p><strong>Drag</strong> to pan the map.</p>"+"<p><strong>Shift and drag</strong> to zoom in or out.</p>";
},mouseover:function(_613){
var _614=Event.element(_613);
var _615=_614.mbShape;
if(!_615){
return;
}
if(!_615.getTool){
return;
}
var tool=_615.getTool();
if(!tool){
return;
}
this.toolManager.pushTool(tool);
},dragstart:function(_617){
var tool=null;
if(_617.shiftKey){
tool=new MapBuzz.Tool.ZoomTool(this.toolManager);
this.toolManager.pushTool(tool,function(_619,_61a){
if(_61a=="dragend"){
return true;
}
});
}else{
tool=new MapBuzz.Tool.PanTool(this.toolManager);
this.toolManager.pushTool(tool,function(_61b,_61c){
if(_61c=="dragend"){
return true;
}
});
}
},dblclick:function(_61d){
var view=this.toolManager.view;
var _61f=this.toolManager.getEventWorldCoord(_61d);
var _620=new Geometry.Point(_61f.x,_61f.y,view.map.world.crs);
view.setCenterScale(_620,view.displayExtent.scale*2.5);
}});
MapBuzz.Tool.InfoTool=function InfoTool(_621,_622){
this.callSuper(arguments.callee,_621);
this.shape=_622;
this.figure=_622.figure;
};
MapBuzz.Tool.InfoTool.inherits(MapBuzz.Tool.AbstractTool);
MapBuzz.Tool.InfoTool.DBL_CLICK_WAIT=200;
MapBuzz.Tool.InfoTool.Z_INDEX=1000;
Object.extend(MapBuzz.Tool.InfoTool.prototype,{activate:function(){
this.applySuper(arguments);
this.cursor.push("url(/cursors/pointer_info.cur), auto");
this.figure.getRoot().highlight();
},resume:function(_623){
this.applySuper(arguments);
this.toolManager.popTool();
},deactivate:function(){
this.closeTooltip();
this.cursor.pop();
this.figure.getRoot().unhighlight();
this.figure=null;
this.applySuper(arguments);
},openTooltip:function(_624){
this.closeTooltip();
var _625=Event.element(_624);
var _626=_625.mbShape;
if(!_626){
return;
}
var _627=this.toolManager.getEventViewCoord(_624);
var _628=new Geometry.Point(_627.x,_627.y,this.toolManager.view.viewCrs);
var _629=this.figure.figures.feature;
this.tooltip=_629.openTooltip(_626,_628);
},closeTooltip:function(_62a){
if(this.tooltip){
this.tooltip.close();
}
this.tooltip=null;
},mouseover:function(_62b){
this.openTooltip(_62b);
},mouseout:function(_62c){
this.toolManager.popTool();
},click:function(_62d){
var _62e=Event.element(_62d);
if(!_62e.mbShape){
return;
}
var _62f=this.toolManager.getEventViewCoord(_62d);
var _630=new Geometry.Point(_62f.x,_62f.y,this.toolManager.view.viewCrs);
this.openEditor(_62e.mbShape,_630);
},dblclick:function(_631){
var _632=Event.element(_631);
var _633=_632.mbShape;
var view=this.toolManager.view;
var _635=_633.figure.figures.feature.getBounds();
view.setBounds(_635);
var _636=this.toolManager.getEventViewCoord(_631);
var _637=new Geometry.Point(_636.x,_636.y,this.toolManager.view.viewCrs);
this.openEditor(_633,_637);
},openEditor:function(_638,_639){
this.closeTooltip();
var tool=new MapBuzz.Tool.FeatureEditorTool(this.toolManager,_638,_639);
this.toolManager.pushTool(tool);
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.EventTool=function EventTool(_63b){
this.applySuper(arguments);
};
MapBuzz.Tool.EventTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.EventTool.prototype,{activate:function(){
this.applySuper(arguments);
},deactivate:function(){
this.applySuper(arguments);
},getTypeCategory:function(){
return MapBuzz.Feature.Event.TYPE_CATEGORY.uri();
},getDescription:function(){
var _63c="<p>";
_63c+="Create a new event";
if(!MapBuzz.user.isAuthenticated()){
_63c+=" (requires login to use)";
}
_63c+=".";
_63c+="</p>";
return _63c;
},getHintContent:function(){
return "";
},mouseover:function(_63d){
},mouseout:function(_63e){
},mousemove:function(_63f){
},click:function(_640){
Event.stop(_640);
var _641=this.toolManager.getEventWorldCoord(_640);
var geom=new Geometry.Point(_641.x,_641.y,this.toolManager.view.map.world.crs);
this.createFeature(this.getTypeCategory(),geom);
this.activateEditorTool(geom);
}});
namespace("MapBuzz.Tool");
MapBuzz.Tool.NoteTool=function NoteTool(_643){
this.applySuper(arguments);
};
MapBuzz.Tool.NoteTool.inherits(MapBuzz.Tool.AbstractFeatureTool);
Object.extend(MapBuzz.Tool.NoteTool.prototype,{resume:function(_644){
if(_644 instanceof MapBuzz.Tool.NoteEditorTool){
this.toolManager.activateDefaultTool();
}
},getTypeCategory:function(){
return MapBuzz.Feature.Note.TYPE_CATEGORY.uri();
},createEditorTool:function(_645,_646){
return new MapBuzz.Tool.NoteEditorTool(this.toolManager,_645,_646);
},getDescription:function(){
var _647="<p>";
_647+="Create a new note on the map";
if(!MapBuzz.user.isAuthenticated()){
_647+=" (requires login to use)";
}
_647+=".";
_647+="</p>";
return _647;
},click:function(_648){
Event.stop(_648);
var _649=this.toolManager.getEventWorldCoord(_648);
var _64a=new Geometry.Point(_649.x,_649.y,this.toolManager.view.map.world.crs);
this.createFeature(this.getTypeCategory(),_64a);
this.activateEditorTool(_64a);
}});
MapBuzz.Tool.NoteInfoTool=function NoteInfoTool(_64b,_64c){
this.callSuper(arguments.callee,_64b);
this.shape=_64c;
this.figure=_64c.figure;
this.clickTimeoutId=null;
};
MapBuzz.Tool.NoteInfoTool.inherits(MapBuzz.Tool.AbstractTool);
Object.extend(MapBuzz.Tool.NoteInfoTool.prototype,{activate:function(){
this.cursor.push("auto");
this.figure.getRoot().highlight();
this.applySuper(arguments);
this.figure.setZIndex(MapBuzz.Tool.InfoTool.Z_INDEX);
this.openViewer();
},deactivate:function(){
this.figure.setZIndex(null);
this.cursor.pop();
this.closeViewer();
this.figure.getRoot().unhighlight();
this.shape=null;
this.figure=null;
this.applySuper(arguments);
},resume:function(){
this.openViewer();
},getHintPanel:function(){
return this.figure.figures.feature.getToolTipPanel();
},openViewer:function(){
if(this.viewer){
return;
}
this.viewer=new MapBuzz.Editor.NoteViewer(this.figure.figures.feature);
this.viewer.open(this.shape,this.shape.getGeom());
},closeViewer:function(_64d){
if(this.viewer){
this.viewer.close();
}
this.viewer=null;
},isNote:function(_64e){
var _64f=Event.element(_64e);
var _650=_64f.mbShape;
if(_650&&_650===this.shape){
return true;
}else{
if(_650&&_650!==this.shape){
return false;
}else{
var _651=this.toolManager.getEventViewCoord(_64e);
return this.viewer.getBounds().containsXY(_651.x,_651.y);
}
}
},isDifferentNote:function(_652){
var _653=Event.element(_652);
var _654=_653.mbShape;
if(_654&&_654!==this.shape){
return true;
}else{
return false;
}
},mouseover:function(_655){
var _656=Event.element(_655);
var _657=_656.mbShape;
if(!this.viewer){
this.openViewer();
}else{
if(this.isDifferentNote(_655)){
this.closeViewer();
this.toolManager.popTool();
}
}
},mousedown:function(_658){
if(!this.isNote(_658)){
this.closeViewer();
this.toolManager.popTool();
}
},click:function(_659){
if(!this.isNote(_659)){
return;
}
Event.stop(_659);
if(this.figure.figures.feature.isReadOnly()){
return;
}
var _65a=Event.element(_659);
if(!_65a.nodeName.match(/div|a/i)){
return;
}
if(_65a.nodeName.match(/div/i)&&!_65a.className.match(/map_note_content/i)){
return;
}
if(_65a.nodeName.match(/a/i)&&!_65a.className.match(/edit/i)){
return;
}
Event.stop(_659);
var _65b=this.toolManager.getEventViewCoord(_659);
var _65c=new Geometry.Point(_65b.x,_65b.y,this.toolManager.view.map.world.crs);
this.openEditor(_65c);
},openEditor:function(_65d){
this.closeViewer();
var tool=new MapBuzz.Tool.NoteEditorTool(this.toolManager,this.shape,_65d);
this.toolManager.popTool(this);
this.toolManager.pushTool(tool);
}});
MapBuzz.Tool.NoteEditorTool=function NoteEditorTool(_65f,_660){
this.applySuper(arguments);
};
MapBuzz.Tool.NoteEditorTool.inherits(MapBuzz.Tool.FeatureEditorTool);
Object.extend(MapBuzz.Tool.NoteEditorTool.prototype,{mouseover:function(_661){
var _662=Event.element(_661);
var _663=_662.figure;
var _664=_662.handle;
var note=_662.note;
if(_664){
var tool=new MapBuzz.Tool.HandleTool(this.toolManager,_664);
this.toolManager.pushTool(tool);
}
},dragstart:function(_667){
var _668=Event.element(_667);
if(!_668||!_668.nodeName.match(/^(img)$/i)||!_668.className.match(/drag/i)){
return;
}
var tool=new MapBuzz.Tool.MoveTool(this.toolManager,[this.editor]);
this.toolManager.pushTool(tool,function(_66a,_66b){
if(_66b=="dragend"){
return true;
}
});
},isEditor:function(_66c){
var _66d=this.toolManager.getEventDocCoord(_66c);
return this.editor.getBounds().containsXY(_66d.x,_66d.y);
},onCancelEditor:function(){
this.applySuper(arguments);
if(!this.shape.figure.figures.feature.isNew()){
var tool=new MapBuzz.Tool.NoteInfoTool(this.toolManager,this.shape);
this.toolManager.pushTool(tool);
}
}});

