参考论坛一些朋友的帖子实现点的在线添加但是也存在问题问题是新加入的点在WebContent进行刷新后不能马上显示出来需要重新打开一个浏览器窗口浏览才能看到刚加入的点希望大家给予指导谢谢
public void addPoint(MapEvent event){
AGSLocalMapResource res = (AGSLocalMapResource)thiswebContextgetResources()get(ags);
try{
// 建立一个工作空间工厂对象并设置它的参数信息
SdeWorkspaceFactory sdewf = (SdeWorkspaceFactory)resgetServerContext()createObject(SdeWorkspaceFactorygetClsid());
PropertySet pset = (PropertySet)resgetServerContext()createObject(PropertySetgetClsid());
psetsetProperty(SERVER gxk);// 服务器名称
psetsetProperty(INSTANCE );// 实例名
psetsetProperty(USER sa); // SDE数据表空间的用户名
psetsetProperty(PASSWORD sa);// 密码
psetsetProperty(VERSION DBOgxk);// SDE数据的版本
Workspace iws =(Workspace) sdewfopen(pset );
WebPoint screenPoint = (WebPoint)eventgetWebGeometry();
WebMap mapctrl = eventgetWebContext()getWebMap();
WebPoint mappnt =WebPointtoMapPoint(screenPoint mapctrlgetCurrentExtent() (int)mapctrlgetWidth() (int)mapctrlgetHeight());
Geometry soapgeo=AGSUtiltoAGSGeometry(mappnt);
String soapString = comesriadfwebagsutilAGSUtilserializeStub(soapgeo);
soapString = soapStringreplaceAll(xsi:type=\soapenc:Array\ );
IPoint mypoint = (IPoint)AGSUtildeserializeArcObject(soapString resgetServerContext());
IWorkspaceEdit wse = (IWorkspaceEdit)iws;
wsestartEditing(false);
wsestartEditOperation();
IFeatureClass featureclass = iwsopenFeatureClass(sdeDBORespt);
IFeature feature = featureclasscreateFeature();
featuresetShapeByRef((IGeometry)mypoint);
featuresetValue(featuregetFields()findField(NAME) kkk);
featurestore();
wsestopEditOperation();
wsestopEditing(true);
thiswebContextrefresh();
}catch(Exception e){
eprintStackTrace();
}
}
刷新地图后不能显示新加入的数据的原因是由于在开始编辑时新打开了一个工作空间该工作空间并不是浏览器中看到地图所在的工作空间