Java实现点在线添加的方法
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”);// k1gz-0.html" target="_blank" >服务器名称
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();
}
}
刷新地图后不能显示新加入的数据的原因是:由于在开始编辑时新打开了一个工作空间,该工作空间并不是浏览器中看到地图所在的工作空间。