阅读:2351回复:1
生成的线和面的交点,如何成为POLYGON的节点
生成的线和面的交点,如何成为POLYGON的节点<br/>Dim ptopopr1 As ITopologicalOperator<br/> Set ptopopr1 = ppolygon<br/>Dim pptcoll1 AsGeometryCollection<br/> Set pptcoll1 = ptopopr1.Intersect(pline1, 1)<br/><br/>怎么把pptcoll1里的点集再加入到polygon??
|
|
1楼#
发布于:2011-09-16 10:48
<div style="PADDING-LEFT: 0in"><strong>
<h3>Building a polygon using points</h3></strong></div> <div style="PADDING-LEFT: 0in"><span>The following code shows how to build a polygon using a collection of points. This approach is preferred when the user has a sequence of vertices as input. The resulting polygon ring will only contain a straight line segment:</span> </div> <div style="PADDING-LEFT: 0in"><span></span></div><br/><span class="lang">[VB.NET]</span><code> <pre class="code"><span class="kwrd">Public</span> <span class="kwrd">Sub</span> CreatePolygonByPoints() <span class="rem">'Build polygon from a sequence of points.</span> <span class="rem">'At ArcGIS 9.2, the recommended way to add arrays of points to a geometry is to use</span> <span class="rem">'the IGeometryBridge2 interface on the GeometryEnvironment singleton object.</span> <span class="kwrd">Dim</span> geometryBridge2 <span class="kwrd">As</span> IGeometryBridge2 = <span class="kwrd">New</span> GeometryEnvironmentClass <span class="kwrd">Dim</span> pointCollection4 <span class="kwrd">As</span> IPointCollection4 = <span class="kwrd">New</span> PolygonClass <span class="rem">'TODO:</span> <span class="rem">'pointCollection4.SpatialReference = 'Define the spatial reference of the new polygon</span> <span class="kwrd">Dim</span> aWKSPointBuffer() <span class="kwrd">As</span> WKSPoint <span class="kwrd">Dim</span> cPoints <span class="kwrd">As</span> <span class="kwrd">Long</span> = 4 <span class="rem">'The number of points in the first part</span> <span class="kwrd">ReDim</span> aWKSPointBuffer(0 <span class="kwrd">To</span> <span class="kwrd">CInt</span>(cPoints - 1)) <span class="rem">'TODO:</span> <span class="rem">'aWKSPointBuffer = 'Read cPoints into the point buffer</span> geometryBridge2.SetWKSPoints(pointCollection4, aWKSPointBuffer) <span class="rem">'pointCollection4 has now been defined</span> <span class="kwrd">End</span> <span class="kwrd">Sub</span></pre></code><br/><span class="lang">[C#]</span><code> <pre class="code"><span class="kwrd">public</span> <span class="kwrd">void</span> CreatePolygonByPoints() { <span class="rem">//Build polygon from a sequence of points. </span> <span class="rem">//At ArcGIS 9.2, the recommended way to add arrays of points to a geometry is to use</span> <span class="rem">//the IGeometryBridge2 interface on the GeometryEnvironment singleton object.</span> IGeometryBridge2 geometryBridge2 = <span class="kwrd">new</span> GeometryEnvironmentClass(); IPointCollection4 pointCollection4 = <span class="kwrd">new</span> PolygonClass(); <span class="rem">//TODO:</span> <span class="rem">//pointCollection4.SpatialReference = 'Define the spatial reference of the new polygon</span> WKSPoint[] aWKSPointBuffer = <span class="kwrd">null</span>; <span class="kwrd">long</span> cPoints = 4; <span class="rem">//The number of points in the first part</span> aWKSPointBuffer = <span class="kwrd">new</span> WKSPoint[System.Convert.ToInt32(cPoints - 1) + 1]; <span class="rem">//TODO:</span> <span class="rem">//aWKSPointBuffer = 'Read cPoints into the point buffer</span> geometryBridge2.SetWKSPoints(pointCollection4, <span class="kwrd">ref</span> aWKSPointBuffer); <span class="rem">//pointCollection4 has now been defined</span> }</pre></code> |
|
|