public void addPoint(MapEvent event){
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();
}
}
刷新地图后不能显示新加入的数据的原因是:由于在开始编辑时新打开了一个工作空间,该工作空间并不是浏览器中看到地图所在的工作空间。