這裏生成緩衝區確定是根據點進行生成的,說是生成緩衝區實際上是根據點生成面。具體思路以下:
首先根據點獲取要生成矩形緩衝區的四個頂點的座標,而後將這四個點生成面便可獲得所謂的矩形緩衝區。ip
//首先獲取要生成緩衝區的點
IPoint pPoint = new PointClass();
pPoint.X = cPointList[i].point.X;
pPoint.Y = cPointList[i].point.Y;
//獲取生成的緩衝區的四個頂點的座標
IPointCollection pPC = new MultipointClass();
for (int j = 0; j < 4; j++)
{
IPoint pPoint1 = new PointClass();
if (j == 0)
{
pPoint1.X = pPoint.X - 2.55;
pPoint1.Y = pPoint.Y - 2.55;
}
if (j == 1)
{
pPoint1.X = pPoint.X - 2.55;
pPoint1.Y = pPoint.Y + 2.55;
} if (j == 2)
{
pPoint1.X = pPoint.X + 2.55;
pPoint1.Y = pPoint.Y + 2.55;
} if (j == 3)
{
pPoint1.X = pPoint.X + 2.55;
pPoint1.Y = pPoint.Y - 2.55;
}
pPC.AddPoint(pPoint1);
}
IGeometryCollection pGeometryCollection = new PolygonClass();
Ring ring = new RingClass(http://www.my516.com);
object missing = Type.Missing;
ring.AddPointCollection(Points);
pGeometryCollection.AddGeometry(ring as IGeometry, ref missing, ref missing);
IPolygon polyGonGeo = pGeometryCollection as IPolygon;
polyGonGeo.Close();
polyGonGeo.SimplifyPreserveFromTo();
pGeo =polyGonGeo as IGeometry;
//建立要素
pFeatureBuffer = pFeaClaPolygon.CreateFeatureBuffer();
pFeatureBuffer.Shape = pGeo;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
結果圖:下圖爲點生成矩形緩衝區的最終成果。io
這個是融合以後的圖形。object
固然在進行頂點座標輸入的時候須要按照順序,否則就會出現下邊這種狀況:
--------------------- List