diff options
author | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-02-02 12:15:57 +0000 |
---|---|---|
committer | randomguy3 <randomguy3@7c02a99a-9b00-45e3-bf44-6f3dd7fddb64> | 2012-02-02 12:15:57 +0000 |
commit | 397cd4071a2f313b3b3b40f8b748c9f6103f5002 (patch) | |
tree | f0fd9b381d13640ee6bc1527418eb64db5a38415 /tikzit/src/common/EdgeStyle.m | |
parent | 071fea73851125d78a7df3a9b749fa90ab41b0fa (diff) |
Generate definitions for the edge styles in the default preamble
git-svn-id: https://tikzit.svn.sourceforge.net/svnroot/tikzit/trunk@407 7c02a99a-9b00-45e3-bf44-6f3dd7fddb64
Diffstat (limited to 'tikzit/src/common/EdgeStyle.m')
-rw-r--r-- | tikzit/src/common/EdgeStyle.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tikzit/src/common/EdgeStyle.m b/tikzit/src/common/EdgeStyle.m index 641d898..5314433 100644 --- a/tikzit/src/common/EdgeStyle.m +++ b/tikzit/src/common/EdgeStyle.m @@ -104,6 +104,38 @@ } } +- (NSString*)tikz { + NSMutableString *buf = [NSMutableString stringWithFormat:@"\\tikzstyle{%@}=[", name]; + + if (tailStyle == AH_Plain) + [buf appendString:@"<"]; + else if (tailStyle == AH_Latex) + [buf appendString:@"latex"]; + + [buf appendString:@"-"]; + + if (headStyle == AH_Plain) + [buf appendString:@">"]; + else if (headStyle == AH_Latex) + [buf appendString:@"latex"]; + + if (decorationStyle != ED_None) { + [buf appendString:@",postaction={decorate},decoration={markings,mark="]; + if (decorationStyle == ED_Arrow) + [buf appendString:@"at position .5 with {\\arrow{>}}"]; + else if (decorationStyle == ED_Tick) + [buf appendString:@"at position .5 with {\\draw (0,-0.1) -- (0,0.1);}"]; + [buf appendString:@"}"]; + } + + if (thickness != 1.0f) { + [buf appendFormat:@",line width=%.3f", thickness]; + } + + [buf appendString:@"]"]; + return buf; +} + - (void)dealloc { [name release]; [super dealloc]; |