Java如何實(shí)現(xiàn)點(diǎn)的在線添加

    時間:2024-07-09 02:58:30 SUN認(rèn)證 我要投稿
    • 相關(guān)推薦

    Java如何實(shí)現(xiàn)點(diǎn)的在線添加

      public void addPoint(MapEvent event){

      AGSLocalMapResource res = (AGSLocalMapResource)this.webContext.getResources().get("ags0");

      try{

      // 建立一個工作空間工廠對象,并設(shè)置它的參數(shù)信息。

      SdeWorkspaceFactory sdewf = (SdeWorkspaceFactory)res.getServerContext().createObject(SdeWorkspaceFactory.getClsid());

      PropertySet pset = (PropertySet)res.getServerContext().createObject(PropertySet.getClsid());

      pset.setProperty("SERVER", "gxk");// 服務(wù)器名稱

      pset.setProperty("INSTANCE", "5151");// 實(shí)例名

      pset.setProperty("USER", "sa"); // SDE數(shù)據(jù)表空間的用戶名

      pset.setProperty("PASSWORD", "sa");// 密碼

      pset.setProperty("VERSION", "DBO.gxk");// SDE數(shù)據(jù)的版本

      Workspace iws =(Workspace) sdewf.open(pset, 0);

      WebPoint screenPoint = (WebPoint)event.getWebGeometry();

      WebMap mapctrl = event.getWebContext().getWebMap();

      WebPoint mappnt =WebPoint.toMapPoint(screenPoint, mapctrl.getCurrentExtent(), (int)mapctrl.getWidth(), (int)mapctrl.getHeight());

      Geometry soapgeo=AGSUtil.toAGSGeometry(mappnt);

      String soapString = com.esri.adf.web.ags.util.AGSUtil.serializeStub(soapgeo);

      soapString = soapString.replaceAll("xsi:type=\"soapenc:Array\"", "");

      IPoint mypoint = (IPoint)AGSUtil.deserializeArcObject(soapString, res.getServerContext());

      IWorkspaceEdit wse = (IWorkspaceEdit)iws;

      wse.startEditing(false);

      wse.startEditOperation();

      IFeatureClass featureclass = iws.openFeatureClass("sde.DBO.Respt");

      IFeature feature = featureclass.createFeature();

      feature.setShapeByRef((IGeometry)mypoint);

      feature.setValue(feature.getFields().findField("NAME"), "kkk");

      feature.store();

      wse.stopEditOperation();

      wse.stopEditing(true);

      this.webContext.refresh();

      }catch(Exception e){

      e.printStackTrace();

      }

      }

      刷新地圖后不能顯示新加入的數(shù)據(jù)的原因是:由于在開始編輯時新打開了一個工作空間,該工作空間并不是瀏覽器中看到地圖所在的工作空間。

    【Java如何實(shí)現(xiàn)點(diǎn)的在線添加】相關(guān)文章:

    Java如何實(shí)現(xiàn)簡單的whois查詢09-21

    Java byte[]轉(zhuǎn)int如何實(shí)現(xiàn)05-24

    實(shí)現(xiàn)鼠標(biāo)畫圖的Java程序06-22

    Java多線程的實(shí)現(xiàn)方式07-08

    Java動態(tài)代理實(shí)現(xiàn)AOP的方法07-22

    Java語言的特點(diǎn)和實(shí)現(xiàn)機(jī)制10-01

    使用JavaScript實(shí)現(xiàn)Java的List功能10-26

    word如何添加標(biāo)題樣式06-26

    PPT如何添加超鏈接09-28

    如何添加用戶對網(wǎng)站的黏度?08-08

    91久久大香伊蕉在人线_国产综合色产在线观看_欧美亚洲人成网站在线观看_亚洲第一无码精品立川理惠

      夜夜爽一区二区三区精品 | 亚洲午夜成激人情在线影院 | 亚洲欧美在线综合图区 | 中文字幕你懂的免费看 | 亚洲欧美国产日韩字幕 | 亚洲人成影院在线高清 |