# Copyright 2000 Earthstar Geographics.
#
# Script:  ESG_Geolink_Zoom.erb
# Date:    March 2000
# Author:  Eric Augenstein (eric@es-geo.com)
# Summary: Geolinks the active window to Overview Zoom mode.  
#          All other open windows with the same datum and 
#          projection are linked automatically.
#          Also sets the mouse pointer to ZoomBox mode.

include "lib/BE_Startup.erb"

$erm_machine_type = getenv "ERM_MACHINE_TYPE"

if current window then goto get_alg_info

say warning "Please open at least one image or algorithm first."
exit

get_alg_info:
	copy algorithm from window
	$alg_datum = get algorithm datum
	$alg_proj = get algorithm projection
	$alg_coordsys = get algorithm coordsys

if ($alg_coordsys == raw) then goto need_geo_image
if ($alg_datum == "RAW") then goto need_geo_image
if ($alg_proj == "RAW") then goto need_geo_image
goto set_geolink

need_geo_image:
say warning "Your image has a 'raw' datum, projection or coordinate type. You can only geolink geocoded images."
exit


set_geolink:
$master_win = current window
select $master_win
set window geolink mode to overview zoom

# Can't set zoombox tool if running on UNIX.
if ($erm_machine_type != "win32") then goto finished

set pointer mode to zoombox

finished:
exit
