http://bbs.esrichina-bj.cn/ESRI/viewthread.php?action=printable&tid=128564

public void CreateRoutesUsing2Fields(string sAccessWS, string sLineFC, string sOutRouteFC, string sWhereClause, string sRouteIDField, string sFromMeasureField, string sToMeasureField)
{
try
{
IWorkspaceFactory wsf = new AccessWorkspaceFactoryClass();
IWorkspace ws = wsf.OpenFromFile(sAccessWS, 0);
IFeatureWorkspace fws = (IFeatureWorkspace)ws;
IFeatureClass lineFC = fws.OpenFeatureClass(sLineFC);

// Create an output feature class name object. We'll write to a stand alone feature class in the
// the same workspace as the inputs
IDataset ds = (IDataset)ws;
IWorkspaceName outWSN = (IWorkspaceName)ds.FullName;
IFeatureClassName outFCN = new FeatureClassNameClass();
IDatasetName outDSN = (IDatasetName)outFCN;
outDSN.WorkspaceName = outWSN;
outDSN.Name = sOutRouteFC; //This name should not already exist

// Create a geometry definition for the new feature class. For the most part, we will copy the geometry
// definition from the input lines. We'll explicitly set the M Domain, however. You should always set an
// M Domain that is appropriate to your data. What is below is just a sample.
IFields flds = lineFC.Fields;
Int32 i = flds.FindField(lineFC.ShapeFieldName);
IField fld = flds.get_Field(i);
IClone GDefclone = (IClone)fld.GeometryDef;
IGeometryDef gDef = (IGeometryDef)GDefclone.Clone();
ISpatialReference2 srRef = (ISpatialReference2)gDef.SpatialReference;
srRef.SetMFalseOriginAndUnits(-1000, 10000);

// Create a selection set to limit the number of lines that will be used to create routes
IQueryFilter qFilt = new QueryFilterClass();
qFilt.WhereClause = sWhereClause;
ISelectionSet2 selSet = (ISelectionSet2)lineFC.Select(qFilt, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, ws);

// Create a new RouteMeasureCreator object. Note that below, we use the selection set and not the
// InputFeatureClass property
IRouteMeasureCreator routeCreator = new RouteMeasureCreatorClass();
routeCreator.InputFeatureSelection = selSet;
routeCreator.InputRouteIDFieldName = sRouteIDField;
IEnumBSTR errors = routeCreator.CreateUsing2Fields(sFromMeasureField, sToMeasureField, outFCN, gDef, "", null);

// The results of running CreatingUsing2Fields returns IEnumBSTR, which is a container
// for a list of error strings indicating why certain lines could not be used to create routes.
string sError = errors.Next();
do
{
System.Windows.Forms.MessageBox.Show(sError);
sError = errors.Next();
} while (sError.Length != 0);
}
catch(Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
}

这段代码能否实现创建路径功能???
CreateUsing2Fields(sFromMeasureField, sToMeasureField, outFCN, gDef, "", null);
上面一行代码各个参数是什么意思呀~~为什么运行的时候出现错误

Mark 创建路径(c#)-动态分段的更多相关文章

  1. eclipse 创建maven 项目 动态web工程报错

    Eclipse 创建maven 项目 动态web工程 注:Eclipse版本为(Version: Mars.1 Release (4.5.1))maven版本为(apache-maven-3.3.9) ...

  2. eclipse 创建maven 项目 动态web工程完整示例

    需求表均同springmvc案例 此处只是使用maven 注意,以下所有需要建立在你的eclipse等已经集成配置好了maven了,说白了就是新建项目的时候已经可以找到maven了 没有的话需要安装m ...

  3. eclipse 创建maven 项目 动态web工程完整示例 maven 整合springmvc整合mybatis

    接上一篇: eclipse 创建maven 项目 动态web工程完整示例 eclipse maven工程自动添加依赖设置 maven工程可以在线搜索依赖的jar包,还是非常方便的 但是有的时候可能还需 ...

  4. Android 通过Java代码生成创建界面。动态生成View,动态设置View属性。addRules详解

    废话不多说,本文将会层层深入给大家讲解如何动态的生成一个完整的界面. 本文内容: Java代码中动态生成View Java代码中动态设置View的位置,以及其他的属性 LayoutParams详解 一 ...

  5. # 2017-2018-2 20155228 《信息安全系统设计原理》 使用VirtualStudio2008创建和调用静态库和使用VirtualC++6.0创建和调用动态库

    使用virtual c++ 6.0创建和调用动态库 不得不说一下关于环境的问题 只要我打一个响指,一半的安装在win7上的VC6.0都会因为兼容性问题直接崩掉 懒得研究怎么解决兼容性的问题了,直接开一 ...

  6. windows 创建和调用 动态库,静态库

    windows创建和调用静态库 // MathFuncsLib.h namespace MathFuncs { class MyMathFuncs { public: // Returns a + b ...

  7. c++ 创建路径方法

    linux.unix平台 #include "stdio.h" #include "stdlib.h" #include <sys/types.h> ...

  8. [Swift通天遁地]九、拔剑吧-(3)创建多种自定义Segment分段样式的控件

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  9. activiti 5.15.1 动态手动通过java编码方式,实现创建用户任务,动态指定个人,用户组,角色,指定监听的实现

    因为我们的业务需要,最近一直在搞动态动过java程序实现为用户任务绑定监听程序.碰了很多壁,查看了API文档,最后终于在找到解决办法,所以贴出来,希望能够留个底,也能帮助有需要的人. -------- ...

随机推荐

  1. 使用python编写的简单远程管理软件

    因为用户可以选择是否同意被控制,所以并不算是木马. 使用python3.7,spyder,在windows 10 开发. client为控制端,server为被控端. 参考 mygithub http ...

  2. react中的jsx详细理解

    这是官网上的一个简单的例子 const name = 'Josh Perez'; const element = <h1>Hello, {name}</h1>; ReactDO ...

  3. 【转】关于编写WPF UserControl时提示The name 'InitializeComponent' does not exist in the current contextr的解决!

    1.打开.csproj(工程)文件. 2.找到<Import Project="$(MSBuildBinPath)/Microsoft.CSharp.targets" /&g ...

  4. Linux内核网络数据包处理流程

    Linux内核网络数据包处理流程 from kernel-4.9: 0. Linux内核网络数据包处理流程 - 网络硬件 网卡工作在物理层和数据链路层,主要由PHY/MAC芯片.Tx/Rx FIFO. ...

  5. Springboot 图标更换

    1.将自己的logo图片转为.ico格式的,命名必须为[favicon.ico] 2.将该图片直接放在src/main/resourecs目录下 3.重启项目,刷新一下浏览器缓存,就会发现图标更换了

  6. java中的缓存技术该如何实现

    1缓存为什么要存在?2缓存可以存在于什么地方?3缓存有哪些属性?4缓存介质? 搞清楚这4个问题,那么我们就可以随意的通过应用的场景来判断使用何种缓存了. 1. 缓存为什么要存在?一 般情况下,一个网站 ...

  7. (2) OpenSSL命令

    openssl命令的格式是"openssl command command-options args",command部分有很多种命令,这些命令需要依赖于openssl命令才能执行 ...

  8. mysql主从同步 change master to配置

    CHANGE MASTER TO MASTER_HOST='10.0.0.52', MASTER_PORT=3308, MASTER_AUTO_POSITION=1, MASTER_USER='rep ...

  9. HTML5增加与改良的input元素

    h5中form表单中input新增的属性值 在HTML5中增加了许多新的标签和功能属性,今天我们来看一个Form表单在HTML5中新的使用方法.那么在HTML5中新加入的这个功能与之前咱们使用的功能区 ...

  10. 年华利率n%

    年化利率12%指的是,在您出借的本金不减少的情况下,您一年后的利息将达到您出借本金的12%.也就是说,如果年化利率是12%,则每月您出借资金获得的利息是1%(12% / 12个月). 在有利网,您的投 ...