[Therion] Changing text on a legend entry
Bill Gee
bgee at campercaver.net
Sat Feb 8 17:36:45 CET 2014
Hi Bruce -
Thanks for your response. I tried adding a text line in the thconfig file, but
it does not change the legend. With the line at either the top or bottom, no
error is produced - it just doesn't work. If I put the line inside the layout
block, then Therion throws a compile error.
Below is the thconfig file I am using. I also attach a screen clip from the
resulting map.
Thanks - Bill Gee
====================
encoding utf-8
source MillCreekCave.th
# This layout is for the main 2D map, all on one page
layout mainmap
units imperial
scale-bar 20 feet
page-numbers on
scale 1 200
color map-fg [100 86 66]
map-comment "A compass and tape survey of Mill Creek Cave, Pulaski
County, Missouri"
statistics explo all
legend on
symbol-set UIS
# section for PDF properties
doc-author "Bill Gee"
doc-title "Map of Mill Creek Cave"
doc-subject "Plan map of Mill Creek Cave"
# Section for map photos
map-image 32 30 center DSC_0004.JPG
map-image 52 105 center DSC_0056.JPG
# Include custom Metapost code for special symbols
# source CustomSymbolsCode.txt
# Custom metapost code
code metapost
# This code defines a gradient point that looks like the NSS-standard symbol
def p_gradient_AMER (expr pos,theta,sc,al) =
U:=(.15u, .4u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
#Left Hand side
thdraw (-.3u, -.2u) -- (-.7u, .1u);
thdraw (-.2u, -.1u) -- (-.4u, .6u);
#Centerline
thdraw (0u, 0u) -- (0u, .9u);
#Right side
thdraw (.3u, -.2u) -- (.7u, .1u);
thdraw (.2u, -.1u) -- (.4u, .6u);
enddef;
# This code defines a stalagmaflat symbol.
def p_u_stalagmaflat_AMER (expr pos,theta,sc,al) =
U:=(0.3u, 0.4u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
#Draw and paint the symbol
thfill
(0.2u,-0.4u)--(0.1u,0.2u)--(0.3u,0.2u)--(0.3u,0.4u)--(-0.3u,0.4u)--(-0.3u,0.2u)--(-0.1u,0.2u)--(-0.2u,-0.4u)--
cycle;
enddef;
# This code redefines the stalagmite symbol.
def p_stalagmite_AMER (expr pos,theta,sc,al) =
U:=(0.2u, 0.4u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
#Draw and paint the symbol
thfill (0.2u,-0.4u)--(0.0u,0.4u)--(-0.2u,-0.4u)--cycle;
enddef;
# This code redefines the stalactite symbol.
def p_stalactite_AMER (expr pos,theta,sc,al) =
U:=(0.2u, 0.4u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
#Draw and paint the symbol
thfill (0.2u,0.4u)--(-0.2u,0.4u)--(0.0u,-0.4u)--cycle;
enddef;
# This code redefines the pillar symbol.
def p_pillar_AMER (expr pos,theta,sc,al) =
U:=(0.2u, 0.4u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
#Draw and paint the symbol
thfill
(0.2u,-0.4u)--(0.1u,0.0u)--(0.2u,0.4u)--(-0.2u,0.4u)--(-0.1u,0.0u)--(-0.2u,-0.4u)--
cycle;
enddef;
# Redefine popcorn to use hollow circles instead of filled-in
def p_popcorn_AMER (expr pos,theta,sc,al)=
U:=(.5u,.2u);
T:=identity aligned al rotated theta scaled sc shifted pos;
pickup PenC;
thdraw (-.5u,-.2u)--(.5u,-.2u);
pickup PenD;
thdraw (-.3u,-.2u)--(-.3u,.0u);
thdraw (0,-.2u)--(0,.0u);
thdraw (.3u,-.2u)--(.3u,.0u);
thdraw fullcircle scaled .2u shifted (-.3u,.1u);
thdraw fullcircle scaled .2u shifted (0,.1u);
thdraw fullcircle scaled .2u shifted (.3u,.1u);
enddef;
# Define a dotted dripline
def l_u_dripline_AMER (expr Path) =
T:=identity;
pickup PenC;
draw Path dashed withdots scaled (.75*optical_zoom) withpen PenA;
enddef;
# Initialize the new symbols
initsymbol ("p_gradient_AMER");
initsymbol ("p_stalagmite_AMER");
initsymbol ("p_stalactite_AMER");
initsymbol ("p_u_stalagmaflat_AMER");
initsymbol ("p_pillar_AMER");
initsymbol ("p_popcorn_AMER");
initsymbol ("l_u_dripline_AMER");
let p_gradient=p_gradient_AMER;
let p_stalagmite=p_stalagmite_AMER;
let p_stalactite=p_stalactite_AMER;
let p_pillar=p_pillar_AMER;
let p_popcorn=p_popcorn_AMER;
endcode
symbol-assign point gradient AMER
symbol-assign point stalagmite AMER
symbol-assign point stalactite AMER
symbol-assign point pillar AMER
symbol-assign point popcorn AMER
endlayout
# Change the legend callout for stalagmaflats
text en_US "point u:stalagmaflat.AMER" "stalagmaflat"
export map -proj plan -layout mainmap -o MillCreekCave.pdf
=====================
On Tuesday, February 04, 2014 19:07:42 Bruce wrote:
> >two followup questions:
> >
> >1) The map legend labels the symbol as "point u:stalagmaflat_AMER". I
>
> tried to use a text line in the thconfig file, but it has no apparent
> effect. If I put it inside the layout/endlayout pair, therion throws an
> error. If I put it outside the layout/endlayout section, then no error -
> and no change.
>
>
> It needs to go in the th-config outside of a layout. See page 48 of Therion
> Book on 'text' translations. You probably need to define a legend entry as
> well. Here is an example I use towards the end of my custom symbol rope
> definition metapost...
>
> initsymbol("l_u_rope")
>
> def l_u_rope_legend =
> l_u_rope(((.2,.2) -- (.8,.8)) inscale)
> enddef;
> endcode
> #Need to add next line to all thconfig files to define legend text
> text en "line u:rope" "rope" #text to appear in legend
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MillCreekSymbols1.jpg
Type: image/jpeg
Size: 13221 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20140208/22287017/attachment.jpg>
More information about the Therion
mailing list