⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form08.frm

📁 VB+MO的GIS开发代码
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Begin VB.Form Form08 
   Caption         =   "组渲染"
   ClientHeight    =   5610
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6705
   LinkTopic       =   "Form1"
   ScaleHeight     =   5610
   ScaleWidth      =   6705
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command3 
      Caption         =   "组渲染"
      Height          =   495
      Left            =   4440
      TabIndex        =   3
      Top             =   4920
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "分类渲染"
      Height          =   495
      Left            =   2640
      TabIndex        =   2
      Top             =   4920
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "图表渲染"
      Height          =   495
      Left            =   840
      TabIndex        =   1
      Top             =   4920
      Width           =   1215
   End
   Begin MapObjects2.Map Map1 
      Height          =   4815
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   6495
      _Version        =   131072
      _ExtentX        =   11456
      _ExtentY        =   8493
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form08.frx":0000
   End
End
Attribute VB_Name = "Form08"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xue Wei,2003/6/9
'gruopRenderer;

Option Explicit
Dim CharRend As New MapObjects2.ChartRenderer
Dim ClassRend As New MapObjects2.ClassBreaksRenderer
Dim oMapLayer As MapObjects2.MapLayer

Private Sub Command1_Click()
  Set Map1.Layers("states").Renderer = Nothing
  Set Map1.Layers("states").Renderer = CharRend
  Map1.Refresh
End Sub

Private Sub Command2_Click()
  Set Map1.Layers("states").Renderer = Nothing
  Set Map1.Layers("states").Renderer = ClassRend
  Map1.Refresh
End Sub

Private Sub Command3_Click()
  Dim GroupRend As New MapObjects2.GroupRenderer
  Set Map1.Layers("states").Renderer = Nothing
  GroupRend.Add ClassRend
  GroupRend.Add CharRend
  Map1.Layers("states").Renderer = GroupRend
  Map1.Refresh
End Sub

Private Sub Form_Load()
  Dim i As Integer
  Dim oStats As MapObjects2.Statistics
  Dim fBreakVal As Double

  DrawLayer
  Set oMapLayer = Map1.Layers("States")
  With ClassRend
    .SymbolType = moFillSymbol
    .Field = "AREA"
    Set oStats = oMapLayer.Records.CalculateStatistics("AREA")
    
    fBreakVal = oStats.Mean - (oStats.StdDev * 3)
    For i = 0 To 6
      If fBreakVal >= oStats.Min And fBreakVal <= oStats.Max Then
        .BreakCount = .BreakCount + 1
        .Break(.BreakCount - 1) = fBreakVal
      End If
      fBreakVal = fBreakVal + oStats.StdDev
    Next
    .RampColors moPaleYellow, moCyan
  End With
  
  With CharRend
    .ChartType = moBar
    .FieldCount = 2
    .Field(0) = "AREA"
    .Color(0) = moRed
    .Field(1) = "featureId"
    .Color(1) = moGreen
  End With
End Sub

Private Sub DrawLayer()
  Dim dc As New DataConnection
  Dim layer As MapLayer
  dc.Database = App.Path + "\..\" + "Mexico"
  If Not dc.Connect Then
    MsgBox "在指定的文件夹下没找到图层数据文件!"
    End
  End If
    
  Set layer = New MapLayer
  Set layer.GeoDataset = dc.FindGeoDataset("States")
  layer.Symbol.Color = moPaleYellow
  layer.Symbol.Size = 1
  layer.Symbol.OutlineColor = moBrown
  Map1.Layers.Add layer
  Map1.Refresh
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -