TNTmips

HOME

FREE PRODUCTS
  TNTlite
  TNTatlas
  TNTsim3D

DOWNLOADS
  Release Version
  Development Version
  FTP
  Language Kits
  Sample Geodata
  Reseller Resources
  Promotional

DOCUMENTATION
  Tutorials
  Technical Guides
  Quick Guides

SITE MAP


Snapshot.sml

See other examples of Tool and Macro scripts ...


##########################
# Snapshot.sml
#
# Updated 27 March 2008  RBS
#
# Requires TNTmips 2005:72
#
##########################
#
# View MacroScript 
# 
# The following symbols are predefined 
#    class GRE_VIEW View      {use to access the view the script is run from} 
#    string MenuChoice$   {will contain the text from the selected menu choice if the button type is "menu"} 
#
##########################


class RVC_RASTER rast, ras;
class MieJPEG jpegHandle;
class MiePNG pngHandle;
class MieBMP bmpHandle;
class MieTIFF tiffHandle;
class MieGIF gifHandle;
class MiePCX pcxHandle;
class MieASCIIRASTER asciiHandle;

# This is the easiest way to get a temporary file without 
# having to worry about filnames already being used.
# Create a temporary raster and then get the filename from it.
CreateTempRaster(rast, 1, 1, "binary");

# Get the snapshot.
View.SaveSnapshot(rast.$Info.Filename, "snap", "snapshot of view");

# Export and open the snapshot.
if (MenuChoice$ == "JPEG") {
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 24);
	CloseRaster(ras);
	jpegHandle.exportCompressFactor = 75;
	ExportRaster(jpegHandle, _context.ScriptDir + "snapshot.jpg", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.jpg");
	}
else if (MenuChoice$ == "PNG") {
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 24);
	CloseRaster(ras);
	ExportRaster(pngHandle, _context.ScriptDir + "snapshot.png", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.png");
	}
else if (MenuChoice$ == "BMP") {
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 24);
	CloseRaster(ras);
	ExportRaster(bmpHandle, _context.ScriptDir + "snapshot.bmp", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.bmp");
	}
else if (MenuChoice$ == "PCX") {
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 8);
	CloseRaster(ras);
	ExportRaster(pcxHandle, _context.ScriptDir + "snapshot.pcx", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.pcx");
	}
else if (MenuChoice$ == "GIF") {
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 8);
	CloseRaster(ras);
	ExportRaster(gifHandle, _context.ScriptDir + "snapshot.gif", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.gif");
	}
else if (MenuChoice$ == "TIFF") {
	tiffHandle.CompressionType = "NONE";
	tiffHandle.PlanarConfiguration = "Pixel interleaved";
	tiffHandle.ExportGeoTags = 1;
	OpenRaster(ras, rast.$Info.Filename, "snap");
	ConvertCompToComp(ras, rast.$Info.Filename, "snapa", 24);
	CloseRaster(ras);
	ExportRaster(tiffHandle, _context.ScriptDir + "snapshot.tif", rast.$Info.Filename, "snapa");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.tif");
	}
else if (MenuChoice$ == "TXT") {
	ExportRaster(asciiHandle, _context.ScriptDir + "snapshot.txt", rast.$Info.Filename, "snap");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.txt");
	}
else if (MenuChoice$ == "DOC") {
	ExportRaster(asciiHandle, _context.ScriptDir + "snapshot.doc", rast.$Info.Filename, "snap");
	RunAssociatedApplication(_context.ScriptDir + "snapshot.doc");
	}

# Delete the temporary file.
DeleteTempRaster(rast);


Back Home ©MicroImages, Inc. 2008 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010   USA
Business & Sales: (402)477-9554  Support: (402)477-9562  Fax: (402)477-9559
Business info@microimages.com  Support support@microimages.com  Web webmaster@microimages.com

9 May 2008

page update: 10 Aug 07