/* *****************************************************************************
/*
/* GEOLOGICAL SURVEY OF CANADA
/* ---------------------------
/*
/* Name: nrlogo.aml
/* Usage: NRLOGO
/* {E | F} {K | R} {point_size}
/* NRLOGO BORDER {E | F} {K | R} {point_size}
/* Arc version: 6.1.1
/* Module: Arcplot
/* OS: Sun OS 4.1.2
/* Platform: Sun SPARCstation2, 1+
/*
/* Purpose: Draws NR logo by user either specifying which position of the
/* logo to place at the specified x,y page coordinates or
/* specifying the upper left coordinate of the border in map
/* units. The user can also state which language to appear first,
/* the colour of the flag and the p[oint size. By default, english
/* appears first, the flag is black, and the point size is
/* approximately 10.
/*
/* Arguments: position - the position on the logo or the keyword BORDER
/* x - x coordinate in page units or map units
/* y - y coordinate in page units or map units
/* language - english or french to appear first in logo
/* colour - the colour of the flag, black or red
/* size - point size of the NR logo
/* Globals: none
/* Locals: echo - current setting of &echo
/* mess - current setting of &messages
/* def_size - default size of text in cover
/* units - current setting of UNITS
/* weed - current setting of WEEDDRAW
/* mapunits - current setting of MAPUNITS
/* angle - current setting of MAPANGLE
/* shadeset - current SHADESET in use
/* shadescale - current SHADESCALE setting
/* pagecoo-x - x page coordinate from converting x map coordinate
/* pagecoo-y - y page coordinate from converting y map coordinate
/* y-offset - vertical offset from border edge (6 mm)
/*
/* Called by: user
/* Calls made: none
/*
/* History: Original coding by Vic Dohar, March 1993
/* Specifying size in points, Vic Dohar, April 1993
/* Addition of %path% variable for users &atool to covers.
/*
/* *****************************************************************************
/*
/* CROWN COPYRIGHTS RESERVED
/*
/* NO GUARANTEE IS MADE BY THE AUTHOR(S) OR THE GEOLOGICAL SURVEY OF
/* CANADA REGARDING EITHER THE ACCURACY OF THIS PROGRAM OR THE PROPER
/* EXECUTION ON ALL COMPUTER SYSTEMS.
/*
/* *****************************************************************************
&args position x y language colour size
&severity &warning &ignore
&severity &error &routine ERROR
/* Setting command display variables
&s mess [show &messages]
&if [show &echo] eq &ON &then
&mess &on
&else
&mess &off &all
/* Check if user is running Arcplot
&if [show program] ne ARCPLOT &then &do
&ty This AML can only run from Arcplot
&mess %mess%
&return
&end /* then do
/* Check if all arguments entered
&if [null %y%] &then
&call USAGE
/* Verify that x and y arguments are numeric
&if [type %x%] gt 0 or [type %y%] gt 0 &then
&call USAGE
/* Set default point size of text in cover
&s def_size 10.3
/* Verify that language, colour and point size options entered and are of
/* correct type
&if ^ [null %language%] &then &do
&if [type %language%] ne 1 &then
&call USAGE
&else &do
&select [translate %language%]
&when E, #
&s language e
&when F
&s language f
&otherwise
&call USAGE
&end /* select
&if ^ [null %colour%] &then &do
&if [type %colour%] ne 1 &then
&call USAGE
&else &do
&select [translate %colour%]
&when #, K
&s colour K
&when R
&s colour R
&otherwise
&call USAGE
&end /* select
&if ^ [null %size%] &then &do
&if [type %size%] ge 0 &then
&call USAGE
&else &do
/* Check that size is grerater than zero
&if %size% le 0 &then &do
&ty Point size must be greater than zero.
&call USAGE
&end /* then do
&end /* else do
&end /* then do
&else
&s size %def_size%
&end /* else do
&end /* then do
&else &do
&s colour K
&s size %def_size%
&end /* else do
&end /* else do
&end /* then do
&else &do
&s language e
&s colour K
&s size %def_size%
&end /* else do
/* Set path to covers using atool path, same as for this aml
&s path [before [extract 1 [show &atool]] /amls]/covers
/* Check if cover NRLOGO_E or NRLOGO_F exists
&if ^ [exists %path%/nrlogo_%language% -cover] &then &do
&ty \In order to execute this aml the covers NRLOGO_E/F must exist in your
&ty current atool subdirectory structure. Contact your system manager.
&mess %mess%
&return
&end /* then do
/* Saving current arcplot environment settings
&s units [show units]
&s weed [show weeddraw]
&s mapunits [show mapunits]
&s angle [show mapangle]
&s shadeset [show shadeset]
&s shadescale [show shadescale]
/* Position logo and setup plotting environment
&select [trans %position%]
&when BORDER; &do
&s pagecoo-x [extract 1 [show convert map %x% %y% page]]
&s y-offset 6 /* in mm
&select [show pageunits]
&when INCHES
&s pagecoo-y [extract 2 [show convert map %x% %y% page]] ~
+ ( %y-offset% / 25.4 )
&when CM
&s pagecoo-y [extract 2 [show convert map %x% %y% page]] + 0.%y-offset%
&otherwise; &do
&ty \Note: Unable to plot NRLOGO_[trans %language%] at corner of
&ty border, because pageunits must be INCHES or CM
&mess %mess%
&return
&end /* otherwise
&end /* select
WEEDDRAW OFF
MAPEXTENT %path%/nrlogo_%language%
MAPUNITS INCHES
MAPSCALE [calc %def_size% / %size%]
MAPANGLE 0
MAPPOSITION 0 0 %pagecoo-x% %pagecoo-y%
&end /* when BORDER
&when UL; &do
&call SETUP
MAPPOSITION 0 0.256 %x% %y%
&end /* when UL
&when CL; &do
&call SETUP
MAPPOSITION 0 0.128 %x% %y%
&end /* when CL
&when LL; &do
&call SETUP
MAPPOSITION 0 0 %x% %y%
&end /* when LL
&when UC; &do
&call SETUP
MAPPOSITION 1.805 0.256 %x% %y%
&end /* when UC
&when CC; &do
&call SETUP
MAPPOSITION 1.805 0.128 %x% %y%
&end /* when CC
&when LC; &do
&call SETUP
MAPPOSITION 1.805 0 %x% %y%
&end /* when LC
&when UR; &do
&call SETUP
MAPPOSITION 3.61 0.256 %x% %y%
&end /* when UR
&when CR; &do
&call SETUP
MAPPOSITION 3.61 0.128 %x% %y%
&end /* when CR
&when LR; &do
&call SETUP
MAPPOSITION 3.61 0 %x% %y%
&end /* when LR
&otherwise
&call USAGE
&end /* select
/* Begin plotting logo
CLEARSELECT
SHADEDELETE ALL
SHADESCALE 1
SHADETYPE COLOR
SHADECOLOR CMYK -1 -1 -1 100
SHADEPUT 1
&if %colour% eq K &then &do /* when flag is black
RESELECT %path%/nrlogo_%language% POLYS ~
NRLOGO_[translate %language%]-ID NE 0
POLYGONSHADES %path%/nrlogo_%language% 1
&end /* then do
&else &do /* when flag is red
RESELECT %path%/nrlogo_%language% POLYS ~
NRLOGO_[translate %language%]-ID EQ 1
POLYGONSHADES %path%/nrlogo_%language% 1
CLEARSELECT
RESELECT %path%/nrlogo_%language% POLYS ~
NRLOGO_[translate %language%]-ID EQ 2
SHADECOLOR CMYK -1 100 100 -1
SHADEPUT 1
POLYGONSHADES %path%/nrlogo_%language% 1
&end /* else do
/* Resetting Arcplot environment
&call RESET
&return
/* -----------------------------------------------------------------------------
&routine SETUP
UNITS PAGE
WEEDDRAW OFF
MAPEXTENT %path%/nrlogo_%language%
MAPUNITS INCHES
MAPSCALE [calc %def_size% / %size%]
MAPANGLE 0
&return
&routine USAGE
&ty Usage: NRLOGO
&ty
&ty {E | F} {K | R} {point_size}
&ty NRLOGO BORDER
&ty {E | F} {K | R} {point_size}
&mess %mess%
&return; &return
&routine RESET
MAPUNITS %mapunits%
MAPANGLE %angle%
SHADEDELETE ALL
SHADESET %shadeset%
SHADESCALE %shadescale%
UNITS %units%
WEEDDRAW %weed%
&mess %mess%
&return
&routine ERROR
&severity &error &ignore
&call RESET
&ty *** An error has occured plotting the NR Logo ***
&return; &return