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

📄 form1.frm

📁 MO组件开发的空间分析功能
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7410
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   9810
   LinkTopic       =   "Form1"
   ScaleHeight     =   7410
   ScaleWidth      =   9810
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command6 
      Caption         =   "xor"
      Height          =   495
      Left            =   120
      TabIndex        =   6
      Top             =   3480
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "difference2"
      Height          =   495
      Left            =   120
      TabIndex        =   5
      Top             =   2880
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "difference"
      Height          =   495
      Left            =   120
      TabIndex        =   4
      Top             =   2280
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "union"
      Height          =   495
      Left            =   120
      TabIndex        =   3
      Top             =   1680
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "intersect"
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "加载图层"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   1215
   End
   Begin MapObjects2.Map Map1 
      Height          =   6615
      Left            =   1440
      TabIndex        =   0
      Top             =   0
      Width           =   8295
      _Version        =   131072
      _ExtentX        =   14631
      _ExtentY        =   11668
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form1.frx":0000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim poly As MapObjects2.Polygon
Dim poly1 As MapObjects2.Polygon
Dim poly2 As MapObjects2.Polygon
Dim p As Point
Dim pts As MapObjects2.Points
Dim sym As New Symbol
Dim sym1 As New Symbol
Dim sym2 As New Symbol


Private Sub Command1_Click()

Set poly1 = New MapObjects2.Polygon
Set pts = New MapObjects2.Points
Set p = Map1.ToMapPoint(100, 100)
pts.Add p
Set p = Map1.ToMapPoint(4500, 1500)
pts.Add p
Set p = Map1.ToMapPoint(800, 3200)
pts.Add p
poly1.Parts.Add pts

Set poly2 = New MapObjects2.Polygon
Set pts = New MapObjects2.Points
Set p = Map1.ToMapPoint(500, 500)
pts.Add p
Set p = Map1.ToMapPoint(6500, 1500)
pts.Add p
Set p = Map1.ToMapPoint(700, 3000)
pts.Add p
poly2.Parts.Add pts

Set poly = Nothing
Map1.TrackingLayer.Refresh True

End Sub

Private Sub Command2_Click()

If Not poly1 Is Nothing Then
   Set poly = poly1.Intersect(poly2)
   Map1.TrackingLayer.Refresh True
End If
End Sub

Private Sub Command3_Click()

If Not poly1 Is Nothing Then
   Set poly = poly1.Union(poly2)
   Map1.TrackingLayer.Refresh True
End If
End Sub

Private Sub Command4_Click()

If Not poly1 Is Nothing Then
    Set poly = poly1.Difference(poly2)
    Map1.TrackingLayer.Refresh True
End If
End Sub

Private Sub Command5_Click()

If Not poly1 Is Nothing Then
    Set poly = poly2.Difference(poly1)
    Map1.TrackingLayer.Refresh True
End If

End Sub

Private Sub Command6_Click()

If Not poly1 Is Nothing Then
   Set poly = poly1.Xor(poly2)
   Map1.TrackingLayer.Refresh True
End If

End Sub

Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)

sym.Color = moRed
sym1.Color = moGreen
sym2.Color = moCyan

If Not poly Is Nothing Then
   Set poly1 = Nothing
   Set poly2 = Nothing
   Map1.DrawShape poly, sym
Else
   If Not poly1 Is Nothing Then
      Map1.DrawShape poly1, sym1
   End If
   If Not poly2 Is Nothing Then
      Map1.DrawShape poly2, sym2
   End If
End If

End Sub

⌨️ 快捷键说明

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