# LaunchSim - Computes center location and zoom level from current view # and launches tntsim with the appropriate parameters. # Requires tntsim built March 20, 2002 or later # # The following symbols are predefined # class VIEW View {use to access the view the script is run from} # Declare variables class POINT2D center; class POINT2D left; class POINT2D right; class POINT2D point; class Raster rast; class Georef ref; # Get georeference info from .sim file OpenRaster(rast,_context.ScriptDir+"Otoe_Sim2.sim","TERRAIN"); ref = GetLastUsedGeorefObject(rast); # Calculate center location in map coordinates center.x = View.Width / 2; center.y = View.Height / 2; center = TransPoint2D(center, ViewGetTransViewToScreen(View, 1)); center = TransPoint2D(center, ViewGetTransMapToView(View, ref.Projection, 1)); # Calculate extent of view extent = View.Width * View.PixelSizeMillimeters * View.CurrentMapScale / 1000; # Launch simulator run(sprintf("tntsim.exe POI=%.2f,%.2f DOV=0.0,-30.0 FOV=%.2f \"%sOtoe_Sim2.sim\"", center.x, center.y, extent, _context.ScriptDir), 0);