亚洲国产日韩欧美在线a乱码,国产精品路线1路线2路线,亚洲视频一区,精品国产自,www狠狠,国产情侣激情在线视频免费看,亚洲成年网站在线观看

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

時(shí)間: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{

  // 建立一個(gè)工作空間工廠對(duì)象,并設(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ù)的原因是:由于在開(kāi)始編輯時(shí)新打開(kāi)了一個(gè)工作空間,該工作空間并不是瀏覽器中看到地圖所在的工作空間。

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

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

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

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

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

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

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

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

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

PPT如何添加超鏈接09-28

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