开心人生

用今天的努力----实现我所向往的明天

导航

CS版本程序,如果使用本地地图的话,不需要查询数据库地物点

涉及到的文件及更改信息:

1,D:\Cs\UniGuard_ComponentCompiled\UniguardCommon\Socket\UniguardWebRequest.vb下的方法SendPointFeatureReq是真正的代码

''' <summary>
''' 地图漂定后,发送宾馆大厦数据的请求
''' </summary>
''' <param name="zoomLevel">缩放等级</param>
''' <param name="mercatorBound">墨卡托范围</param>
''' <param name="handler"></param>
''' <remarks></remarks>
Public Sub SendPointFeatureReq(ByVal zoomLevel As Integer, ByVal mercatorBound As System.Drawing.Rectangle, ByVal handler As EventHandler(Of TableEventArgs))
    Dim adp As New SimpleTableAdapter(Me, New DataTable, "cs/atlas")
    adp.WorkMode = WebSubmitee.WorkModeEnum.Async
    AddHandler adp.OnFillComplete, handler
    Dim args As New Specialized.NameValueCollection
    args("zoom_level") = zoomLevel
    args("min_x") = mercatorBound.Left
    args("max_x") = mercatorBound.Right
    args("min_y") = mercatorBound.Top
    args("max_y") = mercatorBound.Bottom
    adp.Fill("queryPoints", args)
End Sub

2,更改D:\Cs\UniGuard_ComponentCompiled\UniguardCommon\Map\UniguardMap.vb下的UniguardMap_OnMapViewChanged方法到如下

Dim lastChangeTime As DateTime = DateTime.MinValue
Private Sub UniguardMap_OnMapViewChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.OnMapViewChanged
    If DateTime.Now.Subtract(lastChangeTime).TotalMilliseconds > 500 Then
        If mWebRequest Is Nothing Then Return
        If Me.ZoomLevel >= POINT_FEATURE_MIN_LEVEL And mSendPointFeatureReq Then
            mWebRequest.SendPointFeatureReq(Me.ZoomLevel, Me.MercatorBound, AddressOf ProcessPointsArrive)
        End If
        lastChangeTime = DateTime.Now
    End If
End Sub

主要是增加了一个判断条件mSendPointFeatureReq

3,该判断条件是在D:\Cs\UniGuard_ComponentCompiled\UniguardStart\LoginForm.vb的InitTileProviders函数里面定义的,主要代码如下:

Private Sub InitTileProviders(ByVal mapServerUri As String, ByVal eagleMapUri As String)
    ' 初始化大地图提供器
    Dim provider As RasterMap.TileProvider.ITileProvider
    With My.Application
        If My.Settings.GeosetLocation IsNot Nothing AndAlso My.Settings.GeosetLocation.Length > 0 Then
            UniguardMap.InitGeoFactoryPool(My.Settings.GeosetLocation, My.Settings.LocalMapPath)
            UniguardMap.isSendPointFeatureReq(False)
            provider = New GeosetTileProvider(UniguardMap.GeoFactoryPool)
        Else
            provider = New TileProvider.WebTileProvider(mapServerUri)
            UniguardMap.isSendPointFeatureReq(True)
        End If
    End With
    Dim tp As New TileProvider.FileCacheTileProvider(provider)
    tp.CacheDirectory = My.Settings.LocalMapPath
    If tp.CacheDirectory IsNot Nothing AndAlso tp.CacheDirectory.Length > 0 Then
        If IO.Directory.Exists(tp.CacheDirectory) = False Then
            IO.Directory.CreateDirectory(tp.CacheDirectory)
        End If
        UniguardMap.MapProvider = tp
    End If
    ' 初始化鹰眼图提供器       
    provider = New TileProvider.WebTileProvider(eagleMapUri)
    tp = New TileProvider.FileCacheTileProvider(provider)
    tp.CacheDirectory = System.IO.Path.Combine(Application.StartupPath, "eaglemap")
    EagleMap.EagleProvider = tp
End Sub

4,增加了函数isSendPointFeatureReq。位置在D:\Cs\UniGuard_ComponentCompiled\UniguardCommon\Map\UniguardMap.vb。代码如下:

Private Shared mSendPointFeatureReq As Boolean

''' <summary>
''' 是否查询数据库里面存储的点信息
''' </summary>
''' <param name="isQuery"></param>
''' <remarks>是否需要查询</remarks>
Public Shared Sub isSendPointFeatureReq(ByVal isQuery As Boolean)
    mSendPointFeatureReq = isQuery
End Sub

posted on 2008-10-13 16:57  hai  阅读(242)  评论(0)    收藏  举报