如何使用IFeatureProgress接口显示数据转换时的进度?
如何使用IFeatureProgress接口显示数据转换时的进度?
发起人
-
刘峥
ArcGIS多面手
相关问题
- 如何优雅的使用ArcGIS知乎?
- 作为Desktop用户对数据的获取比较乏力,可能缺了哪些知识?
- 有谁知道哪里可以免费获取各省市地图数据呢,包括详细的shape文件数据
- 苹果系统下可以使用arcgis 吗?
- 有栅格数据a(大数据),小数据b,怎么从a中扣掉b,得到a数据剩下的部分?栅格能裁剪取反吗?
- 在Visual studio 2015 中使用 Arcgis API for JavaScript v3.16 如何实现代码智能提示?
- 用ArcMap输入7参数,从wgs84坐标系转西安80坐标系,转后误差较大,4米左右,请问这是正常的吗?如何能提高转换精度?
- 请问arcmap如何使用多线程?
- 在windows server2008 R2 64位中安装了portal 10.5 设置好托管arcgis server站点,并用data store为托管数据库,发布数据出错
- arcgis10.4 离线部署js api 4.3 版本 无法显示
- 如何使用脚本或其他方法,将图层属性中属性域原值内容替换为属性域描述?
问题状态
- 最新活动: 2015-11-26 23:32
- 浏览: 1626
- 关注: 1 人
1 个回复
刘峥 - ArcGIS多面手
赞同来自:
参考链接::http://support.esri.com/en/kno ... 34908
1. 首先构建FeatureProgressHelper类:
private class FeatureProgressHelper : IFeatureProgress
{
private int featureCount = 0;
private int stepValue = 0;
String IFeatureProgress.FeatureClassName
{
set { Console.WriteLine(FeatureClassName: {0}, value); }
}
Boolean IFeatureProgress.IsCancelled
{
get { return false; }
}
int IFeatureProgress.MaxFeatures
{
set { Console.WriteLine(MaxFeatures: {0}, value); }
}
int IFeatureProgress.MinFeatures
{
set { Console.WriteLine(MinFeatures: {0}, value); }
}
int IFeatureProgress.Position
{
set { Console.WriteLine(Position: {0}, value); }
}
void IFeatureProgress.Step()
{
// Increment the number of features replicated and display the progress.
featureCount += stepValue;
Console.WriteLine({0} features replicated., featureCount);
}
int IFeatureProgress.StepValue
{
set { stepValue = value; }
}
}
public FeatureProgressHelper(IConnectionPointContainer connectionPointContainer)
{
// Get the event source''s connection points.
IEnumConnectionPoints enumConnectionPoints = null;
connectionPointContainer.EnumConnectionPoints(out enumConnectionPoints);
enumConnectionPoints.Reset();
// Iterate through the connection points until one for IFeatureProgress is found.
IConnectionPoint connectionPoint = null;
Guid featureProgressGuid = typeof(IFeatureProgress).GUID;
uint pcFetched = 0;
enumConnectionPoints.RemoteNext(1, out connectionPoint, out pcFetched);
while (connectionPoint != null)
{
Guid connectionInterfaceGuid;
connectionPoint.GetConnectionInterface(out connectionInterfaceGuid);
if (connectionInterfaceGuid == featureProgressGuid)
{
break;
}
enumConnectionPoints.RemoteNext(1, out connectionPoint, out pcFetched);
}
// If IFeatureProgress wasn''t found, throw an exception.
if (connectionPoint == null)
{
throw new ArgumentException(An IFeatureProgress connection point could not be found.);
}
// Tie into the connection point.
uint connectionPointCookie = 0;
connectionPoint.Advise(this, out connectionPointCookie);
}
2. 然后在进行数据转换时调用,以IFeatureDataConverter接口为例:
IFeatureDataConverter featureDataConverter = new FeatureDataConverterClass();
IConnectionPointContainer connectionPointContainer = (IConnectionPointContainer)featureDataConverter;
FeatureProgressHelper featureProgressHelper = new FeatureProgressHelper(connectionPointContainer);
要回复问题请先登录或注册