⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitk_adddata.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
📖 第 1 页 / 共 4 页
字号:
	    
	    input1.id = input1.name = "jitkAddDataWFSURL";
	    input1.size = "50";
	    input1.value = "http://";
	    td1.appendChild(input1);
	    tr1.appendChild(td1);
	    tbody.appendChild(tr1);
	    
	    var tr2 = document.createElement("tr");
	    var td2 = document.createElement("td");
	    td2.appendChild(document.createTextNode("ArcGIS Server Example:"));
	    tr2.appendChild(td2);
	    tbody.appendChild(tr2);
	
	    var tr3 = document.createElement("tr");
	    var td3 = document.createElement("td");
	    td3.appendChild(document.createTextNode("http://<server>/arcgis/services/<service>/MapServer/WFSServer"));
	    tr3.appendChild(td3);
	    tbody.appendChild(tr3);     
	
	    var mtr0 = document.createElement("tr");
	    var mtd0 = document.createElement("td");
	    mtd0.align = "right";
	    if (!this.addButton) this.addButton = self.createAddServerButton();
	    mtd0.appendChild(this.addButton);
	    mtd0.appendChild(document.createTextNode(" "));
	    mtd0.appendChild(this.cancelButton);
	    mtr0.appendChild(mtd0);
	    tbody.appendChild(mtr0);
	    
	    this.menuTable.appendChild(tbody);
	    this.menuTd.appendChild(this.menuTable);
	
	    this.resizeWin(420, 250);
  	}  
  
  	function jitkAddDataSelectOption(){
	    var selVal = document.getElementById("jitkAddDataSelectType").value;
	    if (selVal == 'AGSInternet') self.showAGSInternet();
	    if (selVal == 'AGSLocal') self.showAGSLocal();
	    if (selVal == 'AIMS') self.showAIMS();
	    if (selVal == 'WMS') self.showWMS();
	    if (selVal == 'WCS') self.showWCS();
	    if (selVal == 'WFS') self.showWFS();
	    if (selVal == '') self.showNone();
  	}
  
  	function jitkAddDataAddServer() {
	    var selVal = document.getElementById("jitkAddDataSelectType").value;
	    var datasource = '';
	    var msg = "<table border='0'><tr><td><img src='WebResource/com/esri/solutions/jitk/web/tasks/images/loading.gif' border='0' /></td><td>"
	    
	    if (selVal == 'AGSInternet') {
	        var url = document.getElementById('jitkAddDataAGSCatalogURL').value;
	
	        datasource = 'mode=AGSInternet|url=' + url;
	        msg += "<span class='addDataTaskMessage'>Connecting " + url + "...</span>";
	    } else if (selVal == 'AGSLocal') {
	        var host = document.getElementById('jitkAddDataAGSHost').value;
	        var username = document.getElementById('jitkAddDataAGSUsername').value;
	        var password = document.getElementById('jitkAddDataAGSPassword').value;
	        datasource = 'mode=AGSLocal|host=' + host + '|user=' + username + '|pswd=' + password;
	        msg += "<span class='addDataTaskMessage'>Connecting " + host + "...</span>";
	    } else if (selVal == 'AIMS') {
	        if (document.getElementById('jitkAddDataAIMSType0').checked) {
	            var host = document.getElementById('jitkAddDataAIMSHost').value;
	            var port = document.getElementById('jitkAddDataAIMSPort').value;
	            var username = document.getElementById('jitkAddDataAIMSUsername').value;
	            var password = document.getElementById('jitkAddDataAIMSPassword').value;
	            datasource = 'mode=AIMS|type=TCP|host=' + host + '|port=' + port + '|user=' + username + '|pswd=' + password;
	            msg += "<span class='addDataTaskMessage'>Connecting " + host + "...</span>";
	        } else {
	            var url = document.getElementById('jitkAddDataAIMSURL').value;
	            var username = document.getElementById('jitkAddDataAIMSUsername').value;
	            var password = document.getElementById('jitkAddDataAIMSPassword').value;
	            datasource = 'mode=AIMS|type=HTTP|url=' + url + '|user=' + username + '|pswd=' + password;
	            msg += "<span class='addDataTaskMessage'>Connecting " + url + "...</span>";
	        }
	    } else if (selVal == 'WMS') {
	        var wmsurl = document.getElementById('jitkAddDataWMSURL').value;
	        datasource = 'mode=WMS|url=' + wmsurl;
	        msg += "<span class='addDataTaskMessage'>Connecting " + wmsurl + "...</span>";
	    }else if (selVal == 'WCS') {
	        var wcsurl = document.getElementById('jitkAddDataWCSURL').value;
	        datasource = 'mode=WCS|url=' + wcsurl;
	        msg += "<span class='addDataTaskMessage'>Connecting " + wcsurl + "...</span>";
	    } else if (selVal == 'WFS') {
	        var wfsurl = document.getElementById('jitkAddDataWFSURL').value;
	        datasource = 'mode=WFS|url=' + wfsurl;
	        msg += "<span class='addDataTaskMessage'>Connecting " + wfsurl + "...</span>";    
	    }
	    
	    // show loading message
	    JitkShowLoadingIndicator("jitkAddDataChooserWin");
	  
	    document.getElementById('addDataTask_param_addGISServerInfo').value = datasource;
	    document.getElementById('button_addDataTask_action_addGISServerUpdate').click();
	    EsriControls.maps['map1'].hideLoading();
  	}
  
  	function jitkAddDataCheckAIMSType(id){
	    document.getElementById('jitkAddDataAIMSType0').checked = false;
	    document.getElementById('jitkAddDataAIMSType1').checked = false;
	    document.getElementById(id).checked = true;
	    var httpColor = "gray";
	    var tcpColor = "black";
	    var httpDisable = false;
	    var tcpDisable = false;
	    
	    if (id == 'jitkAddDataAIMSType0') {
	    	httpColor = "gray";
	      	tcpColor = "black"; 
	      	httpDisable = true;
	      	tcpDisable = false;
	    } else {
	     	httpColor = "black";
	      	tcpColor = "gray";
	      	httpDisable = false;
	      	tcpDisable = true;
	    }
	    
	    document.getElementById('jitkAddDataTdTCP').style.color = tcpColor;
	    document.getElementById('jitkAddDataTdTCPHost').style.color = tcpColor;
	    document.getElementById('jitkAddDataTdTCPPort').style.color = tcpColor;
	    document.getElementById('jitkAddDataTdHTTP').style.color = httpColor;
	    document.getElementById('jitkAddDataTdHTTPURL').style.color = httpColor;
	    document.getElementById('jitkAddDataTdHTTPDesc').style.color = httpColor;
	    document.getElementById('jitkAddDataAIMSHost').disabled = tcpDisable;
	    document.getElementById('jitkAddDataAIMSPort').disabled = tcpDisable;
	    document.getElementById('jitkAddDataAIMSURL').disabled = httpDisable;      
  	}
  
  	function jitkAddDataSelectAIMSType(e){
    	var id = EsriUtils.getEventSource(e).id;
      	jitkAddDataCheckAIMSType(id);
  	}
  
  	function jitkAddDataCloseChooser(){
    	EsriUtils.hideElement(document.getElementById("jitkAddDataChooserWin"));
  	}

  	if (container) this.init(container);
}

