久久久久无码精品,四川省少妇一级毛片,老老熟妇xxxxhd,人妻无码少妇一区二区

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

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

Java如何實現(xià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");// 實例名

  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如何實現(xiàn)點的在線添加】相關(guān)文章:

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

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

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

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

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

Java語言的特點和實現(xiàn)機制10-01

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

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

PPT如何添加超鏈接09-28

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