阅读:1792回复:2
我和网友关于几何的讨论!<P>2004-12-24 08:24:23 董董 我觉得 line 这个东西在ao中根本就不能把它画出来, </P> <P>2004-12-24 08:20:13 忘我 可以阿 </P> <P>2004-12-24 08:25:01 董董 我觉得不行! </P> <P>2004-12-24 08:20:39 忘我 分为Line 和polyLine </P> <P>2004-12-24 08:25:31 董董 是的,呵呵 我是说line 而不是polyline </P> <P>2004-12-24 08:26:01 董董 polyline 的画法有好几种,但是都不能用来在屏幕上画出line </P> <P>2004-12-24 08:22:37 忘我 polyline是在屏幕画line </P> <P>2004-12-24 08:27:49 董董 找几何对象模型图中,line是继承了片段,也就是说line只是片段的一种, </P> <P>2004-12-24 08:23:31 忘我 是啊 </P> <P>2004-12-24 08:23:38 忘我 Segment </P> <P>2004-12-24 08:29:08 董董 我想片段是不能被画 出来的 </P> <P>2004-12-24 08:25:17 忘我 是用来保存比如Line对象的, </P> <P>2004-12-24 08:33:09 董董 我试过 GeometryDraw </P> <P>2004-12-24 08:33:50 董董 和IScreenDisplay 都是不能画出line的 </P> <P>2004-12-24 08:34:05 董董 我的这line中从一个几何中得到的 </P> <P>2004-12-24 08:30:14 忘我 你为什么要用Line,用Polyline就可以了 </P> <P>2004-12-24 08:31:35 忘我 你设置Symbol了吗 </P> <P>2004-12-24 08:36:15 董董 我不是要用line ,我是想为什么画不出来</P> <P>我把我得到的这个line的几何信息,给我新定义的一个polyline ,那么这个polyline是可以画出的 </P> <P>2004-12-24 08:36:21 董董 设置了 </P> <P>2004-12-24 08:36:42 董董 相同的符号可以画出polyline ,但是不能画出line </P> <P>2004-12-24 08:32:30 忘我 我看一下 </P> <P>2004-12-24 08:37:04 董董 所以我得出结论:4中片段都是不能直接画出的, </P> <P>2004-12-24 08:37:12 董董 [:)] </P> <P>2004-12-24 08:32:54 忘我 我估计Line是个抽象接口 </P> <P>2004-12-24 08:33:07 忘我 我一直多用PolyLine </P> <P>2004-12-24 08:37:53 董董 呵呵,不是的,line和polyline是完全一样的组件类 </P> <P>2004-12-24 08:33:54 忘我 hehe </P> <P>2004-12-24 08:38:40 董董 我们可以定义line : set p=new line </P> <P>2004-12-24 08:34:35 忘我 不一样 </P> <P>2004-12-24 08:39:18 董董 但是这个p的作用只是用来形成polylinede等几何 </P> <P>2004-12-24 08:39:24 董董 ? </P> <P>2004-12-24 08:40:41 董董 包括形成 GeometryCollection SegmentCollection </P> <P>2004-12-24 08:36:40 忘我 Geometry->Curve->PolyCurve->polyLine </P> <P>2004-12-24 08:41:31 董董 这个怎么了? </P> <P>2004-12-24 08:37:15 忘我 我是说他们的继承关系 </P> <P>2004-12-24 08:42:09 董董 不是的 </P> <P>2004-12-24 08:42:22 董董 他们没有继承关系 </P> <P>2004-12-24 08:38:35 忘我 你看看GeometryObjectModel </P> <P>2004-12-24 08:43:23 董董 倒是能够看出他们有包含的关系 </P> <P>2004-12-24 08:38:57 忘我 Line和PolyLine是不一样的 </P> <P>2004-12-24 08:43:40 董董 啊,我是说他们都是组件类,这一点是相同的 </P> <P>2004-12-24 08:44:02 董董 也就是说,都是可以使用 new 生成的 </P> <P>2004-12-24 08:44:30 董董 你怎么能看出他们有继承关系呢? </P> <P>2004-12-24 08:45:25 董董 line继承了segment 而polyline继承了Polycurve segment和Polycurve都继承了Curve </P> <P>2004-12-24 08:41:19 忘我 new只是说明能够创建对象,不能说明别的 </P> <P>2004-12-24 08:46:31 董董 是的,但是完全可以说明这个类在ao中是一个组件类 </P> <P>2004-12-24 08:47:32 董董 我想他们没有继承关系的,他们的关系是包含,也就是说一个polyline可以由多个line组成。 </P> <P>2004-12-24 08:44:21 忘我 DrawPolyline,你用的他吗 </P> <P>2004-12-24 08:49:09 董董 是的 </P> <P>2004-12-24 08:49:50 董董 因为在IScreenDisplay 接口中没有Drawline 呵呵,所以我就用它了 </P> <P>2004-12-24 08:50:26 董董 另外我还使用过 GeometryDraw </P> <P>2004-12-24 08:50:31 董董 还是不行 </P> <P>2004-12-24 08:46:40 忘我 是啊,DrawPolyline(IGeometry * polyLine) </P> <P>2004-12-24 08:51:17 董董 Dim ppline As ILine Set ppline = New esriGeometry.Line ppline.PutCoords pLine.FromPoint, pLine.ToPoint </P> <P>2004-12-24 08:51:42 董董 你把你的qq全屏或者放大会好一点 </P> <P>2004-12-24 08:47:23 忘我 我试试 </P> <P>2004-12-24 08:53:10 董董 我最初是想从一个polyline中得到最长的一个片段, 哦,我忘问了,你用什么语言? </P> <P>2004-12-24 08:48:57 忘我 C++ </P> <P>2004-12-24 08:54:04 董董 呵呵我说吗, 好像指针都上来了 </P> <P>2004-12-24 08:49:57 忘我 是啊 </P> <P>2004-12-24 08:56:52 董董 那没有关系的, 我最初是想从一个polyline中得到最长的一个片段,代码: Dim pGeometry As IGeometry Set pGeometry = pFeature.shape Dim pgeocollion As IGeometryCollection Dim psegmentcoll As ISegmentCollection Set pgeocollion = pGeometry Set psegmentcoll = pGeometry Dim pSegment As ISegment Dim PartIndex As Long Dim Segmnetindex As Long </P> <P>2004-12-24 08:57:55 董董 Dim pMaxlenSegment As ISegment Dim len1 As Integer len1 = 0 Do While PartIndex < psegmentcoll.SegmentCount psegmentcoll.QuerySegments (PartIndex), 1, pSegment If len1 < pSegment.length Then len1 = pSegment.length Set pMaxlenSegment = pSegment End If PartIndex = PartIndex + 1 Loop Set pGeometry1 = pMaxlenSegment </P> <P>2004-12-24 08:58:04 董董 Dim pLine As ILine Set pLine = pGeometry1 </P> <P>2004-12-24 08:58:20 董董 这样我就得到了一个line </P> <P>2004-12-24 08:54:23 忘我 你为啥不用PointCollecttion </P> <P>2004-12-24 08:59:44 董董 这个PointCollecttion 我想得到我想要的会麻烦一点 </P> <P>2004-12-24 09:00:45 董董 它是可以得到所有的点,我还要计算相邻两点的距离,然后,还要用最大的那两个点来生成一个polyline, </P> <P>2004-12-24 09:02:02 董董 这个也可以,不过,我是想,我用片段应该没有问题啊,而且,我发现我得到的那个line,确实是没有问题的,是我想的,但是我就是不能把它画出来,呵呵 </P> <P>2004-12-24 09:02:34 董董 所以我就想啊,4种片段都是不能画在屏幕上的,呵呵 </P> <P>2004-12-24 09:03:32 董董 使用 PointCollecttion 可以间接得到我想要的,使用片段可以直接得到我想要的 </P> <P>2004-12-24 08:59:32 忘我 不是的,一个Polyline可以直接赋值的 Dim pPloyLine As IPolyLine Dim pPointCollection As IPointCollection pPolyLine = new IPolyLine pPointCollection = pPolyLine pPointCollection.Add IPoint pPolyLine = pPointCollection </P> <P>2004-12-24 09:04:31 董董 是的,你的这部分代码是权权正确的! </P> <P>2004-12-24 09:04:51 董董 呵呵,我还是想我的方法为什么不行呢? </P> <P>2004-12-24 09:00:23 忘我 是啊,你可以这样 </P> <P>2004-12-24 09:00:30 忘我 我也不知道 </P> <P>2004-12-24 09:05:29 董董 看来,你还没有推翻我的结论! 呵呵, </P> |
|
1楼#
发布于:2004-12-24 10:50
<P>楼主的结论是在ao中不没有line这个对象?</P><P>看来这东西不必要存在,调用其他对象可以构成啊</P>
|
|
|
2楼#
发布于:2004-12-24 18:37
<P>没有看明白上边的兄弟的意思。</P><P>line这个对象的存在是肯定的。</P><P>我的意思是说:生成的一个line为什么不能够画出来,</P><P>另外,我还有一个问题,</P><P>一个片段(比如说line),它是不能付给一个线元素的几何的(见下面的代码的1处),总是提示:无效的参数调用和过程。 不知道为什么?</P><P>dim pElement as ielement</P><P> Set pcolor = CreateRGBColor(0, 0, 255)
Set pElement = CreateLineElt(pcolor, 5) Set pElement = CreateLineElt(pcolor, 5) If pGeometry1 Is Nothing Then MsgBox "dongguiming111" 'MsgBox pGeometry1.IsEmpty pElement.Geometry = pGeometry1 '.............1 这个地方出错! </P><P>Public Function CreateRGBColor(r As Byte, g As Byte, b As Byte) As IRgbColor Dim pcolor As IRgbColor Set pcolor = New RgbColor 'pColor.Transparency = 50 pcolor.Red = r: pcolor.Green = g: pcolor.Blue = b Set CreateRGBColor = pcolor End Function</P><P>Private Function CreateLineElt(pcolor As IColor, sz As Long) As ILineElement Dim pLineSymbol As ILineSymbol Dim pLineElt As ILineElement Set pLineSymbol = New SimpleLineSymbol pLineSymbol.Color = pcolor pLineSymbol.Width = sz Set pLineElt = New LineElement pLineElt.Symbol = pLineSymbol Set CreateLineElt = pLineElt End Function</P> |
|