Breaking Up Polylines 

http://forums.esri.com/Thread.asp?c=93&f=987&t=74554&mc=4#msgid197545

 

It appears as though IGeometryCollection is the way to go here, rather than ISegmentCollection. I noticed that the "ISegmentCollection" version created 905 line segments (from 15 polylines). ISegmentCollection created a line for every Single PAIR of vertices - 905 straight, two vertex lines. 

There is no way I could have put this thing together at this point. Thanks for getting the ball rolling. 

Hopefully, this can be useful to other users. Multipart lines can be a huge pain when you don't want them. 

Sub ExplodePolyLines()

'

' From the original by Kirk Kuykendall.

'

Dim pUID As New UID

pUID.Value = "esricore.Editor"

 

Dim pEditor As IEditor

Set pEditor = Application.FindExtensionByCLSID(pUID)

 

If pEditor.EditState <> esriStateEditing Then

MsgBox "Make a shapefile editable."

Exit Sub

End If

 

Dim pEditlayers As IEditLayers

Set pEditlayers = pEditor

 

If pEditlayers.CurrentLayer.FeatureClass.ShapeType <> esriGeometryPolyline Then

Exit Sub

End If

 

Dim pFSel As IFeatureSelection

Set pFSel = pEditlayers.CurrentLayer

 

If pFSel.SelectionSet.Count = 0 Then

MsgBox "Select features to be broken up."

Exit Sub

End If

 

Dim pFCur As IFeatureCursor

pFSel.SelectionSet.Search Nothing, False, pFCur

 

pEditor.StartOperation

Dim pFeat As IFeature

Set pFeat = pFCur.NextFeature

Do Until pFeat Is Nothing

Dim pInGeomColl As IGeometryCollection

''' Dim pInSegColl As ISegmentCollection

''' Set pInSegColl = pFeat.ShapeCopy

Set pInGeomColl = pFeat.ShapeCopy

 

Application.StatusBar.Message(0) = "Exploding " & pFeat.OID

Dim l As Long

''' For l = 0 To pInSegColl.SegmentCount - 1

For l = 0 To pInGeomColl.GeometryCount - 1

''' Dim pOutSegColl As ISegmentCollection

''' Set pOutSegColl = New Polyline

Dim pOutGeomColl As IGeometryCollection

Set pOutGeomColl = New Polyline

''' pOutSegColl.AddSegment pInSegColl.Segment(l)

pOutGeomColl.AddGeometry pInGeomColl.Geometry(l)

Dim pOutFeat As IFeature

Set pOutFeat = pEditlayers.CurrentLayer.FeatureClass.CreateFeature

Dim k As Long

For k = 0 To pOutFeat.Fields.FieldCount - 1

If pOutFeat.Fields.Field(k).Editable Then

If pOutFeat.Fields.Field(k).Type <> esriFieldTypeGeometry Then

pOutFeat.Value(k) = pFeat.Value(k)

End If

End If

Next k

