阅读:1163回复:0
鹰眼的问题,请大虾们帮我!
<P>在做鹰眼的时候遇到了一个问题,请哪位高手告诉我,我的代码是这样的:</P>
<P>Private Sub Map1_MapViewChanged()<BR> Dim ftr As Feature<BR> Dim ftrs As Feature<BR> Dim rctMap As Rectangle<BR> Dim pnts As New Points<BR> Dim pnt1 As New Point<BR> Dim pnt2 As New Point<BR> Dim pnt3 As New Point<BR> Dim pnt4 As New Point<BR> Dim styLine As New Style</P> <P> '如果地图文件不存在,则退出<BR> If Map1.GeoSet = "" Then<BR> Exit Sub<BR> End If</P> <P> Set Templayer = Map2.Layers.CreateLayer("layer") '给map2添加临时图层<BR> <BR> '得到对应主视图的鹰眼图集合文件strNavigatorGeosetName<BR> Map2.GeoSet = strNavigatorGeosetName<BR> <BR> Set rctMap = Map1.Bounds '获得主图的区域<BR> pnt1.Set rctMap.XMin, rctMap.YMax '获得主图视野范围的边界点的坐标<BR> pnt2.Set rctMap.XMax, rctMap.YMax<BR> pnt3.Set rctMap.XMax, rctMap.YMin<BR> pnt4.Set rctMap.XMin, rctMap.YMin<BR> pnts.Add pnt1 '将主图视野范围边界点加入点集中<BR> pnts.Add pnt2<BR> pnts.Add pnt3<BR> pnts.Add pnt4<BR> pnts.Add pnt1<BR> styLine.LineColor = vbRed '定义样式的线条颜色<BR> styLine.LineWidth = 2 '定义样式的线条宽度</P> <P> '在鹰眼层增加矩形框对象,框出对应的主图视野范围的边界<BR> Set ftr = Map2.FeatureFactory.CreateLine(pnts, styLine)<BR> Map2.Layers.Item("鹰眼").AddFeature ftr</P> <P>End Sub</P> <P>但是在运行是却出现了以下这个错误:</P> <P>“No object was found using the index you specified”</P> <P>错误指示是这一行:Map2.Layers.Item("鹰眼").AddFeature ftr</P> <P>就我知道的是“鹰眼”应该是临时图层的图层名,但是怎样增加这个图层并给这个图层命名呢?</P> <P>请高手告诉我吧,谢谢!!!</P> |
|