> My arrows have multiple colours. I will share the CC0 code later once I
> am back in front of my computer.

Attached. (Hope the list lets it through.) To use it, you need to set this:

symbol-assign line map-connection MY

Yes, that is the *line* not the point, because Therion turns each point
into a line if it is using offsets on its map.

Hopefully the comment at the start of the code is enough for you to use
it. But basically, it goes something like this. If Therion's bug ever
gets fixed, you can just create:

point mapconnection -attr theme 1
...
endpoint

But until Therion's bug is fixed, you can use my hack:

point mapconnection
...
endpoint
point u:mapconnectiondata -attr theme 1
endpoint

Therion gets it right with line mapconnection, so if you are using those
(eg. in an extended elevation as shown in the Therion book), you can
just set the -attr directly on the line mapconnection.

Each u:mapconnectiondata will only have its theme attribute used once.
So in this case, the first mapconnection point will use theme "default",
and the second one will use theme "1" (because Therion draws things in
reverse order).

point mapconnection
...
endpoint
point mapconnection
...
endpoint
point u:mapconnectiondata -attr theme 1
endpoint

Note that Therion draws "-clip off" objects out of sequence from the
rest of the objects, so if you set that property on a mapconnection
point, you would also need to set it on the u:mapconnectiondata.

Hopefully this is useful for your purposes.

Tarquin
#This MetaPost symbol definition is licensed under CC0 1.0. See the package 
LICENCE.txt for details.

# use with the following -attr type "value" options
# -attr theme default = draws in the default brown
# -attr theme inherit = draws in the symbol colour defined in the layout
# -attr theme 1 = draws in red
# Therion 6 does not support -attr on point mapconnection, so this code 
contains a hacky workaround;
# by placing a point u:mapconnectiondata below the point mapconnection, the 
-attr from that point
# will be used instead. (Note that it must appear below it in rendering order - 
that means any use of
# -clip must also be taken into account!)

#the next line is part of the hack
text en "point u:mapconnectiondata" ""
layout l_mapconnection_MY
        code metapost
                def l_mapconnection_MY (expr P) =
                        T:=identity;
                        begingroup;
                                save arrowsize, type, arrowhead;
                                %the length of the arrowhead, which must be 
bigger than the pen size by enough margin for the line's curved end not to poke 
past the walls of the arrowhead
                                arrowsize:=0.4u;
                                string theme;
                                if known ATTR_theme:
                                        theme:=ATTR_theme;
                                        %this is part of the hack
                                        p_u_mapconnectiondata_ATTR_theme:="";
                                elseif known p_u_mapconnectiondata_ATTR_theme:
                                        %the same attribute, passed using a 
point u:mapconnectiondata
                                        %this is part of the hack
                                        theme:=p_u_mapconnectiondata_ATTR_theme;
                                        p_u_mapconnectiondata_ATTR_theme:="";
                                else:
                                        theme:="default";
                                fi;
                                if (theme = "1"):
                                        drawoptions( withcolor (1,0,0) dashed 
evenly ); %red
                                elseif (theme = "2"):
                                        drawoptions( withcolor (1,0.6,0) dashed 
evenly ); %orange
                                elseif (theme = "3"):
                                        drawoptions( withcolor (0.78,0.78,0) 
dashed evenly ); %dark yellow
                                elseif (theme = "4"):
                                        drawoptions( withcolor (0.46,0.78,0) 
dashed evenly ); %spring green
                                elseif (theme = "5"):
                                        drawoptions( withcolor (0,0.78,0) 
dashed evenly ); %green
                                elseif (theme = "6"):
                                        drawoptions( withcolor (0,0.5,0.44) 
dashed evenly ); %greeny teal
                                elseif (theme = "7"):
                                        drawoptions( withcolor (0,0.8,0.87) 
dashed evenly ); %sky blue
                                elseif (theme = "8"):
                                        drawoptions( withcolor (0,0,1) dashed 
evenly ); %navy blue
                                elseif (theme = "9"):
                                        drawoptions( withcolor (0.5,0,1) dashed 
evenly ); %violet
                                elseif (theme = "10"):
                                        drawoptions( withcolor (1,0,1) dashed 
evenly ); %fuchia
                                elseif (theme = "inherit"):
                                        drawoptions( dashed evenly ); %normally 
black, but can be coloured by the layout
                                else:
                                        drawoptions( withcolor (0.4,0,0) dashed 
dashpattern(on .1u off .5u on .1u) ); %brown
                                fi;
                                %shorten the line by the size of the arrow 
head, so that it cannot bulge out of the sides of the arrowhead
                                thdraw ( subpath( arctime arrowsize of P, 
arctime ( ( arclength P ) - arrowsize ) of P ) of P ) withpen PenA;
                                drawoptions();
                                path arrowhead;
                                arrowhead:=(0,0)--( 2 * arrowsize / 5, 
arrowsize )--( -2 * arrowsize / 5, arrowsize )--cycle;
                                thfill arrowhead rotated ( angle( thdir( P, 0 ) 
) - 90 ) shifted ( point 0 of P );
                                thfill arrowhead rotated ( angle( thdir( P, 
length P ) ) + 90 ) shifted ( point (length P) of P );
                        endgroup;
                enddef;
                initsymbol("l_mapconnection_MY");
                %this is part of the hack
                %store the attr
                string p_u_mapconnectiondata_ATTR_theme;
                def p_u_mapconnectiondata (expr P,R,S,A)=
                        if known ATTR_theme:
                                p_u_mapconnectiondata_ATTR_theme:=ATTR_theme;
                        fi;
                enddef;
                initsymbol("p_u_mapconnectiondata");
        endcode
endlayout
_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion

Reply via email to