function JitkAddDataPreview(id, winId, container, cb, contextPath) {
  	this.inheritsFrom(new EsriPageElement(id, 0, 0, 0, 0));

  	this.callContinuously = false;
  	this.divId = "JitkAddDataPreviewDiv_" + id;
  	this.winId = winId;
  	this.mapDiv;
  	this.contextPath = contextPath;
  	var callback = cb;
  	var self = this;

  	this.init = function(container) {
	    this.divObject = container.appendChild(document.createElement("div"));
	    this.divObject.id = this.divId;
	    this.divObject.className = "jitkAddDataPreview";
	
	    var tbl = document.createElement("table");
	    var tbody = document.createElement("tbody");
	    var tr0 = document.createElement("tr");
	    var td0 = document.createElement("td");
	
	    this.mapDiv = document.createElement("div");    
	    this.mapDiv.style.backgroundRepeat = "no-repeat";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
	    this.mapDiv.style.backgroundPositionX = "center";
	    this.mapDiv.style.backgroundPositionY = "center";
	    
	    td0.appendChild(this.mapDiv);    
	    tr0.appendChild(td0);
	    tbody.appendChild(tr0);
	    tbl.appendChild(tbody);
	    this.divObject.appendChild(tbl);    
  	}
  
  	this.showAGSInternetMap = function(url){
	    var url = 'mapServicePreviewServlet?mode=AGSInternet&url=' + url;
	    
	    if (this.contextPath != null) {
	    	url = this.contextPath + '/mapServicePreviewServlet?mode=AGSInternet&url=' + url;
	    }
	    
	    this.mapDiv.innerHTML = "<img width=400 height=200 src='" + url + "' style=\"display: none;\" onload=\"this.style.display='block';JitkHideLoadingIndicator('jitkAddDataPreviewWin');\" onError=\"jitkAddDataPreview.displayImageLoadingError();\"/>";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	}
  
  	this.showAGSLocalMap = function(params, svrObj){
	    var url = 'mapServicePreviewServlet?mode=AGSLocal&' + params + '&svrObj=' + svrObj;
	    
	    if (this.contextPath != null) {
	   		url = this.contextPath + '/mapServicePreviewServlet?mode=AGSLocal&' + params + '&svrObj=' + svrObj;
	    }
	    
	    this.mapDiv.innerHTML = "<img width=400 height=200 src='" + url + "' style=\"display: none;\" onload=\"this.style.display='block';JitkHideLoadingIndicator('jitkAddDataPreviewWin');\" onError=\"jitkAddDataPreview.displayImageLoadingError();\"/>";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	}
  
  	this.showWMSMap = function(url){
	    var url = 'mapServicePreviewServlet?mode=WMS&url=' + url;
	    
	    if (this.contextPath != null) {
	    	url = this.contextPath + '/mapServicePreviewServlet?mode=WMS&url=' + url;
	    }
	    
	    this.mapDiv.innerHTML = "<img width=400 height=200 src='" + url + "' style=\"display: none;\" onload=\"this.style.display='block';JitkHideLoadingIndicator('jitkAddDataPreviewWin');\" onError=\"jitkAddDataPreview.displayImageLoadingError();\"/>";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	}
  
  	this.showWCSMap = function(url){
	    var url = 'mapServicePreviewServlet?mode=WCS&url=' + url;
	    
	    if (this.contextPath != null) {
	    	url = this.contextPath + '/mapServicePreviewServlet?mode=WCS&url=' + url;
	    } 
	    
	    this.mapDiv.innerHTML = "<img width=400 height=200 src='" + url + "' style=\"display: none;\" onload=\"this.style.display='block';JitkHideLoadingIndicator('jitkAddDataPreviewWin');\" onError=\"jitkAddDataPreview.displayImageLoadingError();\"/>";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	}
  
  	this.showAIMSMap = function(params, svc){
	    var url = 'mapServicePreviewServlet?mode=AIMS&type=' + params + '&service=' + svc;
	    
	    if (this.contextPath != null) {
	    	url = this.contextPath + '/mapServicePreviewServlet?mode=AIMS&type=' + params + '&service=' + svc;
	    }
	    
	    this.mapDiv.innerHTML = "<img width=400 height=200 src='" + url + "' style=\"display: none;\" onload=\"this.style.display='block';JitkHideLoadingIndicator('jitkAddDataPreviewWin');\" onError=\"jitkAddDataPreview.displayImageLoadingError();\"/>";
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	}
  
  	this.showWFSMap = function(params, svc){
  		this.mapDiv.innerHTML = "<table align='center'><tr><td style='padding-top: 90px;'><b>No preview available for Web Feature Services</b></td></tr></table>"
	    //this.mapDiv.innerHTML = "No preview available for Web Feature Services";
	 	JitkHideLoadingIndicator('jitkAddDataPreviewWin');
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	} 
  	
  	this.displayImageLoadingError = function() {
  		this.mapDiv.innerHTML = "<table align='center'><tr><td style='padding-top: 90px;'></td></tr></table>"
	 	JitkHideLoadingIndicator('jitkAddDataPreviewWin');
	    this.mapDiv.style.height = "200px";
	    this.mapDiv.style.width = "400px";
  	} 

  	if (container) this.init(container);
}

