默认头像
路人甲
路人甲
  • 注册日期2005-08-02
  • 发帖数38
  • QQ18087249
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1604回复:3

获取面或线的节点坐标问题

楼主#
更多 发布于:2005-08-19 16:50

不明白为什么会产生多余的两个点,特来探讨一下,程序如下,红色为获取选中的图块方法.

Dim pPolygon As IPolygon
Dim pGeom As IGeometry
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureCursor As IFeatureCursor
Dim pFesyureClass As IFeatureClass
Dim pWorkspaceEdit As IWorkspaceEdit
Dim pFeature As iFeature
Dim pActiveView As IActiveView
Dim pPointColn As IPointCollection

If m_pCurrentLayer Is Nothing Then Exit Sub
Set pFeatureLayer = m_pCurrentLayer
Set pFeatureClass = pFeatureLayer.FeatureClass
Set pFeatureCursor = GetSelectedFeatures
If pFeatureCursor Is Nothing Then Exit Sub
Set pWorkspaceEdit = GetWorkspaceEdit
pWorkspaceEdit.StartEditOperation
Set pFeature = pFeatureCursor.NextFeature
Set pPointColn = pFeature.Shape
MsgBox pPointColn.PointCount
Dim i As Integer
For i = 0 To pPointColn.PointCount - 1
 MsgBox CStr(pPointColn.Point(i).x) + "," + CStr(pPointColn.Point(i).y)
Next

pWorkspaceEdit.StopEditOperation
Set pActiveView = m_pMap
pActiveView.refresh

图1:

pPointColn.PointCount 得到五个节点

1.-140.965,8.682

2.-128.801,4.355

3.-124.637,11.131

4.-124.637,11.131

5.-140.965,8.682

明明只是个三角形,确得到五个点,看图,我们很显然知道4,5是错的.

图2:同样我们画了一个五边形,也得到了七个点,也只有前五个是正确的.

1.-145.17,21.70

2.-133.38,13.39

3.-130.03,17.01

4.-129.89,22.51

5.-136.73,26.80

6.-136.86,26.80

7.-145.17,21.7



[此贴子已经被作者于2005-8-19 16:52:46编辑过]
喜欢0 评分0
默认头像
路人甲
路人甲
  • 注册日期2005-08-02
  • 发帖数38
  • QQ18087249
  • 铜币244枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-08-21 20:13

我也是这样想的,可能是取了两次

举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2003-09-15
  • 发帖数74
  • QQ
  • 铜币325枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-08-20 19:30

为什么会取两次?

举报 回复(0) 喜欢(0)     评分
默认头像
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
3楼#
发布于:2005-08-19 22:23

起点和终点取了两次?

现在没办法测试,周一上班再看了,希望看到你的好消息

GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
默认头像

返回顶部