CustomClass.js
资源名称:arcims.rar [点击查看]
上传用户:gzuoyue
上传日期:2022-07-08
资源大小:177k
文件大小:6k
源码类别:
GIS编程
开发平台:
ASP/ASPX
- /*
- * @class 动态图层处理
- */
- function GmapIms(){
- this.CustonmsStartId = 5;
- this.bCustomLayer = false;
- this.mapservice;
- this.mapserver;
- this.mapport;
- this.ProApply = 0;
- this.LayerList = '';
- this.LayerArcXML = '';
- this.LayerArcXmlString = '';
- this.ActiveLayer = -1;
- this.sActiveLayer = '';
- /***************************************
- 设置参数
- ***************************************/
- this.getMapService = function(){
- return this.mapservice;
- }
- this.getMapServer = function(){
- return this.mapserver;
- }
- this.getMapPort = function(){
- return this.mapport;
- }
- this.getProApply = function(){
- return this.ProApply;
- }
- this.setActiveLayer = function(i){
- if (i<0) i=-1;
- this.ActiveLayer = i;
- return this.ActiveLayer;
- }
- this.getActiveLayer = function(){
- return this.ActiveLayer;
- }
- /**
- * 地图服务器
- */
- this.setMapService = function(val){
- this.mapservice = val;
- return this.mapservice;
- }
- /**
- * 地图服务名
- */
- this.setMapServer = function(val){
- this.mapserver = val;
- return this.mapserver;
- }
- /**
- * 地图端口
- */
- this.setMapPort = function(val){
- this.mapport = val;
- return this.mapport;
- }
- /**
- * 程序应用类型
- */
- this.setProApply = function(val){
- this.ProApply = val;
- return this.ProApply;
- }
- this.setActiveLayerString = function(memo){
- this.sActiveLayer = memo;
- return this.sActiveLayer;
- }
- this.getActiveLayerString = function(){
- return this.sActiveLayer;
- }
- /***************************************
- 处理集
- ***************************************/
- /**
- * 加载动态图层
- * 角色/工作区
- * 角色(1)/工作区(2) 类型
- */
- this.getMapCustomLayer = function(id,type){
- var _sTmp = id+','+type+',';
- this.setCustomLayer(this.getServer('CustomLayer',_sTmp));
- }
- this.getMapCustomLayerList = function(List){
- var _sTmp = List+',';
- this.setCustomLayer(this.getServer('CustomLayerList',_sTmp));
- }
- /**
- * 设置动态图层XML列到参数
- */
- this.setCustomLayer = function(memo){
- return this.LayerArcXML = memo;
- }
- /**
- * 设置动态图层string列,用于arcxml
- */
- this.setCustomLayerString = function(memo){
- this.LayerArcXmlString = memo;
- return this.LayerArcXmlString;
- }
- /**
- * 修改层属性
- */
- this.setLayerVisible = function(arrLayerVisible){
- //alert(LayerVisible);
- var arrLayer = new Array();
- var arrOldLayer = new Array();
- var LayerNum = 0;
- arrOldLayer = arrLayerVisible.split(',');
- arrLayer = this.getCustomLayerString().split('visible="');
- for (var i=1;i<arrLayer.length;i++){
- startpos = arrLayer[i].indexOf('"');
- len = arrLayer[i].length;
- var Yu = '';
- //alert(arrLayer[i]);
- if (arrLayer[i].substring(arrLayer[i],startpos)=='true'){
- Yu = arrLayer[i].substring(4,len);
- arrLayer[i] = 'visible="'+ arrOldLayer[LayerNum] + Yu;
- }else{
- Yu = arrLayer[i].substring(5,len);
- arrLayer[i] = 'visible="'+ arrOldLayer[LayerNum] + Yu;
- }
- LayerNum++;
- }
- //alert(arrLayer.join(' '));
- this.setCustomLayerString(arrLayer.join(''));
- this.setCustomLayer('<Table>'+this.getCustomLayerString()+'</Table>');
- }
- /**
- * 返回图层列
- */
- this.getCustomLayer = function(){
- return this.LayerArcXML;
- }
- /**
- * 返回图层列
- */
- this.getCustomLayerList = function(){
- return this.LayerList;
- }
- /**
- * 返回图层列
- */
- this.getCustomLayerString = function(){
- return this.LayerArcXmlString;
- }
- /***********************************************************
- 和服务器交互
- ***********************************************************/
- /**
- * 提交到服务器,返回结果
- */
- this.getServer = function(liname,memo){
- var varList = new Array();
- if (memo!=''){
- varList = memo.split(',');
- }
- var typename = liname.toUpperCase();
- var returnstring = '';
- switch(typename){
- case 'MAPSERVER':
- //returnstring = qx.ImsDisposal.getArcIms().value;
- break;
- case 'CUSTOMLAYER':
- //this.setCustomLayerString(qx.CustomLayer.CreateCustomLayer(varList[0],this.getProApply(),this.getProApply(),this.CustonmsStartId,varList[1]).value);
- //returnstring = '<Table>'+this.getCustomLayerString()+'</Table>';
- break;
- case 'CUSTOMLAYERLIST':
- //this.setCustomLayerString(qx.CustomLayer.CreateCustonLayerList(varList[0],this.getProApply(),this.CustonmsStartId).value);
- //returnstring = '<Table>'+this.getCustomLayerString()+'</Table>';
- break;
- }
- return returnstring;
- }
- }//arcims end
- /*
- * @class 处理xml类
- */
- function XMLHelper(){
- this.xmlHttp;
- this.Init = function(){
- if (window.ActiveXObject) {
- this.xmlHttp = new ActiveXObject("Microsoft.XMLDOM");
- }
- else if (window.XMLHttpRequest) {
- this.xmlHttp = new XMLHttpRequest();
- }
- }
- this.LoadXmlString = function(XMLString){
- if (XMLString == ""){
- return
- }else{
- this.xmlHttp.loadXML(XMLString);
- }
- }
- /**
- * 返回一个节点的函数
- */
- this.getLayerAtt = function(nodename,sName){
- var nodeLength = this.xmlHttp.getElementsByTagName(nodename).length;
- var sAttstring = '';
- try{
- for (var i=0;i<nodeLength-1;i++){
- var elDocRoot=_MXml.xmlHttp.getElementsByTagName(nodename)[i];
- if (elDocRoot){
- var attrs = elDocRoot.attributes;
- sAttstring = attrs.getNamedItem(sName).value;
- }
- }
- }catch(e){
- sAttstring="";
- }
- return sAttstring;
- }
- /**
- * 返回一个节点的函数的内容
- */
- this.getNodeAtt = function(node,name){
- var AttString='';
- try{
- AttString = node.getNamedItem(name).value;
- }catch(e){
- AttString = '';
- }
- return AttString;
- }
- /**
- * 设置一个节点的函数的值
- */
- this.setNodeAtt = function(node,name,attString){
- if (node!=null){
- node.getNamedItem(name).value = attString;
- }
- }
- this.Init();
- }