/* *****************************************************************************
/*
/* GEOLOGICAL SURVEY OF CANADA
/* ---------------------------
/*
/* Name: locationmap.aml
/* Usage: LOCATIONMAP
/*
/*
/* {dot_colour} {GRIDON | GRIDOFF} {EF | FE | E | F}
/* {COLOUR | BW}
/* Usage: LOCATIONMAP
/*
/* {GRIDON | GRIDOFF} {EF | FE | E | F} {COLOUR | BW}
/* Arc version: 6.1.1
/* Module: Arcplot
/* OS: Sun OS 4.1.1
/* Platform: Sun SPARCstation2
/*
/* Purpose: Draws location map at the page coordinates entered by the user
/* with either a dot showing the location of the map by the user
/* entering longitude at latitude values in decimal degrees or
/* drawing the maps neatline, shading the map area red.
/*
/* Arguments: position - the position of the x,y coordinates on the logo
/* x - x coordinate in page units
/* y - y coordinate in page units
/* option1 - longitude value or name of a neatline cover in the
/* same projection as the location map
/* option2 - latitude value or grid option if a neatline is used
/* option3 - dot colour or language preference if a neatline is
/* used
/* option4 - grid option
/* option5 - language preference
/* option6 - colour or black and white choice
/* Globals: none
/* Locals: mess - current setting of &messages
/* option - draw dot or maps neatline
/* longitude - longitude value in decimal degrees of dot location
/* latitude - latitude value in decimal degrees of dot location
/* neatline - neatline cover to draw instead of dot
/* units - current setting of UNITS
/* weed - current setting of WEEDDRAW
/* mapunits - current setting of MAPUNITS
/* angle - current setting of MAPANGLE
/* lineset - current LINESET
/* linescale - current LINESCALE setting
/* textset - current TEXTSET
/* textscale - current TEXTSCALE setting
/* markerset - current MARKERSET
/* markerscale - current MARKERSCALE setting
/* shadeset - current SHADESET in use
/* shadescale - current SHADESCALE setting
/* clip - current setting of CLIPMAPEXTENT
/* prj - current setting of MAPPROJECTION
/*
/* Called by: user
/* Calls made: none
/*
/* History: - original coding by Vic Dohar, March 1993
/* - corrections to scale and dot size, August 1993
/* - addition of %path% variable for users &atool to covers.
/* - dot colour choice and grid option added, Jan 1995
/* - add colour or bw option, Aug 1996
/*
/* *****************************************************************************
/*
/* 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 option1 option2 option3 option4 option5 option6
&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 be executed from Arcplot
&mess %mess%
&end /* then 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 LOCATION_BASE exists
&if ^ [exists %path%/location_base -cover] &then &do
&ty \In order to execute this aml the cover LOCATION_BASE must exist in your
&ty current atool subdirectory structure. Contact your system manager.
&mess %mess%
&return
&end /* then do
/* Check if cover LOCATION_CULT exists
&if ^ [exists %path%/location_cult -cover] &then &do
&ty \In order to execute this aml the cover LOCATION_CULT must exist in your
&ty current atool subdirectory structure. Contact your system manager.
&mess %mess%
&return
&end /* then do
/* Check if cover LOCATION_H2O exists
&if ^ [exists %path%/location_h2o -cover] &then &do
&ty \In order to execute this aml the cover LOCATION_H2O must exist in your
&ty current atool subdirectory structure. Contact your system manager.
&mess %mess%
&return
&end /* then do
/* Verify that page x and y arguments are numeric
&if [type %x%] gt 0 or [type %y%] gt 0 &then
&call USAGE
/* Verify argument option1 is entered and determine if it is a character type,
/* defining a neatline cover or a numeric value defining the longitude of the
/* dot
&if [null %option1%] &then
&call USAGE
&select [type %option1%]
&when -1, -2; &do
&s option DOT
/* Check if projection file location.prj exists
&if ^ [exists %path%/location.prj -file] &then &do
&ty \In order to plot a dot on the location map the projection file
&ty location.prj must exist at %path%.
&ty Contact your system manager.
&mess %mess%
&return
&end /* then do
/* Dot to be placed on location map, verify that argument option2 is
/* numeric for the latitude of the dot and other arguments
&if [null %option2%] &then
&call USAGE
&if [type %option2%] gt 0 &then
&call USAGE
&s longitude %option1%
&s latitude %option2%
&if [null %option3%] &then &do
&s dotcolour BLACK
&s gridopt GRIDON
&s language EF
&s colour .TRUE.
&end /* then do
&else &do
&if [type %option3%] ne 1 &then
&call USAGE
&select [upcase %option3%]
&when #
&s dotcolour CMYK -1 -1 -1 100
&otherwise
&s dotcolour [upcase %option3%]
&end /* select
/* Check if valid dot colour before proceeding
&severity &error &routine INVALID_DOT_COLOUR
MARKERCOLOR %dotcolour%
&severity &error &routine ERROR
&if [null %option4%] &then &do
&s gridopt GRIDON
&s language EF
&s colour .TRUE.
&end /* then do
&else &do
&if [type %option4%] ne 1 &then
&call USAGE
&select [upcase %option4%]
&when #, GRIDON
&s gridopt GRIDON
&when GRIDOFF
&s gridopt GRIDOFF
&otherwise
&call USAGE
&end /* select
&if [null %option5%] &then &do
&s language EF
&s colour .TRUE.
&end /* then do
&else &do
&if [type %option5%] ne 1 &then
&call USAGE
&select [upcase %option5%]
&when #,EF
&s language EF
&when FE
&s language FE
&when E
&s language E
&when F
&s language F
&otherwise
&call USAGE
&end /* select
&if [null %option6%] &then
&s colour .TRUE.
&else &do
&if [type %option6%] ne 1 &then
&call USAGE
&select [upcase %option6%]
&when #,C,COL,COLOUR
&s colour .TRUE.
&when BW,BLACK
&s colour .FALSE.
&otherwise
&call USAGE
&end /* select
&end /* else do
&end /* else do
&end /* else do
&end /* else do
&end /* when -1, -2
&when 1; &do
&s option NEATLINE
/* Neatline to be plotted on location map, verify that it has polygon
/* topology and check language preference
&if ^ [exists %option1% -polygon] &then &do
&ty Neatline cover [trans %option1%] must have polygon topology
&ty Use dot or exit and build polygon topology
&mess %mess%
&return
&end /* then do
&else &do
&s neatline %option1%
&if [null %option2%] &then &do
&s gridopt GRIDON
&s language EF
&s colour .TRUE.
&end /* then do
&else &do
&if [type %option2%] ne 1 &then
&call USAGE
&select [upcase %option2%]
&when #, GRIDON
&s gridopt GRIDON
&when GRIDOFF
&s gridopt GRIDOFF
&otherwise
&call USAGE
&end /* select
&if [null %option3%] &then &do
&s language EF
&s colour .TRUE.
&end /* then do
&else &do
&if [type %option3%] ne 1 &then
&call USAGE
&select [upcase %option3%]
&when #,EF
&s language EF
&when FE
&s language FE
&when E
&s language E
&when F
&s language F
&otherwise
&call USAGE
&end /* select
&if [null %option4%] &then
&s colour .TRUE.
&else &do
&if [type %option4%] ne 1 &then
&call USAGE
&select [upcase %option4%]
&when #,C,COL,COLOUR
&s colour .TRUE.
&when BW,BLACK
&s colour .FALSE.
&otherwise
&call USAGE
&end /* select
&end /* else do
&end /* else do
&end /* else do
&end /* else do
&end /* when 1
&otherwise
&call USAGE
&end /* select
/* Saving current arcplot environment settings
&s units [show units]
&s weed [show weeddraw]
&s mapunits [show mapunits]
&s angle [show mapangle]
&s lineset [show lineset]
&s linescale [show linescale]
&s textset [show textset]
&s textscale [show textscale]
&s markerset [show markerset]
&s markerscale [show markerscale]
&s shadeset [show shadeset]
&s shadescale [show shadescale]
&s clip [show clipmapextent]
&s prj [extract 1 [show mapprojection]]
/* Setting up plotting environment of location map
&select [trans %position%]
&when UL; &do
&call SETUP
MAPPOSITION -2749579 3906722 %x% %y%
&end /* when UL
&when CL; &do
&call SETUP
MAPPOSITION -2749579 1535755 %x% %y%
&end /* when CL
&when LL; &do
&call SETUP
MAPPOSITION -2749579 -835211 %x% %y%
&end /* when LL
&when UC; &do
&call SETUP
MAPPOSITION 181883 3906722 %x% %y%
&end /* when UC
&when CC; &do
&call SETUP
MAPPOSITION 181883 1535755 %x% %y%
&end /* when CC
&when LC; &do
&call SETUP
MAPPOSITION 181883 -835211 %x% %y%
&end /* when LC
&when UR; &do
&call SETUP
MAPPOSITION 3113345 3906722 %x% %y%
&end /* when UR
&when CR; &do
&call SETUP
MAPPOSITION 3113345 1535755 %x% %y%
&end /* when CR
&when LR; &do
&call SETUP
MAPPOSITION 3113345 -835211 %x% %y%
&end /* when LR
&otherwise
&call USAGE
&end /* select
/* Plotting water
SHADEDELETE ALL
SHADETYPE COLOR
&if %colour% &then
SHADECOLOR CMYK 20 -1 -1 -1
&else
SHADECOLOR CMYK -1 -1 -1 10
SHADEPUT 1
CLEARSELECT
RESELECT %path%/location_h2o POLYS location_h2o-id EQ 1
POLYGONSHADES %path%/location_h2o 1
/* Plotting neatline of map on location map
&if %option% eq NEATLINE &then &do
/* Plotting neatline of map onto location map
&if %colour% &then
SHADECOLOR CMYK -1 40 -1 -1
&else
SHADECOLOR CMYK -1 -1 -1 20
SHADEPUT 1
CLEARSELECT
POLYGONSHADES %neatline% 1
LINEDELETE ALL
LINETYPE WIDE
LINESIZE 0.006
LINEPEN 0.006 BUTT MITER
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
ARCS %neatline%
&end /* then do
/* Plotting base
LINEDELETE ALL
LINETYPE WIDE
LINESIZE 0.006
LINEPEN 0.006 BUTT MITER
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
ARCS %path%/location_base
/* Plotting culture, international boundary
LINETYPE WIDE
LINESIZE 0.008
LINEPEN 0.008 BUTT MITER
LINEINTERVAL 0.01
LINETEMPLATE 9031111111
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 950
ARCS %path%/location_cult
/* Plotting culture, provincial boundary
LINETYPE WIDE
LINESIZE 0.008
LINEPEN 0.008 BUTT MITER
LINEINTERVAL 0.01
LINETEMPLATE 90311111
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 951
ARCS %path%/location_cult
/* Plotting culture, undefined boundary
LINETYPE WIDE
LINESIZE 0.008
LINEPEN 0.008 BUTT MITER
LINEINTERVAL 0.01
LINETEMPLATE 12
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 952
ARCS %path%/location_cult
/* Plotting culture, district boundary
LINETYPE WIDE
LINESIZE 0.008
LINEPEN 0.008 BUTT MITER
LINEINTERVAL 0.01
LINETEMPLATE 903111
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 953
ARCS %path%/location_cult
/* Plotting culture, arctic circle and graticules
&if %gridopt% eq GRIDON &then &do
LINETYPE WIDE
LINESIZE 0.005
LINEPEN 0.005 BUTT MITER
LINEINTERVAL 0.01
LINETEMPLATE 32
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 954
ARCS %path%/location_cult
LINETYPE WIDE
LINESIZE 0.005
LINEPEN 0.005 BUTT MITER
LINEINTERVAL 0
LINETEMPLATE 0
LINECOLOR CMYK -1 -1 -1 100
CLEARSELECT
RESELECT %path%/location_cult ARCS location_cult-id = 955
ARCS %path%/location_cult
&end /* then do
/* Title
TEXTDELETE ALL
TEXTFONT 93709 /* triumvirate
TEXTQUALITY PROPORTIONAL
TEXTSIZE 6 # PT
TEXTCOLOR CMYK -1 -1 -1 100
UNITS MAP
CLIPMAPEXTENT OFF
MOVE 181883 -1200000
&select [upcase %language%]
&when E
TEXT 'LOCATION MAP' LC
&when F
TEXT 'LOCALISATION DE LA CARTE' LC
&when EF
TEXT 'LOCATION MAP - LOCALISATION DE LA CARTE' LC
&when FE
TEXT 'LOCALISATION DE LA CARTE - LOCATION MAP' LC
&end /* select
/* Plotting location dot
&if %option% eq DOT &then &do
MAPPROJECTION %path%/location.prj
MARKERDELETE ALL
MARKERSCALE 1
MARKERFONT 21
MARKERPATTERN 96
&if %colour% &then
MARKERCOLOR %dotcolour%
&else
MARKERCOLOR CMYK -1 -1 -1 100
MARKERPEN 0 BUTT MITER
&if [show pageunits] eq INCHES &then
MARKERSIZE 0.047 /* this will result in a dot around 1.2mm diameter
&else
MARKERSIZE 0.12
MARKER %longitude% %latitude%
&end /* then do
&call RESET
&return
/* -----------------------------------------------------------------------------
&routine SETUP
UNITS PAGE
WEEDDRAW OFF
MAPPROJECTION OFF
MAPEXTENT %path%/location_base
MAPUNITS METERS
MAPSCALE 96000000
MAPANGLE 0
(!LINE TEXT MARKER SHADE!)SCALE 1
&return
&routine USAGE
&ty Usage: LOCATIONMAP
&ty
&ty
&ty {dot_colour} {GRIDON | GRIDOFF} {EF | FE | E | F}
&ty {COLOUR | BW}
&ty LOCATIONMAP
&ty
&ty {GRIDON | GRIDOFF} {EF | FE | E | F} {COLOUR | BW}
&mess %mess%
&return; &return
&routine RESET
/* Resetting Arcplot environment
MAPPROJECTION OFF
MAPUNITS %mapunits%
MAPANGLE %angle%
LINEDELETE ALL
LINESET %lineset%
LINESCALE %linescale%
TEXTDELETE ALL
TEXTSET %textset%
TEXTSCALE %textscale%
MARKERDELETE ALL
MARKERSET %markerset%
MARKERSCALE %markerscale%
SHADEDELETE ALL
SHADESET %shadeset%
SHADESCALE %shadescale%
UNITS %units%
WEEDDRAW %weed%
CLIPMAPEXTENT %clip%
&mess %mess%
&return
&routine ERROR
&severity &error &ignore
&call RESET
&ty *** An error has occured plotting the location map ***
&return; &return
&routine INVALID_DOT_COLOUR
&severity &error &ignore
&call RESET
&ty *** Invalid colour name for dot ***
&return; &return