function jitkAddDataShowMessage(div, msg) {
    var html = '<img src="WebResource/com/esri/solutions/jitk/web/tasks/images/loading.gif">';
    html += '<span class="addDataTaskMessage">';
    html += msg + '</span>';
    div.innerHTML = html;
    div.style.display = "block";  
}

function jitkAddDataToggleVisibility(divid, imgid){
  	var div = document.getElementById(divid);
  	var img = document.getElementById(imgid);
  	
  	if (div.style.display == 'block'){
    	div.style.display = 'none';
    	img.src = 'WebResource/com/esri/solutions/jitk/web/tasks/images/nav-plus.gif';
  	} else {
    	div.style.display = 'block';
    	img.src = 'WebResource/com/esri/solutions/jitk/web/tasks/images/nav-minus.gif';
  	}
}

var jitkAddDataSelSvcs = '';
var jitkRemoveDataSelSvcs = '';
      
      function jitkDeleteGISServer(obj, msg1, msg6){
        if (jitkAddDataCheckSelection(obj)){
          alert(msg1);
          return;
        }
        var nd = document.getElementById('jitkSelDiv_availableServices');
        var nds = nd.getElementsByTagName('a');
        var l = '';
        var delList = new Array();
        var j = 0;
        for (var i = nds.length - 1; i >= 0; i--){
          var elm = nds[i];
          var pos = elm.id.indexOf('jitk_server_');
          if (pos >= 0){
            if (elm.style.backgroundColor == 'silver'){
              delList[j] = elm.id.substring(12);
              j++;
            }             
          }
        }
        if (delList.length > 0){
          var disp = msg6 + '\n\n';
          for (var i = delList.length - 1; i >= 0; i--){
            var ds = delList[i];
            pos = ds.indexOf('user');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -