wolf2oo0
路人甲
路人甲
  • 注册日期2004-08-26
  • 发帖数13
  • QQ
  • 铜币184枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1306回复:0

delphi中生成polygon,高手们帮忙呀!!!!

楼主#
更多 发布于:2006-09-08 13:30
<P>vb自带代码如下Private Sub CreateRectanglePolygonFromEnvelope()<BR>   Dim pEnvelope As IEnvelope<BR>   Dim pSegmentColl As ISegmentCollection<BR>   Dim pspref As ISpatialReference<BR>   Set pEnvelope = New Envelope<BR>   '*********************************************************<BR>   'THE SPATIAL REFERENCE SHOULD BE SET HERE ON THE ENVELOPE<BR>   'Here the spatial reference is created in memory but could also come from various sources:<BR>   'IMap, IGeodataset, IGeometry etc...<BR>   Set pspref = New UnknownCoordinateSystem<BR>   pspref.SetFalseOriginAndUnits -10000, -10000, 100000  'Set the false origin and units.<BR>   'The XYUnits value is equivalent to the precision specified when creating a feature class<BR>   Set pEnvelope.SpatialReference = pspref<BR>   '*********************************************************<BR>   pEnvelope.PutCoords 0, 0, 100, 100<BR>   Set pSegmentColl = New Polygon<BR>   pSegmentColl.SetRectangle pEnvelope 'This is transferring the spatial reference<BR>   'You can draw or store the polygon (pSegmentColl) <BR>End Sub<BR>我现在在delphi改写如下mapcontrol1.ActiveView.Get_ScreenDisplay(pSDisp);<BR>      pRB:=CoRubberEnvelope.create as IRubberBand;<BR>      pRB.TrackNew(pSDisp,nil,pGeometry);<BR>      pGeometry.Get_Envelope(penv);<BR>      pSegmentColl:=CoPolygon.Create as ISegmentCollection;<BR>      pSegmentColl.SetRectangle(penv);<BR>      mPolygon:=CoPolygon.Create as IPolygon;<BR>      mPolygon:=pSegmentColl as IPolygon;<BR>      mPolygon.Get_Envelope(penv1);</P>
<P>但是发现mPolygon植不对请问怎么回事,主要问题就是</P>
<P>pSegmentColl:=CoPolygon.Create as ISegmentCollection;</P>
<P>mPolygon:=pSegmentColl as IPolygon;这两句<BR><BR></P>





喜欢0 评分0
游客

返回顶部