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

📄 jitk_import_svg.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
字号:
/*
Modified from EsriUploadUtil
*/
//filename, id
function jitkHandleImportSVG() {
	//get map control
	var map = EsriControls.maps["map1"];
    
    //get server url
   	var url = EsriUtils.getServerUrl(map.formId);
   	
   	//contruct request parameters
    var params = "mapRefresh=mapRefresh&formId=" + map.formId + "&mapId=" + map.id + "&" + EsriUtils.buildRequestParams(map.formId);
    
    //send AJAX request. Set callback function to process XML response as EsriControls.processPostBack function and pass xmlHttp object
    var xmlHttp = EsriUtils.sendAjaxRequest(url, params, false, function() { EsriControls.processPostBack(xmlHttp); });
}

var JitkImportSVGUtil = new function() {
  var defaultImportSVGPage = "mvs/svg/jitkImportSVG.jsf";
  var defaultImportSVGSuccessPage = "mvs/svg/jitkImportSVGSuccess.jsf";
  var pe, win, listener;

  this.showImportSVGWindow = function(title, importSVGListener, importSVGPage, importSVGSuccessPage) {
    if (win) destroyWindow()
    listener = importSVGListener;
    
    if (! importSVGPage) importSVGPage = defaultImportSVGPage;
    if (! importSVGSuccessPage) importSVGSuccessPage = defaultImportSVGSuccessPage;

    var time = new Date().getTime();
    var divId = "jitk-import-svg-iframe-" + time;
    pe = new EsriPageElement(divId);
    
    var divElement1 = document.createElement("div");
	divElement1.className = "jitk-floating-panel-content-wrapper";
    
    var divElement2 = document.createElement("div");
	divElement2.id = "div_"+divId;
    
    var divElement3 = document.createElement("div");
	divElement3.className = "jitk-floating-panel-content";
    
    var tableElement = document.createElement("table");
    var tbody = document.createElement("tbody");
	var tableElementRow = document.createElement("tr");
	var tableElementColumn = document.createElement("td");
    
    var frameObject = document.createElement("iframe");
    frameObject.frameBorder = 0;
    frameObject.scrolling = "no";
    frameObject.name = "iframe_"+divId;
    frameObject.id = "iframe_"+divId;
    frameObject.width = 300;
    frameObject.height = 130;
    frameObject.src = importSVGPage + "?requestPage=" + importSVGPage + "&successPage=" + importSVGSuccessPage;
    tableElementColumn.appendChild(frameObject);
    tableElementRow.appendChild(tableElementColumn);
    tbody.appendChild(tableElementRow);
    tableElement.appendChild(tbody);
    
    divElement3.appendChild(tableElement);
    divElement2.appendChild(divElement3);
    
    divElement1.appendChild(divElement2);

	var divElement4 = document.createElement("div");
	divElement4.className = "jitk-floating-panel-footer";
	divElement4.appendChild(document.createTextNode("Browse to the locally stored .SVG file you want to import."));
	divElement1.appendChild(divElement4);

	pe.divObject = document.body.appendChild(divElement1);
	pe.divId = pe.divObject.id = divId;
    win = new JitkWindow(divId, title, pe);
    win.isRendered = true;
    win.init();
    win.resize(320,186);
    win.center();
    win.addUpdateListener("jitk-import-svg-win-listener", winListener);
  }
  
  this.getFrameDiv = function(){
    return pe;
  }

  //filename, id
  this.processImportSVG = function() {
    win.removeUpdateListener("jitk-import-svg-win-listener");
    destroyWindow();
    listener();
  }
  
  this.closeWindow = function() { destroyWindow(); }
  function winListener(win) { if (win.closed) listener = null; }

  function destroyWindow() {
    win.hide();
    pe = pe.divObject = pe.divId = win = win.divObject = win.divId = null;
  }
}

⌨️ 快捷键说明

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