diff options
Diffstat (limited to 'Master/texmf-dist/metapost/metauml/metauml_base.mp')
-rw-r--r-- | Master/texmf-dist/metapost/metauml/metauml_base.mp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/Master/texmf-dist/metapost/metauml/metauml_base.mp b/Master/texmf-dist/metapost/metauml/metauml_base.mp index c44947ad43f..e269fb34ec9 100644 --- a/Master/texmf-dist/metapost/metauml/metauml_base.mp +++ b/Master/texmf-dist/metapost/metauml/metauml_base.mp @@ -1,5 +1,5 @@ % MetaUML, a MetaPost library for typesetting exquisite UML diagrams. -% Copyright (C) 2005 Ovidiu Gheorghies +% Copyright (C) 2006 Ovidiu Gheorghies, Radu-George Radulescu % % This program is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License @@ -20,7 +20,19 @@ if known _metauml_base_mp: fi; _metauml_base_mp:=1; -input util_log; +% Sadly, this copy of the macro is needed to prevent multiple file loads being shown by MetaPost. +% The guard values (such as _metauml_mp) do ensure that the file isn't loaded multiple times, +% but this macro makes sure that MetaPost won't try to load the file and display a message for that. +def inputonce text libraryFile= + if not known scantokens ("_" & str libraryFile & "_mp"): + %includeonce% show "Loading " & str libraryFile; + scantokens ("input " & str libraryFile); + else: + %includeonce% show str libraryFile & " already loaded."; + fi; +enddef; + +inputonce util_log; vardef markPoint(text p)(text color) = draw p withpen pencircle scaled 1 withcolor color; @@ -131,6 +143,32 @@ vardef drawCrossedCircle(text pA)(text pB)(text height) = draw pA .. pB .. pA; enddef; +vardef drawSemiCircle(text pA)(text pB)(text height) = + numeric dx, dy; + dx = xpart(pB - pA); + dy = ypart(pB - pA); + + numeric alfa; + alfa = angle(dx, dy); + + numeric width; + width = _length(pA)(pB); + + pair pC, pD; + pC := (width/2 + 5, height/2 + 1); + pC := pC rotated (alfa) shifted pB; + pD := (width/2 + 5, -height/2 - 1); + pD := pD rotated (alfa) shifted pB; + + draw pC .. pA .. pD; +enddef; + +vardef drawCircle(text pA)(text pB)(text height) = + fill pA..pB..pA -- cycle withcolor white; + + draw pA .. pB .. pA; +enddef; + vardef drawLine(expr my_path) = draw my_path; enddef; |