dojo.provide("dcc.tool.basemap"); dojo.declare("dcc.tool.basemap", [dijit._Widget], { parentcontainer: "", load: function (node, map, file) { this.parentcontainer = node; this.map = map; this.file= file; if (typeof this.contentPane == 'undefined') { this.contentPane = new dijit.form.Button( { label: ' Base Map ' }); listnerArray.push(dojo.connect(this.contentPane.domNode, "onclick", function () { curbmPopup.containernode.OpenPopup(); height = (((curbmPopup.containernode.countmaps / 3) ) * 75) + 10; dojo.byId("bsmapnode").style.height = height + "px"; dojo.byId("bsmapnode").innerHTML = curbmPopup.containernode.BMHtml; // set highlighted base map try { dojo.query('#bm_' + curbmPopup.containernode.map.basemap.id)[0].style.border = "2px solid gray" } catch (e) { } })); } dojo.place(this.contentPane.domNode, node, "first"); dojo.addClass(this.contentPane.domNode, "claro"); if (typeof this.dropDown == 'undefined') { this.dropDown = new dijit.TooltipDialog( { onClose: function(){ curLoadedPopup.isOpen = false;}, content: '<span style="float:right;position :relative; cursor:pointer;" onclick="dijit.popup.close(curbmPopup);"><img src="' + 'image.gif" alt="X" title="Click to close"/></span><br/><center id="bsmapnode"></center>' , style: "width:215px;" }); dojo.addClass(this.dropDown.domNode, "claro"); this.dropDown.startup(); } this.dropDown.containernode = this; curbmPopup = this.dropDown; curLoadedPopup = this.dropDown; // load basemaps this.loadBaseMaps(environmentPath + "dcc_GIS_Config/App_Config/basemaps/"+ this.file, this); }, OpenPopup: function () { if (curLoadedPopup.isOpen){ curLoadedPopup.isOpen = false; dijit.popup.close(curLoadedPopup); } else { if (typeof curLoadedPopup != 'undefined') { dijit.popup.close(curLoadedPopup); } this.popup = dijit.popup.open( { popup: this.dropDown, around: this.contentPane.domNode, orient: { BL: 'TL' } }); curLoadedPopup.isOpen= true; curbmPopup = this.dropDown; curLoadedPopup = this.dropDown; } }, loadBaseMaps: function (jsonpath, node) { dojo.xhrGet( { url: jsonpath, load: function (response) { node.BMHtml = ""; node.countmaps = 0; dojo.forEach(response.basemaps, function (entry, index, array) { node.BMHtml += '<div id="bm_' + entry.id + '" style=" border:2px solid white; font-size:10px;width :54px;padding:3px; position:relative; float:left; cursor:pointer;" onclick="curbmPopup.containernode.setBaseMap(\'' + entry.URL + '\', \'' + entry.id + '\' , \'' + entry.name + '\' , \'' + entry.type + '\' , \'' + entry.copyright + '\', curbmPopup.containernode.map) ;"> <img width=55 src="' + entry.swatchURL + '"/><center>' + entry.name + '</center></div>'; node.countmaps++; }); try { dojo.query('#bm_' + curbmPopup.containernode.map.basemap.id)[0].style.border = "2px solid gray" } catch (e) { } response = null; return response; }, error: function (response, ioArgs) { response = null; return response; }, handleAs: "json" }); //this.basemapConfig = this.map.dcc.getJson(jsonpath); //return this.basemapConfig; }, setBaseMap: function (url, id, name, type, copyright, themap) { if (typeof themap.basemap == 'undefined') { this.basemapName = themap._layers[themap.layerIds[0]].id; themap.basemap = themap._layers[themap.layerIds[0]]; } if (this.basemapName != name) //if map has changed { this.basemapId = id; this.basemapName = name; this.basemapType = type; this.url = url; this.copyright = copyright; // clear highlighted services try { dojo.query('#bm_' + curbmPopup.containernode.map.basemap.id)[0].style.border = "2px solid white" } catch (e) { } try { themap.removeLayer(themap.basemap); } catch (e) { themap.removeLayer(themap.basemap); } if (this.basemapType == "ArcGISDynamicMapServiceLayer") { themap.basemap = new esri.layers.ArcGISDynamicMapServiceLayer(this.url, { transparent: true, id: id }); } else if (this.basemapType == "ArcGISTiledMapServiceLayer") { themap.basemap = new esri.layers.ArcGISTiledMapServiceLayer(this.url, { id: id }); } themap.basemap = themap.addLayer(themap.basemap, 0); myLayers[0].Layer= themap.basemap; myLayers[0].Label = id; themap.basemap.url = url; themap.basemap.id = id; // themap.dcc.layers.basemap.id = id; dojo.byId("Copyright").innerHTML = this.copyright; //highlight mapservice try { dojo.query('#bm_' + curbmPopup.containernode.map.basemap.id)[0].style.border = "2px solid gray" } catch (e) { } } } });
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.