期货配资专家

返回股票配资

当前位置: 主页 > GPS学院 > 应用软件 >

GPS学堂 VB+mapx实现各种专题图的示例

时间:2008-01-18 10:44来源:GPS之家-导航之家 作者:fdhmm.wang
Private Sub Command5_Click() '创建专题图层 Dim oDs As MapXLib.Dataset Dim oLayer As MapXLib.Layer Dim oTheme As MapXLib.Theme Dim oFields As New MapXLib.Fields Dim oField As MapXLib.Field Dim oCoordSys As MapXLib.CoordSys Dim strLayerName As String D
Private Sub Command5_Click()
'创建专题图层

    Dim oDs As MapXLib.Dataset
    Dim oLayer As MapXLib.Layer
    Dim oTheme As MapXLib.Theme
    Dim oFields As New MapXLib.Fields
    Dim oField As MapXLib.Field
    Dim oCoordSys As MapXLib.CoordSys
    
    Dim strLayerName As String
    Dim nType As Integer
    
    Dim s As Integer
    
'改变投影系
    Set oCoordSys = Map1.DisplayCoordSys.Clone
    SetCoordsys
        
'设置专题图层
    strLayerName = GetThemeLayerName()
    If strLayerName = Then
        MsgBox 请选择绑定图层
        Exit Sub
    End If
    
'设置专题绑定数据集
    Set oLayer = Map1.Layers.Item(strLayerName)
    Map1.DataSets.RemoveAll
    Set oDs = Map1.DataSets.Add(miDataSetLayer, oLayer, oLayer.KeyField)

'获得专题图类型
    nType = GetThemeType
    If nType = -1 Or nType = 9 Then
        MsgBox 请选择专题类型
        Exit Sub
    End If

'设置专题图
    oFields.RemoveAll
    Set oField = oFields.Add(oDs.Fields.Item(2), data1
    
    oDs.Themes.RemoveAll
    If nType = 1 Or nType = 2 Then
        oFields.Add oDs.Fields.Item(3), data2

        Set oTheme = oDs.Themes.Add(nType, oFields)
    ElseIf nType = 9 Then
        'Set oTheme = oDs.Themes.Add(nType)
    Else
        Set oTheme = oDs.Themes.Add(nType, oField)
    End If
    
  
  
'还原投影系
    
    Set Map1.DisplayCoordSys = oCoordSys
    'Set Map1.NumericCoordSys = oCoordSys
    Set Map1.NumericCoordSys = Map1.DisplayCoordSys
    
End Sub
Sub SetCoordsys()
'设置投影系
    Dim oDatum As New MapXLib.Datum

    oDatum.Set 0, 0, 0, 0, 0, 0, 0, 0, 0
    Map1.DisplayCoordSys.Set miLongLat, oDatum, miUnitDegree
    Set Map1.NumericCoordSys = Map1.DisplayCoordSys

End Sub
(责任编辑:admin)
[ GPSUU整理发布,版权归原作者所有。]
顶一下
(1)
100%
踩一下
(0)
0%
------分隔线----------------------------

推荐内容
图文期货配资
<font color='#333333'>GPS软件应用 Geometry</font>
GPS软件应用 Geometry

期货配资专家