在管网中,因为管线异常复杂,地下的管线结构和分布位置常常很难检测,而且很难看到各种工程管线的
垂直分布,在本人的毕业设计中,通过查阅各种资料找到了一个自动生成横断面的方法,且已经用代码实现,现在记录下来,免得自己忘了同时也可以给大家分享,有不同意见的同行,同志不要吝啬自己的键盘,欢迎提出宝贵意见,下面是具体的思路:
第一步:获取截面线与实际管线的所有交点,同时新建一个交点类,保存交点的一些属性数据(如:类型,埋深,直径等),下面是具体的代码:
1
private
void
GetPouMianTu()
2
{
3
SuperMapLib.soGeoLine objGeoLine;
//
保存跟踪层上的线对象
4
SuperMapLib.soGeoLine objInsectLine;
//
与所画线的相交线
5
SuperMapLib.soPoints objInsectPoints;
//
所画线的相交点串
6
SuperMapLib.soPoints tempInsectPoints;
7
SuperMapLib.soPoints beginPoints;
8
ArrayList pointTypeArr
=
new
ArrayList();
//
用于保存相交点串的类型
9
double
beginPointX
=
0
;
//
所画起点的X坐标
10
double
beginPointY
=
0
;
//
所画起点的Y坐标
11
12
SuperMapLib.soRecordset objAllRst;
13
SuperMapLib.soDatasetVector objAllDVt;
14
15
//
objInsectPoints = new SuperMapLib.soPoints();
16
beginPoints
=
new
SuperMapLib.soPoints();
17
objGeoLine
=
new
SuperMapLib.soGeoLine();
18
objInsectPoints
=
new
SuperMapLib.soPoints();
19
objInsectLine
=
new
SuperMapLib.soGeoLine();
20
objGeoLine
=
(SuperMapLib.soGeoLine)
this
.axSuperMap2.TrackedGeometry;
21
beginPoints
=
objGeoLine.GetPartAt(
1
);
22
beginPointX
=
beginPoints[
1
].x;
23
beginPointY
=
beginPoints[
1
].y;
24
25
//
=================从给水中找=================================
//
26
27
objAllDVt
=
(SuperMapLib.soDatasetVector)
this
.axSuperMap2.Layers[
"
给水@WINXP_JS
"
].Dataset;
28
objAllRst
=
objAllDVt.QueryEx(
this
.axSuperMap2.TrackedGeometry, SuperMapLib.seSpatialQueryMode.scsLineCross,
""
);
29
objAllRst.MoveFirst();
30
while
(
!
objAllRst.IsEOF())
31
{
32
objInsectLine
=
(SuperMapLib.soGeoLine)objAllRst.GetGeometry();
33
tempInsectPoints
=
objInsectLine.GetCrossings(
this
.axSuperMap2.TrackedGeometry);
34

35
objInsectPoints.Add(tempInsectPoints[
1
]);
36
pointTypeArr.Add(
new
PointType(tempInsectPoints[
1
],
"
给水
"
, objAllRst.GetFieldValue(
"
埋深
"
).ToString()));
37
objAllRst.MoveNext();
38
}
39
//
===============================================================
//
40

41
//
======================从雨水中找===============================
//
42
objAllDVt
=
(SuperMapLib.soDatasetVector)
this
.axSuperMap2.Layers[
"
雨水@WINXP_雨水
"
].Dataset;
43
objAllRst
=
objAllDVt.QueryEx(
this
.axSuperMap2.TrackedGeometry, SuperMapLib.seSpatialQueryMode.scsLineCross,
""
);
44
objAllRst.MoveFirst();
45
while
(
!
objAllRst.IsEOF())
46
{
47
objInsectLine
=
(SuperMapLib.soGeoLine)objAllRst.GetGeometry();
48
tempInsectPoints
=
objInsectLine.GetCrossings(
this
.axSuperMap2.TrackedGeometry);
49

50
objInsectPoints.Add(tempInsectPoints[
1
]);
51
pointTypeArr.Add(
new
PointType(tempInsectPoints[
1
],
"
雨水
"
,objAllRst.GetFieldValue(
"
埋深
"
).ToString()));
52
objAllRst.MoveNext();
53
}
54
//
===================================================================
//
55

56
//
======================从污水中找===============================
//
57
objAllDVt
=
(SuperMapLib.soDatasetVector)
this
.axSuperMap2.Layers[
"
污水@WINXP_污水管
"
].Dataset;
58
objAllRst
=
objAllDVt.QueryEx(
this
.axSuperMap2.TrackedGeometry, SuperMapLib.seSpatialQueryMode.scsLineCross,
""
);
59
objAllRst.MoveFirst();
60
while
(
!
objAllRst.IsEOF())
61
{
62
objInsectLine
=
(SuperMapLib.soGeoLine)objAllRst.GetGeometry();
63
tempInsectPoints
=
objInsectLine.GetCrossings(
this
.axSuperMap2.TrackedGeometry);
64

65
objInsectPoints.Add(tempInsectPoints[
1
]);
66
pointTypeArr.Add(
new
PointType(tempInsectPoints[
1
],
"
污水
"
, objAllRst.GetFieldValue(
"
埋深
"
).ToString()));
67
objAllRst.MoveNext();
68
}
69

(本文已被浏览 次) | | |