Java實現點在線添加的方法

來源:文萃谷 6.64K

Java如何實現點在線添加,下面YJBYS小編為大家整理了相關資料,希望對你有所幫助。內容如下:

Java實現點在線添加的方法

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();

}

}

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

熱門標籤