include scalebar.mapyrus

# Settings for page layout.  To use this a template, read these settings
# from files using commands like 'let title=spool("mytitle.txt")' instead.
#
let title = "My Title"
let map = "coastline.shp"

newpage "eps", "tutoriallayout1.eps", "A6", "background=lightgrey"

# Draw the title and logo.
#
move 10, 125
font "Palatino-Roman", 24
color "black"
label title
clearpath
move 80, 10
icon "mapyrus.png"

begin land
  key "box", "Land"
  color "khaki"
  fill
  color "black"
  stroke
end

begin sea
  key "box", "Sea"
  color "seablue"
  fill
end

begin drawMap
  # Set world coordinates in center of page, then draw map.
  #
  clearpath
  box 4, 20, 78, 115
  stroke
  dataset "shapefile", map, ""
  worlds -1300000, 7000000, 300000, 8900000, 10, 25, 75, 110

  clearpath
  box -1300000, 7000000, 300000, 8900000
  clip "inside"
  sea

  while Mapyrus.fetch.more
  do
    fetch
    clearpath
    addpath GEOMETRY
    land
  done
  let mapScale = Mapyrus.worlds.scale
end

# Draw map in procedure so world coordinates and clip
# rectangle are restored when procedure finishes.
#
clearpath
drawMap

# Now draw the legend to the right of the map.
#
clearpath
move 85, 100, 85, 90
font "Palatino-Roman", 4
legend 5

# Draw a table to the right of the map too.
#
font "Palatino-Roman", 3.5
clearpath
move 82, 80
table "", split("State ACT NSW NT QLD SA TAS VIC WA"), \
  split("Rating B A- C AA B C+ D B")

# Finally draw a scalebar below the map.
#
clearpath
scalebar mapScale, "m", 4, 5
