當前位置:文思屋>社會工作>IT認證>

Java如何實現點的線上新增

文思屋 人氣:1.54W

public void addPoint(MapEvent event){

Java如何實現點的線上新增

AGSLocalMapResource res = (AGSLocalMapResource)esources()("ags0");

try{

// 建立一個工作空間工廠物件,並設定它的引數資訊。

SdeWorkspaceFactory sdewf = (SdeWorkspaceFactory)erverContext()teObject(lsid());

PropertySet pset = (PropertySet)erverContext()teObject(lsid());

roperty("SERVER", "gxk");// 伺服器名稱

roperty("INSTANCE", "5151");// 例項名

roperty("USER", "sa"); // SDE資料表空間的使用者名稱

roperty("PASSWORD", "sa");// 密碼

roperty("VERSION", "");// SDE資料的版本

Workspace iws =(Workspace) (pset, 0);

WebPoint screenPoint = (WebPoint)ebGeometry();

WebMap mapctrl = ebContext()ebMap();

WebPoint mappnt =pPoint(screenPoint, urrentExtent(), (int)idth(), (int)eight());

Geometry soapgeo=SGeometry(mappnt);

String soapString = alizeStub(soapgeo);

soapString = aceAll("xsi:type="soapenc:Array"", "");

IPoint mypoint = (IPoint)rializeArcObject(soapString, erverContext());

IWorkspaceEdit wse = (IWorkspaceEdit)iws;

tEditing(false);

tEditOperation();

IFeatureClass featureclass = FeatureClass("t");

IFeature feature = teFeature();

hapeByRef((IGeometry)mypoint);

alue(ields()Field("NAME"), "kkk");

e();

EditOperation();

Editing(true);

esh();

}catch(Exception e){

tStackTrace();

}

}

重新整理地圖後不能顯示新加入的.資料的原因是:由於在開始編輯時新打開了一個工作空間,該工作空間並不是瀏覽器中看到地圖所在的工作空間。

TAGS:Java