JAVA GIS控製圖層顯示方法

來源:互聯網
上載者:User

import com.esri.adf.web.ags.data.AGSMapFunctionality;
import com.esri.adf.web.data.GISResource;
import com.esri.adf.web.data.WebContext;
import com.esri.arcgisws.LayerDescription;
import com.esri.arcgisws.MapDescription;

 

......................

 

//取得gis資源

GISResource rec=(GISResource)context.getResources().get("ags0");

//取得AGSMapFunctionality 函數
   AGSMapFunctionality ags=(AGSMapFunctionality)rec.getFunctionality("map");
   MapDescription des=ags.getMapDescription();
   LayerDescription[] layers= ags.getLayerDescriptions();
   for(int i=0;i<layers.length;i++)
   {
    LayerDescription layer=layers[i];

    //控制顯示標註
    layer.setShowLabels(false);

    //控制是否顯示
    layer.setVisible(false);
   }

   context.refresh();

 

//控製圖層中要素的顯示

AGSMapResource rec = (AGSMapResource) context.getResources().get(
     "ags0");
   MapServerPort mapserverport = rec.getMapServer();
   MapServerInfo mapinfo = mapserverport.getServerInfo(mapserverport
     .getDefaultMapName());
   MapLayerInfo[] layerInfos = mapinfo.getMapLayerInfos();
   
   AGSMapFunctionality ags = (AGSMapFunctionality) rec
     .getFunctionality("map");
   LayerDescription[] laydescs= ags.getLayerDescriptions();
   for(int i=0;i<layerInfos.length;i++)
   {
    if (layerInfos[i].getName().equalsIgnoreCase("圖層名稱"))
    {

     //設定查詢要素條件
     laydescs[i].setDefinitionExpression("SITENAME='666'");
    }
   }

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.