OpenLayers.IMAGE_RELOAD_ATTEMPTS=5;OpenLayers.DOTS_PER_INCH=25.4/0.28;OpenLayers.Util.onImageLoadErrorColor="transparent";OpenLayers.Layer.Grid.prototype.buffer=-1;function DeMap(a){this.searchUrl="DeMapSearch.jsp?";this.contentsUrl="DeMapContents.jsp?";this.attrInfoUrl="DeMapAttrInfo.jsp?";this.thumbUrl="../thumb/?url=";this.jsonFormat=new OpenLayers.Format.JSON();if(a){this.gmlFormat=new OpenLayers.Format.GML();if(a.gml){this.gmlFormat.featureNS=a.gml.ns;this.gmlFormat.featurePrefix=a.gml.prefix;this.gmlFormat.geometryName=a.gml.name;this.gmlFormat.xy=false}if(a.wfs){this.wfsProxyUrl=a.wfs}}}DeMap.prototype={mapType:"DeMap",mapId:0,commId:0,userId:0,mapExtent:null,mapResolution:null,geoServerUrl:null,localSldUrl:null,searchUrl:null,contentsUrl:null,attrInfoUrl:null,thumbUrl:null,wfsProxyUrl:null,map:null,gmlFormat:null,jsonFormat:null,utmProj:new OpenLayers.Projection("EPSG:32654"),dispProj:new OpenLayers.Projection("EPSG:4326"),contentsZoomLevel:15,contentsLayer:null,contentsLayerInfo:null,visibleContentsId:null,visibleContentsIdArray:null,kmlLegend:null,kmlFormat:null,referenceLayers:null,referenceGroupId:null,referenceGroupInfo:null,referenceInfo:null,refLayerNameInfo:null,visibleReferenceLayerId:null,overlayLayers:null,overlayLayersId:null,baseLayers:null,baseLayersId:null,sessionLayerInfo:null,markerLayer:null,rangeLayer:null,rangeFeature:null,icons:{},iconPath:"icons",iconInfo:null,activeMarkers:null,popupMarkers:null,pinPopup:null,mapControls:null,layerIconImage:null,legendContents:null,legendRef:null,legendOverlay:null,legendBase:null,mapMoveListener:null,clickHandler:null,clickBuffer:16,searchLimit:10,searchViewEnabled:false,searchedBounds:null,searchViewLocking:false,searchViewWaiting:false,searchAreaPane:null,searchResultPane:null,searchWaitDiv:null,searchType:null,searchRangeInputs:null,POINT:0,LINESTRING:1,POLYGON:2,MULTIPOINT:3,MULTILINESTRING:4,MULTIPOLYGON:5,geometryTypeIds:{POINT:0,LINESTRING:1,POLYGON:2,MULTIPOINT:3,MULTILINESTRING:4,MULTIPOLYGON:5},getGeometryTypeId:function(a){return this.geometryTypeIds[a]},isMultiGeometry:function(a){switch(this.getGeometryTypeId(a)){case this.MULTIPOINT:case this.MULTILINESTRING:case this.MULTIPOLYGON:return true;default:return false}},isModifiable:function(a){switch(this.getGeometryTypeId(a)){case this.POINT:case this.MULTIPOINT:return false;default:return true}},init:function(mapId,mapdiv,bounds,resolution,initedCallback,options){if(!options){options={}}var self=this;this.mapId=mapId;this.mapExtent=bounds;this.mapResolution=resolution;var url="DeMapLayerJs.jsp?mid="+this.mapId;if(options.showAllContents){url+="&contents=1"}if(options.visibleContents){url+="&visible="+options.visibleContents}dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){if(typeof data=="error"){console.warn("error!",args)}else{try{eval(data);self.initMap(mapdiv,options);initedCallback()}catch(e){console.warn(e)}}}});this.pinPopups=[];this.sessionLayerInfo=[];if(options.iconPath){this.iconPath=options.iconPath}else{this.iconPath="icons/"}if(options.iconInfo){this.iconInfo=options.iconInfo}else{this.iconInfo={"default":["default.png",15,24,8,22],active:["active.png",19,32,9,32],popup:["popup.png",5,8,2,8]}}},initMap:function(g,e){console.log("initMap : "+g);var h=this;this.map=new OpenLayers.Map(g,{controls:[],maxExtent:new OpenLayers.Bounds(-180,-90,180,90),maxResolution:0.703125,numZoomLevels:20,projection:"EPSG:4326"});this.map.setMinZoom(5);this.map.paddingForPopups.left=40;this.map.fractionalZoom=false;this.referenceLayers={};this.overlayLayers={};this.baseLayers={};this.initMapLayer();console.log("Layer Inited");if(!this.map.baseLayer){var d=new OpenLayers.Layer.Image("NULL","images/nulllayer.png",new OpenLayers.Bounds(-180,-90,180,90),new OpenLayers.Size(512,256),{});this.map.addLayer(d);this.map.baseLayer=d}for(var b=this.overlayLayersId.length-1;b>=0;b--){this.map.addLayer(this.overlayLayers[this.overlayLayersId[b][0]])}var j=Math.random();for(var b=this.referenceGroupId.length-1;b>=0;b--){var a=this.referenceGroupId[b];wms=this.getReferenceWmsUrl(a);this.referenceLayers[a]=new OpenLayers.Layer.WMS(this.referenceGroupInfo[a].name,wms,{transparent:"TRUE",_olSalt:j},{buffer:0,alpha:true,opacity:this.referenceGroupInfo[a].opacity?this.referenceGroupInfo[a].opacity:1});this.referenceLayers[a].tiled=true;this.map.addLayer(this.referenceLayers[a]);if(!this.visibleReferenceLayerId[a]||this.visibleReferenceLayerId[a].length==0){this.referenceLayers[a].setVisibility(false)}}this.contentsLayer=new OpenLayers.Layer.WMS("登録情報レイヤ",this.getContentsWmsUrl(),{transparent:true,_olSalt:j},{buffer:0,alpha:true,tiled:true,isBaseLayer:false});if(this.visibleContentsId.length==0){this.contentsLayer.setVisibility(false)}this.map.addLayer(this.contentsLayer);this.rangeLayer=new OpenLayers.Layer.Vector("range");this.rangeLayer.displayInLayerSwitcher=false;this.map.addLayer(this.rangeLayer);this.rangeLayer.styleMap.styles["default"]=new OpenLayers.Style({fillColor:"white",fillOpacity:0.25,strokeColor:"red",strokeOpacity:1,strokeWidth:1});this.markerLayer=new OpenLayers.Layer.Markers("marker");this.markerLayer.displayInLayerSwitcher=false;this.map.addLayer(this.markerLayer);this.map.events.register("moveend",this.map,function(){h.searchViewArea()});this.showInitLocation();this.map.setInitExtent(this.map.getExtent());this.mapControls={DRAG:new OpenLayers.Control.Navigation({zoomWheelEnabled:false,handleRightClicks:true}),SEARCH:new OpenLayers.Control.SearchArea({callbackArea:function(k,i){h.setSearchArea(k,i)},callbackSearch:function(k,i){h.searchAreaSelected()}})};this.map.addControl(this.mapControls.DRAG);this.map.addControl(this.mapControls.SEARCH);var f=new OpenLayers.Control.PanZoomBar();this.map.addControl(f);f.enableZoomWheel();this.map.addControl(new OpenLayers.Control.Attribution());this.map.addControl(new OpenLayers.Control.ScaleBar());var c=new OpenLayers.Control.CenterCursor();this.map.addControl(c);c.moveCenter();if(e.layerSwitcher){this.map.addControl(new OpenLayers.Control.LayerSwitcher())}console.log("Map Inited : "+g);this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.onMapClick},{single:true,pixelTolerance:5});this.clickHandler.down=new OpenLayers.Pixel(0,0);this.changeMapMode("DRAG")},showInitLocation:function(){if(this.mapResolution>0){var a=this.map.getZoomForResolution(this.mapResolution,true);this.map.setCenter(this.mapExtent.getCenterLonLat(),a)}else{this.map.zoomToExtent(this.mapExtent)}},mapPanTo:function(b,a){this.map.panTo(new OpenLayers.LonLat(b,a))},mapSetCenter:function(b,a){this.map.setCenter(new OpenLayers.LonLat(b,a))},zoomToExtent:function(a){this.map.zoomToExtent(a)},getSize:function(){return this.map.getSize()},getBounds:function(){return this.map.getExtent()},getResolution:function(){return this.map.getResolution()},addMapMoveListener:function(a,c){var b=this;this.mapMoveListener=function(){c(b,a)};this.map.events.register("move",this.map,this.mapMoveListener)},removeMapMoveListener:function(a){this.map.events.unregister("move",this.map,this.mapMoveListener)},mapMoveZoom:function(a,b){this.map.setCenter(a,b)},mapMove:function(a){this.map.setCenter(a,this.map.getZoom())},mapZoom:function(a){this.map.zoomTo(a)},updateSize:function(){this.map.updateSize()},getLonLat:function(){return this.map.getCenter()},getZoom:function(){return this.map.getZoom()},changeMapMode:function(a){if(this.editingMode){this.changeEditControl(null)}for(key in this.mapControls){this.mapControls[key].deactivate()}this.mapControls[a].activate();this.clickHandler.deactivate();this.clickHandler.deactivate();if(a=="DRAG"){this.clickHandler.activate()}},startMeasure:function(e,d){if(!this.mapControls.MEASURE){var c=new OpenLayers.Style();c.addRules([new OpenLayers.Rule({symbolizer:{Point:{pointRadius:4,graphicName:"square",fillColor:"white",fillOpacity:1,strokeWidth:1,strokeOpacity:1,strokeColor:"#333333"},Line:{strokeWidth:3,strokeOpacity:1,strokeColor:"#FF0000",strokeDashstyle:"dash"},Polygon:{strokeWidth:2,strokeOpacity:1,strokeColor:"#FF0000",fillColor:"white",fillOpacity:0.3}}})]);var b={handlerOptions:{style:"default",layerOptions:{styleMap:new OpenLayers.StyleMap({"default":c})},persist:true}};this.mapControls.MEASURE=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,b);this.map.addControl(this.mapControls.MEASURE);this.mapControls.MEASUREAREA=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,b);this.map.addControl(this.mapControls.MEASUREAREA);this.mapControls.MEASURE.handler.dblclick=this.mapControls.MEASURE.handler.click;this.mapControls.MEASUREAREA.handler.dblclick=this.mapControls.MEASUREAREA.handler.click}var a=d?"MEASUREAREA":"MEASURE";this.stopMeasure();this.mapControls[a].activate();this.mapControls[a].events.on({measure:e,measurepartial:e})},stopMeasure:function(){this.mapControls.MEASURE.events.remove("measure");this.mapControls.MEASURE.events.remove("measurepartial");this.mapControls.MEASURE.deactivate();this.mapControls.MEASUREAREA.events.remove("measure");this.mapControls.MEASUREAREA.events.remove("measurepartial");this.mapControls.MEASUREAREA.deactivate()},addMeasurePoint:function(d,c){var b=null;if(this.mapControls.MEASURE.active){b=this.mapControls.MEASURE.handler}if(this.mapControls.MEASUREAREA.active){b=this.mapControls.MEASUREAREA.handler}if(b){var a={xy:this.map.getPixelFromLonLat({lon:d,lat:c})};if(b.point){b.point.geometry.x=d;b.point.geometry.y=c;b.point.geometry.clearBounds();b.modifyFeature()}b.mousedown(a);b.mouseup(a)}},undoMeasurePoint:function(){var b=null;if(this.mapControls.MEASURE.active){b=this.mapControls.MEASURE.handler}if(this.mapControls.MEASUREAREA.active){b=this.mapControls.MEASUREAREA.handler}if(b){if(b.line&&b.line.geometry.components.length>=2){var a=b.line.geometry.components[b.line.geometry.components.length-2];b.line.geometry.components.length=b.line.geometry.components.length-2;b.drawFeature();b.callback("point",[b.point.geometry,b.getGeometry()]);b.line.geometry.components[b.line.geometry.components.length]=a;b.lastDown=new OpenLayers.Pixel(-1,-1);b.lastUp=new OpenLayers.Pixel(-1,-1)}}},editFeature:function(b,a,e,d,c){if(this.isEditable(b,a)){this.editContents(b,a,e,d,c)}else{alert("編集できません")}},isEditable:function(b,a){var c=this.getLayerInfo(b);return(this.editingLayer&&c&&c.status<c.STATUS_FIXED)},menuLegend:null,initContentsLegend:function(b,e,a,f){var d=this;dojo.byId(b).innerHTML="";this.legendContents=new LegendTree(b,function(g){d.callbackContentsLegend(g)},f);this.legendContents.loadLegend(e+this.mapId+("&"+new Date().getTime()/1000),a);var c=this.legendContents;if(f){dojo.connect(f,"onOpen",function(){c.menuLayerId=c.mouseLayerId;d.menuLegend=c})}},initReferenceLegends:function(b,c,a,f){if(!$(b)){return}if(!this.legendRef){this.legendRef=[]}for(var e=0;e<this.referenceGroupId.length;e++){var d=this.referenceGroupId[e];this.initReferenceLegend(b,c,a,d,f)}},initReferenceLegend:function(b,e,a,f,g){var d=this;var h=new dijit.Menu({leftClickToOpen:false});h.addChild(new dijit.PopupMenuItem({label:g.label,popup:g.popup}));h.startup();this.legendRef[f]=new LegendTree(b,function(i){d.callbackReferenceLegend(i,f)},h,h,h);this.legendRef[f].loadLegend(e+this.mapId+"&root="+f+("&"+new Date().getTime()/1000),a);var c=this.legendRef[f];if(h){dojo.connect(h,"onOpen",function(){c.menuLayerId=c.mouseLayerId;d.menuLegend=c})}},addReferenceLayers:function(g,j,m,k){if(!g||g.length==0){return}var n=this;var d=g[0].layerId;var a={name:g[0].layerName,opacity:g[0].opacity,wfs:"null",wms:g[0].wmsURL+"&FORMAT="+g[0].format+"&"};var b=new dijit.Menu({leftClickToOpen:false});b.addChild(new dijit.PopupMenuItem({label:k.label,popup:k.popup}));b.startup();var l=new LegendTree(j,function(i){n.callbackReferenceLegend(i,d)},b,b,b);if(b){dojo.connect(b,"onOpen",function(){l.menuLayerId=l.mouseLayerId;n.menuLegend=l})}this.referenceGroupId.push(d);this.referenceGroupInfo[d]=a;this.legendRef[d]=l;var c=[];l.addLegend(d,g[0].layerName,null);for(var e=1;e<g.length;e++){c.push(g[e].layerId);this.refLayerNameInfo[d+":"+g[e].featureTypes.replace(/^.*?\:/,"")]=g[e].layerName;this.referenceInfo[g[e].layerId]=[d,g[e].featureTypes];l.addLegend(g[e].layerId,g[e].layerName,m,d,e!=g.length-1)}this.visibleReferenceLayerId[d]=c.reverse().join();wms=this.getReferenceWmsUrl(d);console.log("ReferenceWMS : "+wms);var h=0;if(this.overlayLayersId.length>0){h=this.map.getLayerIndex(this.overlayLayers[this.overlayLayersId[0][0]])}var f=new OpenLayers.Layer.WMS(a.name,wms,{transparent:"TRUE"},{buffer:0,alpha:true,opacity:a.opacity?a.opacity:1});this.referenceLayers[d]=f;f.tiled=true;this.map.addLayer(f);this.map.setLayerIndex(f,h+1);f.setVisibility(true)},addGeoRSSLayer:function(a,c){var b=new OpenLayers.Layer.GeoRSS("GeoRSS",a,{icon:new OpenLayers.Icon("http://openlayers.org/~crschmidt/yelp.png",new OpenLayers.Size(20,29))});this.map.addLayer(b);this.map.setLayerIndex(b,0);b.setVisibility(true)},addKMLLayer:function(d,c){if(!this.kmlFormat){this.kmlFormat=new OpenLayers.Format.KML({extractStyles:true})}var e="cswKML.jsp?mid="+this.mapId+"&kml="+escape(d)+"&"+(Math.floor(new Date().getTime()/1000));var b=this;var f;if(c>0){f=setInterval(function(){if(a.visibility){b.loadKMLFeature(a,e,f)}},c*1000)}var a=new OpenLayers.Layer.Vector("KML");this.loadKMLFeature(a,e,f,function(g){b.map.zoomToExtent(a.getDataExtent());var i=document.createElement("div");i.appendChild(new dijit.form.CheckBox({checked:true,onClick:function(){a.setVisibility(this.checked)}}).domNode);var h=document.createElement("span");if(g&&g.length>0&&g[0].attributes){if(g[0].attributes.name){name=g[0].attributes.name}else{if(g[0].attributes.id){name=g[0].attributes.id}}}if(name){h.innerHTML=name}else{h.innerHTML="KMLレイヤ"}i.appendChild(h);if(b.kmlLegend){b.kmlLegend.appendChild(i)}});this.map.addLayer(a)},loadKMLFeature:function(a,c,d,e){var b=this;dojo.xhrGet({url:c,handleAs:"text",handle:function(h,g){try{var f=b.kmlFormat.read(h);a.addFeatures(f);if(e){e(f)}}catch(i){if(d){clearTimeout(d)}}}})},initOverlayLegend:function(b,e,a,f){if(!$(b)){return}var d=this;this.legendOverlay=new LegendTree(b,function(g){d.callbackOverlayLegend(g)},f);this.legendOverlay.loadLegend(e+this.mapId+("&"+new Date().getTime()/1000),a);var c=this.legendOverlay;if(f){dojo.connect(f,"onOpen",function(){c.menuLayerId=c.mouseLayerId;d.menuLegend=c})}},addOverlayLayer:function(f,e,b,g,d,a){if(!d){d={}}d.buffer=0;d.isBaseLayer=false;d.alpha=true;var c=new OpenLayers.Layer.WMS(f,this.getWmsGetMapUrl(b,g),{transparent:"TRUE"},d);this.overlayLayersId[this.overlayLayersId.length]=[f,e];this.overlayLayers[f]=c;this.map.addLayer(c);this.map.setLayerIndex(c,0);c.setVisibility(true);this.legendOverlay.addLegend(f,e,a)},initBaseLayerLegend:function(b,e,a,f){var d=this;this.legendBase=new LegendTree(b,function(g){d.callbackBaseLayerLegend(g)},f);this.legendBase.loadLegend(e+this.mapId+("&"+new Date().getTime()/1000),a);var c=this.legendBase;if(f){dojo.connect(f,"onOpen",function(){c.menuLayerId=c.mouseLayerId;d.menuLegend=c})}},addBaseLayer:function(f,d,b,g,e,a){var c=new OpenLayers.Layer.WMS(f,this.getWmsGetMapUrl(b,g),{},{buffer:0,attribution:e,isBaseLayer:true});this.baseLayersId[this.baseLayersId.length]=[f,d];this.baseLayers[f]=c;this.map.addLayer(c);this.map.setLayerIndex(c,0);this.map.setBaseLayer(c);c.setVisibility(true);this.legendBase.addLegend(f,d,a,null,null,"_baselayers")},callbackContentsLegend:function(c){var a=[];for(var b=c.length-1;b>=0;b--){if(this.contentsLayerInfo[c[b]]){a.push(c[b])}}var d=a.join(",");if(this.visibleContentsId!=d){this.visibleContentsId=d;this.visibleContentsIdArray=a;if(d==""){this.contentsLayer.setVisibility(false)}else{this.contentsLayer.url=this.getContentsWmsUrl();this.contentsLayer.overRedraw();this.contentsLayer.setVisibility(true)}this.searchLayerUpdate()}},callbackReferenceLegend:function(d,c){var a=[];for(var b=d.length-1;b>=0;b--){if(this.referenceInfo[d[b]]){a.push(d[b])}}layers=a.join(",");console.log(c+":"+layers);if(this.visibleReferenceLayerId[c]!=layers){this.visibleReferenceLayerId[c]=layers;if(!this.visibleReferenceLayerId[c]||this.visibleReferenceLayerId[c].length==0){this.referenceLayers[c].setVisibility(false)}else{this.referenceLayers[c].url=this.getReferenceWmsUrl(c);this.referenceLayers[c].overRedraw();this.referenceLayers[c].setVisibility(true)}}},callbackOverlayLegend:function(d){var a={};for(var b=0;b<d.length;b++){a[d[b]]=true;console.log(c)}for(var c in this.overlayLayers){var e=false;if(a[c]){e=true}this.overlayLayers[c].setVisibility(e)}},callbackBaseLayerLegend:function(a){if(a.length>0){this.setBaseLayer(a[0])}},getVisibleReferenceFeatureId:function(c){var d=[];if(this.visibleReferenceLayerId[c]){var a=this.visibleReferenceLayerId[c].split(",");for(var b=a.length-1;b>=0;b--){d[b]=this.referenceInfo[a[b]][1]}}return d},setLegendOpacity:function(d,e){if(this.legendOverlay==this.menuLegend&&this.legendOverlay.menuLayerId){this.overlayLayers[this.legendOverlay.menuLayerId].setOpacity(d);this.legendOverlay.menuLayerId=null}else{if(this.legendBase==this.menuLegend&&this.legendBase.menuLayerId){this.baseLayers[this.legendBase.menuLayerId].setOpacity(d);this.legendBase.menuLayerId=null}else{for(var c=0;c<this.referenceGroupId.length;c++){var a=this.legendRef[this.referenceGroupId[c]];if(a==this.menuLegend&&a.menuLayerId){var b=this.referenceLayers[this.referenceGroupId[c]];if(b){b.setOpacity(d)}a.menuLayerId=null}}}}},getVisibleContentsLayersWithOption:function(){return this.visibleContentsId},getVisibleRefLayersWithOption:function(){var d=[];for(var c=this.referenceGroupId.length-1;c>=0;c--){var b=this.referenceGroupId[c];var a=this.referenceLayers[b].opacity;d.push('["'+b+'",'+(a?a:1)+',"'+this.visibleReferenceLayerId[b]+'"]')}console.log(d);return d},getVisibleOverlayLayersWithOption:function(){var d=[];for(var c=this.overlayLayersId.length-1;c>=0;c--){var b=this.overlayLayers[this.overlayLayersId[c][0]];if(b.getVisibility()){var a=b.opacity;d.push(this.overlayLayersId[c][0]+":"+(a?a:1))}}return d},getVisibleBaseLayersWithOption:function(){var a=this.map.baseLayer.opacity;return this.map.baseLayer.layerId+":"+(a?a:1)},setBaseLayer:function(a){this.map.setBaseLayer(this.baseLayers[a])},setOverlayLayer:function(a,b){this.overlayLayers[a].setVisibility(b)},setContentsLayer:function(a,b){this.legendContents.setChecked(a,b)},setSessionLayerInfo:function(h,i,f,e,a,c,k,d,g,j){var b={type:h,mapId:i,layerId:f,layerName:e,featureTypes:a,wmsURL:c,format:k,opacity:d,attr:g,parent:j};this.sessionLayerInfo.push(b);return b},getSessionLayerInfoURL:function(a){return"SessionLayerInfo.jsp?MID="+a.mapId+"&LAYER="+a.layerId+"&NAME="+a.layerName+"&TYPE="+a.type+(a.featureTypes?("&FEATURETYPES="+a.featureTypes):"")+"&WMSGETMAP="+escape(a.wmsURL)+"&FORMAT="+a.format+(a.attr?("&ATTR="+encodeURI(a.attr)):"")+(a.parent?("&PARENT="+a.parent):"")},getSessionLayerInfoArray:function(){var a=[];for(var b=0;b<this.sessionLayerInfo.length;b++){a.push(this.sessionLayerInfo[b])}return a},getLayerInfo:function(a){var b=this.contentsLayerInfo[a];return b},getLayerScale:function(a){var b=this.getLayerInfo(a);if(b){return b.minScale}return 0},getLayerMaxScale:function(a){var b=this.getLayerInfo(a);if(b&&b.minScale!=0){return b.maxScale}return Number.MAX_VALUE},getLayerScaleZoom:function(a){var b=this.getLayerScale(a);if(b==0){return this.contentsZoomLevel}return this.map.getZoomForResolution(OpenLayers.Util.getResolutionFromScale(b,this.map.baseLayer.units),true)},createLayerIconImage:function(b){this.layerIconImage={};for(var c in this.contentsLayerInfo){var a=new Image();a.src=b+c;this.layerIconImage[c]=a}},createLayerNameDiv:function(d,f){var b=document.createElement("table");b.cellPadding=0;b.cellSpacing=0;var c=document.createElement("tbody");var e=document.createElement("tr");var g=document.createElement("td");var a=document.createElement("img");if(this.layerIconImage&&this.layerIconImage[d]){a.className="icon_div";a.src=this.layerIconImage[d].src;g.appendChild(a)}e.appendChild(g);g=document.createElement("td");g.innerHTML=f[0];g.style.lineHeight="105%";g.width="80%";e.appendChild(g);c.appendChild(e);b.appendChild(c);return b},createMarker:function(b,a){var c;c=new OpenLayers.Marker(a,this.getIcon(b).clone());return c},getIcon:function(b){if(b==undefined||b==null){return this.icons["default"]}if(this.icons[b]){return this.icons[b]}if(b.match(/^http/)||b.match(/^\//)){var d=b.split(",");if(d[0]){var a=(d.length>1)?Math.min(64,d[1]):32;var c=(d.length>2)?Math.min(64,d[2]):32;icon=new OpenLayers.Icon(d[0],new OpenLayers.Size(a,c),new OpenLayers.Pixel(-a/2,-c/2))}this.icons[b]=icon;return icon}else{return this.createIcon(b)}return null},createIcon:function(d){if(!this.iconInfo[d]){d="list"}var b=this.iconInfo[d];var a=(b.length>2)?new OpenLayers.Size(b[1],b[2]):new OpenLayers.Size(32,32);var c=(b.length>4)?new OpenLayers.Pixel(-b[3],-b[4]):new OpenLayers.Pixel(-a.w/2,-a.h/2);this.icons[d]=new OpenLayers.Icon(this.iconPath+b[0],a,c);return this.icons[d]},showActiveMarker:function(a){this.clearActiveMarker();this.activeMarkers=[];this.activeMarkers[0]=this.createMarker("active",a);this.markerLayer.addMarker(this.activeMarkers[0])},clearActiveMarker:function(){this.idx=-1;if(this.activeMarkers){for(var a=0;a<this.activeMarkers.length;a++){this.markerLayer.removeMarker(this.activeMarkers[a]);delete this.activeMarkers[a]}delete this.activeMarkers}},showPopupMarkers:function(b){this.popupMarkers=[];for(var a=0;a<b.length;a++){this.popupMarkers[a]=this.createMarker("popup",b[a]);this.markerLayer.addMarker(this.popupMarkers[a])}},clearPopupMarkers:function(){this.idx=-1;if(this.popupMarkers){for(var a=0;a<this.popupMarkers.length;a++){this.markerLayer.removeMarker(this.popupMarkers[a]);delete this.popupMarkers[a]}delete this.popupMarkers}},onMapClick:function(b){this.clearActiveMarker();var c=this.map.getLonLatFromPixel(new OpenLayers.Pixel(b.xy.x-this.clickBuffer,b.xy.y+this.clickBuffer));var a=this.map.getLonLatFromPixel(new OpenLayers.Pixel(b.xy.x+this.clickBuffer,b.xy.y-this.clickBuffer));if(this.map.displayProjection){c.transform(this.map.getProjectionObject(),this.map.displayProjection);a.transform(this.map.getProjectionObject(),this.map.displayProjection)}var d=[c.lon,c.lat,a.lon,a.lat];this.clickSearch(this.map.getLonLatFromPixel(b.xy),d)},clickSearch:function(center,bbox){if(this.editing){return}var layers=this.getSearchableContentsId([this.visibleContentsIdArray],this.map.getScale(),DeMap.LayerInfo.prototype.SEARCH_CLICK);if(layers.length==0){this.getReferenceFeatureInfo(center,bbox);return}var url=this.contentsUrl+"bbox="+(bbox.join(","))+"&mid="+this.mapId+"&layers="+layers.join(",")+"&"+Math.floor(new Date().getTime()/1000);url+="&noname=true";var self=this;dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){if(typeof data=="error"){console.warn("error!",args)}else{try{var result=eval(data);if(result[1].length==1){self.getContent(result[1][0][0],result[1][0][1],center,bbox)}else{if(result[1].length>1){self.showListPopup(center,bbox,result)}else{self.getReferenceFeatureInfo(center,bbox);self.closePopupWindows()}}}catch(e){console.error(e)}}}});layers=null;url=null},getContent:function(layer,gid,center,bbox,options){var url=this.contentsUrl+"mid="+this.mapId+"&gid="+gid+"&layer="+layer+"&"+Math.floor(new Date().getTime()/1000);var self=this;dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){if(typeof data=="error"){console.warn("error!",args)}else{self.showContentsPopup(layer,gid,eval(data),center,bbox,options)}}});url=null},getReferenceFeatureInfo:function(d,f,g,e){var c=g;if(!g){c=document.createElement("div");c.className="popup_div"}for(var b=0;b<this.referenceGroupId.length;b++){var a=this.referenceGroupId[b];this.getReferenceFeatureInfoScope(d,f,c,e,a)}},getReferenceFeatureInfoScope:function(e,g,d,f,c){var a=this;if(this.visibleReferenceLayerId[c]&&this.visibleReferenceLayerId[c].length>0){var b=this.getWmsGetFeatureInfoUrl(this.referenceGroupInfo[c].wms,this.getVisibleReferenceFeatureId(c),g,6,6,5);dojo.xhrGet({url:b,handleAs:"text",handle:function(j,i){if(typeof j=="error"){console.warn("error!",i)}else{if(j.length>0){var h=a.gmlFormat.read(j);a.getReferenceFeatureInfoResponse(e,g,h,c,d,f);j=null}}}});b=null}},closePopupWindow:function(a){this.map.removePopup(a);this.clearPopupMarkers();this.clearActiveMarker();for(var b=this.pinPopups.length-1;b>=0;b--){if(this.pinPopups[b]==a){this.pinPopups.splice(b,1);break}}},closePopupWindows:function(d){if(this.map.popups){this.clearPopupMarkers();this.clearActiveMarker();for(var c=this.map.popups.length-1;c>=0;c--){if(d){this.map.removePopup(this.map.popups[c]);this.pinPopups.length=0}else{var a=false;for(var b=this.pinPopups.length-1;b>=0;b--){if(this.pinPopups[b]==this.map.popups[c]){a=true;break}}if(!a){this.map.removePopup(this.map.popups[c])}}}}},setPopupPin:function(a,d){var b=true;for(var c=this.pinPopups.length-1;c>=0;c--){if(this.pinPopups[c]==a){this.pinPopups.splice(c,1);b=false;break}}if(b){this.pinPopups.push(a);d.className="popup_pinned_button"}else{d.className="popup_pin_button"}},turnPopup:function(a){if(a.relativePosition=="br"){a.relativePosition="bl"}else{if(a.relativePosition=="bl"){a.relativePosition="tl"}else{if(a.relativePosition=="tl"){a.relativePosition="tr"}else{if(a.relativePosition=="tr"){a.relativePosition="br"}}}}a.updatePosition();a.updateRelativePosition()},showPopupWindow:function(d,e,b,i){var l=this;e.style.overflow="visible";var k;if(i.maxWidth){k=i.maxWidth}else{k=this.map.size.w*0.7}var f=this.getContentsSize(e,k,i.noScroll);var m=new OpenLayers.Size(f.w,f.h);m.w=parseInt(Math.max(150,Math.min(m.w,k)));if(i.maxHeight){m.h=Math.min(i.maxHeight,m.h)}else{m.h=Math.min(this.map.size.h*0.5-60,m.h)}if(m.h<f.h){m.w+=20}e.style.overflow="auto";this.closePopupWindows();var a=new OpenLayers.Popup.FramedCloud("popup",d,m,"<br/>");this.map.addPopup(a,false);if(i.panIntoView){a.panMapIfOutOfView=true}if(i.centered){this.map.setCenter(a.lonlat,this.map.getZoom(),true,true)}a.show();a.contentDiv.innerHTML="";e.style.width=m.w+"px";e.style.height=(m.h+8)+"px";var c=document.createElement("div");c.className="popup_div";if(b){c.appendChild(b)}c.appendChild(e);a.contentDiv.appendChild(c);var g=document.createElement("div");g.className="popup_close_button";g.onclick=function(){l.closePopupWindow(a)};a.contentDiv.appendChild(g);if(i.pinned){var j=document.createElement("div");j.className="popup_pin_button";j.onclick=function(){l.setPopupPin(a,j)};a.contentDiv.appendChild(j);var h=document.createElement("div");h.className="popup_turn_button";h.onclick=function(){l.turnPopup(a)};a.contentDiv.appendChild(h)}m.h+=20;if(dojo.isIE){m.h+=4}a.setSize(m);a.calculateRelativePosition=function(){return this.relativePosition}},getContentsSize:function(f,d,e){var c=document.createElement("div");c.className="popup_div";c.style.overflow="visible";c.style.position="absolute";c.style.top="-9999px";c.style.left="-9999px";c.appendChild(f);c.style.width="auto";c.style.height="auto";document.body.appendChild(c);var b=0;if(!e&&c.scrollWidth>d){b=24}var a=parseInt(Math.min(580,Math.min(c.scrollWidth,d)));c.style.width=(a-20)+"px";b+=c.scrollHeight;c.removeChild(f);document.body.removeChild(c);return new OpenLayers.Size(a,Math.min(580,b))},showListPopup:function(h,l,k){var m=this;var n=k[0];var o=k[1];var d=document.createElement("div");d.className="popup_list";for(var f=0;f<o.length;f++){var e=o[f][0];var j=o[f][2];var g=o[f][3];var c=this.createLayerNameDiv(e,['<a href="javascript:void(0);">'+this.escapeXml(g[1])+"</a> "+Math.floor(j[2])+"m"]);var a=document.createElement("div");c.onclick=function b(p,i){return function(){m.getContent(p,i,h,l,{fromList:true})}}(o[f][0],o[f][1]);c.onmouseover=function b(i){return function(){m.listOver(i[0],i[1])}}(j);c.onmouseout=function(){m.listOut()};d.appendChild(c);e=null;j=null;g=null;c=null;a=null}this.setRefLink(h,l,d);this.showPopupWindow(h,d,document.createElement("br"),{maxWidth:200,noScroll:true});n=null;o=null;d=null},listOver:function(b,a){this.showActiveMarker(new OpenLayers.LonLat(b,a))},listOut:function(){this.clearActiveMarker()},showContentsPopup:function(m,C,y,L,o,s){var g=this;if(!s){s={}}var l=this.getLayerInfo(m);var j=y[2];var E=new OpenLayers.LonLat(j[0],j[1]);var h=y[3];var u=y[4];var k=y[6];if(!L){L=E}if(!o){var D=this.clickBuffer*this.map.getResolution()/2;o=[L.lon-D,L.lat-D,L.lon+D,L.lat+D]}var r=document.createElement("div");r.className="popup_contents";var q=document.createElement("table");q.cellSpaceing=0;q.cellPadding=0;var A=document.createElement("tbody");var K=document.createElement("tr");var c;var v;var I;if(u.length>0){c=document.createElement("td");c.style.verticalAlign="top";var n=document.createElement("div");n.className="popup_filelist";n.style.height="152px";for(var G=0;G<u.length;G+=2){n.appendChild(this.createFileDiv(u[G],u[G+1],120,140,true))}c.appendChild(n);K.appendChild(c);v=c}c=document.createElement("td");c.style.verticalAlign="top";c.style.paddingLeft="2px";var F=this.createLayerNameDiv(m,[this.escapeXml(l.name)]);F.className="popup_layer_name";c.appendChild(F);var e=document.createElement("div");e.className="popup_attr";var z=0;for(var G=1;G<h.length;G+=2){var J=(h[G]?this.escapeXml(h[G]):"").replace(/\n+/gm,"<br/>");var f=h[G-1].length+J.length;z=Math.max(z,(f)*8+8);I=document.createElement("div");J=J.replace(/(https?\:\/\/[^\s]+)/ig,'<a href="$1" target="_blank">$1</a>');I.innerHTML='<span class="attrname">'+this.escapeXml(h[G-1])+":</span>"+(f>12?'<br/><div class="attr">'+J+"</div>":'<span class="attr2">'+J+"</span>");e.appendChild(I)}var B=Math.min(200,Math.max(150,z));e.style.width=B+"px";F.style.width=(B+6)+"px";c.appendChild(e);K.appendChild(c);A.appendChild(K);q.appendChild(A);r.appendChild(q);var p=this.getLayerScaleZoom(m);if(s.zoomed&&this.map.getZoom()<p){this.map.zoomTo(p)}var d=document.createElement("div");d.className="popup_control";var x="";var a=document.createElement("span");a.onclick=function(){if(g.map.getZoom()<p){g.map.setCenter(E,p)}else{g.map.panTo(E)}a.className="popup_center";a.innerHTML="中心"};if(this.map.getZoom()<p){a.innerHTML="拡大";a.className="popup_zoom"}else{a.innerHTML="中心";a.className="popup_center"}d.appendChild(a);if(this.editingLayer&&(k[0]||k[1]||k[2])){var b=document.createElement("span");b.className="popup_edit";b.onclick=function(){g.editContents(m,C,E.lon,E.lat)};b.innerHTML="編集";d.appendChild(b)}if(s.fromList&&this.visibleContentsIdArray.length>0){var H=document.createElement("div");H.className="link_div";H.innerHTML='<a href="javascript:void(0);">一覧に戻る</a>';H.onclick=function(){g.clickSearch(L,o)};r.appendChild(H);H=null}else{this.setRefLink(L,o,r)}this.showPopupWindow(E,r,d,{centered:s.centered,pinned:true,maxHeight:250});var t=[];for(var G=j.length/2-2;G>=0;G--){t[G]=new OpenLayers.LonLat(j[G*2+2],j[G*2+3])}this.showPopupMarkers(t);if(n){n.style.height=(v.offsetHeight+2)+"px"}},getReferenceFeatureInfoResponse:function(w,d,o,s,u,t){try{var g=document.createElement("div");g.className="popup_ref";if(o.length==0){o=null;if(t){var u=document.createElement("div");u.innerHTML="参照情報はありません";var b=this.getContentsLinkDiv(w,d);this.showPopupWindow(w,u,b?b:document.createElement("br"),{})}return}var k={};var x;var m="";var E,c,f,r;var F=true;for(var A=0;A<o.length;A++){var l=o[A].fid.replace(/\..+$/,"");var C;if(m!=l){C=[];m=l}var q=0;for(var n in o[A].attributes){q++}if(C.length<q){var v=0;for(var n in o[A].attributes){C[v++]=n}k[l]=C}}m="";for(var A=0;A<o.length;A++){var l=o[A].fid.replace(/\..+$/,"");var B=k[l];if(!B){B=[]}if(m!=l){x=document.createElement("div");x.className="featureTypeName";var G=this.refLayerNameInfo[s+":"+l];x.innerHTML=G?G:l;console.log(s+":"+l);g.appendChild(x);m=l;E=document.createElement("table");E.className="featureInfo";c=document.createElement("tbody");f=document.createElement("tr");F=true;for(var z=0;z<B.length;z++){r=document.createElement("th");r.innerHTML=B[z];var a=document.createElement("div");a.style.width=(B[z].length*6)+"px";r.appendChild(a);f.appendChild(r);F=false}if(!F){c.appendChild(f)}}f=document.createElement("tr");for(var z=0;z<B.length;z++){r=document.createElement("td");var y=o[A].attributes[B[z]];if(y){r.innerHTML=y;var a=document.createElement("div");a.style.width=(Math.min(100,y.length*6))+"px";r.appendChild(a)}f.appendChild(r)}if(F){r=document.createElement("td");r.innerHTML="属性なし";f.appendChild(r)}c.appendChild(f);E.appendChild(c);g.appendChild(E)}var b=null;if(t){b=this.getContentsLinkDiv(w,d)}if(!b){b=document.createElement("br")}var p={panIntoView:true};if(u){u.appendChild(g);this.showPopupWindow(w,u,b,p)}else{this.showPopupWindow(w,g,b,p)}o=null}catch(D){console.log(D)}},getContentsLinkDiv:function(b,d){if(this.getSearchableContentsId([this.visibleContentsIdArray],this.map.getScale(),DeMap.LayerInfo.prototype.SEARCH_ALL).length>0){var a=this;var c=document.createElement("div");c.className="link_div";c.innerHTML='<a href="javascript:void(0);">登録情報を検索</a>';c.onclick=function(){a.clickSearch(b,d)};return c}return null},setRefLink:function(e,g,d){var b=this;for(var c=this.referenceGroupId.length-1;c>=0;c--){var a=this.visibleReferenceLayerId[this.referenceGroupId[c]];if(a&&a.length>0){var f=document.createElement("div");f.className="link_div";f.innerHTML='<a href="javascript:void(0);">参照地図を検索</a>';f.onclick=function(){b.getReferenceFeatureInfo(e,g,null,true)};d.appendChild(f);return}}},initSearchAreaPane:function(b,d,c){var a=this;if(c){this.searchLimit=c}this.searchAreaPane=dijit.byId(b);dojo.connect(this.searchAreaPane,"toggle",function(){a.toggleSearchAreaPane(dijit.byId("searcharea_modesearch").checked)});this.searchResultPane=dijit.byId(d);this.searchRangeInputs={t:dijit.byId("search_t"),l:dijit.byId("search_l"),r:dijit.byId("search_r"),b:dijit.byId("search_b"),x:dijit.byId("search_x"),y:dijit.byId("search_y"),dist:dijit.byId("search_dist")};this.searchWaitDiv=$("search_wait");this.searchViewEnabled=true;this.searchType="DIST";if(this.map){this.searchUpdate()}},searchUpdate:function(){if(!this.searchAreaPane.open){return}if(this.searchViewEnabled){this.searchViewArea(0)}else{this.updateSearchArea()}},searchLayerUpdate:function(){if($("search_layer")&&$("search_layer").value.length==0){this.searchUpdate()}},toggleSearchAreaPane:function(a){if(this.searchAreaPane.open){this.setSearchAreaEnable(dijit.byId("searcharea_enable").checked);if(this.searchViewEnabled){this.setSearchAreaEnable(false)}else{if(a){this.changeMapMode("SEARCH")}else{this.changeMapMode("DRAG")}this.updateSearchArea(false)}}else{this.searchViewEnabled=false;this.setSearchArea();this.changeMapMode("DRAG")}},setSearchAreaEnable:function(b,c){var a=this;this.searchViewEnabled=!b;dijit.byId("searcharea_enable").setChecked(b);if(b){$("searcharea_typespan").style.display="block";dojox.fx.wipeIn({node:"searcharea_wipe"}).play();$("searcharea_frame").style.display="block";if(dijit.byId("searcharea_modesearch").checked){this.changeMapMode("SEARCH")}else{this.changeMapMode("DRAG")}this.setSearchAreaType(this.searchType)}else{$("searcharea_typespan").style.display="none";dojox.fx.wipeOut({node:"searcharea_wipe",onEnd:function(){$("searcharea_frame").style.display="none"}}).play();this.setSearchArea();this.clearSearchResult();this.searchViewLocking=false;this.searchViewWaiting=false;this.searchedBounds=null;this.searchViewArea();this.changeMapMode("DRAG")}if(c){dijit.byId("searcharea_modesearch").setChecked(false);this.changeMapMode("DRAG")}},setSearchFilterEnable:function(b){var a=this;if(b){$("searchfilter_frame").style.display="block";dojox.fx.wipeIn({node:"searchfilter_wipe"}).play()}else{dojox.fx.wipeOut({node:"searchfilter_wipe",onEnd:function(){$("searchfilter_frame").style.display="none"}}).play()}if(dijit.byId("search_filter").attr("value").trim().length!=0){this.searchUpdate()}},setSearchAreaType:function(a){if(a=="BOX"){$("searcharea_box").style.display="block";$("searcharea_dist").style.display="none";dojox.fx.wipeIn({node:"searcharea_wipe"}).play();dijit.byId("searcharea_radio_box").attr("checked",true)}else{if(a=="DIST"){$("searcharea_box").style.display="none";$("searcharea_dist").style.display="block";dojox.fx.wipeIn({node:"searcharea_wipe"}).play();dijit.byId("searcharea_radio_dist").attr("checked",true)}}this.searchType=a;var b=this.updateSearchArea();if(!b){this.clearSearchResult()}},setSearchArea:function(d,b){if(!d&&!b){if(this.rangeFeature!=null){this.rangeLayer.removeFeatures([this.rangeFeature]);this.rangeFeature=null}return}if(this.searchType=="BOX"){this.searchRangeInputs.l.attr("value",this.formatCoord(b.left));this.searchRangeInputs.b.attr("value",this.formatCoord(b.bottom));this.searchRangeInputs.r.attr("value",this.formatCoord(b.right));this.searchRangeInputs.t.attr("value",this.formatCoord(b.top));this.drawSearchAreaBox(b)}else{if(this.searchType=="DIST"){this.searchRangeInputs.x.attr("value",this.formatCoord(d.lon));this.searchRangeInputs.y.attr("value",this.formatCoord(d.lat));var a;if(b){var c=this.lonLatToDistance(d.lon,d.lat,b.right-b.left,b.top-b.bottom);c=Math.floor(c*100)/100;this.searchRangeInputs.dist.attr("value",c);a=Math.sqrt(b.getWidth()*b.getWidth()+b.getHeight()*b.getHeight())}else{var c=parseFloat(this.searchRangeInputs.dist.attr("value"));if(isNaN(c)||c<=0){c=100;this.searchRangeInputs.dist.attr("value",c)}a=this.distanceToDegree(c)}this.drawSearchAreaCircle([d.lon,d.lat,c])}}this.rangeLayer.redraw()},searchAreaSelected:function(){dijit.byId("searcharea_modesearch").attr("checked",false);this.changeMapMode("DRAG");this.searchArea()},updateSearchArea:function(){var c=false;if(this.searchType=="BOX"){try{var g=this.parseCoord(this.searchRangeInputs.l.attr("value"));var j=this.parseCoord(this.searchRangeInputs.b.attr("value"));var a=this.parseCoord(this.searchRangeInputs.r.attr("value"));var k=this.parseCoord(this.searchRangeInputs.t.attr("value"));if(!isNaN(g)&&!isNaN(j)&&!isNaN(a)&&!isNaN(k)){this.drawSearchAreaBox(new OpenLayers.Bounds(g,j,a,k));c=true}}catch(h){}}else{if(this.searchType=="DIST"){try{var d=this.parseCoord(this.searchRangeInputs.x.attr("value"));var i=this.parseCoord(this.searchRangeInputs.y.attr("value"));var f=parseFloat(this.searchRangeInputs.dist.attr("value"));if(!isNaN(d)&&!isNaN(i)&&!isNaN(f)){this.drawSearchAreaCircle([d,i,f]);c=true}}catch(h){}}}this.rangeLayer.redraw();if(c){this.searchArea()}else{this.setSearchArea()}return c},drawSearchAreaBox:function(a){if(this.rangeFeature==null){this.rangeFeature=new OpenLayers.Feature.Vector(a.toGeometry());this.rangeLayer.addFeatures([this.rangeFeature])}else{this.rangeFeature.geometry.removeComponents(this.rangeFeature.geometry.components);this.rangeFeature.geometry.addComponents(a.toGeometry().components)}},drawSearchAreaCircle:function(a){var b=OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(a[0],a[1]).transform(this.dispProj,this.utmProj),a[2],24,0);b=b.transform(this.utmProj,this.dispProj);if(this.rangeFeature==null){this.rangeFeature=new OpenLayers.Feature.Vector(b);this.rangeLayer.addFeatures([this.rangeFeature])}else{this.rangeFeature.geometry.components=b.components}},showSearchResult:function(f,j){var m=this;this.searchWaitDiv.style.display="none";var p=f[0];var h=f[1];var k=document.createElement("div");var g=document.createElement("div");var l=document.createElement("div");if(p[0]>this.searchLimit){var n=document.createElement("span");n.style.paddingRight="4px";if(p[2]>0){var w=document.createElement("a");n.onclick=(j)?function(){m.searchViewArea(p[2]-p[1])}:function(){m.searchArea(p[2]-p[1])};w.innerHTML="≪前へ";w.style.cursor="pointer";n.appendChild(w)}else{n.style.color="#D0D0D0";n.innerHTML="≪前へ"}var o=document.createElement("span");if(p[2]+p[1]<p[0]){var w=document.createElement("a");o.onclick=(j)?function(){m.searchViewArea(p[2]+p[1])}:function(){m.searchArea(p[2]+p[1])};w.innerHTML="次へ≫";w.style.cursor="pointer";o.appendChild(w)}else{o.style.color="#D0D0D0";o.innerHTML="次へ≫"}l.appendChild(n);l.appendChild(o)}var d=document.createElement("span");if(p[0]==0){d.innerHTML="( 0件 )"}else{d.innerHTML=" ( "+(p[2]+1)+"-"+Math.min(p[0],p[1]+p[2])+" / "+p[0]+"件 )"}l.appendChild(d);k.appendChild(l);if(!this.resultMenu){var c=new dijit.Menu({id:"resultMenu",leftClickToOpen:false});var u=new dijit.Menu({parentMenu:c});u.addChild(new dijit.MenuItem({label:" 100m",onClick:function(){m.searchFromResult(100)}}));u.addChild(new dijit.MenuItem({label:" 250m",onClick:function(){m.searchFromResult(250)}}));u.addChild(new dijit.MenuItem({label:" 500m",onClick:function(){m.searchFromResult(500)}}));u.addChild(new dijit.MenuItem({label:" 1km",onClick:function(){m.searchFromResult(1000)}}));u.addChild(new dijit.MenuItem({label:" 2km",onClick:function(){m.searchFromResult(2000)}}));u.addChild(new dijit.MenuItem({label:" 3km",onClick:function(){m.searchFromResult(3000)}}));u.addChild(new dijit.MenuItem({label:" 4km",onClick:function(){m.searchFromResult(4000)}}));u.addChild(new dijit.MenuItem({label:" 5km",onClick:function(){m.searchFromResult(5000)}}));u.addChild(new dijit.MenuItem({label:" 10km",onClick:function(){m.searchFromResult(10000)}}));c.addChild(new dijit.PopupMenuItem({label:"距離検索",popup:u}));c.addChild(new dijit.MenuItem({label:"中心に表示",onClick:function(){m.showResultCenter()}}));c.startup();this.resultMenu=c}for(var t=0;t<h.length;t++){var r=h[t][2];var q=h[t][3];var v=h[t][4];var e=this.createResultDiv(h[t][0],h[t][1],r,q,v);g.appendChild(e);this.resultMenu.bindDomNode(g)}k.appendChild(g);if(p[0]>this.searchLimit){l=document.createElement("div");var b=n.cloneNode(true);b.onclick=n.onclick;l.appendChild(b);var s=o.cloneNode(true);s.onclick=o.onclick;l.appendChild(s);k.appendChild(l)}this.searchResultPane.attr("content",k)},resultMenu:null,resultInfo:null,setResultFeatureInfo:function(c,b,a){if(this.resultMenu&&this.resultMenu.isShowingNow){return}this.resultInfo={layerId:c,gid:b,geom:a}},showResultCenter:function(){this.mapSetCenter(this.resultInfo.geom[0],this.resultInfo.geom[1])},searchFromResult:function(a){this.searchRangeInputs.x.attr("value",this.formatCoord(this.resultInfo.geom[0]));this.searchRangeInputs.y.attr("value",this.formatCoord(this.resultInfo.geom[1]));this.searchRangeInputs.dist.attr("value",a);this.setSearchAreaType("DIST");this.setSearchAreaEnable(true,true)},editFromResult:function(){this.editFeature(this.resultInfo.layerId,this.resultInfo.gid,this.resultInfo.geom[0],this.resultInfo.geom[1])},createResultDiv:function(f,h,l,j,d){var o=this;var k=document.createElement("div");k.className="search_result_div";k.onmouseover=function(){o.listOver(l[0],l[1]);o.setResultFeatureInfo(f,h,l)};k.onmouseout=function(){o.listOut()};k.onclick=function(){o.getContent(f,h,new OpenLayers.LonLat(l[0],l[1]))};var a=this.getLayerInfo(f);var b=this.createLayerNameDiv(f,[this.escapeXml(a.name)+" : "+Math.floor(l[2])+"m"]);k.appendChild(b);if(d.length>1){var e=d[1];var m=this.createFileDiv(d[0],e,90,120,true,60);m.className="search_result_filediv";k.appendChild(m)}for(var g=0;g<j.length;g+=2){attrDiv=document.createElement("div");var c=(j[g+1]?this.escapeXml(j[g+1]):"").replace(/\n+/gm,"<br/>");if(j[g]&&c.length>0){c=c.replace(/(https?\:\/\/[^\s]+)/ig,'<a href="$1" target="_blank">$1</a>');attrDiv.innerHTML='<span class="attrname">'+this.escapeXml(j[g])+':</span><br/><div class="attr">'+c+"</div>"}k.appendChild(attrDiv)}var n=document.createElement("div");n.style.clear="both";attrDiv.appendChild(n);a=null;b=null;return k},clearSearchResult:function(b){var a=document.createElement("div");this.searchResultPane.attr("content",a);this.searchWaitDiv.style.display="none"},getSearchableContentsId:function(f,e,d){var h=[];var c=0;for(var b=0;b<f.length;b++){if(f[b]){for(var a=0;a<f[b].length;a++){var g=this.getLayerInfo(f[b][a]);if(g&&(g.maxScale==0||g.maxScale>=e)&&g.searchType>=d){h[c++]=g.layerId}}}}return h},getSearchParams:function(){var d=$("search_layer").value;if(d.length==0){d=this.getSearchableContentsId([this.visibleContentsIdArray],this.map.getScale(),DeMap.LayerInfo.prototype.SEARCH_ALL);if(d.length==0){this.clearSearchResult();return null}d=d.join(",")}var c="";if(dijit.byId("searchfilter_enable").checked){var a=$("search_filter").value.trim();if(a.length>0){c+="&keyword="+a}}var b=$("search_sort").value;if(b!=""){c+="&sort="+b}return"&layers="+d+c+"&limit="+this.searchLimit+"&"+Math.floor(new Date().getTime()/1000)},searchViewArea:function(offset,force){if(!this.searchAreaPane){return}if(this.searchAreaPane.domNode.offsetWidth<=1){return}var self=this;if(!this.searchViewEnabled){return}var params=this.getSearchParams();if(params==null){return}if(this.searchViewLocking&&!force){this.searchViewWaiting=true;return}this.searchViewWaiting=false;var bounds=this.map.getExtent();if(offset==undefined&&this.searchedBounds&&this.searchedBounds.left==bounds.left&&this.searchedBounds.bottom==bounds.bottom&&this.searchedBounds.right==bounds.right&&this.searchedBounds.top==bounds.top){return}this.searchedBounds=bounds;this.searchViewLocking=true;this.searchWaitDiv.style.display="block";params+="&bbox="+bounds.left+","+bounds.bottom+","+bounds.right+","+bounds.top;var url=this.searchUrl+"mid="+this.mapId+params+(offset?("&offset="+offset):"");params=null;bounds=null;dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){try{if(self.searchViewWaiting){data=null;setTimeout(function(){self.searchViewArea(0,true)},1000)}else{if(typeof data=="error"){console.warn("error!",args)}else{setTimeout(function(){self.searchViewLocking=false},500);if(self.searchViewEnabled){self.showSearchResult(eval(data),true)}}}}catch(e){console.log(e);self.searchViewLocking=false}data=null;args=null}});url=null;params=null;bounds=null},searchArea:function(offset){var params=this.getSearchParams();if(params==null){return}var range;if(this.searchType=="BOX"){range="&bbox="+this.parseCoord(this.searchRangeInputs.l.attr("value"))+","+this.parseCoord(this.searchRangeInputs.b.attr("value"))+","+this.parseCoord(this.searchRangeInputs.r.attr("value"))+","+this.parseCoord(this.searchRangeInputs.t.attr("value"))}else{if(this.searchType=="DIST"){range="&x="+this.parseCoord(this.searchRangeInputs.x.attr("value"))+"&y="+this.parseCoord(this.searchRangeInputs.y.attr("value"))+"&dist="+this.searchRangeInputs.dist.attr("value")}}var offsetParam="";if(offset){offsetParam="&offset="+offset}var url=this.searchUrl+"mid="+this.mapId+params+range+offsetParam;this.searchWaitDiv.style.display="block";var self=this;dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){if(typeof data=="error"){console.warn("error!",args)}else{var result=eval(data);self.showSearchResult(result,false)}}});url=null;range=null;params=null},getContentsWmsUrl:function(){return this.geoServerUrl+"&SLD="+this.localSldUrl+"mid="+this.mapId+"%26layer="+this.visibleContentsId+"&"},getReferenceWmsUrl:function(a){return this.referenceGroupInfo[a].wms+"&SRS=EPSG%3A4326&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS="+this.getVisibleReferenceFeatureId(a)},getWmsGetMapUrl:function(a,b){return a+"&SRS=EPSG%3A4326&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS="+b},getWfsGetFeatureUrl:function(d,c,b,a){return this.wfsProxyUrl+(d?"&url="+escape(d):"")+"&request=GetFeature&version=1.1.0&SRS=EPSG:4326&outputFormat=GML2&typeName="+c+":"+b+"&FEATUREID="+b+"."+a+"&"+Math.floor(new Date().getTime()/1000)},getWfsGetFeatureBbox:function(c,b,a,d){return c+"&request=GetFeature&version=1.0.0&typeName="+b+"&propertyName="+a+"&BBOX="+(d.join(","))},getWmsGetFeatureInfoUrl:function(a,f,e,b,c,d){return this.wfsProxyUrl+(a?"&url="+escape(a):"")+"&HEIGHT="+c+"&WIDTH="+b+"&LAYERS="+f+"&STYLES=&SRS=EPSG%3A4326&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX="+(e.join(","))+"&X="+Math.floor(b/2)+"&Y="+Math.floor(c/2)+"&INFO_FORMAT=application/vnd.ogc.gml&QUERY_LAYERS="+f+"&FEATURE_COUNT="+d},createFileDiv:function(j,f,m,l,c,e){var n=this;if(!f||f.length==0){f=this.getFileName(j)}var k=document.createElement("div");k.className="fl_filediv";var d=this.getFileExt(j);k.style.cursor="pointer";if(d.match(/jpg|gif|png|jpeg|file/i)){var g=document.createElement("img");k.appendChild(g);this.createImage(j,this.thumbUrl+encodeURI(j),f,g,m,l);if(c){k.onclick=function b(o,a){return function(){n.browseImage(o,a)}}(j,f)}g=null}else{if(d==d.match(/html|htm|php|jsp|asp/i)){var h=document.createElement("a");h.className="external_link";h.href="javascript:void(0);";h.title=j;h.innerHTML=f;if(c){k.onclick=function b(a){return function(){n.openWindow(a,"de_map_link");return false}}(j)}if(e){k.style.width=e+"px"}k.appendChild(h);i=null}else{var g=document.createElement("img");k.appendChild(g);var i=document.createElement("span");g.src="fileicons/"+d+".png";i.innerHTML="<br/>"+f;if(c){k.onclick=function b(a){return function(){n.openWindow(a,"de_map_link","location=no");return false}}(j)}if(e){k.style.width=e+"px"}k.appendChild(i);g=null;i=null}}d=null;return k},getFileExt:function(b){var a="";if(b.match(/^https?:\/\/[^\/]+$/)||b.match(/.*\/$/)){return"html"}var c=b.lastIndexOf(".");if(c>b.lastIndexOf("/")&&c!=-1){a=b.substring(c+1)}if(a.length==0||a.length>4){a="file"}return a},getFileName:function(b,c){if(!c){c="/"}var a="";return decodeURI(b.substring(b.lastIndexOf(c)+1))},browseImage:function(c,b){var a=new Image();a.src=c;a.onload=function(){if(!b){b=""}dojo.require("dojox.image.Lightbox");var d=new dojox.image.Lightbox({href:c,title:b});d.startup();d.show();a=null}},openWindow:function(b,a){if(!a){a="_blank"}window.open(b,a,"location=no,personalbar=no,status=yes,resizable=yes,scrollbars=yes")},createImage:function(a,d,e,i,g,f){var h=this;i.src="images/loading.gif";var c=new Image();c.onload=function(){h.createImageLoaded(c,e,i,g,f)};var b=function(){h.openWindow(a)};c.onerror=function(){this.src="fileicons/file.png";i.onclick=b};c.src=d;d=null;return c},createImageLoaded:function(b,e,d,c,a){if(a&&b.width/b.height<c/a){d.height=Math.min(b.height,a)}else{d.width=Math.min(b.width,c)}d.src=b.src;d.title=e},lonLatToDistance:function(a,g,b,d){var e=40000000/360;var f=b*e;var c=d*e;return Math.sqrt(f*f+c*c)},distanceToDegree:function(b){var a=40077000/360;return b/a},parseCoord:function(b){var a=b.split(":");a[0].replace(/^[N|E]/i,"");a[0].replace(/^[S|W]/i,"-");return parseInt(a[0])+parseFloat(a[1])/60+parseFloat(a[2])/3600},formatCoord:function(e){var c=Math.floor(e);var b=Math.floor((e-c)*60);var a=Math.floor((((e-c)*60-b)*60)*1000)/1000;var d=c+":";if(b<1){d+="00"}else{d+=(b<10)?("0"+b):b}d+=":"+((a<10)?("0"+a):a);return d},getText:function(a,b){dojo.xhrGet({url:a,handleAs:"text",handle:function(d,c){if(typeof d=="error"){console.warn("error!",c)}else{b(d)}}})},postForm:function(b,a,c){dojo.xhrPost({url:a,form:b,handleAs:"text",handle:function(e,d){if(typeof e=="error"){console.warn("error!",d)}else{c(e)}}})},escapeXml:function(a){return a.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/"/gm,"&quot;")},debug:null};DeMap.LayerInfo=function(f,b,e,d,g,h,a,c){this.layerId=f;this.name=b;this.status=e;this.opacity=d;this.minScale=g;this.maxScale=h;this.geomType=a;this.searchType=c};DeMap.LayerInfo.prototype={layerId:null,name:null,status:0,opacity:1,minScale:0,maxScale:0,geomType:null,searchType:null,attrInfo:null,isEditable:function(){return this.status<this.STATUS_FIXED},isGeomEditable:function(){return this.status<this.STATUS_FIXGEOM},STATUS_DEFAULT:0,STATUS_FIXGEOM:50,STATUS_FIXED:100,SEARCH_NONE:-1,SEARCH_CLICK:1,SEARCH_ALL:255};DeMap.AttrInfo=function(a){this.attrId=a[0];this.name=a[1];this.status=a[2];this.length=a[3];this.maxLength=a[4];this.sqlType=a[5];this.nullable=a[6]};DeMap.AttrInfo.prototype={attrId:null,name:null,status:null,length:0,maxLength:0,sqlType:0,nullable:true};function DeMapGoogle(){}DeMapGoogle.prototype={map:null,paneLeft:0,mapMoveListener:null,svClient:null,svMarker:null,svOverlay:null,svLastLatLng:null,svLastYaw:0,panorama:null,svLng:null,svDialog:null};DeMapGoogle.prototype.init=function(g,b,c,a){this.map=new GMap2(document.getElementById(g));var d=this.boundsToZoom(c);this.map.setCenter(new GLatLng(b.lat,b.lon),d);this.map.addControl(new GSmallZoomControl());this.map.addControl(new GMapTypeControl(),new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(25,5)));try{this.map.addControl(new PanoMapTypeControl(),new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(115,30)))}catch(f){}this.svDialog=a;this.addStreetViewButton();if(this.svOverlay){this.toggleOverlay()}};DeMapGoogle.prototype.mapMoveZoom=function(a,b){this.map.setCenter(new GLatLng(a.lat,a.lon),b+1)};DeMapGoogle.prototype.mapMove=function(a){this.map.setCenter(new GLatLng(a.lat,a.lon))};DeMapGoogle.prototype.mapZoom=function(a){this.map.setZoom(a+1)};DeMapGoogle.prototype.getLonLat=function(){var a=this.map.getCenter();return new OpenLayers.LonLat(a.lng(),a.lat())};DeMapGoogle.prototype.getZoom=function(){return this.map.getZoom()-1};DeMapGoogle.prototype.addMapMoveListener=function(a,c){var b=this;this.mapMoveListener=GEvent.addListener(this.map,"move",function(){c(b,a)})};DeMapGoogle.prototype.removeMapMoveListener=function(a,c){var b=this;GEvent.removeListener(this.mapMoveListener)};DeMapGoogle.prototype.boundsToZoom=function(a){return this.map.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(a.bottom,a.left),new GLatLng(a.top,a.right)))+1};DeMapGoogle.prototype.checkResize=function(){if(this.map){this.map.checkResize()}if(this.svDialog.open){this.openPanoramaDialog()}};DeMapGoogle.prototype.checkPosition=function(){this.setPanoramaPosition()};DeMapGoogle.prototype.addStreetViewButton=function(){var a=this;var b=document.createElement("div");b.onclick=function(){if(a.svClient==null){a.initStreetView()}a.toggleOverlay();if(a.svOverlay){b.style.fontWeight="bold";b.style.borderColor="white";b.style.borderTop="1px solid #b0b0b0";b.style.borderLeft="1px solid #b0b0b0"}else{b.style.fontWeight="normal";b.style.borderColor="white";b.style.borderRightColor="#CCCCCC";b.style.borderBottomColor="#CCCCCC"}};b.style.backgroundColor="white";b.style.padding="0px 3px 0px 3px";b.style.borderWidth="1px";b.style.borderStyle="solid";b.style.borderColor="white";b.style.borderRightColor="#CCCCCC";b.style.borderBottomColor="#CCCCCC";b.style.fontSize="11px";b.style.textAlign="center";b.style.cursor="pointer";b.style.height="18px";b.innerHTML="ストリートビュー";var c=document.createElement("div");c.style.border="1px solid black";c.style.position="absolute";c.style.right="20px";c.style.top="30px";c.style.width="100px";c.appendChild(b);this.map.getContainer().appendChild(c)};DeMapGoogle.prototype.initStreetView=function(){var a=this;this.svClient=new GStreetviewClient();var b=new GIcon();b.image="http://maps.google.co.jp/intl/ja_jp/mapfiles/cb/man-0.png";b.transparent="http://maps.google.co.jp/intl/ja_jp/mapfiles/cb/man-pick.png";b.imageMap=[26,13,30,14,32,28,27,28,28,36,18,35,18,27,16,26,16,20,16,14,19,13,22,8];b.iconSize=new GSize(49,52);b.iconAnchor=new GPoint(25,35);b.infoWindowAnchor=new GPoint(25,5);b.shadow=null;var c=this.map.getCenter();this.svMarker=new GMarker(c,{icon:b,draggable:true});this.svLastLatLng=c;GEvent.addListener(this.svMarker,"drag",function(){a.onDrag()});GEvent.addListener(this.svMarker,"dragend",function(){a.onDragEnd()});GEvent.addListener(this.svMarker,"click",function(){a.openPanoramaDialog()});GEvent.addListener(this.svMarker,"infowindowclose",function(){a.svMarker.setImage(b.image);if(a.panorama){a.panorama.remove()}});GEvent.addListener(this.map,"click",function(e,d){if(!e){a.svMarker.setLatLng(d);a.onDragEnd()}})};DeMapGoogle.prototype.openPanoramaDialog=function(){if(!this.svOverlay){return}var a=this;this.svClient.getNearestPanoramaLatLng(this.svMarker.getLatLng(),function(b){if(b){a.showPanorama(b);a.svMarker.setLatLng(b);a.svLastLatLng=b;a.map.panTo(b)}else{a.svDialog.hide()}})};DeMapGoogle.prototype.showPanorama=function(e){var b=this;var a=this.map.getSize().width;var c=Math.ceil(this.map.getSize().height*0.4);var d=document.createElement("div");d.style.width=a+"px";d.style.height=c+"px";d.innerHTML="<div id='pano' style='width:"+a+"px;height:"+c+"px;'></div>";this.svDialog.setContent(d);this.svDialog.show();if(!this.svDialog.toggleOpen){this.svDialog.toggle()}this.setPanoramaPosition();b.panorama=new GStreetviewPanorama(document.getElementById("pano"));b.panorama.setLocationAndPOV(e,{yaw:b.svLastYaw});GEvent.addListener(b.panorama,"initialized",function(f){b.onNewLocation(f)});GEvent.addListener(b.panorama,"yawchanged",function(f){b.onYawChange(f)})};DeMapGoogle.prototype.setPanoramaPosition=function(){if(!this.svDialog){return}var b=0;var a=this.map.getContainer().offsetParent;while(a){b+=a.offsetLeft;a=a.offsetParent}this.svDialog.setPosition({top:1,left:b})};DeMapGoogle.prototype.toggleOverlay=function(){if(!this.svOverlay){this.svOverlay=new GStreetviewOverlay();this.map.addOverlay(this.svOverlay);this.map.addOverlay(this.svMarker);this.svMarker.setLatLng(this.map.getCenter());this.openPanoramaDialog()}else{this.map.removeOverlay(this.svOverlay);this.map.removeOverlay(this.svMarker);this.svDialog.hide();this.svOverlay=null}};DeMapGoogle.prototype.onYawChange=function(b){var a=16;var d=360/a;if(b<0){b+=360}var c=Math.round(b/d)%a;this.svMarker.setImage("http://maps.google.co.jp/intl/ja_jp/mapfiles/cb/man_arrow-"+c+".png");this.svLastYaw=b};DeMapGoogle.prototype.onNewLocation=function(a){this.map.panTo(a.latlng);this.svMarker.setLatLng(a.latlng);this.map.getInfoWindow().reset(a.latlng);this.svLastLatLng=a.latlng};DeMapGoogle.prototype.onDrag=function(){if(!this.svLng||this.svLng<this.svMarker.getLatLng().lng()){this.svMarker.setImage("http://www.google.co.jp/intl/ja_jp/mapfiles/cb/man_fly_right.png")}else{if(this.svLng>this.svMarker.getLatLng().lng()){this.svMarker.setImage("http://www.google.co.jp/intl/ja_jp/mapfiles/cb/man_fly_left.png")}}this.svLng=this.svMarker.getLatLng().lng()};DeMapGoogle.prototype.onDragEnd=function(){var a=this;this.svMarker.setImage(this.svMarker.getIcon().image);var b=this.svMarker.getLatLng();this.openPanoramaDialog()};DeMap.prototype.createPointStyle=function(a){var b=this.getIcon(a);return{externalGraphic:b.url,graphicWidth:b.size.w,graphicHeight:b.size.h,graphicXOffset:b.offset.x,graphicYOffset:b.offset.y,iconid:a}};DeMap.prototype.createPolylineStyle=function(c,a,b){return{strokeWidth:c,strokeColor:a,strokeOpacity:b}};DeMap.prototype.clonePolylineStyle=function(a){return this.createPolylineStyle(a.strokeWidth,a.strokeColor,a.strokeOpacity)};DeMap.prototype.createPolylineStyleFromArray=function(a){if(a.length==0){return false}return this.createPolylineStyle(a[0],a[1],a[2])};DeMap.prototype.getPolylineStyleString=function(a){return"["+a.strokeWidth+",'"+a.strokeColor+"',"+a.strokeOpacity+"]"};DeMap.prototype.createPolygonStyle=function(e,b,d,c,a){return{strokeWidth:e,strokeColor:b,strokeOpacity:d,fillColor:c,fillOpacity:a}};DeMap.prototype.clonePolygonStyle=function(a){return this.createPolygonStyle(a.strokeWidth,a.strokeColor,a.strokeOpacity,a.fillColor,a.fillOpacity)};DeMap.prototype.createPolygonStyleFromArray=function(a){if(a.length==0){return false}return this.createPolygonStyle(a[0],a[1],a[2],a[3],a[4])};DeMap.prototype.getPolygonStyleString=function(a){return"["+a.strokeWidth+",'"+a.strokeColor+"',"+a.strokeOpacity+",'"+a.fillColor+"',"+a.fillOpacity+"]"};function DeMapWMS(){console.log("new DeMapWMS")}DeMapWMS.prototype={mapType:"WMS",map:null,mapMoveListener:null};DeMapWMS.prototype.init=function(b,c,a,d){this.map=new OpenLayers.Map(b,{controls:[new OpenLayers.Control.Navigation({zoomWheelEnabled:false,handleRightClicks:true})],maxExtent:new OpenLayers.Bounds(-180,-90,180,90),maxResolution:0.703125,numZoomLevels:20,projection:"EPSG:4326"});this.map.addLayer(new OpenLayers.Layer.WMS("WMS",c,{},{buffer:0}));this.map.setCenter(a,d)};DeMapWMS.prototype.addMapMoveListener=function(a,c){var b=this;this.mapMoveListener=function(){c(b,a)};this.map.events.register("move",this.map,this.mapMoveListener)};DeMapWMS.prototype.removeMapMoveListener=function(a){this.map.events.unregister("move",this.map,this.mapMoveListener)};DeMapWMS.prototype.mapMoveZoom=function(a,b){this.map.setCenter(a,b)};DeMapWMS.prototype.mapMove=function(a){this.map.setCenter(a,this.map.getZoom())};DeMapWMS.prototype.mapZoom=function(a){this.map.zoomTo(a)};DeMapWMS.prototype.updateSize=function(){this.map.updateSize()};DeMapWMS.prototype.getLonLat=function(){return this.map.getCenter()};DeMapWMS.prototype.getZoom=function(){return this.map.getZoom()};DeMap.prototype.attrUpdateUrl="DeMapAttrUpdate.jsp?";DeMap.prototype.uploader=null;DeMap.prototype.fileListUrl="DeMapContentsFile.jsp?";DeMap.prototype.fileUpdateUrl="DeMapContentsFileUpdate.jsp?";DeMap.prototype.fileListDiv=null;DeMap.prototype.editing=false;DeMap.prototype.insertCallback=null;DeMap.prototype.updateCallback=null;DeMap.prototype.deleteCallback=null;DeMap.prototype.editingLayer=null;DeMap.prototype.editControls=null;DeMap.prototype.editButtons=null;DeMap.prototype.editMarkers=null;DeMap.prototype.modifyStyleMap=null;DeMap.prototype.editDialog=null;DeMap.prototype.editingLayerId=null;DeMap.prototype.editingGeometryType=null;DeMap.prototype.editingGID=null;DeMap.prototype.editingAttrInputs=null;DeMap.prototype.editingFiles=null;DeMap.prototype.noGeomFeature=null;DeMap.prototype.featureBackup=null;DeMap.prototype.editMODE=null;DeMap.prototype.selectedFeatures=null;DeMap.prototype.FEATURE_STATE_DEFAULT=0;DeMap.prototype.SQL_TYPE_BOOLEAN=16;DeMap.prototype.SQL_TYPE_DECIMAL=3;DeMap.prototype.SQL_TYPE_INTEGER=4;DeMap.prototype.SQL_TYPE_SMALLINT=5;DeMap.prototype.SQL_TYPE_BIGINT=-5;DeMap.prototype.SQL_TYPE_DOUBLE=8;DeMap.prototype.SQL_TYPE_FLOAT=6;DeMap.prototype.SQL_TYPE_DATE=91;DeMap.prototype.SQL_TYPE_TIME=92;DeMap.prototype.SQL_TYPE_TIMESTAMP=93;DeMap.prototype.initMapEditor=function(b,a,c){this.insertCallback=b;this.updateCallback=a;this.deleteCallback=c;this.editingLayer=new OpenLayers.Layer.Vector("コンテンツ編集レイヤ");this.map.addLayer(this.editingLayer);this.editingLayer.setVisibility(false)};DeMap.prototype.initEditControls=function(){var a=this;var b={onModificationStart:function(c){a.selectedFeatures=[c];if(a.editMode=="REMOVE"){a.removeSelectedFeature()}}};this.editControls={POINT:new OpenLayers.Control.DrawFeature(this.editingLayer,OpenLayers.Handler.Point,{featureAdded:function(c){a.addFeature(c)}}),LINESTRING:new OpenLayers.Control.DrawFeature(this.editingLayer,OpenLayers.Handler.Path,{featureAdded:function(c){a.addFeature(c)}}),POLYGON:new OpenLayers.Control.DrawFeature(this.editingLayer,OpenLayers.Handler.Polygon,{featureAdded:function(c){a.addFeature(c)}}),MODIFY:new OpenLayers.Control.ModifyFeature(this.editingLayer,b,{clickout:false,toggle:false}),DRAG:new OpenLayers.Control.DragFeature(this.editingLayer)};this.editControls.REMOVE=this.editControls.MODIFY;this.editControls.MULTIPOINT=this.editControls.POINT;this.editControls.MULTILINESTRING=this.editControls.LINESTRING;this.editControls.MULTIPOLYGON=this.editControls.POLYGON;for(key in this.editControls){this.map.addControl(this.editControls[key])}this.editControls.MODIFY.virtualStyle.externalGraphic="icons/vertice.png";this.editControls.MODIFY.virtualStyle.graphicWidth=9;this.editControls.MODIFY.virtualStyle.graphicHeight=9;this.editControls.MODIFY.virtualStyle.graphicOpacity=0.5;this.editControls.MODIFY.virtualStyle.graphicXOffset=-5;this.editControls.MODIFY.virtualStyle.graphicYOffset=-5;this.editControls.MODIFY.deleteCodes=[46,100];this.editButtons={ZOOMIN:new dijit.form.Button({label:"表示",onClick:function(){a.zoomEditingFeature()}}),MODIFY:new dijit.form.Button({label:"変形",onClick:function(){a.changeEditControl("MODIFY")}}),REMOVE:new dijit.form.Button({label:"図形削除",onClick:function(){a.removeSelectedFeature()}}),DRAG:new dijit.form.Button({label:"移動",onClick:function(){a.changeEditControl("DRAG")}}),POINT:new dijit.form.Button({label:"点追加",onClick:function(){a.changeEditControl("POINT")}}),POINTCENTER:new dijit.form.Button({label:"中心に点追加",onClick:function(){a.addCenterPoint()}}),LINESTRING:new dijit.form.Button({label:"線追加",onClick:function(){a.changeEditControl("LINESTRING")}}),POLYGON:new dijit.form.Button({label:"面追加",onClick:function(){a.changeEditControl("POLYGON")}}),INSERT:new dijit.form.Button({label:"新規追加",onClick:function(){a.insertEditContents()}}),UPDATE:new dijit.form.Button({label:"更新",onClick:function(){a.updateEditContents()}}),DELETE:new dijit.form.Button({label:"削除",onClick:function(){a.deleteEditContents()}}),CANCEL:new dijit.form.Button({label:"キャンセル",onClick:function(){a.cancelEditContents()}}),LINESTRINGEND:new dijit.form.Button({label:"図形確定",onClick:function(){a.endDrawPath()}}),POLYGONEND:new dijit.form.Button({label:"図形確定",onClick:function(){a.endDrawPolygon()}})};this.editButtons.MULTIPOINT=this.editButtons.POINT;this.editButtons.MULTILINESTRING=this.editButtons.LINESTRING;this.editButtons.MULTIPOLYGON=this.editButtons.POLYGON;this.modifyStyleMap=new OpenLayers.StyleMap();this.modifyStyleMap.styles["default"]=new OpenLayers.Style({fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,externalGraphic:"icons/editing.png",graphicWidth:19,graphicHeight:32,graphicOpacity:1,graphicXOffset:-10,graphicYOffset:-32,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"});this.modifyStyleMap.styles.select=new OpenLayers.Style({fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"red",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,externalGraphic:"icons/editing.png",graphicWidth:19,graphicHeight:32,graphicOpacity:1,graphicXOffset:-10,graphicYOffset:-32,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"})};DeMap.prototype.editNewContents=function(a){this.editContents(a)};DeMap.prototype.editContents=function(c,b,f,e){this.initEditControls();this.editMarkers=this.activeMarkers;this.activeMarkers=null;this.closePopupWindows();this.endEdit();this.setContentsLayer(c,true);var d=this.getLayerScale(c);if(d!=0&&this.map.getScale()>d){this.map.zoomToScale(d)}if(f){this.mapSetCenter(f,e)}this.editing=true;var g=this.getLayerInfo(c);this.editingLayerId=c;this.editingGeometryType=g.geomType;this.editingGID=b;this.editingFiles=null;if(this.editingGID){var a=this.getWfsGetFeatureUrl(null,"map",this.editingLayerId,this.editingGID);this.editingLayer.styleMap=this.modifyStyleMap;OpenLayers.loadURL(a,null,this,this.editFeatureLoaded)}else{this.editingLayer.styleMap=this.modifyStyleMap;this.editingFiles=[];this.changeEditControl(this.editingGeometryType);if(g.isGeomEditable()){switch(this.getGeometryTypeId(this.editingGeometryType)){case this.POINT:case this.MULTIPOINT:this.addCenterPoint();break}}this.editButtons.INSERT.domNode.style.display="inline";this.showEditDialog([this.editButtons.INSERT])}this.editingLayer.setVisibility(true)};DeMap.prototype.editFeatureLoaded=function(d){var g=this.getLayerInfo(this.editingLayerId);var e=d.responseXML;if(!e||!e.documentElement){e=OpenLayers.Format.XML.prototype.read(d.responseText)}var c=this.gmlFormat.read(e);var a=this.devideFeatures(c[0],this.editingGeometryType);if(a){this.editingLayer.addFeatures(a)}else{this.noGeomFeature=c[0]}this.featureBackup=c[0].clone();var f=[this.editButtons.UPDATE,this.editButtons.DELETE];if(!g.isGeomEditable()){f=[this.editButtons.UPDATE];this.changeEditControl(null)}else{if(this.isModifiable(this.editingGeometryType)&&a){this.changeEditControl("MODIFY")}else{this.changeEditControl("DRAG")}}var b=this;this.showEditDialog(f)};DeMap.prototype.showEditDialog=function(buttons){dojo.require("dijit.form.SimpleTextarea");var url=this.attrInfoUrl+"mid="+this.mapId+"&layer="+this.editingLayerId;var self=this;dojo.xhrGet({url:url,handleAs:"text",handle:function(data,args){if(typeof data=="error"){console.warn("error!",args)}else{var dataArray=eval(data);var attrInfo=[];for(var i=0;i<dataArray.length;i++){attrInfo[i]=new DeMap.AttrInfo(dataArray[i])}self.createEditDialog(attrInfo,buttons)}}})};DeMap.prototype.createEditDialog=function(s,D){var r=this;var u=this.getLayerInfo(this.editingLayerId);var q=this.editDialog;var p=document.createElement("div");dojo.require("map.dijit.ModelessDialog");this.editDialog=new map.dijit.ModelessDialog({id:"edit_dialog"+new Date().getTime(),title:"コンテンツ編集",duration:100,left:2,top:2,maxWidth:480,maxHeight:this.map.getSize().h*0.4},p);dojo.connect(this.editDialog,"hide",function(){r.closeEditDialog()});if(q){dojo.connect(this.editDialog,"onLoad",function(){q.destroy()})}var e=document.createElement("div");var B=document.createElement("table");var a=document.createElement("tbody");var b=document.createElement("tr");var k;k=document.createElement("td");k.style.height="100%";k.style.margin="0px";k.style.border="1px solid gray";k.setAttribute("rowSpan","2");this.fileListDiv=document.createElement("div");this.fileListDiv.id="edit_filelist";this.fileListDiv.style.height="100%";k.appendChild(this.fileListDiv);b.appendChild(k);k=document.createElement("td");var y=this.createLayerNameDiv(this.editingLayerId,[this.escapeXml(u.name)]);y.id="edit_layer_name";k.appendChild(y);var h="\\d{4}\\/\\d?\\d\\/\\d?\\d( \\d?\\d:\\d\\d(:\\d\\d)?)?";var A=document.createElement("div");this.editingAttrInputs=[];A.className="edit_attrform";for(var v=0;v<s.length;v++){var d=document.createElement("div");d.style.verticalAlign="middle";d.innerHTML=s[v].name+"：";var g;if(s[v].sqlType==this.SQL_TYPE_INTEGER||s[v].sqlType==this.SQL_TYPE_DECIMAL||s[v].sqlType==this.SQL_TYPE_SMALLINT||s[v].sqlType==this.SQL_TYPE_BIGINT){g="[+|-]?\\d+"}else{if(s[v].sqlType==this.SQL_TYPE_FLOAT||s[v].sqlType==this.SQL_TYPE_DOUBLE){g="[+|-]?\\d+(.\d+)?"}else{g=".+"}}var o;if(s[v].length>0){var j=20;var m=Math.ceil(s[v].length/j);var n=(Math.min(j,s[v].length)*12+24);if(m==1){o=new dijit.form.ValidationTextBox({id:"attr_"+(s[v].attrId),regExp:g,required:!s[v].nullable})}else{o=new dijit.form.SimpleTextarea({id:"attr_"+(s[v].attrId),value:""});o.domNode.setAttribute("rows",m);o.domNode.setAttribute("cols",j)}o.domNode.style.width=n+"px"}else{o=new dijit.form.ValidationTextBox({id:"attr_"+(s[v].attrId),regExp:g,required:!s[v].nullable})}this.editingAttrInputs.push(o);d.appendChild(o.domNode);A.appendChild(d)}var l=document.createElement("a");l.innerHTML="[詳細情報設定]";l.onclick=function(){dojo.byId("edit_meta_div").style.display="";this.style.display="none";return false};A.appendChild(l);var f=document.createElement("div");f.id="edit_meta_div";f.style.display="none";f.style.padding="4px 0px 0px 0px";var t=document.createElement("div");t.style.verticalAlign="middle";t.innerHTML="期間開始：";var o=new dijit.form.ValidationTextBox({id:"attr_time_from",regExp:h});o.domNode.style.width="160px";this.editingAttrInputs.push(o);t.appendChild(o.domNode);f.appendChild(t);t=document.createElement("div");t.style.verticalAlign="middle";t.innerHTML="期間終了：";o=new dijit.form.ValidationTextBox({id:"attr_time_to",regExp:h});o.domNode.style.width="160px";this.editingAttrInputs.push(o);t.appendChild(o.domNode);f.appendChild(t);A.appendChild(f);if(this.editingLayer.features&&this.editingLayer.features[0]||this.noGeomFeature){this.updateEditDialog()}k.appendChild(A);b.appendChild(k);a.appendChild(b);if(this.editingLayer.features.length==1&&!this.editingLayer.features[0].geometry){this.editingLayer.removeFeatures(this.editingLayer.features)}b=document.createElement("tr");k=document.createElement("td");var E=document.createElement("div");E.className="edit_tooldiv";if(u.isGeomEditable()){E.appendChild(this.editButtons.DRAG.domNode);switch(this.getGeometryTypeId(this.editingGeometryType)){case this.POINT:case this.MULTIPOINT:E.appendChild(this.editButtons.POINT.domNode);E.appendChild(this.editButtons.POINTCENTER.domNode);E.appendChild(this.editButtons.REMOVE.domNode);this.editButtons.REMOVE.attr("label","点削除");break;case this.LINESTRING:case this.MULTILINESTRING:E.appendChild(this.editButtons.MODIFY.domNode);E.appendChild(this.editButtons.LINESTRING.domNode);E.appendChild(this.editButtons.LINESTRINGEND.domNode);E.appendChild(this.editButtons.REMOVE.domNode);this.editButtons.REMOVE.attr("label","線削除");break;case this.POLYGON:case this.MULTIPOLYGON:E.appendChild(this.editButtons.MODIFY.domNode);E.appendChild(this.editButtons.POLYGON.domNode);E.appendChild(this.editButtons.POLYGONEND.domNode);E.appendChild(this.editButtons.REMOVE.domNode);this.editButtons.REMOVE.attr("label","面削除");break}}else{E.innerHTML="&nbsp;形状の編集はできません"}k.appendChild(E);b.appendChild(k);a.appendChild(b);b=document.createElement("tr");k=document.createElement("td");k.setAttribute("colSpan","2");var x=document.createElement("table");x.style.width="100%";var z=document.createElement("tbody");var C=document.createElement("tr");var c=document.createElement("td");c.appendChild(this.editButtons.ZOOMIN.domNode);C.appendChild(c);c=document.createElement("td");c.style.textAlign="right";for(var v=0;v<D.length;v++){c.appendChild(D[v].domNode)}c.appendChild(this.editButtons.CANCEL.domNode);C.appendChild(c);z.appendChild(C);x.appendChild(z);k.appendChild(x);b.appendChild(k);a.appendChild(b);B.appendChild(a);e.appendChild(B);this.editDialog.attr("content",e);this.checkEditButtons();this.editDialog.show();this.loadFileList()};DeMap.prototype.checkEditButtons=function(){var b=(this.editingLayer.features.length==0||!this.editingLayer.features[0].geometry);this.editButtons.MODIFY.attr("disabled",b);this.editButtons.REMOVE.attr("disabled",b);this.editButtons.ZOOMIN.attr("disabled",b);console.log(this.editingLayer.features.length);var a=(!b&&!this.isMultiGeometry(this.editingGeometryType));this.editButtons.POINT.attr("disabled",a);this.editButtons.POINTCENTER.attr("disabled",a);this.editButtons.LINESTRING.attr("disabled",a);this.editButtons.POLYGON.attr("disabled",a);this.editButtons.INSERT.attr("disabled",false);this.editButtons.UPDATE.attr("disabled",false);this.editButtons.DELETE.attr("disabled",false)};DeMap.prototype.updateEditDialog=function(){var a=this.editingLayer.features[0];if(!a){a=this.noGeomFeature}for(var b=0;b<this.editingAttrInputs.length;b++){for(var b=0;b<this.editingAttrInputs.length;b++){var d=this.editingAttrInputs[b].id.substr(5);if(a.attributes[d]){var c=a.attributes[d];if(d=="time_from"||d=="time_to"){c=c.replace("T"," ").replace(/-/g,"/")}this.editingAttrInputs[b].attr("value",c)}else{this.editingAttrInputs[b].attr("value","")}}}};DeMap.prototype.changeEditControl=function(a){this.editMode=a;for(key in this.editControls){this.editControls[key].deactivate();if(this.editButtons[key].domNode){this.editButtons[key].domNode.style.borderColor="transparent";this.editButtons[key].domNode.style.borderStyle="solid"}}if(this.editControls[a]){this.editControls[a].activate();if(this.editButtons[a].domNode){this.editButtons[a].domNode.style.borderColor="";this.editButtons[a].domNode.style.borderStyle="inset";this.editButtons[a].domNode.style.borderWidth="2px"}if(a=="MODIFY"){this.editControls.MODIFY.selectControl.select(this.editingLayer.features[0])}}};DeMap.prototype.endDraw=function(b,c){if(!b.drawing){return}var a=b.line.geometry.components.length-c;b.line.geometry.removeComponent(b.line.geometry.components[a]);if(b.persist){b.destroyPoint()}b.finalize()};DeMap.prototype.endDrawPath=function(){this.endDraw(this.editControls.LINESTRING.handler,1)};DeMap.prototype.endDrawPolygon=function(){this.endDraw(this.editControls.POLYGON.handler,2)};DeMap.prototype.zoomEditingFeature=function(){if(this.editingLayer.features.length>0){var a=this.editingLayer.features[0].geometry.getBounds()}this.map.setCenter(a.getCenterLonLat(),this.map.getZoomForExtent(a))};DeMap.prototype.removeSelectedFeature=function(){try{if(this.editingLayer.selectedFeatures&&this.editingLayer.selectedFeatures.length>0){if(!confirm("選択した図形を削除しますか？")){return}}else{if(this.editingLayer.features.length==1){if(!confirm("図形を削除しますか？")){return}this.selectedFeatures=this.editingLayer.features}else{return}}}finally{this.changeEditControl("REMOVE")}this.editingLayer.removeFeatures(this.selectedFeatures);this.selectedFeatures=null;this.checkEditButtons();if(this.editingLayer.features.length==0){this.changeEditControl("DRAG")}else{this.changeEditControl("MODIFY")}};DeMap.prototype.addFeature=function(a){if(!this.isMultiGeometry(this.editingGeometryType)){if(this.isModifiable(this.editingGeometryType)){this.changeEditControl("MODIFY")}else{this.changeEditControl("DRAG")}}this.checkEditButtons()};DeMap.prototype.addCenterPoint=function(){var b=this.map.getCenter();var a=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(b.lon,b.lat));this.editingLayer.addFeatures([a]);this.addFeature(a)};DeMap.prototype.parseInsertTime=function(g){var b=new Date(g.trim());var a=b.getUTCMonth()+1;var i=b.getUTCDate();var f=b.getUTCHours();var c=b.getUTCMinutes();var e=b.getUTCSeconds();return b.getUTCFullYear()+"-"+(a<10?"0"+a:a)+"-"+(i<10?"0"+i:i)+"T"+(f<10?"0"+f:f)+":"+(c<10?"0"+c:c)+":"+(e<10?"0"+e:e)};DeMap.prototype.parseUpdateTime=function(g){var b=new Date(g.trim());var a=b.getMonth()+1;var i=b.getDate();var f=b.getHours();var c=b.getMinutes();var e=b.getSeconds();return b.getFullYear()+"-"+(a<10?"0"+a:a)+"-"+(i<10?"0"+i:i)+" "+(f<10?"0"+f:f)+":"+(c<10?"0"+c:c)+":"+(e<10?"0"+e:e)};DeMap.prototype.mergeFeatures=function(b,a){var c;if(this.isMultiGeometry(a)){switch(this.getGeometryTypeId(a)){case this.MULTIPOINT:c=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint(b[0].geometry));break;case this.MULTILINESTRING:c=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiLineString(b[0].geometry));break;case this.MULTIPOLYGON:c=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPolygon(b[0].geometry));break}for(var d=1;d<b.length;d++){c.geometry.addComponents(b[d].geometry)}c.fid=b[0].fid}else{c=b[0]}return c};DeMap.prototype.devideFeatures=function(d,b){if(!d){return null}if(!d.geometry){return null}var c=[];if(this.isMultiGeometry(b)){var a=d.geometry.components;for(var e=0;e<a.length;e++){var f=new OpenLayers.Feature.Vector(a[e],d.attributes);f.fid=d.fid;c.push(f)}}else{c.push(d)}return c};DeMap.prototype.closeEditDialog=function(){this.endEdit()};DeMap.prototype.insertEditContents=function(){var a=true;for(var f=0;f<this.editingAttrInputs.length;f++){if(this.editingAttrInputs[f].isValid&&!this.editingAttrInputs[f].isValid()){a=false;break}}if(!a){alert("入力値が正しくありません");return}try{var k=this;this.editButtons.INSERT.attr("disabled",true);this.changeEditControl();var j;var g;if(this.editingLayer.features.length==0){j=new OpenLayers.Feature.Vector()}else{j=this.mergeFeatures(this.editingLayer.features,this.editingGeometryType)}g=function(e){k.insertSuccess(e)};for(var f=0;f<this.editingAttrInputs.length;f++){var c=this.editingAttrInputs[f].id.substr(5);var d=this.editingAttrInputs[f].attr("value");if(d.length>0){j.attributes[c]=d}}j.attributes.cid=this.commId;j.attributes.mid=this.mapId;j.attributes.status=this.FEATURE_STATE_DEFAULT;j.attributes.userid="{__uid__}";j.attributes.modified="{__create__}";if(j.attributes.time_from){j.attributes.time_from=this.parseInsertTime(j.attributes.time_from)}if(j.attributes.time_to){j.attributes.time_to=this.parseInsertTime(j.attributes.time_to)}var b=new OpenLayers.Format.WFS({},new OpenLayers.Layer(this.editingLayerId,{}));b.featureNS=this.gmlFormat.featureNS;b.featurePrefix=this.gmlFormat.featurePrefix;b.geometryName=this.gmlFormat.geometryName;b.layerName=b.featurePrefix+":"+this.editingLayerId;b.featureName=this.editingLayerId;j.state=OpenLayers.State.INSERT;console.log(b.featureNS);console.log(b.featurePrefix);console.log(b.featureName);this.commitWFS(b.write([j]),g,function(){k.insertFailure()})}catch(h){this.checkEditButtons()}};DeMap.prototype.insertSuccess=function(b){if(this.insertCallback){this.insertCallback(this.editingLayerId)}this.editDialog.hide();this.contentsLayer.redraw(true);console.log("insertSuccess "+b);if(this.editingFiles.length>0){var c=b.responseText.match(/FeatureId fid="(.*)"/i);if(c){var a=c[1].match(/\.(\d+)$/);if(a){this.updateFeatureFiles(parseInt(a[1]))}}}else{this.searchUpdate()}};DeMap.prototype.insertFailure=function(a){alert("insertFailure");this.checkEditButtons()};DeMap.prototype.updateEditContents=function(){try{var m=this;var a=true;for(var g=0;g<this.editingAttrInputs.length;g++){if(this.editingAttrInputs[g].isValid&&!this.editingAttrInputs[g].isValid()){a=false;break}}if(!a){alert("入力値が正しくありません");return}this.editButtons.UPDATE.attr("disabled",true);this.editButtons.DELETE.attr("disabled",true);this.changeEditControl();var k;var h;if(this.editingLayer.features.length==0){var l={};for(var g=0;g<this.editingAttrInputs.length;g++){var d=this.editingAttrInputs[g].id.substr(5);var f=this.editingAttrInputs[g].attr("value");l[d]=f}l.the_geom="";l.gid=this.editingGID;if(l.time_from){l.time_from=this.parseUpdateTime(l.time_from)}if(l.time_to){l.time_to=this.parseUpdateTime(l.time_to)}console.log(this.jsonFormat.write(l));var b=this.attrUpdateUrl+"mid="+this.mapId+"&layer="+this.editingLayerId;new OpenLayers.Ajax.Request(b,{method:"post",postBody:this.jsonFormat.write([l]),onComplete:function(){m.updateSuccess()},onFailure:function(){m.updateFailure()}})}else{k=this.mergeFeatures(this.editingLayer.features,this.editingGeometryType);h=function(){m.updateSuccess()};k.fid=this.editingLayerId+"."+this.editingGID;for(var g=0;g<this.editingAttrInputs.length;g++){var d=this.editingAttrInputs[g].id.substr(5);var f=this.editingAttrInputs[g].attr("value");k.attributes[d]=f}k.attributes.modified="{__modified__}";if(k.attributes.time_from){k.attributes.time_from=this.parseUpdateTime(k.attributes.time_from)}if(k.attributes.time_to){k.attributes.time_to=this.parseUpdateTime(k.attributes.time_to)}var c=new OpenLayers.Format.WFS({},new OpenLayers.Layer(this.editingLayerId,{}));c.featureNS=this.gmlFormat.featureNS;c.featurePrefix=this.gmlFormat.featurePrefix;c.geometryName=this.gmlFormat.geometryName;c.layerName=c.featurePrefix+":"+this.editingLayerId;k.state=OpenLayers.State.UPDATE;this.commitWFS(c.write([k]),h,function(){m.updateFailure()})}}catch(j){this.checkEditButtons()}};DeMap.prototype.updateSuccess=function(a){this.updateFeatureFiles(this.editingGID);if(this.updateCallback){this.updateCallback(this.editingLayerId,this.editingGID)}this.editDialog.hide();this.contentsLayer.redraw(true)};DeMap.prototype.updateFailure=function(a){alert("updateFailure");this.checkEditButtons()};DeMap.prototype.deleteEditContents=function(){if(!confirm("このコンテンツを削除しますか？")){return}this.editButtons.UPDATE.attr("disabled",true);this.editButtons.DELETE.attr("disabled",true);try{var a=this;this.changeEditControl(null);var b=new OpenLayers.Feature.Vector();b.fid=this.editingLayerId+"."+this.editingGID;var c=new OpenLayers.Format.WFS({},new OpenLayers.Layer(this.editingLayerId,{}));c.featureNS=this.gmlFormat.featureNS;c.featurePrefix=this.gmlFormat.featurePrefix;c.geometryName=this.gmlFormat.geometryName;c.layerName=c.featurePrefix+":"+this.editingLayerId;b.state=OpenLayers.State.DELETE;this.commitWFS(c.write([b]),function(){a.deleteSuccess()},function(){a.deleteFailure()})}catch(d){this.checkEditButtons()}};DeMap.prototype.deleteSuccess=function(a){this.updateFeatureFiles(this.editingGID);if(this.deleteCallback){this.deleteCallback(this.editingLayerId,this.editingGID)}this.editDialog.hide();this.contentsLayer.redraw(true)};DeMap.prototype.deleteFailure=function(a){alert("deleteFailure");this.editDialog.hide();this.checkEditButtons()};DeMap.prototype.commitWFS=function(b,c,a){new OpenLayers.Ajax.Request(this.wfsProxyUrl,{method:"post",postBody:b,onComplete:c,onFailure:a})};DeMap.prototype.cancelEditContents=function(){this.editDialog.hide()};DeMap.prototype.endEdit=function(){this.editing=false;this.changeEditControl(null);this.editingLayer.removeFeatures(this.editingLayer.features);this.editingLayer.setVisibility(false);this.noGeomFeature=null;if(this.editingAttrInputs){for(var c=0;c<this.editingAttrInputs.length;c++){this.editingAttrInputs[c].destroy()}}var a=dijit.byId("updateButton");if(a){a.destroy()}a=dijit.byId("deleteButton");if(a){a.destroy()}if(this.editMarkers!=null){var d=this.activeMarkers;this.activeMarkers=this.editMarkers;this.clearActiveMarker();this.editMarkers=null;this.activeMarkers=d}};DeMap.prototype.showUploadDialog=function(){if(this.uploader){var a=this;this.uploader.showUploadDialog(function(b){a.fileUploaded(b)},"コンテンツファイル追加")}};DeMap.prototype.fileUploaded=function(c){console.log("result: "+c);if(this.uploader){if(c[0]){var b=c[0];console.log("fileUrl: "+b);var a=dijit.byId("upload_title1").attr("value").trim();if(a.length==0){a=this.getFileName(b)}console.log(this.getFileName(b));dijit.byId("upload_title1").attr("value","");this.uploader.closeUploadDialog();this.editingFiles[this.editingFiles.length]=[b,a];this.redrawFileList()}else{alert("アップロードできませんでした。")}}};DeMap.prototype.showFileEditDialog=function(a,e,d){var b=this;if(!dijit.byId("file_edit_dialog")){var c=new dijit.Dialog({id:"file_edit_dialog",title:"コンテンツファイル編集",duration:100,onLoad:function(){b.showFileEditDialog(a,e,d)}});c.setHref("contentsFileEdit.html")}else{dijit.byId("file_edit_url").attr("value",e);dijit.byId("file_edit_title").attr("value",d);$("file_edit_button").onclick=function(){b.fileListEdit(a,dijit.byId("file_edit_url").attr("value"),dijit.byId("file_edit_title").attr("value"));dijit.byId("file_edit_dialog").hide()}}dijit.byId("file_edit_dialog").show()};DeMap.prototype.fileListEdit=function(a,c,b){if(!b||b.length==0){fielTitle=this.getFileName(c)}this.editingFiles[a]=[c,b];this.redrawFileList()};DeMap.prototype.loadFileList=function(){if(this.editingGID){var a=this.fileListUrl+"layer="+this.editingLayerId+"&gid="+this.editingGID+"&"+Math.floor(new Date().getTime()/1000);OpenLayers.loadURL(a,null,this,this.fileListLoaded)}else{this.redrawFileList()}};DeMap.prototype.fileListLoaded=function(a){this.editingFiles=dojo.fromJson(a.responseText);this.redrawFileList()};DeMap.prototype.redrawFileList=function(){var b=this;if(this.fileListDiv.style.height=="100%"){this.fileListDiv.style.height=(this.fileListDiv.offsetHeight)+"px";console.log(this.fileListDiv.style.height)}var c=0;while(dijit.byId("flmenu"+c)){dijit.byId("flmenu"+c).destroy();c++}this.fileListDiv.innerHTML="";if(this.editingFiles!=null){for(var c=0;c<this.editingFiles.length;c++){this.redrawFileListScope(c)}}if(dijit.byId("edit_upload_button")){dijit.byId("edit_upload_button").destroy()}var a=new dijit.form.Button({id:"edit_upload_button",label:"ファイル追加",onClick:function(){b.showUploadDialog()}});this.fileListDiv.appendChild(a.domNode)};DeMap.prototype.redrawFileListScope=function(b){var a=this;var e=this.editingFiles[b][0];var d=(this.editingFiles[b].length>1)?this.editingFiles[b][1]:this.getFileName(e);var g=this.createFileDiv(e,d,120);this.fileListDiv.appendChild(g);var f=new dijit.Menu({id:"flmenu"+b,leftClickToOpen:false});var c=this.getFileExt(e);if(c.match(/jpg|gif|png/i)){f.addChild(new dijit.MenuItem({label:"画像を表示",onClick:function(){a.browseFileList(b)}}))}else{f.addChild(new dijit.MenuItem({label:"ブラウザで表示",onClick:function(){a.openFileList(b)}}))}if(b>0){f.addChild(new dijit.MenuItem({label:"↑ 上へ",onClick:function(){a.moveFileList(b,true)}}))}if(b<this.editingFiles.length-1){f.addChild(new dijit.MenuItem({label:"↓ 下へ",onClick:function(){a.moveFileList(b,false)}}))}f.addChild(new dijit.MenuSeparator());f.addChild(new dijit.MenuItem({label:"ファイル情報編集",onClick:function(){a.showFileEditDialog(b,e,d)}}));f.addChild(new dijit.MenuSeparator());f.addChild(new dijit.MenuItem({label:"一覧から削除",onClick:function(){a.removeFileList(b)}}));f.bindDomNode(g);dojo.connect(g,"onclick",f,"_openMyself")};DeMap.prototype.browseFileList=function(a){this.browseImage(this.editingFiles[a][0],this.editingFiles[a][1])};DeMap.prototype.openFileList=function(a){this.openWindow(this.editingFiles[a][0])};DeMap.prototype.removeFileList=function(a){for(var b=a+1;b<this.editingFiles.length;b++){this.editingFiles[b-1]=this.editingFiles[b]}this.editingFiles.pop();this.redrawFileList()};DeMap.prototype.moveFileList=function(b,a){var d=a?-1:1;var c=this.editingFiles[b+d];this.editingFiles[b+d]=this.editingFiles[b];this.editingFiles[b]=c;this.redrawFileList()};DeMap.prototype.updateFeatureFiles=function(c){var a=this;var b=this.fileUpdateUrl+"mid="+this.mapId+"&layer="+this.editingLayerId+"&gid="+c;new OpenLayers.Ajax.Request(b,{method:"post",postBody:this.jsonFormat.write(this.editingFiles),onComplete:function(){a.searchUpdate()},onFailure:function(){console.log("onFailure")}})};OpenLayers.Format.WFS.prototype.createFeatureXML=function(d){var g=this.createElementNS(this.featureNS,"feature:"+this.featureName);if(d.geometry){var f=this.buildGeometryNode(d.geometry);var b=this.createElementNS(this.featureNS,"feature:"+this.geometryName);b.appendChild(f);g.appendChild(b)}for(var a in d.attributes){var h=this.createTextNode(d.attributes[a]);var c=a;if(a.search(":")!=-1){c=a.split(":")[1]}var e=this.createElementNS(this.featureNS,"feature:"+c);e.appendChild(h);g.appendChild(e)}return g};function PdfWriter(a){this.deMap=a;dojo.require("dijit.layout.TabContainer")}PdfWriter.prototype={pdfDialog:null,pdfProgressBar:null,pdfForm:null,deMap:null,checking:false};PdfWriter.prototype.initPdfDialog=function(){this.pdfForm=$("pdfForm");this.pdfProgressBar=dijit.byId("pdfProgressBar");this.setTabDisable()};PdfWriter.prototype.setTabDisable=function(){dijit.byId("pdfTabContainer").tablist.getChildren()[1].domNode.style.display=this.pdfForm.printmap.checked?"":"none";dijit.byId("pdfTabContainer").tablist.getChildren()[2].domNode.style.display=this.pdfForm.printlegend.checked?"":"none";dijit.byId("pdfTabContainer").tablist.getChildren()[3].domNode.style.display=this.pdfForm.printlist.checked?"":"none";dojo.byId("mapsize_div").style.display=this.pdfForm.printmap.checked?"":"none";dijit.byId("pdfPrint").attr("disabled",(!this.pdfForm.printmap.checked&&!this.pdfForm.printlegend.checked&&!this.pdfForm.printlist.checked))};PdfWriter.prototype.showPdfDialog=function(b){var a=this;if(!this.pdfDialog){dojo.require("dijit.Dialog");dojo.require("dijit.ProgressBar");this.pdfDialog=new dijit.Dialog({id:"pdfDialog",title:"印刷ダイアログ"});this.pdfDialog.setHref("pdf.jsp?mid="+b+"&"+(Math.floor(new Date().getTime()/1000)));dojo.connect(this.pdfDialog,"onLoad",function(){a.initPdfDialog()});dojo.connect(this.pdfDialog,"hide",function(){a.cancelPdfDownload()})}this.pdfDialog.show();if(this.pdfProgressBar){this.setPdfCreatable(true);$("pdfError").style.display="none"}};PdfWriter.prototype.closePdfDialog=function(){this.pdfDialog.hide()};PdfWriter.prototype.printMapPdf=function(){this.createPdf(this.pdfForm.printmap.checked)};PdfWriter.prototype.createPdf=function(e){var b=this.deMap.getSessionLayerInfoArray();for(var d=0;d<b.length;d++){dojo.xhrGet({url:this.deMap.getSessionLayerInfoURL(b[d]),handleAs:"text"})}var c=this;$("pdfError").style.display="none";$("pdfProgress").style.display="none";dojo.byId("pdfDownloadLink").innerHTML="";if(this.pdfForm.bboxtype[0].checked){var a=this.deMap.map.getExtent();this.pdfForm.bbox.value=a.left+","+a.bottom+","+a.right+","+a.top}else{this.pdfForm.bbox.value=""}this.pdfForm.contentslayers.value=this.deMap.getVisibleContentsLayersWithOption();this.pdfForm.reflayers.value="["+this.deMap.getVisibleRefLayersWithOption().join()+"]";this.pdfForm.overlaylayers.value=this.deMap.getVisibleOverlayLayersWithOption().join();this.pdfForm.baselayer.value=this.deMap.getVisibleBaseLayersWithOption();this.pdfForm.submit();dojo.xhrPost({url:"pdfload?check=1&"+(Math.floor(new Date().getTime()/1000)),form:this.pdfForm,handleAs:"text",handle:function(h,f){if(h.name=="Error"){var g=$("pdfError");g.style.display="";c.cancelPdfDownload(true);if(h.status==0){g.innerHTML="サーバの応答がありません"}else{if(h.status==500){g.innerHTML=h.responseText}}}else{c.pdfProgressBar.update({progress:0});$("pdfError").style.display="none";$("pdfProgress").style.display="";c.setPdfCreatable(false);c.checking=true;setTimeout(function(){c.checkPdfDownload()},1000)}}})};PdfWriter.prototype.checkPdfDownload=function(){if(!this.pdfDialog.open||!this.checking){return}var a=this;dojo.xhrGet({url:"pdfload?sid="+this.pdfForm.sid.value+"&"+(Math.floor(new Date().getTime()/1000)),handleAs:"json",handle:function(b){if(b.name=="Error"){$("pdfError").innerHTML="エラーが発生しました";$("pdfError").style.display="";a.setPdfCreatable(true)}else{try{if(b[0]==0&&b[1]==0){setTimeout(function(){a.checkPdfDownload()},1000)}else{if(a.pdfProgressBar){a.pdfProgressBar.update({progress:b[0]/b[1]*100})}if(b[0]<b[1]){setTimeout(function(){a.checkPdfDownload()},1000)}else{setTimeout(function(){a.setPdfCreatable(true)},2000);dojo.byId("pdfDownloadLink").innerHTML='<a target="_blank" href="pdfload?download=1&sid='+a.pdfForm.sid.value+'" style="text-decoration: underline;color:AA0000;">手動ダウンロードはこちら</a>'}}}catch(c){console.warn(c)}}}})};PdfWriter.prototype.cancelPdfDownload=function(b){if(dijit.byId("pdfPrint").domNode.style.display==""){return}var a=this;dojo.xhrGet({url:"pdfload?sid="+this.pdfForm.sid.value+"&cancel=1&"+(Math.floor(new Date().getTime()/1000)),handleAs:"json",handle:function(c){if(c.name=="Error"){$("pdfError").innerHTML="エラーが発生しました";$("pdfError").style.display=""}else{if(c.error){if(!b){$("pdfError").innerHTML=c.error;$("pdfError").style.display=""}}}a.checking=false;a.setPdfCreatable(true)}})};PdfWriter.prototype.setPdfCreatable=function(a){dijit.byId("pdfPrint").domNode.style.display=(a)?"":"none";dijit.byId("pdfCancel").domNode.style.display=(a)?"none":"";$("pdfProgress").style.display=(a)?"none":""};PdfWriter.prototype.setPdfMapMarginDisabled=function(a){this.pdfForm.mapmt.disabled=a;this.pdfForm.mapmb.disabled=a;this.pdfForm.mapml.disabled=a;this.pdfForm.mapmr.disabled=a};PdfWriter.prototype.setPdfLegendMarginDisabled=function(a){this.pdfForm.legendmt.disabled=a;this.pdfForm.legendmb.disabled=a;this.pdfForm.legendml.disabled=a;this.pdfForm.legendmr.disabled=a};PdfWriter.prototype.setPdfListMarginDisabled=function(a){this.pdfForm.listmt.disabled=a;this.pdfForm.listmb.disabled=a;this.pdfForm.listml.disabled=a;this.pdfForm.listmr.disabled=a};PdfWriter.prototype.changePaperSize=function(h){var e=this.pdfForm.pagesize.value;var f=e.substr(0,1);var i=e.substr(1,1);var b=dojo.byId("mapsize_a");var a=dojo.byId("mapsize_b");b.style.display=(f=="a"?"":"none");a.style.display=(f=="b"?"":"none");if(f=="a"){a.value=b.value}else{b.value=a.value}if(b.value==-1){if(h){this.checkMapDivSize()}return}var g=1;var j=1;var d=i-b.value;if(d<0){if(h){b.value=i;a.value=i;alert("地図出力サイズを用紙サイズに合わせました")}else{this.pdfForm.pagesize[b.value].selected=true;alert("用紙サイズを地図出力サイズに合わせました")}}else{if(d>0){var c=this.pdfForm.rotate[0].checked;switch(d){case 1:case 2:g=2;j=2;break;case 3:case 4:g=4;j=4;break;case 5:case 6:g=8;j=8;break}if(d%2==1){if(c){g/=2}else{j/=2}}}}dojo.byId("cols").value=g;dojo.byId("rows").value=j};PdfWriter.prototype.setMapSize=function(a){dojo.byId("mapsize_a").value=a;dojo.byId("mapsize_b").value=a};PdfWriter.prototype.checkMapDivSize=function(){var a=this.pdfForm.pagesize.value.substr(1,1);var c=dojo.byId("cols").value;var b=dojo.byId("rows").value;var e=this.pdfForm.rotate[0].checked;var d=Math.pow(2,Math.floor(a/2));c=Math.min(d*(a%2==1?(e?1:2):1),c);b=Math.min(d*(a%2==1?(e?2:1):1),b);dojo.byId("cols").value=c;dojo.byId("rows").value=b};function Importer(a){this.callback=a}Importer.prototype={deletedHeader:null,layerId:null,dialog:null,form:null,callback:null,mouseAnchor:null,menuAnchor:null};Importer.prototype.showDialog=function(b){if(!this.dialog){dojo.require("dojo.dnd.Source");dojo.require("map.dijit.ModelessDialog");this.dialog=new map.dijit.ModelessDialog({id:"importDialog",title:"データ一括登録",duration:100});var a=this;dojo.connect(this.dialog,"onLoad",this,function(){if(a.onLoadDialog){a.onLoadDialog()}})}this.dialog.setHref("importForm.jsp?mid="+b+"&"+(Math.floor(new Date().getTime()/1000)));this.dialog.show()};Importer.prototype.closeDialog=function(){this.dialog.hide()};Importer.prototype.onLoadDialog=function(){if($("list_header_tr")){var d=$("importForm");if(d&&d.numheader){var b=this;var e=$("list_header_tr").getElementsByTagName("th");var a=e.length;var g=d.numheader.value;for(var c=0;c<e.length;c++){e[c].onmouseover=function(){b.mouseAnchor=this}}var f=dijit.byId("headerMenu");dojo.connect(f,"onOpen",function(){b.menuAnchor=b.mouseAnchor});for(var c=a-1;c>=g;c--){if(e[c]){this.deleteHeader(e[c],true)}}this.adjustTail()}}};Importer.prototype.setLayerId=function(a){$("importForm").layer.value=a};Importer.prototype.importPreview=function(){var a=this;dojo.xhrPost({url:"importPreview.jsp?"+(Math.floor(new Date().getTime()/1000)),form:$("importForm"),handleAs:"text",handle:function(c,b){console.log(c);if(c.status==500){alert(c.responseText)}else{a.showPreview(c)}}})};Importer.prototype.showPreview=function(a){this.dialog.setContent(a);this.th=null;if(document.forms.importForm.has_title.value=="1"){$("startrow").checked=true;$("firstRow").className="titleRow"}};Importer.prototype.importData=function(b,c){this.layerId=c;var a=this;dojo.xhrPost({url:"importData.jsp?"+(Math.floor(new Date().getTime()/1000)),form:$("importForm"),handleAs:"text",handle:function(e,d){if(typeof e=="error"){console.warn("error!",d)}else{a.showImportResult(e)}}})};Importer.prototype.showImportResult=function(a){this.dialog.setContent(a);this.th=null;this.callback(this.layerId,true)};Importer.prototype.addHeader=function(c){var b=$(c);if(b){var a=b.nextSibling;if(a==this.menuAnchor){headerTr.parent.insertBefore(this.menuAnchor,b)}else{headerTr.parent.insertBefore(b,this.menuAnchor);if(a){headerTr.parent.insertBefore(this.menuAnchor,a)}else{headerTr.parent.appendChild(this.menuAnchor)}}}else{b=this.deletedHeader[c];if(!b){return}headerTr.parent.insertBefore(b,this.menuAnchor);this.adjustTail()}};Importer.prototype.addMultiHeader=function(d,b){var c=document.createElement("th");c.className="dojoDndItem";c.innerHTML="<div>"+b+'<input type="hidden" name="h[]" value="'+d+'"></div>';var a=this;c.onmouseover=function(){a.mouseAnchor=this};headerTr.insertNodes(false,[c],true,this.menuAnchor);this.adjustTail()};Importer.prototype.setEmptyHeader=function(){if(this.menuAnchor&&this.isEmptyTh(this.menuAnchor)){return}headerTr.insertNodes(false,[this.getEmptyTh()],true,this.menuAnchor);this.deleteHeader(this.menuAnchor)};Importer.prototype.addEmptyHeader=function(){headerTr.insertNodes(false,[this.getEmptyTh()],true,this.menuAnchor);this.adjustTail()};Importer.prototype.getEmptyTh=function(){var b=document.createElement("th");b.className="dojoDndItem";b.innerHTML='<div style="color:gray">未登録<input type="hidden" name="h[]" value=""/></div>';b.style.color="gray";var a=this;b.onmouseover=function(){a.mouseAnchor=this};return b};Importer.prototype.isEmptyTh=function(a){return(a&&a.style.color=="gray")};Importer.prototype.deleteHeader=function(b,a){if(!b){b=this.menuAnchor}if(this.isEmptyTh(this.menuAnchor)){headerTr.parent.removeChild(this.menuAnchor)}else{if(!this.deletedHeader){this.deletedHeader={}}this.deletedHeader[b.id]=b;console.log("delete:"+b.id);headerTr.parent.removeChild(b);if(!a){this.setTailEmptyHeader()}}};Importer.prototype.adjustTail=function(){var c=$("importForm");if(c&&c.numcol){var d=$("list_header_tr").getElementsByTagName("th");var e=d.length;var b=c.numcol.value;for(var a=b;a<e;a++){this.deleteHeader(d[a],true)}for(var a=e;a<b;a++){headerTr.insertNodes(false,[this.getEmptyTh()],false)}}};Importer.prototype.setTailEmptyHeader=function(){var c=$("importForm");if(c&&c.numcol){var d=$("list_header_tr").getElementsByTagName("th");var e=d.length;var b=c.numcol.value;for(var a=0;a<b-e;a++){headerTr.insertNodes(false,[this.getEmptyTh()],false)}for(var a=b;a<e;a++){if(this.isEmptyTh(d[a])){headerTr.parent.removeChild(d[a])}}}};function ListEditor(){}ListEditor.prototype={mapId:null,layerId:null,limit:100,attrId:null,desc:null,offset:0,editingGid:null,contentPane:null,editingRow:null};ListEditor.prototype.initList=function(d,b,c){var a=this;this.contentPane=d;this.mapId=b;this.layerId=c;this.attrId=null;this.desc=null;this.loadOffset(0);this.loadList()};ListEditor.prototype.checkEditable=function(){console.log(dojo.byId("addressUpdatable"));if(dojo.byId("addressUpdatable").innerHTML=="0"){dojo.byId("addressUpdateDiv").style.display="none"}};ListEditor.prototype.editRow=function(e,c){var d=$("r_"+e);d.style.backgroundColor="#DDDDFF";var b=d.getElementsByTagName("td");for(var a=2;a<b.length;a++){b[a].innerHTML='<input type="text" style="width:'+(b[a].offsetWidth)+'px;" value="'+(b[a].innerHTML)+'"/>'}};ListEditor.prototype.setLayerId=function(a){this.layerId=a;this.attrId=null;this.desc=null;this.loadOffset(0)};ListEditor.prototype.setSort=function(a,b){this.attrId=a;this.desc=b;this.loadOffset(0)};ListEditor.prototype.setLimit=function(a){this.limit=a;this.loadOffset(0)};ListEditor.prototype.loadOffset=function(a){this.offset=a;this.loadList()};ListEditor.prototype.loadList=function(){var a=this;dojo.xhrGet({url:"ListEditor.jsp?mid="+this.mapId+(this.layerId?"&layer="+this.layerId:"")+"&limit="+this.limit+(this.offset?"&offset="+this.offset:"")+(this.attrId?"&order="+this.attrId:"")+(this.desc?"&desc=1":"")+"&"+(Math.floor(new Date().getTime()/1000)),handleAs:"text",handle:function(c,b){if(typeof c=="error"){console.warn("error!",b)}else{a.showList(c)}}})};ListEditor.prototype.showList=function(a){this.contentPane.attr("content",a);this.checkEditable()};ListEditor.prototype.updateGeometry=function(b,e,d,c){var a=this;dojo.xhrGet({url:"ListEditorUpdate.jsp?action=lonlat&mid="+this.mapId+"&layer="+this.layerId+"&gid="+b+"&lon="+e+"&lat="+d+"&"+(Math.floor(new Date().getTime()/1000)),handleAs:"text",handle:function(g,f){if(typeof g=="error"){console.warn("error!",f)}else{a.updateGeometryCallback(g,b,c)}}})};ListEditor.prototype.updateGeometryCallback=function(b,a,c){this.updateListRow(this.layerId,a);c(a)};ListEditor.prototype.deleteList=function(c,b){if(!confirm("選択データを削除しますか？")){return}var a=this;dojo.xhrPost({url:"ListEditorUpdate.jsp?action=delete",form:$(c),handleAs:"text",handle:function(e,d){if(typeof e=="error"){console.warn("error!",d)}else{a.deleteListCallback(e,b)}}})};ListEditor.prototype.deleteListCallback=function(data,callback){try{var values=eval(data);if(!values.length){alert("削除できませんでした");return}if(values.length>0){var listTbody=$("list_tbody");for(var i=0;i<values.length;i++){var tr=$("le"+values[i]);if(tr){listTbody.removeChild(tr);tr=null}}callback();this.loadList()}alert(values.length+"件 削除しました")}catch(e){console.log(e);alert("削除できませんでした")}};ListEditor.prototype.deleteListRow=function(b,a){if(this.layerId!=b){return}var d=$("list_tbody");var c=$("le"+a);if(c){d.removeChild(c)}};ListEditor.prototype.updateListRow=function(c,b){if(this.layerId!=c){return}var a=this;dojo.xhrGet({url:"ListEditor.jsp?action=value&mid="+this.mapId+"&layer="+c+"&gid="+b+"&"+(Math.floor(new Date().getTime()/1000)),handleAs:"json",handle:function(e,d){if(typeof e=="error"){console.warn("error!",d)}else{a.updateListRowCallback(c,b,e)}}})};ListEditor.prototype.updateListRowCallback=function(c,b,e){var d=$("le"+b);if(d){var f=d.getElementsByTagName("td");for(var a=0;a<e.length;a++){if(f[a]){f[a].innerHTML=(e[a]&&e[a].length)>0?e[a]:"<br/>"}}}};function CswDialog(a,b){this.deMap=a;this.legendURL=b}CswDialog.prototype={GROUPTYPE_REFERENCE:50,GROUPTYPE_BASE:1000,deMap:null,mapId:null,cswDialog:null,legendURL:null,showDialog:function(b){dojo.require("dojo.dnd.Source");this.mapId=b;if(!this.cswDialog){dojo.require("dijit.Dialog");this.cswDialog=new dijit.Dialog({id:"csw_dialog",title:"地図を検索して追加します",duration:100});var a=this;dojo.connect(this.cswDialog,"onLoad",function(){a.searchCsw(document.forms.cswForm)});this.cswDialog.setHref("cswDialog.jsp?form=1&mid="+this.mapId+"&"+(Math.floor(new Date().getTime()/1000)));this.cswDialog.show()}else{this.cswDialog.show();document.forms.cswForm.keyword.value="";this.searchCsw(document.forms.cswForm)}},checkAll:function(a,d){if(!a){return}var c=a.length;for(var b=0;b<c;b++){a[b].checked=d}},showCswList:function(a){var b=dojo.byId("cswList");if(b){b.style.display=a?"":"none"}var b=dojo.byId("cswInfo");if(b){b.style.display=a?"none":""}},searchCsw:function(c,e){var d=c.keyword.value;var f=c.range.value;var b=c.orderby.value;if(d.match(/^http.?:/)){if(d.match(/\.kml(\?.*)?$/)){dijit.byId("cswList").setHref("cswKML.jsp?page=true&mid="+this.mapId+"&kml="+escape(d)+"&"+(Math.floor(new Date().getTime()/1000)))}else{if(d.match(/\/feed\//)){dijit.byId("cswList").setHref("cswGeoRSS.jsp?mid="+this.mapId+"&georss="+escape(d)+"&"+(Math.floor(new Date().getTime()/1000)))}else{this.setWmsCapabilities(d)}}return}var h="";if(c.range[1].checked){h="&range=1"}else{if(c.range[2].checked){var g=this.deMap.map.getExtent();h="&bbox="+g.left+","+g.bottom+","+g.right+","+g.top}}var i="";if(e){i="&offset="+e}var a="../csw/cswSearch.jsp?mid="+this.mapId+"&keyword="+encodeURI(d)+h+i+"&orderby="+b+"&"+(Math.floor(new Date().getTime()/1000));dijit.byId("cswList").setHref(a);this.showCswList(true)},showWmsCapabilitiesForm:function(){this.cswDialog.setHref("cswDialog.jsp?mid="+this.mapId+"&capsform=1&"+(Math.floor(new Date().getTime()/1000)))},addRecord:function(a){this.showCswList(false);dijit.byId("cswInfo").setHref("../csw/wmsCapabilities.jsp?dijit=1&mid="+this.mapId+"&cswid="+a+"&"+(Math.floor(new Date().getTime()/1000)))},showMetadata:function(a){this.showCswList(false);dijit.byId("cswInfo").setHref("../csw/cswMetadata.jsp?mid="+this.mapId+"&cswid="+a+"&"+(Math.floor(new Date().getTime()/1000)))},setWmsCapabilities:function(b){var a="";if(b){a="../csw/wmsCapabilities.jsp?dijit=1&mid="+this.mapId+"&wmscaps="+escape(b)+"&"+(Math.floor(new Date().getTime()/1000))}else{a="../csw/wmsCapabilities.jsp?dijit=1&mid="+this.mapId+"&wmscaps=0&"+(Math.floor(new Date().getTime()/1000))}this.showCswList(false);dijit.byId("cswInfo").setHref(a)},addLayer:function(l,e,a){var o=a.title.value;var f=a.getmap.value;var u=a.format.value;var v=a.attr.value;var j=a.opacity.checked?0.5:1;var g=dojo.byId("cwsLayers").getElementsByTagName("input");var k=a.ltype.value;var w=a.gltype.value;if(!g[0]){g=[g]}this.cswDialog.hide();if(!g){return}var n=[];var q=[];var r={};for(var t=0;t<g.length;t++){if(g[t].name.match(/^layername_/)){r[g[t].name.substr(10)]=g[t].value}else{if(g[t].checked){var m=g[t].value.split(",");if(m.length>1){q.push(m[0].trim());if(m.length>2&&m[2]=="1"){n.push(groupLayerType)}else{n.push(k)}}}}}if(e==this.GROUPTYPE_REFERENCE){var d=[];var b=new Date().getTime();d.push(this.deMap.setSessionLayerInfo(k,this.mapId,b,o,"",f,u,j,v));for(var t=0;t<q.length;t++){d.push(this.deMap.setSessionLayerInfo(n[t],this.mapId,b+"_"+t,r[q[t]],q[t],f,u,j,null,b))}addReferenceLayers(this.deMap,d,0)}else{var c=new Date().getTime();var h=q.join(",");var s=this.deMap.setSessionLayerInfo(e,this.mapId,c,o,h,f,u,j,v);var p=this;dojo.xhrGet({url:this.deMap.getSessionLayerInfoURL(s),handleAs:"text",handle:function(z,x){var i=p.legendURL+"&mid="+l+"&WIDTH=36&HEIGHT=30&layer=";var y={opacity:j};if(v&&v.length>0){y.attribution=v}if(e==p.GROUPTYPE_BASE){p.deMap.addBaseLayer(c,o,f+"&FORMAT="+u,h,y,i)}else{p.deMap.addOverlayLayer(c,o,f+"&FORMAT="+u,h,y,i)}}})}},addKMLLayer:function(b,a){try{a=parseFloat(a)}catch(c){a=null}this.deMap.addKMLLayer(b,a);this.cswDialog.hide()}};function LegendTree(a,f,g,d,c){var b=this;this.div=dojo.byId(a);this.callback=f;this.menu=g;this.gMenu=d;this.rMenu=c;if(!$("legChkMixLoader")){var h=document.createElement("div");h.id="legChkMixLoader";h.className+=" legChkMix";this.div.appendChild(h);h.style.display="none"}var e=document.createElement("div");e.className="dijitTreeContainer";this.rootContainer=e;this.div.appendChild(e);dojo.require("dijit.form.CheckBox")}LegendTree.prototype={div:null,rootContainer:null,treeRoot:null,callback:null,menu:null,gMenu:null,rMenu:null,showRoot:false,menuLayerId:null,mouseLayerId:null,loadLegend:function(d,e,a,c){console.log(this.div.id+" , "+d+" , "+e);var b=this;dojo.xhrGet({url:d,handleAs:"text",handle:function(g,f){if(typeof g=="error"){console.warn("error!",f)}else{b.legendLoaded(e,g,a,c)}}})},legendLoaded:function(f,e,a,b){this.treeRoot=dojo.fromJson(e).items[0];var d=this.rootContainer;if(this.showRoot){this.createTreeContainer(this.treeRoot,d,f,0)}else{d.id="leg_"+this.treeRoot.id;for(var c=0;c<this.treeRoot.children.length;c++){this.createTreeContainer(this.treeRoot.children[c],d,f,0)}}this.checkAll(this.treeRoot);if(a){this.callbackLayers()}if(b){b()}},removeAllChildren:function(b){var a=this.getItem(this.treeRoot,b);this.removeChildren(a)},removeChildren:function(g){var e=dojo.byId("leg_"+g.id);for(var d=0;d<g.children.length;d++){var h=g.children[d];this.removeChildren(h);var f=dojo.byId("leg_"+h.id);if(f){h.node.removeChild(f);f.innerHTML="";delete f;f=null}var b=dojo.byId("legName_"+h.id);if(b){delete b;b=null}var a=dijit.byId("legChk_"+h.id);a.destroy();if(e){e.removeChild(h.node)}delete h.node;h.innerHTML="";delete h;h=null}e.innerHTML="";delete e;e=null;g.children=[]},addLegend:function(e,b,f,j,a,i,h){if(h==undefined){h=true}var l={checked:h,children:[],id:e,name:b};if(i){l.group=i}if(!this.treeRoot){this.treeRoot=l;this.createTreeContainer(l,this.rootContainer,f,0)}else{if(!j){this.treeRoot.children.push(l);this.createTreeContainer(l,this.rootContainer,f,0)}else{var g=this.getItem(this.treeRoot,j);g.children.push(l);var k=this;var c=dojo.byId("legExp_"+g.id);if(c.className.match(" dijitTreeExpandoLeaf")){c.className=c.className.replace(" dijitTreeExpandoLeaf","")+" dijitTreeExpandoOpened";c.onclick=function(){k.toggleNode(g.id)}}var d=dojo.byId("leg_"+g.id);this.createTreeContainer(l,d,f,a?-1:1);g.node.className=g.node.className.replace(" dijitTreeIsLast","").replace(" dijitTreeExpandoLeaf","")}}},updateLegend:function(d,e,b){var c=this.getItem(this.treeRoot,d);c.name=e;var a=dojo.byId("legName_"+d);if(a){a.innerHTML=e}},createTreeContainer:function(o,a,k,j){var n=this;var e=o.children&&o.children.length>0;var d=document.createElement("div");o.node=d;d.className="dijitTreeNode";if(j==0){d.className+=" dijitTreeIsRoot"}else{if(j==1){d.className+=" dijitTreeIsLast"}}a.appendChild(d);var p=document.createElement("div");p.id="legRow_"+o.id;p.className="dijitTreeRow";p.style.whiteSpace="";d.appendChild(p);var c;var c=document.createElement("span");c.id="legExp_"+o.id;c.className="dijitTreeExpando";if(e){if(o.closed){c.className+=" dijitTreeExpandoClosed"}else{c.className+=" dijitTreeExpandoOpened"}c.onclick=function(){n.toggleNode(o.id)}}else{c.className+=" dijitTreeExpandoLeaf"}p.appendChild(c);c=document.createElement("span");c.className="dijitTreeContent dijitTreeContentExpanded dijitTreeNodeHover";p.appendChild(c);if(o.group){var b=new dijit.form.RadioButton({id:"legChk_"+o.id,checked:o.checked,value:o.id,name:o.group,onClick:function(){n.setChecked(o.id,this.checked)}});p.appendChild(b.domNode)}else{var m=new dijit.form.CheckBox({id:"legChk_"+o.id,checked:o.checked,value:o.id,onClick:function(){n.setChecked(o.id,this.checked)}});p.appendChild(m.domNode)}var l=document.createElement("label");l.id="legName_"+o.id;l.htmlFor="legChk_"+o.id;l.style.display="inline-block";l.className="dijitTreeLabel";l.innerHTML=o.name;p.appendChild(l);if(k){c=document.createElement("div");c.className="legendDiv";var g=document.createElement("img");g.src=k+o.id;g.onload=function(){if(this.width>800){this.parentNode.style.display="none"}if(this.height>800&&!this.src.match(/\&HEIGHT=12/i)){this.src=this.src.replace(/\&HEIGHT=\d+/i,"&HEIGHT=12")}};g.onerror=function(){this.parentNode.style.display="none"};c.appendChild(g);p.appendChild(c)}if(!e){if(this.menu){this.menu.bindDomNode(l);l.onmouseover=function(){n.mouseLayerId=o.id};if(g){this.menu.bindDomNode(g);g.onmouseover=function(){n.mouseLayerId=o.id}}}}else{if(j==0){if(this.rMenu){this.rMenu.bindDomNode(l);l.onmouseover=function(){n.mouseLayerId=o.id};if(g){this.rMenu.bindDomNode(g);g.onmouseover=function(){n.mouseLayerId=o.id}}}}else{if(this.gMenu){this.gMenu.bindDomNode(l);l.onmouseover=function(){n.mouseLayerId=o.id};if(g){this.gMenu.bindDomNode(g);g.onmouseover=function(){n.mouseLayerId=o.id}}}}}var h=document.createElement("div");h.id="leg_"+o.id;h.className="dijitTreeContainer";if(o.closed){h.style.display="none"}d.appendChild(h);if(o.group&&o.checked){this.setChecked(o.id,o.checked)}if(e){for(var f=0;f<o.children.length;f++){if(o.children[f]){this.createTreeContainer(o.children[f],h,k,(f==o.children.length-1)?1:-1)}}}},toggleNode:function(a){if($("leg_"+a).style.display=="none"){dojo.fx.wipeIn({duration:150,node:"leg_"+a,onEnd:function(){$("leg_"+a).style.display=""}}).play();$("legExp_"+a).className="dijitTreeExpando dijitTreeExpandoOpened"}else{dojo.fx.wipeOut({duration:150,node:"leg_"+a,onEnd:function(){$("leg_"+a).style.display="none"}}).play();$("legExp_"+a).className="dijitTreeExpando dijitTreeExpandoClosed"}},getItem:function(d,c){if(d.id==c){return d}else{for(var b=0;b<d.children.length;b++){var a=this.getItem(d.children[b],c);if(a){return a}}}return null},getParent:function(d,c){for(var b=0;b<d.children.length;b++){if(d.children[b].id==c){return d}else{var a=this.getParent(d.children[b],c);if(a){return a}}}return null},getSelectedLayers:function(a,d){var b=dijit.byId("legChk_"+d.id);if(b&&b.attr("checked")){a.push(d.id)}for(var c=0;c<d.children.length;c++){this.getSelectedLayers(a,d.children[c])}},setChecked:function(d,c){var a=dijit.byId("legChk_"+d);if(!a){return}var b=this.getItem(this.treeRoot,d);a.attr("checked",c);this.checkAllChildren(b,c);a.attr("checked",c);a.domNode.className=a.domNode.className.replace(" legChkMix","");this.checkParent(d);this.callbackLayers()},callbackLayers:function(){if(this.callback){var a=[];this.getSelectedLayers(a,this.treeRoot);this.callback(a);console.log(a)}},checkAllChildren:function(d,c){if(!d){return}for(var b=d.children.length-1;b>=0;b--){var a=dijit.byId("legChk_"+d.children[b].id);if(a){a.attr("checked",c);a.domNode.className=a.domNode.className.replace(" legChkMix","")}this.checkAllChildren(d.children[b],c)}},checkParent:function(g){var c=this.getParent(this.treeRoot,g);if(c){var a=dijit.byId("legChk_"+c.id);if(a){var b=0;var h=0;var f=false;for(var e=0;e<c.children.length;e++){var d=dijit.byId("legChk_"+c.children[e].id);if(d.attr("checked")){b++}else{if(!c.children[e].group){h++}}if(b>0&&h>0||d.domNode.className.match(" legChkMix")){f=true;break}}a.attr("checked",h==0);if(f){a.domNode.className+=" legChkMix"}else{a.domNode.className=a.domNode.className.replace(" legChkMix","")}}this.checkParent(c.id)}},checkAll:function(f){if(f.children.length==0){return}var b=0;var g=0;var e=false;for(var d=f.children.length-1;d>=0;d--){this.checkAll(f.children[d]);var c=dijit.byId("legChk_"+f.children[d].id);if(c.attr("checked")){b++}else{if(!f.children[d].group){g++}}if(b>0&&g>0||c.domNode.className.match(" legChkMix")){e=true}}var a=dijit.byId("legChk_"+f.id);if(a){a.attr("checked",g==0);if(e){a.domNode.className+=" legChkMix"}else{a.domNode.className=a.domNode.className.replace(" legChkMix","")}}}};var map1=null;var map2=null;var gmap=null;var subMapPane=null;var subMapId=null;var interlocked=false;var overview=null;var geocoder;var paneSize={};var splitters={};var openTag={};function openWin(b,a){var c=window.open(b,a,"location=no,personalbar=no,resizable=yes,scrollbars=yes");c.focus()}function openBlankWindow(a){var b=window.open(a,"_blank","location=no,personalbar=no,resizable=yes,scrollbars=yes");b.focus()}function isCheckedAll(a){var c=a.length;for(var b=0;b<c;b++){if(a[b].checked){return true}}return false}function checkAll(a,d){if(!a){return}var c=a.length;for(var b=0;b<c;b++){a[b].checked=d}}function mapPanTo(b,a){map1.mapPanTo(b,a)}function mapSetCenter(b,a){map1.mapSetCenter(b,a)}function mapRedraw(){map1.contentsLayer.redraw(true)}function mapShowMarker(b,a){map1.showActiveMarker(new OpenLayers.LonLat(b,a))}function mapHideMarker(){map1.clearActiveMarker()}function mapShowContents(a,b,d,c){map1.getContent(a,b,new OpenLayers.LonLat(d,c))}function zoomToExtent(d,b,a,c){map1.zoomToExtent(new OpenLayers.Bounds(d,b,a,c))}function insertCallback(a,b){console.log("insertCallback "+a);if(listEditor&&listEditor.layerId==a){listEditor.loadList()}if(b){mapRedraw()}}function updateCallback(b,a,c){console.log("updateCallback "+b+","+a);if(listEditor&&listEditor.layerId==b){listEditor.updateListRow(b,a)}if(c){mapRedraw()}}function deleteCallback(b,a,c){console.log("deleteCallback "+b+","+a);if(listEditor&&listEditor.layerId==b){listEditor.deleteListRow(b,a)}if(c){mapRedraw()}}var refLegendDiv="map1_legend_reference";var refMenuPopup;var contentsMenu;function initMap(c,a,d,h){var g=mapInited;var b={};if(d){b.visibleContents=d}if(d&&h>0){g=function(){mapInited(d);if(d&&h>0){try{map1.getContent(d,h,null,null,{centered:true,zoomed:true});map1.setContentsLayer(d,true)}catch(i){console.warn(i)}}}}map1.init(c,"map1",initExtent,initResolution,g,b);subMapId=a;dojo.connect(dijit.byId("map_container"),"resize",function(){updateSubMapPane()});try{map1.uploader=new DojoUploader("contentsUpload.html","upload_dialog","upload_form","upload_file1","upload_button","./upload?type=contents&mid="+c)}catch(f){}}function mapInited(a){contentsMenu=new dijit.Menu({leftClickToOpen:false});contentsMenu.addChild(new dijit.MenuItem({label:"登録情報追加",onClick:function(){map1.editNewContents(function i(){return map1.legendContents.menuLayerId}())}}));contentsMenu.addChild(new dijit.MenuItem({label:"一覧編集",onClick:function(){showListEditor(map1.mapId,function i(){return map1.legendContents.menuLayerId}(),true)}}));contentsMenu.startup();var e=new dijit.Menu({});e.addChild(new dijit.MenuItem({label:"10%",onClick:function(){map1.setLegendOpacity(0.9)}}));e.addChild(new dijit.MenuItem({label:"20%",onClick:function(){map1.setLegendOpacity(0.8)}}));e.addChild(new dijit.MenuItem({label:"30%",onClick:function(){map1.setLegendOpacity(0.7)}}));e.addChild(new dijit.MenuItem({label:"40%",onClick:function(){map1.setLegendOpacity(0.6)}}));e.addChild(new dijit.MenuItem({label:"50%",onClick:function(){map1.setLegendOpacity(0.5)}}));e.addChild(new dijit.MenuItem({label:"60%",onClick:function(){map1.setLegendOpacity(0.4)}}));e.addChild(new dijit.MenuItem({label:"70%",onClick:function(){map1.setLegendOpacity(0.3)}}));e.addChild(new dijit.MenuItem({label:"80%",onClick:function(){map1.setLegendOpacity(0.2)}}));e.addChild(new dijit.MenuItem({label:"90%",onClick:function(){map1.setLegendOpacity(0.1)}}));var d=new dijit.Menu({});d.addChild(new dijit.MenuItem({label:"なし",onClick:function(){map1.setLegendOpacity(1)}}));d.addChild(new dijit.MenuItem({label:"濃い",onClick:function(){map1.setLegendOpacity(0.75)}}));d.addChild(new dijit.MenuItem({label:"半透明",onClick:function(){map1.setLegendOpacity(0.5)}}));d.addChild(new dijit.MenuItem({label:"うすい",onClick:function(){map1.setLegendOpacity(0.25)}}));d.addChild(new dijit.PopupMenuItem({label:"詳細 ≫",popup:e}));refMenuPopup=new dijit.PopupMenuItem({label:"透明度設定",popup:d});var h=new dijit.Menu({leftClickToOpen:false});h.addChild(new dijit.PopupMenuItem({label:"透明度設定",popup:d}));h.startup();var c=new dijit.Menu({leftClickToOpen:false});c.addChild(new dijit.PopupMenuItem({label:"透明度設定",popup:d}));c.startup();map1.kmlLegend=document.createElement("div");dojo.byId(refLegendDiv).appendChild(map1.kmlLegend);var g="";if(a){g="visible="+a}map1.initContentsLegend("map1_legend_contents","DeMapLegendInfo.jsp?"+g+"&mid=",legendURL+"&mid="+map1.mapId+"&WIDTH=36&HEIGHT=30&layer=",contentsMenu);map1.initReferenceLegends(refLegendDiv,"DeMapLegendInfo.jsp?type=50&mid=",legendURL+"&mid="+map1.mapId+"&WIDTH=36&HEIGHT=30&layer=",refMenuPopup);map1.initOverlayLegend("map1_legend_overlays","DeMapLegendInfo.jsp?type=100&mid=",legendURL+"&mid="+map1.mapId+"&WIDTH=36&HEIGHT=36&layer=",h);map1.initBaseLayerLegend("map1_legend_baselayers","DeMapLegendInfo.jsp?type=1000&mid=",legendURL+"&mid="+map1.mapId+"&WIDTH=36&HEIGHT=36&layer=",c);map1.createLayerIconImage(legendURL+"&mid="+map1.mapId+"&RESIZE=1&WIDTH=28&HEIGHT=28&layer=");map1.initMapEditor(insertCallback,updateCallback,deleteCallback);if($("overview")){var f=new OpenLayers.Layer.WMS("admin",overviewURL,{});var b={div:$("overview"),layers:[f],minRatio:16,maxRatio:16,minRectSize:4,mapOptions:{maxExtent:new OpenLayers.Bounds(-180,-90,180,90),maxResolution:0.703125}};overview=new OpenLayers.Control.OverviewMap(b);map1.map.addControl(overview);overview.mapDiv.style.width="100%";overview.mapDiv.style.height="100%";overview.element.style.padding="0px";overview.element.style.background="none";overview.updateOverview()}if(subMapId){subMapVisible(subMapId)}}function initSplitter(d,b,g,f,c){if(g=="right"||g=="left"){splitters[d]=dijit.byId(b).getSplitter(g);paneSize[d]=c;if(f){splitters[d]._minSize=c}dojo.connect(splitters[d],"_stopDrag",function(){showPaneOpenTag(d)});var a=document.createElement("div");a.className="open_tag";var e=document.createElement("span");e.id=d+"_opentag";e.title="表示";e.onclick=function(){showContentPane(d)};e.className=g;a.style.display=(f)?"block":"none";a.appendChild(e);$(b).appendChild(a);openTag[d]=a}}function subMapVisible(a){var b=dijit.byId("subMapMenu_"+a);if(b){b.onClick()}}function changeContentsLayer(a,b){map1.mapId=a;map1.initContentsLegend("map1_legend_contents","DeMapLegendInfo.jsp?mid=",b+"&mid="+map1.mapId+"&WIDTH=36&HEIGHT=30&layer=",contentsMenu)}function hideContentPane(a){var c=dijit.byId(a);var b=c.domNode.offsetWidth;paneSize[a]=b;c.resize({w:0});dijit.byId("window_container").layout();splitters[a]._minSize=paneSize[a]||150;showPaneOpenTag(a);if(gmap){gmap.checkPosition()}}function showContentPane(a){var b=dijit.byId(a);b.resize({w:paneSize[a]});dijit.byId("window_container").layout();showPaneOpenTag(a);if(gmap){gmap.checkPosition()}}function showPaneOpenTag(a){map1.updateSize();if(openTag[a]){var b="block";if($(a).offsetWidth>0){splitters[a]._minSize=80;b="none"}openTag[a].style.display=b}}var csw;function showCswDialog(a){if(!csw){csw=new CswDialog(map1,legendURL)}csw.showDialog(a)}function addGeoRSSLayer(a,b){try{map1.addGeoRSSLayer(a,b)}catch(c){console.error(c)}}function addReferenceLayers(d,b,a){if(a<b.length){dojo.xhrGet({url:d.getSessionLayerInfoURL(b[a]),handleAs:"text",handle:function(f,e){if(typeof f!="error"){addReferenceLayers(d,b,++a)}}})}else{try{d.addReferenceLayers(b,refLegendDiv,legendURL+"&mid="+d.mapId+"&WIDTH=36&HEIGHT=30&layer=",refMenuPopup)}catch(c){console.error(c)}}}function showSubMap(c,d){var a;var b;try{a=map1.getBounds();b=map1.getResolution()}catch(f){a=initExtent;b=initResolution}setButtonDisabled(true);if(subMapPane){closeSubMap()}if(!map2||map2.mapType!="DeMap"){map2=new DeMap()}createSubMapPane(d);dijit.byId("window_container").layout();subMapId=c;map2.init(c,"map2",a,b,subMapInited,{searcharea:false,showAllContents:true,layerSwitcher:true})}function showWMSSubMap(b,a){if(subMapPane){closeSubMap()}if(!map2||map2.mapType!="WMS"){map2=new DeMapWMS()}createSubMapPane(b);map2.init("map2",a,map1.map.getCenter(),map1.map.getZoom());subMapInited();selectSubMapMenu(-1)}function subMapInited(){map1.addMapMoveListener(map2,mapMoveListener);map2.addMapMoveListener(map1,mapMoveListener);setButtonDisabled(false);map1.updateSize()}var streetviewDialog;function showGMap(){setButtonDisabled(true);if(subMapPane){closeSubMap()}createSubMapPane("GoogleMap");dijit.byId("window_container").layout();if(!gmap){gmap=new DeMapGoogle()}if(!streetviewDialog){dojo.require("map.dijit.ModelessDialog");streetviewDialog=new map.dijit.ModelessDialog({id:"streetview_dialog",title:"Googleストリートビュー",duration:100,top:1})}gmap.init("map2",this.map1.getLonLat(),this.map1.getBounds(),streetviewDialog);map1.addMapMoveListener(gmap,mapMoveListener);gmap.addMapMoveListener(map1,mapMoveListener);subMapId=null;setButtonDisabled(false);$("map2_title_pane").style.width="100%";$("map2_pane").style.width="100%";gmap.checkResize()}function createSubMapPane(d){var e=document.createElement("div");e.innerHTML='<div dojoType="dijit.layout.BorderContainer" design="sidebar" style="width:auto;height:100%;" gutters="false" id="map2_container"><div dojoType="dijit.layout.ContentPane" region="top" gutters="false" id="map2_title_pane">'+d+'</div><div dojoType="dijit.layout.ContentPane" region="center" id="map2_pane"><div id="map2" style="width:auto;"></div></div></div>';subMapPane=new dijit.layout.ContentPane({id:"map2_outer_pane",region:"right",splitter:true,onlayout:false});dijit.byId("map_container").addChild(subMapPane);subMapPane.attr("content",e);$("map2_title_pane").style.width="100%";$("map2_pane").style.width="100%";dijit.byId("map_container").layout();var b=$("map1_pane").offsetWidth;subMapPane.resize({w:b*subMapSize});map1.updateSize();dijit.byId("map_container").layout();var a=dijit.byId("map_container").getSplitter("right");dojo.connect(a,"_stopDrag",function(){$("map2_title_pane").style.width="100%";$("map2_pane").style.width="100%";if(map2&&map2.map){map2.updateSize()}if(gmap){gmap.checkResize()}setSubMapSize()});var c=document.createElement("span");c.className="paneCloseIcon";c.appendChild(document.createElement("span"));c.title="閉じる";c.onclick=closeSubMap;subMapPane.domNode.appendChild(c)}function closeSubMap(){if(map2){map1.removeMapMoveListener(map2);map2.removeMapMoveListener(map1);map2=null}else{if(gmap){map1.removeMapMoveListener(gmap);gmap.removeMapMoveListener(map1);gmap=null;if(streetviewDialog){streetviewDialog.hide()}}}if(subMapPane){dijit.byId("map_container").removeChild(subMapPane);map1.updateSize();subMapPane.destroyRecursive();subMapPane=null}selectSubMapMenu(0)}function selectSubMapMenu(a){var b=dijit.byId("subMapMenu").getChildren();for(var c=0;c<b.length;c++){if(c==a){b[c].attr("disabled",true);b[c].domNode.style.backGroundColor="red"}else{b[c].attr("disabled",false)}}}function setButtonDisabled(a){dijit.byId("buttonSubMap").attr("disabled",a)}subMapSize=0.5;function setSubMapSize(){var b=$("map1_pane").offsetWidth;var a=$("map2_pane").offsetWidth;subMapSize=Math.min(0.9,a/(b+a))}function updateSubMapPane(){if(subMapPane){dijit.byId("map_container").layout();var a=$("map_container").offsetWidth;if($("map1_legend_pane")){a-=$("map1_legend_pane").offsetWidth}subMapPane.resize({w:a*subMapSize});map1.updateSize();if(map2&&map2.map){map2.updateSize()}if(gmap){gmap.checkResize()}dijit.byId("map_container").layout()}}function mapMoveListener(b,a){if(interlocked){return}interlocked=true;a.mapMoveZoom(b.getLonLat(),b.getZoom());interlocked=false}function searchAddress(b){console.log(map1.map.getExtent());console.log(map1.map.getResolution());b=b.trim();if(b.length==0){return}if(!geocoder){try{geocoder=new GClientGeocoder()}catch(c){}}if(geocoder){var a=this;this.geocoder.getLatLng(b,function(d){if(!d){alert(b+" が見つかりません。")}else{console.log(d);map1.mapPanTo(d.lng(),d.lat())}})}}function startMeasureDist(){$("measure_dist_span").style.display="block";$("measure_area_span").style.display="none";dijit.byId("measure_dist").attr("value",0);map1.startMeasure(measureCallback,false)}function startMeasureArea(){$("measure_dist_span").style.display="none";$("measure_area_span").style.display="block";dijit.byId("measure_area").attr("value",0);map1.startMeasure(measureCallback,true)}function stopMeasure(){dijit.byId("measure_type_dist").attr("checked",false);dijit.byId("measure_type_area").attr("checked",false);$("measure_dist_span").style.display="none";$("measure_area_span").style.display="none";dijit.byId("measure_pane").toggle();map1.stopMeasure()}function measureCallback(a){dijit.byId("measure_dist").attr("value",Math.floor(a.measure*1000)/1000);$("measure_dist_units").innerHTML=a.units;dijit.byId("measure_area").attr("value",Math.floor(a.measure*1000)/1000);$("measure_area_units").innerHTML=a.units}function addCenterMeasure(){var a=map1.map.getCenter();map1.addMeasurePoint(a.lon,a.lat)}function undoMeasurePoint(){map1.undoMeasurePoint()}var importer;function showImportDialog(a,b){if(!importer){importer=new Importer(insertCallback)}importer.showDialog(a,b)}var listEditor;var addressCue=[];var addressInterval;function showListEditor(c,f,b){if(!listEditor){listEditor=new ListEditor()}else{if(listEditor.layerId&&!b){f=listEditor.layerId}}var h=dijit.byId("list_pane");if(!h||b){var g=null;if(!h){var e=dijit.byId("window_container");h=new dijit.layout.ContentPane({id:"list_pane",region:"bottom",splitter:true,style:"height:200px;"});e.addChild(h,0);e.layout();var a=new dijit.layout.BorderContainer({id:"list_inner_container",design:"sidebar",gutters:false});var d=new dijit.layout.ContentPane({id:"list_title_pane",region:"top",style:"overflow:hidden;"});d.setContent('<div class="paneTitleBar" title="一覧編集"><span class="paneTitle">一覧編集</span><span class="paneCloseIcon" title="閉じる" onclick="hideListEditor();"><span/></span></div>');if(!g){g=new dijit.layout.ContentPane({id:"list_inner_pane",region:"center"})}a.addChild(d,0);a.addChild(g,1);h.setContent(a.domNode)}else{g=dijit.byId("list_inner_pane")}listEditor.initList(g,c,f);map1.updateSize()}else{hideListEditor()}}function hideListEditor(){var a=dijit.byId("window_container");var b=dijit.byId("list_pane");if(b){a.removeChild(b);if(dijit.byId("listMenu")){dijit.byId("listMenu").destroy(true)}if(dijit.byId("listLayer")){dijit.byId("listLayer").destroy(true)}dijit.byId("list_title_pane").destroy(true);dijit.byId("list_inner_pane").destroy(true);dijit.byId("list_inner_container").destroy(true);b.destroy(true);map1.updateSize()}}function startListEdit(b,a,d,c){map1.editFeature(b,a,d,c)}function setListLayerId(a){listEditor.setLayerId(a)}function setListLimit(a){listEditor.setLimit(a)}function showListOffset(a){listEditor.loadOffset(a)}function sortList(a,b){listEditor.setSort(a,b)}function checkListAddress(b,a,m,l){if(!geocoder){try{geocoder=new GClientGeocoder()}catch(j){}}if(!b){return}var g;var p=b.length;var h=0;var f=0;if(addressCue.length>0){f=500}stopListAddress();var c=[];for(var d=0;d<p;d++){if(b[d].checked){g=b[d].value;var k=$("le"+g).getElementsByTagName("td");var o=k[m];var n=a+o.innerHTML.replace(/<[^>]*>/,"");c.push([n,g,m])}}if(c.length==0){alert("位置情報を"+(l?"登録":"取得")+"する行を選択してください")}else{if(l){if(!confirm("現在設定されている位置情報を上書きされます。\n位置情報を登録しますか？")){return}}addressCue=c;addressInterval=setInterval(function(){getListAddress(l)},250);$("addressChk").style.display="none";$("addressStop").style.display=""}}function stopListAddress(){if(addressInterval){clearInterval(addressInterval)}addressInterval=null;addressCue.length=0;$("addressStop").style.display="none";$("addressChk").style.display="";mapRedraw()}function getListAddress(b){if(geocoder){if(addressCue.length==0){stopListAddress()}else{var c=addressCue[0][0];c=c.replace(/一丁目/,"１丁目").replace(/二丁目/,"２丁目").replace(/三丁目/,"３丁目").replace(/四丁目/,"４丁目").replace(/五丁目/,"５丁目").replace(/高等学校/,"高校");var a=addressCue[0][1];var d=addressCue[0][2];addressCue.shift();geocoder.getLatLng(c,function(g){var f=$("le"+a).getElementsByTagName("td");var i=f[1];var h=f[d];if(g){console.log(g);if(b){updateListGeometry(a,g.lng(),g.lat());i.innerHTML='&nbsp;<a onclick="mapSetCenter('+g.lng()+","+g.lat()+');return false;" onmouseover="mapShowMarker('+g.lng()+","+g.lat()+')" onmouseout="mapHideMarker()">表示</a>'}else{var e=new OpenLayers.LonLat(g.lng(),g.lat());h.innerHTML='<a onclick="mapSetCenter('+g.lng()+","+g.lat()+');return false;" onmouseover="mapShowMarker('+g.lng()+","+g.lat()+')" onmouseout="mapHideMarker()">'+h.innerHTML+"</a>"}if(b){updateListGeometry(a,g.lng(),g.lat())}}else{h.innerHTML='<span style="color:red">'+h.innerHTML+"</span>"}})}}}function updateListGeometry(a,c,b){console.log("updateListGeometry("+a+")");listEditor.updateGeometry(a,c,b,updateListGeometryCallback)}function updateListGeometryCallback(a){$("addressRedraw").style.display=""}var pdf;function showPdfDialog(a){if(!pdf){pdf=new PdfWriter(map1)}pdf.showPdfDialog(a)}function pdfWriterLoaded(){pdf=new PdfWriter();pdf.initPdfDialog();pdf.showPdfDialog(mapId)};
