當前位置:才華齋>IT認證>SUN認證>

Java如何實現點的在線添加

SUN認證 閲讀(7.81K)

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

}

}

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