阅读:1709回复:1
问题请教:如何定位一个地块?
假如我按照查询要求查到一个面属性,我如何将这个面属性选中?
|
|
1楼#
发布于:2004-04-06 10:38
以前发过了,下面再发一次了,其实你多看看论坛里的贴,就ok了
如何放大到选择的多个对象[原创] '功能:放大到已经显示选择的地物 '调用参数:map1,recs Public Function ZoomToSelected(map As MapObjects2.map, recs As MapObjects2.Recordset) On Error GoTo ZoomError '定义字段和值的变量,放大到的显示对象的范围的变量 Dim fld As MapObjects2.Field Dim shp As Object Dim ext As MapObjects2.Rectangle Dim x1 As Double, x2 As Double Dim y1 As Double, y2 As Double recs.MoveFirst Set fld = recs.Fields("Shape") Set shp = fld.value '获得所选择的图形的范围,以进行下一步的放大到对象的操作 If TypeOf shp Is MapObjects2.Point Then Dim pts As New MapObjects2.Points pts.Add shp Do Until recs.EOF Set shp = fld.value pts.Add shp recs.MoveNext Loop Set ext = pts.Extent Else Set ext = shp.Extent x1 = ext.Left x2 = ext.Right y1 = ext.Bottom y2 = ext.Top Do Until recs.EOF Set ext = fld.value.Extent x1 = IIf(ext.Left < x1, ext.Left, x1) x2 = IIf(ext.Right > x2, ext.Right, x2) y1 = IIf(ext.Bottom < y1, ext.Bottom, y1) y2 = IIf(ext.Top > y2, ext.Top, y2) recs.MoveNext Loop ext.Left = x1 ext.Right = x2 ext.Bottom = y1 ext.Top = y2 End If '设置地图显示范围 Set map.Extent = ext Exit Function ZoomError: End Function |
|
2楼#
发布于:2004-04-07 11:02
3q
|
|