Java如何實現點線上新增,下面YJBYS小編為大家整理了相關資料,希望對你有所幫助。內容如下:
public void addPoint(MapEvent event){
AGSLocalMapResource res = (AGSLocalMapResource)esources()。get(“ags0”);
try{
// 建立一個工作空間工廠物件,並設定它的引數資訊。
SdeWorkspaceFactory sdewf = (SdeWorkspaceFactory)erverContext()。createObject(lsid());
PropertySet pset = (PropertySet)erverContext()。createObject(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()。getWebMap();
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()。findField(“NAME”), “kkk”);
e();
EditOperation();
Editing(true);
esh();
}catch(Exception e){
tStackTrace();
}
}
重新整理地圖後不能顯示新加入的資料的原因是:由於在開始編輯時新打開了一個工作空間,該工作空間並不是瀏覽器中看到地圖所在的工作空間。