''' Set pOutFeat.Shape = pOutSegColl

Set pOutFeat.Shape = pOutGeomColl

pOutFeat.Store

Next l

pFeat.Delete

Set pFeat = pFCur.NextFeature

Loop

pEditor.StopOperation "Explode"

 

Dim pMxDoc As IMxDocument

Set pMxDoc = pEditor.Parent.Document

Dim pAV As IActiveView

Set pAV = pMxDoc.FocusMap

Dim lCacheID As Long

lCacheID = pAV.ScreenCacheID(esriViewGeoSelection, Nothing)

pAV.ScreenDisplay.Invalidate Nothing, True, lCacheID

MsgBox "Done"

End Sub

Multipart polyline to single part lines的更多相关文章

  1. Multipart to single part feature

    Multipart to single part feature Explode Link: http://edndoc.esri.com/arcobjects/8.3/?URL=/arcobject ...

  2. [非官方]ArcGIS10.2 for Desktop扩展工具包——XTools Pro

    XTools Pro 是一套为ArcGIS平台设计的矢量空间分析. 形状转换和表管理扩展工具,大大增强了 ArcGIS 的功能,使用该工具能够提高 ArcGIS 用户的效率和性能. XTools Pr ...

  3. leaflet地图库

    an open-source JavaScript libraryfor mobile-friendly interactive maps Overview Tutorials Docs Downlo ...

  4. 关于arcgi s_api_for_flex的总结

    1.flex 的简介 a) Flex是adobe开发的东西,主要特点就是开发一个swf格式的应用,flex可以做桌面的应用和web的应用,但本质差不多. b) Flex采用mxml的格式来进行应用的布 ...

  5. POJ 3845 Fractal(计算几何の旋转缩放)

    Description Fractals are really cool mathematical objects. They have a lot of interesting properties ...

  6. POJ3041Asteroids(最小点覆盖+有点小抽象)

    Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18289   Accepted: 9968 Descri ...

  7. Milking Cows

    Milking Cows Three farmers rise at 5 am each morning and head for the barn to milk three cows. The f ...

  8. POJ 3041 Asteroids

     最小点覆盖数==最大匹配数 Asteroids Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12678 Accepted:  ...

  9. Asteroids(匈牙利算法入门)

    Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16211   Accepted: 8819 Descri ...

随机推荐

  1. js中字符串处理成数字的方法

    <script> var a="11.1111"; var b="12.2222"; //第一种方法:乘以1的方法 //alert(a*1+b*1) ...

  2. bzoj2631

    题解: lct+链上修改 每一次修改的时候记录lazy标记 如果有了乘法,加法的lazy标记也要相应的随之变化 代码: #pragma GCC optimize(2) #include<bits ...

  3. [批处理]NetstatFilter快速查找端口被占用问题

    前言 准确的说,他是一个网络连接端口查看器,可以根据进程查端口,也可以根据端口查进程.期初是因在使用Fiddler的时候发现无法启动,提示端口被占用,但是由不知道用什么方法才能找到是哪个程序占用的Fi ...

  4. 流程设计器jQuery + svg/vml(Demo1 - 构建设计器UI界面)

    之前用Silverlight实现过一个流程设计器(Demo),使用起来不是很方便.打算参考GooFlow,结合自己对工作流的理解,用jQuery改造实现一个,力求简单实用. 第一步是要构建设计器的UI ...

  5. 分析器错误信息: 服务器标记不能包含 <% ... %> 构造

    我的程序如下:<form runat="server"><TABLE><TR><TD>用户名:</TD><TD&g ...

  6. Shell 命令行,写一个自动整理 ~/Downloads/ 文件夹下文件的脚本

    Shell 命令行,写一个自动整理 ~/Downloads/ 文件夹下文件的脚本 在 mac 或者 linux 系统中,我们的浏览器或者其他下载软件下载的文件全部都下载再 ~/Downloads/ 文 ...

  7. 判断设备(PC,安Android,iOS)

    //判断是不是PC function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = new Array("An ...

  8. debian 安装deb软件

    deb包 deb包是debian,ubuntu等LINUX发行版的软件安装包,是类似于rpm的软件包,而非debian,ubuntu系统不推荐使用deb软件包,因为要解决软件包依赖问题,安装也比较麻烦 ...

  9. [UOJ198][CTSC2016]时空旅行

    uoj description 你要维护若干个集合,每个集合都是有一个编号比他小的集合扩展而来,扩展内容为加入一个新的元素\((x,c)\)或者删除一个已有元素.集合的扩展关系之间构成一个树形结构. ...

  10. FastAdmin bootstrap-table 分页手动输入跳转

    FastAdmin bootstrap-table 分页手动输入跳转 Bootstrap-Table (V1.11.0)默认是没有这个功能的,不过作者有写的扩展. https://github.com ...