encoding  utf-8
#_____________________________________________________________
#                                                             |
#             THIS IS A THERION LAYOUT DEFINITION FILE        |
#                                                             |
#             it contains the redefinition for a layout       |
#             with a Tanguy approved style                    |
#                                                             |
#             the format is good, trust me                    |
#_____________________________________________________________|

# first we open the layout

layout overview2

#_____________________________________________________________
#                                                             |
#                        GENERAL STATEMENTS                   |
#_____________________________________________________________|

  language en
  #debug all
  scale 1 4000
  
  symbol-hide group all
  symbol-show line wall
  symbol-show area water
  symbol-show area sump
  symbol-show line rock-border
  symbol-show area clay
  symbol-show line label
  symbol-show point entrance
  map-image 100 105 se ../victoria_cave/outputs/victoria_main_plan_overview.pdf
  legend off
  map-header 70 40 off
  

code metapost 
#_____________________________________________________________
#                                                             |
#                            LEGEND ITEMS                     |
#_____________________________________________________________|

  # NORTH ARROW (contributions of Thomas Holder)
  
   def s_northarrow (expr rot) =
    begingroup
      interim defaultscale:=0.5; % scale your north arrow here
      T:=identity scaled defaultscale rotated -rot;
      pickup pencircle scaled (0.08cm * defaultscale);
      thdraw (-.4cm,-1.4cm)--(0,2.8cm)--(.4cm,-1.4cm)--cycle;
      p:=fullcircle scaled 1.6cm;
      thclean p; thdraw p;
      p:=(0.95cm,0)--(0.65cm,0);
      thdraw p; thdraw p xscaled -1;
      pickup pencircle scaled (0.12cm * defaultscale);
      p:=(0.28cm,0.42cm);
      thdraw p--(p yscaled -1)--(p xscaled -1)--(p scaled -1);
    endgroup;
  enddef; 

  ## SCALE BAR (modified from contributions by Thomas Holder)
  
  def s_scalebar (expr l, units, txt) =
    begingroup
     interim warningcheck:=0;
     tmp20:=20 * (l / Scale * cm * units / 100);
     tmp40:=40 * (l / Scale * cm * units / 100);
     tmp60:=60 * (l / Scale * cm * units / 100);
     tmp80:=80 * (l / Scale * cm * units / 100);
     tmp100:=100 * (l / Scale * cm * units / 100);
     scal10:=10 * l / 100;
     scal20:=20 * l / 100;
     scal40:=40 * l / 100;
     scal60:=60 * l / 100;
     scal80:=80 * l / 100;
     brht:= 5bp;
     lblht:= 8bp;
    endgroup;

    pickup PenD;

    draw (0,0)--(0,brht)--(tmp100,brht)--(tmp100,0)--(0,0);
    draw (tmp20,0)--(tmp20,brht);
    draw (tmp40,0)--(tmp40,brht);
    draw (tmp60,0)--(tmp60,brht);
    draw (tmp80,0)--(tmp80,brht);
    fill (tmp20,0)--(tmp40,0)--(tmp40,brht)--(tmp20,brht)--cycle;
    fill (tmp60,0)--(tmp80,0)--(tmp80,brht)--(tmp60,brht)--cycle;


    begingroup
     label.top(thTEX(decimal (l) & "\thinspace" & txt),origin+(tmp100,lblht));
     label.top(thTEX(decimal (scal80)),origin+(tmp80,lblht));
     label.top(thTEX(decimal (scal60)),origin+(tmp60,lblht));
     label.top(thTEX(decimal (scal40)),origin+(tmp40,lblht));
     label.top(thTEX(decimal (scal20)),origin+(tmp20,lblht));
     label.top(thTEX(decimal (0)),origin+(0,lblht));
     label.bot(thTEX("ELEVATION 1 : " & decimal round(Scale*100)),(tmp40+scal10,-2lblht));
    endgroup
   enddef; 
       
    
    # ROCKBORDERS

    def l_rockborder_MY (expr P) = 
      T:=identity;
      pickup PenD;
      if cycle P: thclean P fi;
      thdraw P withcolor (0.3,0.3,0.3);
    enddef;
    
#_____________________________________________________________
#                                                             |
#                            AREA TYPES                       |
#_____________________________________________________________|

     # WATER
      def a_water_MY (expr p) =
       T:=identity;
       thfill p withcolor (0.7,0.7,0.85);
     enddef;
    
     
     def a_clay_MY (expr Path) =
      T:=identity;
      thclean Path;
      thfill Path withcolor (0.65,0.55,0.1);
    enddef;
    

#_____________________________________________________________
#                                                             |
#               NOW WE INITIATE ALL THE SYMBOLS               |
#_____________________________________________________________|
   
    
    # others
    initsymbol("l_rockborder_MY");
   
   
   ## areas
    # redefinitions

    initsymbol("a_water_MY");
    initsymbol("a_clay_MY");

endcode

#_____________________________________________________________
#                                                             |
#          WE ASSIGN THE SYMBOLS TYPES AND COLOURS            |
#_____________________________________________________________|


 symbol-assign area water MY
 

 symbol-assign area clay MY

endlayout

#_____________________________________________________________
#                                                             |
#          FINALLY, WE DEFINE THE LEGEND LABELS               |
#_____________________________________________________________|

#english labels
text en "point u:logger_MY"  "logger"
text en "line u:flowstone_MY" "flowstone  wall"
text en "line u:openshaft_MY" "open shaft"
text en "line u:texture" "bedrock exposed"
text en "point u:waterdrip" "water drips"
text en "point u:sampled_MY" "sample taken"
text en "line u:wall_flowstone_MY" "wall flowstone"


#german labels
text de "line u:openshaft_MY" "Eingangskessel"
text de "line u:texture" "Felsboden"
text de "line u:flowstone_MY" "flächiger Sinter"

