MO sample中的缓冲冲区的例子很简单的一个例子
2010-04-27 11:12
351 查看
Option Explicit
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'Point buffering
If Option1.Value Then
Dim pt As New MapObjects2.Point
Dim eventPt As New MapObjects2.GeoEvent
Dim buffPt As New MapObjects2.Polygon
Dim buffEventPt As New MapObjects2.GeoEvent
Set pt = Map1.ToMapPoint(x, y)
Set eventPt = Map1.TrackingLayer.AddEvent(pt, 0)
Set buffPt = pt.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventPt = Map1.TrackingLayer.AddEvent(buffPt, 3)
'Line buffering
ElseIf Option2.Value Then
Dim line As New MapObjects2.line
Dim eventLine As New MapObjects2.GeoEvent
Dim buffLine As New MapObjects2.Polygon
Dim buffEventLine As New MapObjects2.GeoEvent
Set line = Map1.TrackLine
Set eventLine = Map1.TrackingLayer.AddEvent(line, 1)
Set buffLine = line.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventLine = Map1.TrackingLayer.AddEvent(buffLine, 3)
'Rectangle buffering
ElseIf Option3.Value Then
Dim rect As New MapObjects2.Rectangle
Dim eventRect As New MapObjects2.GeoEvent
Dim buffRect As New MapObjects2.Polygon
Dim buffEventRect As New MapObjects2.GeoEvent
Set rect = Map1.TrackRectangle
Set eventRect = Map1.TrackingLayer.AddEvent(rect, 2)
Set buffRect = rect.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventRect = Map1.TrackingLayer.AddEvent(buffRect, 3)
'Polygon buffering
ElseIf Option4.Value Then
Dim poly As New MapObjects2.Polygon
Dim eventPoly As New MapObjects2.GeoEvent
Dim buffPoly As New MapObjects2.Polygon
Dim buffEventPoly As New MapObjects2.GeoEvent
Set poly = Map1.TrackPolygon
Set eventPoly = Map1.TrackingLayer.AddEvent(poly, 2)
Set buffPoly = poly.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventPoly = Map1.TrackingLayer.AddEvent(buffPoly, 3)
'Ellipse buffering
ElseIf Option5.Value Then
Dim arect As New MapObjects2.Rectangle
Dim elli As New MapObjects2.Ellipse
Dim eventElli As New MapObjects2.GeoEvent
Dim buffElli As New MapObjects2.Polygon
Dim buffEventElli As New MapObjects2.GeoEvent
Set arect = Map1.TrackRectangle
elli.Top = arect.Top
elli.Bottom = arect.Bottom
elli.Left = arect.Left
elli.Right = arect.Right
Set eventElli = Map1.TrackingLayer.AddEvent(elli, 2)
Set buffElli = elli.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventElli = Map1.TrackingLayer.AddEvent(buffElli, 3)
End If
End Sub
Private Sub Form_Load()
Option1.Caption = "Point"
Option2.Caption = "Line"
Option3.Caption = "Rectangle"
Option4.Caption = "Polygon"
Option5.Caption = "Ellipse"
Text1.Text = "100"
Map1.TrackingLayer.SymbolCount = 4
With Map1.TrackingLayer.Symbol(0)
.SymbolType = moPointSymbol
.Style = moTriangleMarker
.Color = moRed
.Size = 3
End With
With Map1.TrackingLayer.Symbol(1)
.SymbolType = moLineSymbol
.Color = moRed
.Size = 3
End With
With Map1.TrackingLayer.Symbol(2)
.SymbolType = moFillSymbol
.Style = moGrayFill
.Color = moRed
.OutlineColor = moRed
End With
With Map1.TrackingLayer.Symbol(3)
.SymbolType = moFillSymbol
.Style = moGrayFill
.Color = moBlue
.OutlineColor = moBlue
End With
End Sub
运行结果
用mo真是累.写个毕业设计真是麻烦.
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'Point buffering
If Option1.Value Then
Dim pt As New MapObjects2.Point
Dim eventPt As New MapObjects2.GeoEvent
Dim buffPt As New MapObjects2.Polygon
Dim buffEventPt As New MapObjects2.GeoEvent
Set pt = Map1.ToMapPoint(x, y)
Set eventPt = Map1.TrackingLayer.AddEvent(pt, 0)
Set buffPt = pt.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventPt = Map1.TrackingLayer.AddEvent(buffPt, 3)
'Line buffering
ElseIf Option2.Value Then
Dim line As New MapObjects2.line
Dim eventLine As New MapObjects2.GeoEvent
Dim buffLine As New MapObjects2.Polygon
Dim buffEventLine As New MapObjects2.GeoEvent
Set line = Map1.TrackLine
Set eventLine = Map1.TrackingLayer.AddEvent(line, 1)
Set buffLine = line.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventLine = Map1.TrackingLayer.AddEvent(buffLine, 3)
'Rectangle buffering
ElseIf Option3.Value Then
Dim rect As New MapObjects2.Rectangle
Dim eventRect As New MapObjects2.GeoEvent
Dim buffRect As New MapObjects2.Polygon
Dim buffEventRect As New MapObjects2.GeoEvent
Set rect = Map1.TrackRectangle
Set eventRect = Map1.TrackingLayer.AddEvent(rect, 2)
Set buffRect = rect.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventRect = Map1.TrackingLayer.AddEvent(buffRect, 3)
'Polygon buffering
ElseIf Option4.Value Then
Dim poly As New MapObjects2.Polygon
Dim eventPoly As New MapObjects2.GeoEvent
Dim buffPoly As New MapObjects2.Polygon
Dim buffEventPoly As New MapObjects2.GeoEvent
Set poly = Map1.TrackPolygon
Set eventPoly = Map1.TrackingLayer.AddEvent(poly, 2)
Set buffPoly = poly.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventPoly = Map1.TrackingLayer.AddEvent(buffPoly, 3)
'Ellipse buffering
ElseIf Option5.Value Then
Dim arect As New MapObjects2.Rectangle
Dim elli As New MapObjects2.Ellipse
Dim eventElli As New MapObjects2.GeoEvent
Dim buffElli As New MapObjects2.Polygon
Dim buffEventElli As New MapObjects2.GeoEvent
Set arect = Map1.TrackRectangle
elli.Top = arect.Top
elli.Bottom = arect.Bottom
elli.Left = arect.Left
elli.Right = arect.Right
Set eventElli = Map1.TrackingLayer.AddEvent(elli, 2)
Set buffElli = elli.Buffer(Text1.Text, Map1.FullExtent)
Set buffEventElli = Map1.TrackingLayer.AddEvent(buffElli, 3)
End If
End Sub
Private Sub Form_Load()
Option1.Caption = "Point"
Option2.Caption = "Line"
Option3.Caption = "Rectangle"
Option4.Caption = "Polygon"
Option5.Caption = "Ellipse"
Text1.Text = "100"
Map1.TrackingLayer.SymbolCount = 4
With Map1.TrackingLayer.Symbol(0)
.SymbolType = moPointSymbol
.Style = moTriangleMarker
.Color = moRed
.Size = 3
End With
With Map1.TrackingLayer.Symbol(1)
.SymbolType = moLineSymbol
.Color = moRed
.Size = 3
End With
With Map1.TrackingLayer.Symbol(2)
.SymbolType = moFillSymbol
.Style = moGrayFill
.Color = moRed
.OutlineColor = moRed
End With
With Map1.TrackingLayer.Symbol(3)
.SymbolType = moFillSymbol
.Style = moGrayFill
.Color = moBlue
.OutlineColor = moBlue
End With
End Sub
运行结果
用mo真是累.写个毕业设计真是麻烦.
相关文章推荐
- [导入]一个很简单的C#例子,给网友解答的,总觉得应该有更简单的方法
- 一个简单的PV统计例子,演示如何利用内存缓冲高并发环境下的计数
- linux 下创建动态链接库的一个很简单的例子
- 一个很简单的例子,从汇编层次理解函数调用
- 一个例子叫你理解缓冲输入与非缓冲输入,以及流的概念:论read与fget open与fopen的区别
- 一个很简单的用nios写的中断方式接受的串口例子
- 一个很简单的操作excel的例子
- AJAX与JSP结合实例,一个很简单实用的例子:身份证号码检验
- AJAX与JSP结合实例,一个很简单实用的例子:身份证号码检验
- 一个很简单的Android手机和pc通信的例子
- 很简单 很简单的一个java线程 例子
- 一个很简单的C#例子,给网友解答的,总觉得应该有更简单的方法
- linux 下创建动态链接库的一个很简单的例子
- 一个ListView根据标识加载不同布局,很简单的例子,就是聊天界面,你说话在右边好友在左边怎么实现呢.
- 一个很简单的DirectShow例子
- 一个很简单的java回调的例子
- java se tutorials 里面的一个很简单的例子,高手请指点一下
- 一个用Phaser控制多线程协作的小例子
- 大数据学习35:一个scala 操控 HDFS 文件目录的小例子
- 一个简单的Inno Setup例子