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

📄 overlaymapscalelimits.bas

📁 Surfer是地学中常用的一个软件
💻 BAS
字号:
'OverlayMapScaleLimits.bas overlays all maps in the current window
' keeping the scale, limits, and position of the selected map.
' TB - 15 Feb 02
Sub Main
	Debug.Print "----- ";Time;" -----"
	Set surf = GetObject(,"surfer.application")
	Set plotdoc1 = surf.ActiveDocument
	surf.Caption = "Surfer "+surf.Version
	AppActivate "Surfer "+surf.Version
	Debug.Print plotdoc1.Selection.Count;" object(s) selected."
	If plotdoc1.Selection.Count <> 1 Then
		MsgBox("Select one map." + vbCrLf + _
			Trim(Str(plotdoc1.Selection.Count)) + _
			" objects selected.")
		End
	End If		
	With plotdoc1.Selection(1)
		If .Type <> srfShapeMapFrame Then
			MsgBox ("Select one map.")
			End
		End If
		mapxmin = .xMin
		mapxmax = .xMax
		mapymin = .yMin
		mapymax = .yMax
		mapxscale = .xMapPerPU
		mapyscale = .yMapPerPU
		'mapzscale = .zMapPerPU
		maptop = .Top
		mapleft = .Left
	End With
	
	For Each obj In plotdoc1.Shapes
		If obj.Type = srfShapeMapFrame Then 
			If (obj.xMin >= mapxmax Or _
		  	obj.xMax <= mapxmin Or _
		  	obj.yMin >= mapymax Or _
		  	obj.yMax <= mapymin) Then
		  		plotdoc1.Selection.DeselectAll
		  		obj.Select
					If MsgBox(obj.Name + ":" +obj.Overlays(1) + _
						" is not within the limits of the reference map.  Continue?" + vbCrLf + _
						"Reference Map          "+obj.Name+":"+obj.Overlays(1) +vbCrLf + _
						"xMin:" + Str(mapxmin) + "                    xMin:"+ Str(obj.xMin), _
						vbYesNo) = vbNo Then End
			End If
		End If					
	Next		
			
	plotdoc1.Shapes.SelectAll
	Set mapframe2 = plotdoc1.Selection.OverlayMaps
	plotdoc1.Selection.DeselectAll
	mapframe2.Select
	With mapframe2
		.SetLimits(mapxmin,mapxmax,mapymin,mapymax)
		.xMapPerPU = mapxscale
		.yMapPerPU = mapyscale
'		.zMapPerPU = mapzscale
		.Top = maptop
		.Left = mapleft
	End With

End Sub

⌨️ 快捷键说明

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