小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

server 專(zhuān)題圖

 WindySky 2009-01-07

專(zhuān)題圖需要使用擴(kuò)展map的方式來(lái)實(shí)現(xiàn),我把步驟說(shuō)一下,請(qǐng)您試一下!

1、后臺(tái)java代碼

package com.supermap.server.components;

import java.util.*;
import com.supermap.services.commontypes.*;

public class MyMap extends Map{
    public MyMap(String mapName, String hostAddress, int port, HashMap stateManager) {
        //調(diào)用父類(lèi)構(gòu)造函數(shù)
        super(mapName, hostAddress, port, stateManager);
    }

    //重載父類(lèi)Map的execute方法
    public boolean execute(String command, String parameter) {
        //調(diào)用父類(lèi)的execute方法,并將父類(lèi)execute方法的返回值附給變量flag
        boolean flag = super.execute(command, parameter);

        //如果flag為false,說(shuō)明父類(lèi)對(duì)傳入的command命令不能處理,此時(shí)對(duì)父類(lèi)進(jìn)行擴(kuò)展,處理父類(lèi)execute方法不能處理的命令
        if(!flag){
   if (command.equals("makeXXX")) {//自己定義的名稱(chēng)
    ...//實(shí)例化專(zhuān)題圖對(duì)象代碼themeXXX

    MapParam mapParam = super.getMapParam();
    LayerCollection layerCollection = (LayerCollection) mapParam.layerCollection
      .get(this.getMapName());
    boolean success = false;
    SuperMapLayerSetting superMapLayerSetting = null;
    Layer newLayer = null;
    if (layerCollection != null) {
     Layer layer = (Layer) layerCollection.get("XX@XX");//要做專(zhuān)題圖的圖層名稱(chēng)格式是:數(shù)據(jù)集@數(shù)據(jù)源
     if (layer != null && layer.isHavingValidDatasetInfo()) {
      SuperMapLayerSetting layerSetting = (SuperMapLayerSetting) layer.getLayerSetting();
      DatasetInfo datasetInfo = new DatasetInfo(layerSetting.datasetInfo);
      if (datasetInfo != null) {
       superMapLayerSetting = new SuperMapLayerSetting(themeXXX, layerSetting);
      }
     }
    }
    if (superMapLayerSetting != null) {
     newLayer = new Layer(superMapLayerSetting);
     newLayer.visible = true;
     success = layerCollection.addLayer(true, newLayer);
     if (success) {
      ISession session = this.getSession();
      session.setAttribute(XMLTool.getNodeText(parameter,"mapName")+ "_"+ mapParam.layerCollection.hashCode() + "", mapParam.layerCollection);
      session.setAttribute(session.getId()+ this.getMapName(), this);
      this.commandResultsList.put(command,mapParam.layerCollection.hashCode() + "");
     } else {
      System.out.println("添加專(zhuān)題圖層失敗");
     }
    }
  }
        return flag;
    }
}

2、設(shè)置mapconfig.xml文件

<map mapClass="com.supermap.server.components.MyMap(上面代碼里面的包名+類(lèi)名)" mapId="MyMap(隨便起的)">
3、修改加載的mapname名稱(chēng),改為上面的mapid

4、javascript代碼調(diào)用

 function makeXXX()\\函數(shù)名任意

{
  SuperMap.Committer.commitMapCmd("MyMap"(與mapname的名字相同), "makeXXX(與自己定義的方法相同)", null,null(如果不需要傳遞參數(shù)兩個(gè)都為null), onquerybysqlComplete(回調(diào)函數(shù)));
 }
 function onquerybysqlComplete(e)
 {
  mapControl.getMap()._params.layersKey = e;
  mapControl.refreshMapControl();

 }

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀(guān)點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多