/*N itemgrid.aml /*P----------------------------- Purpose ------------------------------------- /*A---------------------------- Arguments ------------------------------------ /*G------------------------ Global Variables --------------------------------- /*L------------------------ Local Variables ---------------------------------- /*I---------------- Input/Output Files, Coverages, etc. ---------------------- /*D----------------- Detailed Remarks, Assumptions, etc. --------------------- /*R----------- Other AMLs, Menus, or Programs Run from this AML -------------- /*B----------- Other AMLs, Menus, or Programs which Run this AML ------------- /*O-------------------- Operating System Dependencies ------------------------ /*H----------------------------- History ------------------------------------- /* /* Jacek Blaszczynski 04/21/97 Original Coding /* /*E=========================================================================== &severity &error &routine bailout &args in_cover out_grid cellsize f_class /* Check arguments &call chkargs /* Generate list of items for %in_cover% and %f_class% &call items /* Do the work &call main &call exit &return /* End of itemgrid.aml /*-------------- &routine chkargs /*-------------- &if [SHOW PROGRAM] <> ARC &then &do &type This aml must be run from ARC. &call bailout &end &do arg &list in_cover out_grid cellsize &if [NULL [VALUE %arg%]] &then &do &call usage &call bailout &end &end &if not [EXISTS %in_cover% -COVER] &then &do &type Input coverage %in_cover% does not exist. &call bailout &end &if [EXISTS %out_grid% -GRID] &then &do &type Output grid: %out_grid%, already exists. &call bailout &end &else &do &if [LENGTH %out_grid%] > 13 &then &do &type Grid names must be 13 characters or less. &call bailout &end &end &s celltype = [TYPE %cellsize%] &if %celltype% <> -1 &then &do /* Cellsize not integer &type Cellsize must be an integer. &call bailout &end &else &do &if %cellsize% < 1 &then &do &type Cellsize must be greater than 0 &call bailout &end &end &if [NULL %f_class%] &then &do &s f_class = POLY &end &else &do &s valid_classes = {'POLY','LINE','POINT'} &s f_class = [UPCASE %f_class%] &if not %f_class% in %valid_classes% &then &do &call usage &call bailout &end &end &return /* End of routine chkargs /*------------ &routine items /*------------ &s count = 0 &do itemtype &list integer numeric binary float &s count = %count% + 1 &if %count% = 1 &then &do &s choiceitems = [LISTITEM %in_cover% -%f_class% -%itemtype%] &end &else &do &s choiceitems = %choiceitems% [LISTITEM %in_cover% -%f_class% -%itemtype%] &end &end &type %choiceitems% &return /* End of routine items /*----------- &routine main /*----------- &terminal 9999 display 9999 &s attribute = [GETCHOICE %choiceitems% -PROMPT [QUOTE Select an item for %out_grid%] -NONE] &if [NULL %attribute%] &then &do /* Stop aml &type Stopping execution of itemgrid.aml &call bailout &end &else &do &select %f_class% &when POLY; &do POLYGRID %in_cover% %out_grid% %attribute% %cellsize% Y &end &when LINE; &do LINEGRID %in_cover% %out_grid% %attribute% %cellsize% Y &end &when POINT; &do POINTGRID %in_cover% %out_grid% %attribute% %cellsize% Y &end &end &end grid mape %in_cover% gridshades %out_grid% describe %out_grid% quit &return /* End of routine main /*------------ &routine usage /*------------ &type Usage: &r itemgrid {POLY | LINE | POINT} &return /* End of routine usage /*----------- &routine exit /*----------- &return /* End of routine exit /*-------------- &routine bailout /*-------------- &severity &error &ignore &call exit &return &error Bailing out of itemgrid.aml...