diff options
author | Karl Berry <karl@freefriends.org> | 2006-07-15 21:07:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-07-15 21:07:44 +0000 |
commit | addfc6cb8f4f70fdc76a72cb6338bd0c69c4c4c3 (patch) | |
tree | 9df3d1ec788caf8f5a848d259f44cfbafa7ad717 | |
parent | 9599b464aebb35b4a1bc3bf70a4cd2740f3765f7 (diff) |
new metapost package metauml (21mar06)
git-svn-id: svn://tug.org/texlive/trunk@1851 c570f23f-e606-0410-a88d-b1316a301751
91 files changed, 11145 insertions, 1 deletions
diff --git a/Build/cdbuild/ctan2tds.pl b/Build/cdbuild/ctan2tds.pl index 62c306b0214..369bbe7fad7 100755 --- a/Build/cdbuild/ctan2tds.pl +++ b/Build/cdbuild/ctan2tds.pl @@ -176,6 +176,7 @@ chdir $startdir || die "chdir($startdir) failed: $!"; 'mathmode', "&setup", 'mathpazo', "&MAKEmathpazo", 'metaobj', "&MAKEflatten", + 'metauml', "&MAKEmetauml", 'mflogo', "&MAKEmflogo", 'mfpic', "&MAKEflatten", 'mh', "&MAKEflatten", @@ -377,6 +378,7 @@ $standardfoundry='public'; 'latexmp', 'metapost', 'leawood', 'fonts', 'lfb', 'fonts', + 'latexmp', 'metauml', 'mfpic', 'generic', 'multido', 'generic', 'ofs', 'generic', @@ -474,6 +476,7 @@ $standardfmt='latex'; 'lfb', 'fonts', 'lshort-portuguese', 'portuguese', 'metatex', 'plain', + 'metauml', 'metapost', 'mfpic', 'generic', 'mpattern', 'metapost', 'ofs', 'generic', @@ -1499,6 +1502,15 @@ sub MAKEbbm { &donormal; } +sub MAKEmetauml { + &setup; + &xchdir ("$DEST/doc/$whichdocformat/$package"); + &SYSTEM ("$MV doc/* examples/* inputs/* ."); + &SYSTEM ("rmdir doc examples inputs"); + &buildfilelist; + &donormal; +} + sub MAKEmflogo{ &setup; chdir("$DEST"); diff --git a/Build/tools/tpm-ctan-check b/Build/tools/tpm-ctan-check index 0a4c5698a7b..55913d8ad48 100755 --- a/Build/tools/tpm-ctan-check +++ b/Build/tools/tpm-ctan-check @@ -66,7 +66,8 @@ sub main "ltabptch", "ltxmisc", #"malayalam", # missing C sources on CTAN, wrote author 5jun05. #"mathspic", # inside pictex, later - "makecell", "makeplot", "mathmode", "mcaption", "memoir", "mfpic", + "makecell", "makeplot", "mathmode", "mcaption", + "memoir", "metauml", "mfpic", "mhchem", "minitoc", "microtype", "minitoc", "mla-paper", "moderncv", "movie15", "muthesis", #"mpattern", # not up-to-date on CTAN, wrote author 28may05. diff --git a/Master/texmf-dist/doc/metapost/metauml/README b/Master/texmf-dist/doc/metapost/metauml/README new file mode 100644 index 00000000000..6b2b2ae7407 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/README @@ -0,0 +1,20 @@ +MetaUML, human-friendly UML textual notation for LaTeX/MetaPost +http://metauml.sourceforge.net + +Version: 0.2.3 +Author : Ovidiu Gheorghies +Date : March 21, 2005 + +MetaUML is a GNU GPL MetaPost library for typesetting UML diagrams. +It offers (partial) support for: +- class diagrams +- package diagrams +- activity diagrams +- use case diagrams +- state machine diagrams + +This release contains the following directories: + +doc : PDF documentation +examples : source code for the documentation (GNU FDL) +inputs : the macros needed to typeset in MetaUML (GNU GPL) diff --git a/Master/texmf-dist/doc/metapost/metauml/license.txt b/Master/texmf-dist/doc/metapost/metauml/license.txt new file mode 100644 index 00000000000..ca68ebd7a51 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/license.txt @@ -0,0 +1,341 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity.mp new file mode 100644 index 00000000000..676d1996eb1 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity.mp @@ -0,0 +1,52 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + Begin.b; + End.e; + FlowFinal.f; + + leftToRight(20)(b, e, f); + + drawObjects(b, e, f); +endfig; + +beginfig(2); + Activity.A("Learn MetaUML -", + "the MetaPost UML library"); + drawObject(A); +endfig; + +beginfig(3); + Fork.forkA("h", 50); + Fork.forkB("v", 20); + + leftToRight(10)(forkA, forkB); + + drawObjects(forkA, forkB); +endfig; + +beginfig(4); + Branch.testA; + + drawObject(testA); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity_diagrams.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity_diagrams.mp new file mode 100644 index 00000000000..0807619acd9 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity_diagrams.mp @@ -0,0 +1,59 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +% for f in `find . | grep '.*\.[1-9]'`; do echo $f; done + +input metauml; + +beginfig(1); + Begin.b; + Activity.eat("Eat something good", "from the kitchen"); + Branch.enough; + Fork.fork("h", 50); + Activity.read("Read a book"); + Activity.listen("Listen to music", "(and ignore it)"); + Fork.join("h", 50); + End.e; + + eat.n = b.s + (0,-20); + enough.n = eat.s + (0,-20); + fork.n = enough.s + (0, -20); + + read.top = listen.top = fork.bottom - 30; + listen.left - read.right = 10; + b.midx = .5[listen.left, read.right]; + + join.n = (b.midx, listen.bottom - 20); + e.n = join.s + (0, -20); + + drawObjects(b, eat, enough, fork, read, listen, join, e); + + clink(transition)(b, eat); + clink(transition)(eat, enough); + link(transition)(pathStepX(enough.w, eat.w, -80)); + clink(transition)(enough, fork); + clink(transition)(fork, read); + clink(transition)(fork, listen); + clink(transition)(read, join); + clink(transition)(listen, join); + clink(transition)(join, e); + + item(iGuard)("still hungry")(obj.se = enough.w + (-20, 0)); + item(iGuard)("had enough")(obj.nw = enough.s + (0, -4)); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/appetizer.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/appetizer.mp new file mode 100644 index 00000000000..6f3e794ff32 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/appetizer.mp @@ -0,0 +1,204 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + Class.Client("Client")()(); + + Class.Component("Component")() + ("+Operation()", "+Add(Component)", "+Remove(Component)", "+GetChild(int)"); + classStereotype.Component("<<interface>>"); + + Class.Leaf("Leaf")()("+Operation()"); + + Class.Composite("Composite")()(); + %("+Operation()", "+Add(Component)", "+Remove(Component)", "+GetChild(int)"); + + leftToRight.top(30)(Client, Component); + leftToRight.top(20)(Leaf, Composite); + .5[Leaf.ne, Composite.nw] = below(Component.s, 45); + + drawObjects(Client, Component, Leaf, Composite); + + link(associationUni)(pathHorizontal(Client.e, Component.left)); + link(inheritance)(pathStepY(Leaf.n, Component.s, 20)); + link(inheritance)(pathStepY(Composite.n, Component.s, 20)); + + link(aggregationUni)(pathStepX(Component.e, Composite.e, 55)); +endfig; + +beginfig(2); + Begin.b; + Activity.eat("Eat something good", "from the kitchen"); + Branch.enough; + Fork.fork("h", 50); + Activity.read("Read a book"); + Activity.listen("Listen to music", "(and ignore it)"); + Fork.join("h", 50); + End.e; + + leftToRight.top(10)(read, listen); + Group.readListen(read, listen); + + leftToRight(30)(b, eat); + topToBottom(20)(eat, enough, fork, readListen, join, e); + + drawObjects(b, eat, enough, fork, readListen, join, e); + + clink(transition)(b, eat); + clink(transition)(eat, enough); + link(transition)(pathStepX(enough.e, eat.e, 80)); + clink(transition)(enough, fork); + clink(transition)(fork, read); + clink(transition)(fork, listen); + clink(transition)(read, join); + clink(transition)(listen, join); + clink(transition)(join, e); + + item(iGuard)("still hungry")(obj.sw = enough.e + (20, 0)); + item(iGuard)("had enough")(obj.nw = enough.s + (0, -4)); +endfig; + +beginfig(3); + Actor.user("User"); + Actor.db("Database"); + + Usecase.dbquery("Query database"); + Usecase.auth("Authenticate user"); + Usecase.authA("Authenticate by", "username, password"); + Usecase.authB("Authenticate by", "smartcard"); + + leftToRight(30)(user.human, auth, dbquery, db.human); + leftToRight.top(30)(authA, authB); + .5[authA.ne, authB.nw] = below(auth.s, 20); + + drawObjects(user, auth, dbquery, db, authA, authB); + + clink(inheritance)(authA, auth); + clink(inheritance)(authB, auth); + clink(association)(auth, dbquery); + clink(association)(user.human, auth); + clink(association)(dbquery, db.human); +endfig; + +beginfig(4); + save b, e, reading, processing, composite, exit, error, result, theEnd; + + Begin.b; + State.reading("Reading commands")(); + State.processing("Processing commands")(); + End.e; + + State.composite("Working")(b, reading, processing, e); + composite.info.left := composite.info.right := 10; + composite.info.drawNameLine := 1; + + topToBottom(20)(b, reading, processing, e); + drawObject(composite); + + clink(transition)(b, reading); + clink(transition)(reading, processing); + clink(transition)(processing, e); + + ExitPoint.exit; + exit.c=(composite.right, reading.midy); + drawObject(exit); + item(iAssoc)("error")(obj.nw = exit.s); + + clink(transition)(reading, exit); + + State.error("Preparing error report")(); + State.result("Writing result")(); + End.theEnd; + + topToBottom(20)(error, result, theEnd); + leftToRight(30)(exit, error); + + drawObjects(error, result, theEnd); + + clink(transition)(exit, error); + clink(transition)(error, result); + clink(transition)(result, theEnd); + + link(transition)(rpathHorizontal(result.w, composite.right)); +endfig; + + +beginfig(5); + save A, B; + + Note.A("An important", "UML note"); + Note.B("Another note"); + + leftToRight(20)(A, B); + drawObjects(A, B); + + clink(dashedLink)(A, B); +endfig; + +beginfig(6); + Class.A("A")()(); + Class.B("B")()(); + + Package.pA("net.foo")(); + Package.pB("net.foo.bar")(A, B); + + leftToRight(20)(A, B); + leftToRight(50)(pA, pB); + + drawObjects(A, B, pA, pB); + + clink(nest)(pB, pA); +endfig; + +beginfig(7); + save A; + + Class.A("MyClass") + ("attr1: int", "attr2: int") + ("method1(): void", + "method2(): void"); + + A.nw = (0, 0); % optional, implied + drawObject(A); +endfig; + +beginfig(8); + save A, B; + Class.A("A")()(); + Class.B("B")()(); + + A.nw = (0,0); + B.e = A.w + (-20, 0); + + drawObjects(A, B); +endfig; + +beginfig(9); + save A, B; + + Class.A("A")()(); + Class.B("B")()(); + B.e = A.w + (-20, 0); + drawObjects(A, B); + link(inheritance)(B.e -- A.w); +endfig; +end + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/boxes_vs_util.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/boxes_vs_util.mp new file mode 100644 index 00000000000..985c9bb158b --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/boxes_vs_util.mp @@ -0,0 +1,92 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input boxes; +input util_commons; +input util_object; +input util_picture; + +beginfig(1); + boxit.a ("yummy"); + boxit.b ("cool"); + + a.nw = (0,0); + b.sw = a.se + (10,0); + + drawboxed (a, b); + draw a.sw -- b.se dashed evenly withpen pencircle scaled 1.1; + + boxit.c ("yummy"); + boxit.d ("cool"); + + c.nw = (0,-20); + d.sw = c.se + (10,0); + + drawunboxed (c, d); + draw c.sw -- d.se dashed evenly withpen pencircle scaled 1.1; +endfig; + +beginfig(2); + save a, b, c, d; + + Picture.a("yummy"); + Picture.b("cool"); + a.info.boxed := b.info.boxed := 1; + + a.nw = (0,0); + b.sw = a.se + (10,0); + + drawObjects(a, b); + draw a.sw -- b.se dashed evenly withpen pencircle scaled 1.1; + + Picture.c("yummy"); + Picture.d("cool"); + + c.nw = (0,-20); + d.sw = c.se + (10,0); + + drawObjects(c, d); + draw c.sw -- d.se dashed evenly withpen pencircle scaled 1.1; +endfig; + +beginfig(3); + save a, b, c, d; + + iPict.ignoreNegativeBase := 1; + + Picture.a("yummy"); + Picture.b("cool"); + a.info.boxed := b.info.boxed := 1; + + a.nw = (0,0); + b.sw = a.se + (10,0); + + drawObjects(a, b); + draw a.sw -- b.se dashed evenly withpen pencircle scaled 1.1; + + Picture.c("yummy"); + Picture.d("cool"); + + c.nw = (0,-20); + d.sw = c.se + (10,0); + + drawObjects(c, d); + draw c.sw -- d.se dashed evenly withpen pencircle scaled 1.1; +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class.mp new file mode 100644 index 00000000000..8997e86295d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class.mp @@ -0,0 +1,95 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + Class.A("Point") + ("#x:int", "#y:int") + ("+set(x:int, y:int)", + "+getX():int", + "+getY():int", + "-debug():void"); + drawObject(A); +endfig; + +beginfig(2); + save A, T; + + Class.A("User")()(); + classStereotypes.A("<<interface>>", "<<home>>"); + + drawObject(A); +endfig; + +beginfig(3); + save A, T; + + Class.A("Vector")()(); + ClassTemplate.T("T", "size: int")(A); + + drawObjects(A, T); +endfig; + +beginfig(4); + link(association)( (0,0) -- (50,0) ); +endfig; + +beginfig(5); + link(associationUni)( (0,0) -- (50,0) ); +endfig; + +beginfig(6); + link(inheritance)( (0,0) -- (50,0) ); +endfig; + +beginfig(7); + link(aggregation)( (0,0) -- (50,0) ); +endfig; + +beginfig(8); + link(aggregationUni)( (0,0) -- (50,0) ); +endfig; + +beginfig(9); + link(composition)( (0,0) -- (50,0) ); +endfig; + +beginfig(10); + link(compositionUni)( (0,0) -- (50,0) ); +endfig; + +beginfig(11); + save A; + Interface.A("Observer") + ("+update(src:Object)"); + + drawObject(A); +endfig; + +beginfig(12); + save A; + EClass.A(iAbstractClass)("Observable") + ("observers: Observer[0..*]") + ("+addObserver(o: Observer)", + "+notify()"); + + drawObject(A); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_association.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_association.mp new file mode 100644 index 00000000000..2ff5037a8c8 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_association.mp @@ -0,0 +1,72 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save P,B; + + Class.P("Person")()(); + Class.B("Bank")()(); + + P.nw = (0,0); + B.w = P.e + (50,0); + + drawObjects(P, B); + + drawRelation(association)(P.e -- B.w); + + item.assocName(iAssoc)("works for")(assocName.s = .5[P.e,B.w]); + + draw assocName.n -- (assocName.n + (20,20)); + label.urt("association name" infont "tyxtt", assocName.n + (20,20)); +endfig; + +beginfig(2); + save P,C; + + Class.P("Person")()(); + Class.C("Company")()(); + + C.n = P.s + (0, -70); + drawObjects(P, C); + + link(association)(P.s -- C.n); + + item(iAssoc)("employee")(obj.nw = P.s); + item(iAssoc)("1..*")(obj.ne = P.s); + + item(iAssoc)("employer")(obj.sw = C.n); + item(iAssoc)("0..*")(obj.se = C.n); + + item(iAssoc)("works for")(obj.w = .5[P.s,C.n]); +endfig; + +beginfig(3); + save F, O; + + Class.F("Factory")()(); + Class.O("Object")()(); + + O.n = F.s - (0, 50); + drawObjects(F, O); + + clink(dependency)(F, O); + item(iStereo)("<<creates>>")(obj.w = .5[F.s,O.n]) +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization.mp new file mode 100644 index 00000000000..c6e849683c2 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization.mp @@ -0,0 +1,188 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + iClass.foreColor := (.9, .9, 0); + + Class.A("A")()(); + Class.B("B")()(); + Class.C("C")()(); + + B.w = A.e + (20,0); + C.n = .5[A.se, B.sw] + (0, -10); + + drawObjects(A, B, C); +endfig; + +beginfig(2); + save A, B, C; + iClass.foreColor := (.9, .9, 0); + + Class.A("A")()(); + Class.B("B")()(); + Class.C("C")()(); + C.info.foreColor := (.7, .7, .9); + C.info.borderColor := blue; + C.info.iName.iFont.scale := 2; + + B.w = A.e + (20,0); + C.n = .5[A.se, B.sw] + (0, -10); + + drawObjects(A, B, C); +endfig; + +beginfig(3); + ClassInfoCopy.iHome(iClass); + iHome.foreColor := (0, .9, .9); + + ClassInfo.iRemote; + iRemote.foreColor := (.9, .9, 0); + iRemote.borderColor := (0, 0, .9); + + save A, B, C, D; + + EClass.A(iHome)("UserHome")()(); + EClass.B(iRemote)("UserRemote")()(); + EClass.C(iHome)("CartHome")()(); + EClass.D(iRemote)("CartRemote")()(); + + + B.nw = A.ne + (20,0); + D.nw = C.ne + (20,0); + A.bottom - C.top = 10; + A.left = C.left; + + drawObjects(A, B, C, D); +endfig; + +beginfig(4); + iClass.foreColor := .9white; + save A; + + Class.A("Foo") + ("a: int", "b: int") + ("foo()", "bar()", "gar()"); + A.info.iName.iFont.name := metauml_defaultFontBold; + A.info.iName.iFont.scale := 1.2; + + A.info.iAttributeStack.iPict.iFont.scale := 0.8; + A.info.iAttributeStack.top := 10; + A.info.iAttributeStack.spacing := 11; + + A.info.iMethodStack.iPict.iFont.scale := 2; + A.info.iMethodStack.spacing := 17; + A.info.iMethodStack.bottom := 10; + drawObject(A); +endfig; + +%beginfig(1); +% save Test; +% Class.Test("Test")("n:int","a2", "a3")("aLongMethod():void"); +% %, "anotherLongMethod():void", "yetAnotherLongMethod()"); + +% Test.sw = (0,0); +% Class_draw.Test; + +% dotlabel.ulft(btex nw etex, Test.nw); +% dotlabel.top(btex n etex, Test.n); +% dotlabel.urt(btex ne etex, Test.ne); +% dotlabel.urt(btex e etex, Test.e); +% dotlabel.lrt(btex se etex, Test.se); +% dotlabel.llft(btex s etex, Test.s); +% dotlabel.llft(btex sw etex, Test.sw); +% dotlabel.lft(btex w etex, Test.w); + +% dotlabel.ulft(btex c etex, Test.c); + +% draw Test.nw - (50,0) -- Test.ne + (30,0) dashed evenly; +% label.urt(btex top etex, Test.nw - (50,0)); + +% draw Test.sw - (50,0) -- Test.se + (30,0) dashed evenly; +% label.lrt(btex bottom etex, Test.sw - (50,0)); + +% draw Test.nw + (0,25) -- Test.sw - (0, 50) dashed evenly; +% label.bot(btex left etex, Test.sw - (0,50)); + +% draw Test.ne + (0,25) -- Test.se - (0, 50) dashed evenly; +% label.bot(btex right etex, Test.se - (0,50)); + +% drawdblarrow Test.nw - (40,0) -- Test.sw - (40,0); +% label.lft(btex height etex, .5[Test.nw, Test.sw] - (40,0)); + +% drawdblarrow Test.sw - (0,40) -- Test.se - (0,40); +% label.bot(btex width etex, .5[Test.sw, Test.se] - (0,40)); + +% draw Test.n -- Test.s + (0, -20) dashed evenly; +% label.bot(btex midx etex, Test.s + (0,-20)); + +% draw Test.w -- Test.e + (20,0) dashed evenly; +% label.rt(btex midy etex, Test.e + (20,0)); + +% draw Test.sw + (classLeftMargin,0) -- Test.nw + (classLeftMargin, 25) dashed evenly; +% draw Test.se + (-classRightMargin,0) -- Test.ne + (-classRightMargin, 25) dashed evenly; + +% drawdblarrow Test.nw + (0,20) -- Test.nw + (classLeftMargin, 20); +% label.top(btex classLeftMargin etex, Test.nw + (classLeftMargin/2, 25)); + +% drawdblarrow Test.ne + (0,20) -- Test.ne + (-classRightMargin, 20); +% label.top(btex classRightMargin etex, Test.ne + (-classLeftMargin/2, 25)); + +% pair A,B; +% A := ((xpart Test.ne) + 30, ypart Test.ne); +% B := ((xpart Test.ne) + 30, ypart Test.namePict.nw); +% draw Test.namePict.nw -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classNameBefore etex, .5[A,B]); + +% A := (xpart A, ypart Test.namePict.se); +% B := (xpart A, Test.nameEndsAtY - classNameAfter); +% draw Test.namePict.se -- A dashed evenly; +% draw (xpart Test.namePict se, ypart B) -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classNameAfter etex, .5[A,B]); + +% A := B; +% B := (xpart A, ypart Test.attributePict[0].ne); +% draw Test.attributePict[0].ne -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classAttributesBefore etex, .5[A,B]); + +% A := (xpart A, ypart Test.attributePict[2].se); +% B := A + (0, -classAttributesAfter); +% draw Test.attributePict[2].se -- A dashed evenly; +% draw (Test.attributePict[2].se + (0, -classAttributesAfter)) -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classAttributesAfter etex, .5[A,B]); + +% A := B; +% B := (xpart A, ypart Test.methodPict[0].ne); +% draw Test.methodPict[0].ne -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classMethodsBefore etex, .5[A,B]); + +% A := (xpart A, ypart Test.methodPict[0].se); +% B := A + (0, -classMethodsAfter); +% draw Test.methodPict[0].se -- A dashed evenly; +% draw (Test.methodPict[0].se + (0, -classMethodsAfter)) -- B dashed evenly; +% drawdblarrow A-(10,0) -- B-(10,0); +% label.rt(btex classMethodsAfter etex, .5[A,B]); +% endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization2.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization2.mp new file mode 100644 index 00000000000..be45e95240b --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization2.mp @@ -0,0 +1,31 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save Test; + Class.Test("TestClass")("attribute1: int","attribute2: double") + ("oneLongMethod(): void", + "anotherLongMethod(): void"); + + Test.nw = (0,0); + Class_draw.Test; +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_diagrams.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_diagrams.mp new file mode 100644 index 00000000000..0505e3af5ef --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_diagrams.mp @@ -0,0 +1,199 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Class.Count("Count") + ("#n: int") + ("+increase(): void", + "+get(): int"); + + %Count.nw = (0,0); + drawObject(Count); + %Class_draw.Count; +endfig; + +beginfig(2); + Class.A("Point") + ("+x: int", + "+y: int") (); + + Class.B("Circle") + ("radius: int") + ("+getRadius(): int", + "+setRadius(r: int):void"); + + A.nw = (0,0); + B.n = A.s - (0,45); + Class_draw.A; + Class_draw.B; + + drawRelation(aggregationUni)(A.s -- B.n); +endfig; + +beginfig(3); + Class.Test("Test")("a1","a2","a3")("aLongMethod():void"); + + Test.nw = (0,0); + Class_draw.Test; + + dotlabel.ulft(btex nw etex, Test.nw); + dotlabel.top(btex n etex, Test.n); + dotlabel.urt(btex ne etex, Test.ne); + dotlabel.rt(btex e etex, Test.e); + dotlabel.lrt(btex se etex, Test.se); + dotlabel.bot(btex s etex, Test.s); + dotlabel.llft(btex sw etex, Test.sw); + dotlabel.lft(btex w etex, Test.w); + + dotlabel.lft(btex c etex, Test.c); + + draw Test.nw - (50,0) -- Test.ne + (10,0); + label.urt(btex top etex, Test.nw - (50,0)); + + draw Test.sw - (50,0) -- Test.se + (10,0); + label.lrt(btex bottom etex, Test.sw - (50,0)); + + draw Test.nw + (0,10) -- Test.sw - (0, 50); + label.bot(btex left etex, Test.sw - (0,50)); + + draw Test.ne + (0,10) -- Test.se - (0, 50); + label.bot(btex right etex, Test.se - (0,50)); + + drawarrow Test.nw - (25,0) -- Test.sw - (25,0); + label.lft(btex height etex, .5[Test.nw, Test.sw] - (25,0)); + + drawarrow Test.sw - (0,25) -- Test.se - (0,25); + label.bot(btex width etex, .5[Test.sw, Test.se] - (0,25)); +endfig; + +%newAssociationDescription.association; +%newAssociationUniDescription.associationUni; +%newInheritanceDescription.inheritance; +%newAggregationDescription.aggregation; +%newAggregationUniDescription.aggregationUni; +%newCompositionDescription.composition; +%newCompositionUniDescription.compositionUni; +%newDashedLinkDescription.dashedLink; +%newDependencyDescription.dependency; + +beginfig(4); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(association)(X.e -- Y.w); +endfig; + +beginfig(5); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(associationUni)(X.e -- Y.w); +endfig; + +beginfig(6); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(inheritance)(X.e -- Y.w); +endfig; + +beginfig(7); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(aggregation)(X.e -- Y.w); +endfig; + +beginfig(8); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(aggregationUni)(X.e -- Y.w); +endfig; + +beginfig(9); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(composition)(X.e -- Y.w); +endfig; + +beginfig(10); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(compositionUni)(X.e -- Y.w); +endfig; + +beginfig(11); + save X, Y; + Class.X("X")()(); + Class.Y("Y")()(); + + X.nw = (0,0); + Y.w = X.e + (50,0); + Class_draw.X; + Class_draw.Y; + + drawRelation(dependency)(X.e -- Y.w); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_templates.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_templates.mp new file mode 100644 index 00000000000..8ef9b4be126 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_templates.mp @@ -0,0 +1,45 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Class.V("Vector")("elements: T(n)")(); + Template.T("T", "n: int"); + Template_attachToClass.T(V); + + drawObjects(V); + show "-----------------------------"; + drawObjects(T); +endfig; + +beginfig(2); +% save P,C; + +% newClass.P("Person")()(); +% newClass.C("Company")()(); + +% drawClassAt.P ( P.nw = (0,0) ); +% d rawClassAt.C ( C.w = P.e + (150,0) ); + +% drawRelation(association)(P.e -- C.w); + +% assocItem("employee", item.sw = P.e); +% assocItem("works for", item.n = .5[P.e,C.w]); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/cliparts.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/cliparts.mp new file mode 100644 index 00000000000..e84cca863f8 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/cliparts.mp @@ -0,0 +1,73 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +%vardef Foo(text southeast)(text width)(text height)= +% e eroare daca e 'se' pentru ca inlocuieste in +% qqq.se + +vardef Foo(expr _se, _width, _height)= + + Picture.ppp("foo"); + drawObjectAt(ppp)(ppp.nw = (0,0)); + + save qqq; + Lock.qqq("base"); + qqq.se = (0,0); + drawObject (qqq); +enddef; + + +beginfig(1); +% drawLockLocked((0,10), (6,0)); +% drawLockUnlocked((50,10), (56,0)); +% drawLockBase((25,10), (31,0)); +% show w; + + numeric a, b; + path x; + a= 10; + b = 20; + x = (a,a)--(b,b); + draw x; + + Lock.lock("opened"); + drawObjectAt(lock)(lock.nw =(0,0)); + + Lock.lockB("closed"); + drawObjectAt(lockB)(lockB.nw=(20,0)); + + Lock.lockC("base"); + drawObjectAt(lockC)(lockC.nw=(40,0)); + + ELock.otherLock(iLock)("closed"); + drawObjectAt(otherLock)(otherLock.nw = (60,0)); + + LockInfo.iLockMy(30, 30, .55, .15, .55, .4white, .6white, .7white, .3white); + save foo; + ELock.foo(iLockMy)("opened"); + foo.se = (100,0); + drawObject(foo); + + pair q; + q := (30,30); + %Foo( q ) (20)( 20); + Foo( (0,0),1,3); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/group.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/group.mp new file mode 100644 index 00000000000..0e25e58ea66 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/group.mp @@ -0,0 +1,51 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input boxes; +input util_commons; +input util_object; +input util_picture; +input util_margins; +input util_group; + +beginfig(1); + iGroup.left:=20; + iGroup.right:=15; + iGroup.boxed:=1; + iPict.boxed:=1; + + Picture.a("yummy"); + Picture.b("cool"); + Picture.c("fool"); + + a.nw = (0,0); + b.nw = (20,20); + c.nw = (15, 40); + + Group.g(a, b, c); + + drawObjects(g); +endfig; + +beginfig(2); +endfig; + +beginfig(3); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/how-links-work.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/how-links-work.mp new file mode 100644 index 00000000000..c8d8500358d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/how-links-work.mp @@ -0,0 +1,38 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + drawRelation(aggregationUni) + ((0,0)--(40,0)); +endfig; + + +beginfig(2); + path myPath; + myPath := (0,0) -- (100,0); + LinkStructure.ls(myPath, + aggregationUni.widthA, + aggregationUni.widthB); + + describeLinkStructure(ls); + drawLinkStructure(ls)(aggregationUni); +endfig; + +end + diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/instance.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/instance.mp new file mode 100644 index 00000000000..9417224306a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/instance.mp @@ -0,0 +1,9 @@ +input metauml; + +beginfig(1); + Instance.order("o: Order") + ("name='book'", "{placed}", "{payed}"); + drawObject(order); +endfig; + +end
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/mptrace.tmp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/mptrace.tmp new file mode 100644 index 00000000000..95b723d1b3a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/mptrace.tmp @@ -0,0 +1,25 @@ + +input metauml_note; +input metauml_base; +input metauml_paths; +input metauml_links; +input metauml_class_relations; + +beginfig(1); + Note.foo("Antananarivo", "Machupichu"); + drawObject(foo); +endfig; + +beginfig(2); + save foo; + Note.foo("Please disregard this note"); + Note.bar("Please take the other note", "very seriously"); + + bar.s = foo.n + (10,20); + drawObjects(foo, bar); + clink(dashedLink)(foo, bar); +endfig; + +end + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/note.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/note.mp new file mode 100644 index 00000000000..52b5a1541bb --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/note.mp @@ -0,0 +1,56 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Note.A("This note", "has two lines."); + drawObject(A); +endfig; + +beginfig(2); + save A, C; + Note.A("This is a class"); + Class.C("Object")()(); + + A.sw = C.ne + (20, 20); + + drawObjects(A, C); + + clink(dashedLink)(A, C); +endfig; + +beginfig(3); + save C; + Note.nA("This is the class name"); + Note.nB("This is a key attribute"); + Note.nC("This is a nice method"); + + Class.C("Object")("+id:int") + ("+clone()", "+serialize()"); + + topToBottom.left(10)(nA, nB, nC); + leftToRight(10)(C, nB); + + drawObjects(C, nA, nB, nC); + + clink(dashedLink)(C.namePict, nA); + clink(dashedLink)(C.attributeStack.pict[0], nB); + clink(dashedLink)(C.methodStack.pict[1], nC); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/object_stack.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/object_stack.mp new file mode 100644 index 00000000000..b9cd4d32b34 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/object_stack.mp @@ -0,0 +1,46 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input boxes; +input util_commons; +input util_object; +input util_picture; + + +beginfig(1); + iPict.ignoreNegativeBase := 1; + iPict.boxed := 1; + Picture.a0("yummy"); + Picture.a1("cool"); + Picture.a2("fool"); + + a0.nw = (0,0); + setObjectJoin(pa.sw = pb.nw); + + joinObjects(scantokens listArray(a)(3)); + drawObjects(scantokens listArray(a)(3)); + +endfig; + +beginfig(2); +endfig; + +beginfig(3); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/package.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/package.mp new file mode 100644 index 00000000000..fbf59ddbf26 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/package.mp @@ -0,0 +1,93 @@ +input metauml; +input metauml_package; +input metauml_package_relations; + +beginfig(1); + Package.P("java.lang")(); + drawObject(P); +endfig; + +beginfig(2); + save P; + Package.P("An important", "package")(); + drawObject(P); +endfig; + +beginfig(3); + save P; + Package.P("java.lang")(); + P.info.forceEmptyContent := 1; + drawObject(P); +endfig; + +beginfig(4); + save P, A, B; + Class.A("A")()(); + Class.B("B")()(); + Package.P("net.metauml")(A, B); + + leftToRight(10)(A, B); + + drawObject(P); +endfig; + +beginfig(5); + Package.X("X")(); + Package.Y("Y")(); + + leftToRight(50)(X, Y); + drawObjects(X, Y); + + link(nest)(X.e -- Y.w); +endfig; + +beginfig(8); + Package.emptyPackage("")(); + + Package.nameOnlyPackage("java.sun.com")(); + + Class.oneClass("A class")()(); + Package.oneClassPackage("One class package")(oneClass); + + Instance.oneInstance("An instance")(); + State.oneState("A state")(); + Activity.oneActivity("An activity"); + Package.multiPackage("Multipackage")(oneInstance, oneState, oneActivity); + + Package.allPackage("This package contains them all")(emptyPackage, nameOnlyPackage, + oneClassPackage, multiPackage); + + nameOnlyPackage.nw = emptyPackage.ne + (30, 0); + oneClassPackage.ne = emptyPackage.s - (0, 50); + + multiPackage.top = oneClassPackage.top; + multiPackage.left = oneClassPackage.right + 20; + + centered_allign_top(oneState, oneActivity)(10, below(oneInstance.s, 20)); + + drawObjects(allPackage); +endfig; + +beginfig(8); + Package.nameOnlyOnTopPackage("Name on top")(); + nameOnlyOnTopPackage.info.forceEmptyContent := 1; + Package.nameOnlyInMiddlePackage("By default name", "is in the middle")(); + + Class.cl("A class")("Attribute")("Method"); + Package.notEmptyPackage("Contains class")(cl); + + nameOnlyInMiddlePackage.n = nameOnlyOnTopPackage.s - (0, 40); + notEmptyPackage.w = nameOnlyInMiddlePackage.e + (80, 0); + drawObjects(nameOnlyOnTopPackage, nameOnlyInMiddlePackage, notEmptyPackage); + + %link(import)(pathStepX(notEmptyPackage.w, nameOnlyOnTopPackage.e, -30)); + %link(import)(pathVertical(nameOnlyInMiddlePackage.ne - (10, 0), nameOnlyOnTopPackage.bottom)); + %link(import)(notEmptyPackage.sw -- nameOnlyInMiddlePackage.ne); +endfig; + +beginfig(8); + link(nest)((10,10)--(30,30)); +endfig; + + +end
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths.mp new file mode 100644 index 00000000000..06ca5761209 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths.mp @@ -0,0 +1,132 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + pair za, zb; + za = (10,10); + zb = (10,-5); + path cool; + cool := za .. za+(20,10) .. + zb+(20,-20) .. + zb+(-10,-30) -- zb; + link(aggregationUni)(cool); +endfig; + +beginfig(2); + save A, B; + Class.A("A")()(); + Class.B("B")()(); + + B.sw = A.ne + (10,10); + + drawObjects(A, B); + + link(aggregationUni) + (rpathManhattanX(A.e, B.s)); + link(inheritance) + (pathManhattanY(A.n, B.w)); +endfig; + +beginfig(3); + save A, B; + Class.A("A")()(); + Class.B("B")()(); + + B.sw = A.ne + (10,10); + + drawObjects(A, B); + + stepX:=60; + link(aggregationUni) + (pathStepX(A.e, B.e, stepX)); + + stepY:=20; + link(inheritance) + (pathStepY(B.n, A.n, stepY)); + + pair X,Y; + X := A.se + (0,-30); + Y := X + (stepX, 0); + draw A.se -- X dashed evenly; + draw (xpart Y, ypart A.e) -- Y dashed evenly; + drawdblarrow X + (0,15) -- Y + (0,15); + label.top(btex stepX etex, .5[X,Y]); + + pair X,Y; + X := B.n + (-70,-0); + Y := X + (0, stepY); + + draw B.n -- X dashed evenly; + draw B.n + (0,stepY) -- Y dashed evenly; + drawdblarrow X + (15,0) -- Y + (15,0); + label.lft(btex stepY etex, .5[X,Y]); +endfig; + +% horizontal, vertical +beginfig(4); + save A, B; + Class.A("A")()(); + Class.B("B")("b")(); + Class.C("C")("foo: int")(); + + B.sw = A.se + (30,5); + C.sw = A.nw + (0, 30); + + drawObjects(A, B, C); + + untilX := B.left; + drawRelation(association) + (pathHorizontal(A.e, untilX)); + + draw B.nw -- B.sw + (0,-10) dashed evenly; + label.bot(btex untilX etex, B.sw + (0,-10)); + + untilY:= C.bottom; + drawRelation(association)(pathVertical(A.n, untilY)); + + draw C.sw -- C.sw + (-20,0) dashed evenly; + label.lft(btex untilY etex, C.sw + (-20,-0)); + +endfig; + +beginfig(5); + save A,B; + Activity.A("A"); + Activity.B("B"); + + B.nw = A.ne + (40,30); + drawObjects(A,B); + + z = A.se + (30, -10); + link(transition)(pathCut(A, B) + (A.c -- z -- B.c)); +endfig; + +beginfig(6); + save A,B; + Class.A("A")()(); + Class.B("B")()(); + + B.nw = A.ne + (20,30); + drawObjects(A,B); + + clink(inheritance)(A, B); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths_man.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths_man.mp new file mode 100644 index 00000000000..a6c502f147b --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths_man.mp @@ -0,0 +1,143 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save A, B; + Class.A("A")("foo:int")("bar()"); + Class.B("B")()(); + + A.nw = (0,0); + B.s = A.ne + (30,30); + + Class_draw.A; + Class_draw.B; + + drawRelation(aggregationUni) + (A.n ..(30,30)..B.w); + path cool; + cool := A.e .. A.e+(20,10) .. + B.s+(20,-40) .. B.s+(-10,-30) + -- B.s; + drawRelation(inheritance)(cool); +endfig; + +beginfig(2); + save A, B; + Class.A("A")()(); + Class.B("B")()(); + + A.nw = (0,0); + B.sw = A.ne + (10,10); + + Class_draw.A; + Class_draw.B; + + drawRelation(aggregationUni) + (pathManhattanX(A.e, B.s)); + drawRelation(inheritance) + (pathManhattanY(A.n, B.w)); +endfig; + +beginfig(3); + save A, B; + Class.A("A")()(); + Class.B("B")()(); + + A.nw = (0,0); + B.sw = A.ne + (10,10); + + Class_draw.A; + Class_draw.B; + + stepX:=60; + drawRelation(aggregationUni) + (pathStepX(A.e, B.e, stepX)); + + stepY:=20; + drawRelation(inheritance) + (pathStepY(B.n, A.n, stepY)); + + pair X,Y; + X := A.se + (0,-30); + Y := X + (stepX, 0); + draw A.se -- X dashed evenly; + draw (xpart Y, ypart A.e) -- Y dashed evenly; + drawdblarrow X + (0,15) -- Y + (0,15); + label.top(btex stepX etex, .5[X,Y]); + + pair X,Y; + X := B.n + (-70,-0); + Y := X + (0, stepY); + + draw B.n -- X dashed evenly; + draw B.n + (0,stepY) -- Y dashed evenly; + drawdblarrow X + (15,0) -- Y + (15,0); + label.lft(btex stepY etex, .5[X,Y]); +endfig; + +beginfig(4); + save A, B; + Class.A("A")()(); + Class.B("B")("a")(); + + A.nw = (0,0); + B.sw = A.se + (30,5); + + Class_draw.A; + Class_draw.B; + + untilX := B.left; + drawRelation(association) + (pathHorizontal(A.e, untilX)); + + draw B.nw -- B.sw + (0,-10) dashed evenly; + label.bot(btex untilX etex, B.sw + (0,-10)); +endfig; + +beginfig(5); + save A, B; + Class.A("A")()(); + Class.B("B")("a")("foo()"); + + A.nw = (0,0); + B.sw = A.ne + (-20,20); + + Class_draw.A; + Class_draw.B; + + untilY:= B.bottom; + drawRelation(association) + (pathVertical(A.n, untilY)); + + draw B.sw -- B.sw + (-20,0) dashed evenly; + label.lft(btex untilY etex, B.sw + (-20,-0)); +endfig; + +beginfig(6); + save A,B; + Class.A("A")()(); + Class.B("B")()(); + + B.nw = A.ne + (40,30); + drawObjects(A,B); + + link(inheritance)(pathCut(A,B)(A.c -- B.c)); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_info.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_info.mp new file mode 100644 index 00000000000..ec8ecdc3f8f --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_info.mp @@ -0,0 +1,55 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input boxes; +input util_commons; +input util_object; +input util_picture; + +PictureInfoCopy.iBig(iPict); +iBig.left := iBig.right := 20; +iBig.top := 10; +iBig.bottom := 1; +iBig.boxed := 1; +iBig.ignoreNegativeBase := 1; +iBig.iFont.name := defaultfont; +iBig.iFont.scale := 3; + +PictureInfoCopy.iSmall(iPict); +iSmall.boxed := 1; +iSmall.borderColor := green; + +beginfig(1); + EPicture.a(iBig)("yummy"); + EPicture.b(iSmall)("cool"); +% you can still modify a.info +% and b.info if you wish. + + a.nw = (0,0); + b.nw = a.sw + (0,-10); + + drawObjects(a, b) +endfig; + +beginfig(2); +endfig; + +beginfig(3); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_stack.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_stack.mp new file mode 100644 index 00000000000..ee6e09104b7 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_stack.mp @@ -0,0 +1,44 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input boxes; +input util_commons; +input util_object; +input util_picture; +input util_group; +input util_picture_stack; + +beginfig(1); + iStack.boxed := 1; + iStack.iPict.boxed := 1; + PictureStack.myStack("foo", + "bar: int" infont "tyxtt", + "cool-man-centered" infont defaultfont, + "nice")("vcenter"); + + myStack.nw = (0,0); + drawObject(myStack); +endfig; + +beginfig(2); +endfig; + +beginfig(3); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/positioning.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/positioning.mp new file mode 100644 index 00000000000..f98de47182f --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/positioning.mp @@ -0,0 +1,139 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Class.A("A")()(); + Class.B("B")()(); + Class.C("C")()(); + Class.Base("Base")()(); + + + A.ne = B.nw - (20,0); + B.ne = C.nw - (20,0); + Base.s = B.n + (0,20); + + drawObjects(Base, A, B, C); +endfig; + +beginfig(2); + save A, B, C, Base; + + Class.A("A")()(); + Class.B("B")()(); + Class.C("C")()(); + Class.Base("Base")()(); + + leftToRight(20)(A, B, C); + topToBottom(20)(Base, B); + + drawObjects(Base, A, B, C); +endfig; + +iPict.boxed := 1; +spacing := 5; +string strA, strB, strC; +strA := "a"; +strB := "..."; +strC := "Cyan"; + +beginfig(3); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.top(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.left, X.top) -- (Z.right, X.top) dashed evenly withpen pencircle withcolor red; +endfig; + +beginfig(4); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.midy(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.left, X.midy) -- (Z.right, X.midy) dashed evenly withpen pencircle withcolor red;; +endfig; + +beginfig(5); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.bottom(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.left, X.bottom) -- (Z.right, X.bottom) dashed evenly withpen pencircle withcolor red;; +endfig; + +beginfig(6); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.left(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.left, X.top) -- (X.left, Z.bottom) dashed evenly withpen pencircle withcolor red;; +endfig; + +beginfig(7); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.midx(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.midx, X.top) -- (X.midx, Z.bottom) dashed evenly withpen pencircle withcolor red;; +endfig; + +beginfig(8); + save A, B, C, X, Y, Z; + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.right(spacing)(X, Y, Z); + + drawObjects(X, Y, Z); + + draw (X.right, X.top) -- (X.right, Z.bottom) dashed evenly withpen pencircle withcolor red;; +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/properties.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/properties.mp new file mode 100644 index 00000000000..94f71d772ea --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/properties.mp @@ -0,0 +1,58 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + Class.Test("Test")("a1","a2","a3")("aLongMethod():void"); + + Test.nw = (0,0); + Class_draw.Test; + + dotlabel.ulft(btex nw etex, Test.nw); + dotlabel.top(btex n etex, Test.n); + dotlabel.urt(btex ne etex, Test.ne); + dotlabel.rt(btex e etex, Test.e); + dotlabel.lrt(btex se etex, Test.se); + dotlabel.bot(btex s etex, Test.s); + dotlabel.llft(btex sw etex, Test.sw); + dotlabel.lft(btex w etex, Test.w); + + dotlabel.lft(btex c etex, Test.c); + + draw Test.nw - (50,0) -- Test.ne + (10,0); + label.urt(btex top etex, Test.nw - (50,0)); + + draw Test.sw - (50,0) -- Test.se + (10,0); + label.lrt(btex bottom etex, Test.sw - (50,0)); + + draw Test.nw + (0,10) -- Test.sw - (0, 50); + label.bot(btex left etex, Test.sw - (0,50)); + + draw Test.ne + (0,10) -- Test.se - (0, 50); + label.bot(btex right etex, Test.se - (0,50)); + + drawarrow Test.nw - (25,0) -- Test.sw - (25,0); + label.lft(btex height etex, .5[Test.nw, Test.sw] - (25,0)); + + drawarrow Test.sw - (0,25) -- Test.se - (0,25); + label.bot(btex width etex, .5[Test.sw, Test.se] - (0,25)); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/state.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/state.mp new file mode 100644 index 00000000000..77c7691a9a2 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/state.mp @@ -0,0 +1,55 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + State.s("Take order")(); + drawObject(s); +endfig; + +beginfig(2); + Begin.b; + End.e; + State.c("Component")(); + State.composite("Composite")(b, e, c); + + b.midx = e.midx = c.midx; + c.top = b.bottom - 20; + e.top = c.bottom - 20; + + composite.info.drawNameLine := 1; + drawObject(composite); + + link(transition)(b.s -- c.n); + link(transition)(c.s -- e.n); +endfig; + +beginfig(3); + save s; + State.s("An interesting state", + "which is worth mentioning")(); + stateTransitions.s( + "OnEntry / Open eyes", + "OnExit / Sleep well"); + s.info.drawNameLine := 1; + + drawObject(s); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/statemachine_diagrams.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/statemachine_diagrams.mp new file mode 100644 index 00000000000..ff93a74dd5d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/statemachine_diagrams.mp @@ -0,0 +1,78 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +% for f in `find . | grep '.*\.[1-9]'`; do echo $f; done + +input metauml; + +beginfig(1); + Begin.b; + State.on("On")(); + State.off("Off")(); + End.e; + + setObjectJoin(pb.w = pa.e + (20,0)); + joinObjects(b, on, off, e); + drawObjects(b, on, off, e); + + clink(transition)(b, on); + clink(transition)(on, off); + clink(transition)(off, e); +endfig; + +beginfig(2); + save b, reading, processing, e, exit; + + Begin.b; + State.reading("Commands read")(); + State.processing("Processing commands")(); + End.e; + setObjectJoin(pb.n = pa.s + (0, -20)); + joinObjects(b, reading, processing, e); + + State.composite("Work")(b, reading, processing, e); + drawObject(composite); + + clink(transition)(b, reading); + clink(transition)(reading, processing); + clink(transition)(processing, e); + + ExitPoint.exit; + exit.c=(composite.right, reading.midy); + drawObject(exit); + item(iAssoc)("error")(obj.nw = exit.s); + + clink(transition)(reading, exit); + + State.error("Prepare error report")(); + State.result("Display result")(); + End.theEnd; + + error.midx = result.midx = theEnd.midx = composite.right + 90; + error.midy = exit.midy; + result.midy = processing.midy; + theEnd.midy = e.midy; + drawObjects(error, result, theEnd); + + clink(transition)(exit, error); + clink(transition)(error, result); + clink(transition)(result, theEnd); + + link(transition)(rpathHorizontal(result.w, composite.right)); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_activity.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_activity.mp new file mode 100644 index 00000000000..841bdb8a312 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_activity.mp @@ -0,0 +1,46 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Begin.b; + End.e; + + e.n = (30,30); + drawObject(b); + show "Object b drawn"; + drawObject(e); + + link(associationUni)(pathCut(b,e)(b.c--e.c)); +endfig; + +beginfig(2); + EActivity.act(iActivity)("go to school", "while singing"); + drawObject(act); + + Branch.br; + br.nw = (50,50); + drawObject(br); + + Fork.fork("h",30); + fork.nw = (30,70); + drawObject(fork); +endfig; + +end + diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class.mp new file mode 100644 index 00000000000..b807e970b57 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class.mp @@ -0,0 +1,125 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(0); + show "Copying class info..."; + ClassInfoCopy.foo(iClass); +endfig; + +beginfig(1); + Class.P("AAA")("- noo:int", "+bar:double","c:Integer","f: int")("foo()", "bar()"); + Class_setDebugMode.P; + + P.nw=(0,0); + Class_draw.P; + + Class.Q("AAA")("-noo:int", "+bar:double","c:Integer","f: int")("-noo()", "bar()"); + Q.nw=P.ne + (20,0); + Class_draw.Q; +endfig; + +beginfig(2); + save P, Q; + + Class.P("AAA")("+ foo:int", "+bar:double","c:Integer","f: int")(); + Class_setDebugMode.P; + P.nw=(0,0); + Class_draw.P; + + Class.Q("AAA")("+ foo:int", "+bar:double","c:Integer","f: int")(); + Q.nw=P.ne + (20,0); + Class_draw.Q; +endfig; + +beginfig(3); + save P, Q; + + Class.P("AAA")()(); + Class_setDebugMode.P; + P.nw=(0,0); + Class_draw.P; + + Class.Q("AAA")()(); + Q.nw=P.ne + (20,0); + Class_draw.Q; +endfig; + +beginfig(4); + save P, Q; + + Class.P("AAA")()(); + classStereotypes.P("<<ooo>>","<<home>>", "<<intergace>>"); + Class_setDebugMode.P; + P.nw=(0,0); + Class_draw.P; + + + Class.Q("AAA")()(); + classStereotypes.Q("<<ooo>>","<<home>>", "<<intergace>>"); + Q.nw=P.ne + (20,0); + Class_draw.Q; +endfig; + +beginfig(5) + Class.A("User")()(); + classStereotypes.A("<<interface>>","<<home>>"); + A.nw=(0,0); + drawObject(A); +endfig; + +beginfig(6) + save A; + Class.A("User")()(); + A.info.iMethodStack.left := A.info.iMethodStack.right := 50; + A.info.iMethodStack.top := A.info.iMethodStack.bottom := 20; + + drawObject(A); +endfig; + +beginfig(7) + save inter; + EClass.inter(iInterface)("Observer")()("+update(src: Object)"); + drawObjects(inter); +endfig; + +beginfig(8) + save inter; + EInterface.inter(iInterface)("Observer")("+update(src: Object)"); + drawObjects(inter); +endfig; + +beginfig(9) + save inter; + Interface.inter("Observer")("+update(src: Object)"); + drawObjects(inter); +endfig; + +beginfig(10) + save A; + EClass.A(iAbstractClass)("AbstractClass")("[]{}")("+update(src: Object)"); + drawObjects(A); +endfig; + +beginfig(11) + save A; + AbstractClass.A("AbstractClass")("[]{}")("+update(src: Object)"); + drawObjects(A); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_qual_assoc.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_qual_assoc.mp new file mode 100644 index 00000000000..735bba19e0d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_qual_assoc.mp @@ -0,0 +1,53 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save P,qa; + + Class.P("Person")()(); + QualifiedAssociation.qa("accountNumber:int", "foo: id"); + + P.nw = (0,0); + qa.n = P.s; + + + P.info.iName.left := 35; + P.info.iName.right := 35; + drawObjects(P); + + drawObject(qa); +endfig; + +beginfig(2); + save P,qa; + + Class.P("Person")()(); + QualifiedAssociation.qa("accountNumber:int", "foo: id", "foolang"); + + P.nw = (0,0); + qa.w = P.e; + + P.info.shade := 0; + P.info.iMethodStack.top := 20; + drawObjects(P); + + drawObject(qa); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_templates.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_templates.mp new file mode 100644 index 00000000000..c3fc50209c8 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_templates.mp @@ -0,0 +1,62 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save P,template; + + Class.P("Person")()(); + Template.template("foo", "bar"); + + drawObjectAt(P)(P.nw=(0,0)); + + Template_attachToClass.template(P); + drawObject(template); +endfig; + +beginfig(2); + save P,template; + + Class.P("Person")()(); + Template.template("foo: int"); + Template_attachToClass.template(P); + + drawObjectAt(P)(P.nw=(0,0)); + drawObject(template); +endfig; + +beginfig(3); + save CA, TA, CB, TB, CC, TC; + Class.CA("VeryVeryLongClassName")()(); + ClassTemplate.TA("int foo")(CA); + + Class.CB("Shortie")("abracadabra: long long int")(); + ClassTemplate.TB("T")(CB); + + Class.CC("Shortie")("abracadabra: long long int")(); + ClassTemplate.TC("TrulyAmazingLongTypename")(CC); + + CA.s = CB.n + (0,14); + CB.s = CC.n + (0,14); + + drawObjects(CA, TA, CB, TB, CC, TC); +endfig; + + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_font.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_font.mp new file mode 100644 index 00000000000..d5fc1a7702f --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_font.mp @@ -0,0 +1,91 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +string theFont; + +beginfig(1); + theFont := "pcrr"; + + boxjoin(a.sw=b.nw); + boxit.ff(("Font name: ( ) " & theFont) infont theFont); + boxit.s0("<<stereotype>>" infont theFont ); + boxit.s1("<<a>>, <<b>>, <<c>>" infont theFont); + boxit.g0("[guard] " infont theFont); + boxit.g1("[stillhungry] closing paranthesis SHOWN after hungry !" infont theFont); + boxit.g2("[still hungry] closing paranthesis NOT shown after hungry !" infont theFont); + boxit.g3("[][][][]hm]" infont theFont); + boxit.c0("{constraint}" infont theFont); + boxit.c1("{a constraint} closing paranthesis NOT shown !" infont theFont); + + drawboxed(ff, s0, s1, g0, g1, g2, g3, c0, c1); +endfig; + +beginfig(2); + save ff,s,g,c; + theFont := "tyxbtt"; + + boxjoin(a.sw=b.nw); + boxit.ff(("Font name: ( ) " & theFont) infont theFont); + boxit.s0("<<stereotype>>" infont theFont ); + boxit.s1("<<a>>, <<b>>, <<c>>" infont theFont); + boxit.g0("[guard] " infont theFont); + boxit.g1("[stillhungry] closing paranthesis SHOWN after hungry !" infont theFont); + boxit.g2("[still hungry] closing paranthesis NOT shown after hungry !" infont theFont); + boxit.g3("[][][][]hm]" infont theFont); + boxit.c0("{constraint}" infont theFont); + boxit.c1("{a constraint} closing paranthesis NOT shown !" infont theFont); + + drawboxed(ff, s0, s1, g0, g1, g2, g3, c0, c1); +endfig; + +beginfig(3); + picture pA, pB, pC; + string sA, sB, sC; + sA := "assembleElementLocalMatrix(k: KeyType, mat: LocalMatrixType, a: AssembleAction)"; + sB := "assembleElementLocalMatri(k: KeyType, mat: LocalMatrixType, a: AssembleAction)"; + sC := "assembleElntLocalMatri(k: KeyType, mat: LocalMatrixType, a: AssembleAction)"; + + pA := sA infont "tyxbtt"; + pB := sB infont "tyxbtt"; + pC := sC infont "tyxbtt"; + + draw pA; + draw pB shifted (0,-20); + draw pC shifted (0,-40); +endfig; + +beginfig(4); + save ff,s,g,c; + theFont := "ptmr8r"; + + boxjoin(a.sw=b.nw); + boxit.ff(("Font name: ( ) " & theFont) infont theFont); + boxit.s0("<<stereotype>>" infont theFont ); + boxit.s1("<<a>>, <<b>>, <<c>>" infont theFont); + boxit.g0("[guard] " infont theFont); + boxit.g1("[stillhungry] closing paranthesis SHOWN after hungry !" infont theFont); + boxit.g2("[still hungry] closing paranthesis NOT shown after hungry !" infont theFont); + boxit.g3("[][][][]hm]" infont theFont); + boxit.c0("{constraint}" infont theFont); + boxit.c1("{a constraint} closing paranthesis NOT shown !" infont theFont); + + drawboxed(ff, s0, s1, g0, g1, g2, g3, c0, c1); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_group.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_group.mp new file mode 100644 index 00000000000..17265c458b2 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_group.mp @@ -0,0 +1,60 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + save p,q,r,t,g; + + EPicture.p(iPictBoxed)("p0"); + EPicture.q(iPictBoxed)("p1"); + p.se = q.nw; + + string f; + f= enumToString(p,q)(""); + show "f=" & f; + + EGroup.g(iGroup)(p,q); + g.nw = (0,0); + + drawObject(g); +endfig; + +beginfig(2); + save g,h,p,gg; + + Group.g(); + g.info.boxed := 1; + g.nw = (30,30); + drawObject(g); + + Picture.p("Test picture in group"); + p.info.boxed := 1; + Group.h(p); + h.info.boxed := 1; + h.nw = (0,0); + drawObject(h); + + Picture.v0("s"); v0.info.boxed := 1; + Picture.v1("s"); v1.info.boxed := 1; + v1.nw = v0.se + (10,10); + Group.gg(v0, v1); gg.info.boxed := 1; + gg.nw = (70,70); + drawObject(gg); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_instance.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_instance.mp new file mode 100644 index 00000000000..d01ff8452e2 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_instance.mp @@ -0,0 +1,35 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 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 +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + Instance.A(":Foo")("int: val1", "bool: val2"); + Instance.B(":Bar")("very long text for testing purposes"); + Instance.C("s: Student")("line1", "line2", "line3", "line4", "line5"); + Instance.D("Example")("small"); + Instance.E("g: Yummy")("{placed}", "{color=red}"); + + B.w = A.e + (20, 0); + C.n = A.s - (0, 20); + D.w = C.e + (20, 0); + E.w = D.e + (20, 0); + + drawObjects(A, B, C, D, E); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lars_issues.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lars_issues.mp new file mode 100644 index 00000000000..607ef54c909 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lars_issues.mp @@ -0,0 +1,94 @@ +input metauml; + +numeric u; +u = 1.3cm; + +beginfig(1); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Class.ElLocSysAcc("ElementLocalSystemAcceptor") +() +("+startElementAssebly()", + "+assembleElementLocalMatrix(k: KeyType, mat: LocalMatrixType, a: AssembleAction)", + "+assembleElementLocalRHS(k: KeyType, rhs: LocalRHSType, a: AssembleAction)", + "+endElementAssembly()"); + +classStereotypes.ElLocSysAcc("<<interface>>"); +ClassTemplate.TEl("KeyType: typename")(ElLocSysAcc); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Class.FaceLocSysAcc("FaceLocalSystemAcceptor") + () + ("+startFaceAssebly()", + "+assembleFaceLocalMatrix(k1: KeyType, k2: KeyType, mat: LocalMatrixType, a: AssembleAction)", + "+assembleFaceLocalRHS(k: KeyType, rhs: LocalRHSType, a: AssembleAction)", + "+endFaceAssembly()"); + + classStereotypes.FaceLocSysAcc("<<interface>>"); + ClassTemplate.TFa("KeyType: typename")(FaceLocSysAcc); + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Class.SolProvider("SolutionProvider") + () + ("+startSortBack()", + "+getLocalSolution(k: KeyType, sol: LocalSolutionType)", + "+endSortBack()"); + + classStereotypes.SolProvider("<<interface>>"); + ClassTemplate.TSol("KeyType: typename")(SolProvider); + +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % now inherit from these for LapackMatrixSorter + Class.LapackMS("LapackMatrixSorter") + ("-indMan: IndexManager", + "-A: LaGenMatDouble&", + "-x: LaVectorDouble&", + "-b: LaVectorDouble&" + ) + ("+startElementAssembly()"); + + ClassTemplate.TLap("KeyType: typename", "IndexManager: class")(LapackMS); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% where to draw these: +FaceLocSysAcc.nw = ElLocSysAcc.ne + (1.5u, 0); +SolProvider.nw = FaceLocSysAcc.ne + (1.5u, 0); +LapackMS.n = FaceLocSysAcc.s + (0, -3u); + +drawObjects(ElLocSysAcc, TEl, FaceLocSysAcc, TFa, + SolProvider, TSol, LapackMS, TLap); + +% 50: how much should the path raise upwards before making a horizontal turn. +link(inheritance)(pathStepY(LapackMS.n, FaceLocSysAcc.s, 50)); +link(inheritance)(pathStepY(LapackMS.n, SolProvider.s, 50)); +link(inheritance)(pathStepY(LapackMS.n, ElLocSysAcc.s, 50)); + +endfig; + +beginfig(2); + Begin.b; + Activity.A("Eat something good", "from the kitchen"); + Activity.B("Read a book"); + End.e; + + % or other positioning code... + setObjectJoin(pa.s = pb.n + (0,20)); + joinObjects(b, A, B, e); + + % important: first draw the activities + drawObjects(b, A, B, e); + + % you can now draw the transitions + clink(transition)(b, A); + clink(transition)(A, B); + link(transition)(pathStepX(B.e, e.e, 30)); + + item(iGuard)("foo")(obj.sw = .5[b.s, A.n]); +endfig; + +end; diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lowlevel.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lowlevel.mp new file mode 100644 index 00000000000..952da34f482 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lowlevel.mp @@ -0,0 +1,66 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; +input util_infrastructure; + +beginfig(1); + show "Lowlevel test"; + %string foo; + %foo := var_instruction(numeric) x, y; + %show foo; + %foo := foo & ";"; + %show foo; + attributes(foo); + _n_ := "foo"; + %scantokens foo; + %string x; + %x := str(numeric); + var(numeric) x; + + label.top("nothing shown (intentionally)", (0,0)); +endfig; + +vardef _foo@#= + attributes(@#); + var(string) @#a[]; + @#a[0] := "fpp"; + @#a[1] := "gqq"; +enddef; + +% _foo.b; % not working + +vardef _bar@#(text s)= + attributes(@#); + var(string) elements; + @#elements := enumToString(s)(""); +enddef; + +beginfig(2); + for f = scantokens "a, b, c": + show f; + endfor; + _bar.xx(a, b, c, d); + show xx.elements; + for f = scantokens xx.elements: + show f; + endfor; + label.top("nothing shown (intentionally)", (0,0)); +endfig; + +end + diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_note.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_note.mp new file mode 100644 index 00000000000..9ea6b1a2931 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_note.mp @@ -0,0 +1,39 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml_note; +input metauml_base; +input metauml_paths; +input metauml_links; +input metauml_class_relations; + +beginfig(1); + Note.foo("Antananarivo", "Machupichu"); + drawObject(foo); +endfig; + +beginfig(2); + save foo; + Note.foo("Please disregard this note"); + Note.bar("Please take the other note", "very seriously"); + + bar.s = foo.n + (10,20); + drawObjects(foo, bar); + clink(dashedLink)(foo, bar); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_package.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_package.mp new file mode 100644 index 00000000000..990391f4f7a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_package.mp @@ -0,0 +1,54 @@ +input metauml; +input metauml_package; +input metauml_package_relations; + +beginfig(1); + Package.emptyPackage("")(); + + Package.nameOnlyPackage("java.sun.com")(); + + Class.oneClass("A class")()(); + Package.oneClassPackage("One class package")(oneClass); + + Instance.oneInstance("An instance")(); + State.oneState("A state")(); + Activity.oneActivity("An activity"); + Package.multiPackage("Multipackage")(oneInstance, oneState, oneActivity); + + Package.allPackage("This package contains them all")(emptyPackage, nameOnlyPackage, + oneClassPackage, multiPackage); + + nameOnlyPackage.nw = emptyPackage.ne + (30, 0); + oneClassPackage.ne = emptyPackage.s - (0, 50); + + multiPackage.top = oneClassPackage.top; + multiPackage.left = oneClassPackage.right + 20; + + centered_allign_top(oneState, oneActivity)(10, below(oneInstance.s, 20)); + + drawObjects(allPackage); +endfig; + +beginfig(2); + Package.nameOnlyOnTopPackage("Name on top")(); + nameOnlyOnTopPackage.info.forceEmptyContent := 1; + Package.nameOnlyInMiddlePackage("By default name", "is in the middle")(); + + Class.cl("A class")("Attribute")("Method"); + Package.notEmptyPackage("Contains class")(cl); + + nameOnlyInMiddlePackage.n = nameOnlyOnTopPackage.s - (0, 40); + notEmptyPackage.w = nameOnlyInMiddlePackage.e + (80, 0); + drawObjects(nameOnlyOnTopPackage, nameOnlyInMiddlePackage, notEmptyPackage); + + %link(import)(pathStepX(notEmptyPackage.w, nameOnlyOnTopPackage.e, -30)); + %link(import)(pathVertical(nameOnlyInMiddlePackage.ne - (10, 0), nameOnlyOnTopPackage.bottom)); + %link(import)(notEmptyPackage.sw -- nameOnlyInMiddlePackage.ne); +endfig; + +beginfig(3); + link(nest)((10,10)--(30,30)); +endfig; + + +end
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_paths.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_paths.mp new file mode 100644 index 00000000000..141b3efdb1c --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_paths.mp @@ -0,0 +1,38 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + iClass.shade := 3; + Class.F("Foo")("a: int","b: int")(); + Class.B("Bar")()(); + + B.nw = F.ne + (20,-20); + + drawObjects(B, F); + + link(association)(B.nw -- F.ne); + + draw objectBorder(B) withcolor red; + draw objectBorder(F) withcolor blue; + + link(association)(pathCut(B,F)(B.c--F.c)); +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture.mp new file mode 100644 index 00000000000..db78bb1a742 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture.mp @@ -0,0 +1,192 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +string theFont; +theFont := "tyxbtt"; + +beginfig(1); + draw "xxx" infont defaultfont scaled defaultscale shifted (0,0); + draw "yyy" infont (iFont.name) scaled (iFont.scale) shifted (5, 5); + + Picture.p("foo, bar, foo"); + p.nw = (0,0); + drawObject(p); + + Picture.q("nice, ugly"); + drawObjectAt(q)( q.nw = (30,30) ); + + FontInfo.foo("tyxbtt", 1); + PictureInfo.nice(3,6,5,10)(foo); + nice.boxed := 1; + + EPicture.myPic(nice)("what a nice feature"); + drawObjectAt(myPic)( myPic.nw = (0,0)); +endfig; + +beginfig(2); + save p, q, r, t; + + Picture.p("foo"); + Picture.q("bar"); + p.nw = (10, 10); + q.nw = (20, 20); + + drawObject(p); + drawObject(q); + + drawObjects(p, q); + + Picture.a0("root" infont defaultfont); + Picture.a1("toof"); + + a[0].nw = (30, 30); + a[1].nw = (50, 50); + + drawObjects(scantokens listArray(a)(2)); + %drawObjectArray(a)(2); +endfig; + +beginfig(3); + save p, q, r, t, u, pp; + + bboxmargin := 0; + + picture pp; + pp = "a" infont theFont; + Picture.p(pp); + Picture.q("cool" infont theFont); + Picture.r("good" infont theFont); + Picture.t("tust"); + Picture.u("fook" infont theFont); + + p.nw = (0,50); + setObjectJoin(pa.left=pb.left; pa.bottom = pb.top + 1); + joinDrawObjects(p, q, r, t, u); + + defaultdy:=0; + boxjoin(a.sw=b.nw; a.se=b.ne); + boxit.A0("aaa"); + boxit.A1("dddd"); + boxit.A2("asf"); + boxit.A3("good"); + boxit.A4(".."); + A0.nw=(0,0); + drawboxed(A0,A1,A2,A3,A4); + + show A[1].nw; + + Picture.B0(btex adsaas etex); + Picture.X[2](btex asdasad etex); + + myy := 40; + + bboxmargin := 0; + + pair p; + p := (30,myy); + dotlabel.lrt(".", p); + picture x; + x := "f: int" infont theFont; + draw bbox(x) shifted p; + draw x shifted p; + + show "LLCORNER P"; + show llcorner x; + + pair q; + q := (70,myy); + dotlabel.lrt(".", q); + picture y; + y := "goofy: int" infont theFont; + draw bbox(y) shifted q; + draw y shifted q; + + pair qq; + qq := (135,myy); + dotlabel.lrt(".", qq); + picture y; + y := "goot" infont theFont; + draw bbox(y) shifted qq; + draw y shifted qq; + + show "LLCORNER q"; + show llcorner y; + + draw (0,myy)--(150, myy) dashed evenly; + + myyb := 70; + Picture.aa(btex goof etex); + aa.sw = (30, myyb); + Picture_draw.aa; + + draw (0,myyb)--(100, myyb) dashed evenly; +endfig; + +beginfig(4); + save a, b; + FontInfo.myFont(theFont, 1); + PictureInfo.myWay(0,0,0,0)(myFont); + myWay.boxed := 1; + + EPicture.a0(myWay)("goof"); + EPicture.a1(myWay)("Aoorian"); + EPicture.a2(myWay)("fpp"); + EPicture.a3(myWay)("f: int"); + EPicture.a4(myWay)("aa()"); + + a0.nw = (0,0); + setObjectJoin(pa.bottom = pb.bottom; pa.right = pb.left - 10); + joinDrawObjects(scantokens listArray(a)(5)); + + draw a0.sw -- a4.se withcolor black dashed evenly; + + myWay.ignoreNegativeBase := 1; + EPicture.b0(myWay)("goof"); + EPicture.b1(myWay)("Aoorian"); + EPicture.b2(myWay)("fpp"); + EPicture.b3(myWay)("f: int"); + EPicture.b4(myWay)("aa()"); + + b0.nw = (0,-20); + setObjectJoin(pa.bottom = pb.bottom; pa.right = pb.left - 10); + joinDrawObjects(scantokens listArray(b)(5)); + + draw b0.sw -- b4.se withcolor black dashed evenly; +endfig; + + +beginfig(5); + truecorners := 1; + bboxmargin := 0; + save p; + picture basepict; + basepict := "<<foo>>" infont "tyxtt"; + + draw basepict; + draw bbox basepict; +endfig; + +beginfig(6); + item.foo(iPictBoxed)("foo bar cool")(foo.nw = (0,0)); + item.bar(iPict)("x: int")(bar.nw = (20,20)); + + aitem(iPictBoxed)("an anounymous item")(obj.nw = (40,10)); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture_stack.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture_stack.mp new file mode 100644 index 00000000000..d13803f71ff --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture_stack.mp @@ -0,0 +1,70 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +string theFont; +theFont := "tyxtt"; + +beginfig(1); + PictureStackInfoCopy.stackWay(iStack); + + EPictureStack.emptyStack(stackWay)()("vcenter"); + emptyStack.nw=(10,10); + drawObject(emptyStack); +endfig; + +beginfig(2); + PictureStack.myStack("foo", "bar: int" infont theFont, "cool man" infont defaultfont, "nice")("vcenter"); + myStack.nw = (0,0); + PictureStack_draw.myStack; +endfig; + +beginfig(3); + % 1 + PictureStack.stack("fooornika", "gar nichts", "nicelina")("vcenter"); + stack.info.boxed := 1; + stack.info.iPict.boxed := 1; % this does nothing, it's too late + + stack.nw = (0,0); + drawObject(stack); + + % 2 + PictureStack.stackb("fooornika", "gar nichts", "nicelina")("vcenter"); + stackb.info.boxed := 1; + stackb.pict[0].info.boxed := 1; + stackb.pict[2].info.boxed := 1; + + stackb.nw = (50,0); + drawObject(stackb); + + % 3 + PictureStackInfoCopy.myInfo(iStack); + myInfo.boxed := 1; + myInfo.iPict.boxed := 1; + EPictureStack.stackc(myInfo)("fooornika", "gar nichts", "nicelina")("vcenter"); + + stackc.nw = (100,0); + drawObject(stackc); +endfig; + +beginfig(4); + % + +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_positioning.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_positioning.mp new file mode 100644 index 00000000000..5e2a855539c --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_positioning.mp @@ -0,0 +1,195 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +iPict.boxed := 1; +spacing := 5; +string strA, strB, strC; +strA := "a"; +strB := "..."; +strC := "XYZ"; + +beginfig(1); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(top, left, right)(spacing)("+")(A, B, C); + + drawObjects(A, B, C); + + draw (A.left, A.top) -- (C.right, A.top); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.top(spacing)(X, Y, Z); + + X.top = A.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.left, X.top) -- (Z.right, X.top); +endfig; + +beginfig(2); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(midy, left, right)(spacing)("+")(A, B, C); + + drawObjects(A, B, C); + + draw (A.left, A.midy) -- (C.right, A.midy); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.midy(spacing)(X, Y, Z); + + X.top = A.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.left, X.midy) -- (Z.right, X.midy); +endfig; + +beginfig(3); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(bottom, left, right)(spacing)("+")(A, B, C); + + drawObjects(A, B, C); + + draw (A.left, A.bottom) -- (C.right, A.bottom); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + leftToRight.bottom(spacing)(X, Y, Z); + + X.top = A.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.left, X.bottom) -- (Z.right, X.bottom); +endfig; + +beginfig(4); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(left, top, bottom)(spacing)("-")(A, B, C); + + drawObjects(A, B, C); + + draw (A.left, A.top) -- (A.left, C.bottom); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.left(spacing)(X, Y, Z); + + X.top = C.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.left, X.top) -- (X.left, Z.bottom); +endfig; + +beginfig(5); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(midx, top, bottom)(spacing)("-")(A, B, C); + + drawObjects(A, B, C); + + draw (A.midx, A.top) -- (A.midx, C.bottom); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.midx(spacing)(X, Y, Z); + + X.top = C.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.midx, X.top) -- (X.midx, Z.bottom); +endfig; + +beginfig(6); + save A, B, C, X, Y, Z; + + Picture.A(strA); + Picture.B(strB); + Picture.C(strC); + + allign(right, top, bottom)(spacing)("-")(A, B, C); + + drawObjects(A, B, C); + + draw (A.right, A.top) -- (A.right, C.bottom); + + %%%% + + Picture.X(strA); + Picture.Y(strB); + Picture.Z(strC); + + topToBottom.right(spacing)(X, Y, Z); + + X.top = C.bottom - 10; + + drawObjects(X, Y, Z); + + draw (X.right, X.top) -- (X.right, Z.bottom); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins.mp new file mode 100644 index 00000000000..750cee4e975 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins.mp @@ -0,0 +1,26 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; +input metauml_skin_simple; + +beginfig(1); + Class.HelloSkin("HelloSkin")("nice: int")("done(): void"); + drawObject(HelloSkin); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins_global_defaults.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins_global_defaults.mp new file mode 100644 index 00000000000..aaeffd043b7 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins_global_defaults.mp @@ -0,0 +1,29 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +string metauml_defaultFont, metauml_defaultFontLight; +metauml_defaultFont := "cmr12"; +metauml_defaultFontLight := "cmr10"; + +input metauml; + +beginfig(1); + Class.HelloSkinB("HelloSkinGlobal")("foo: int")("bar(): void"); + drawObject(HelloSkinB); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_state.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_state.mp new file mode 100644 index 00000000000..f9a53741c01 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_state.mp @@ -0,0 +1,73 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +beginfig(1); + EntryPoint.entry; + ExitPoint.exit; + + entry.nw = (0,0); + exit.nw = (50,50); + + drawObjects(entry, exit); + clink(transition)(entry, exit); +endfig; + +beginfig(2); + EState.myState(iState)("the light is", "visibly on")(); + drawObject(myState); + + State.anotherState("Another nice state")(); + anotherState.info.drawNameLine := 1; + drawObjectAt(anotherState)(anotherState.nw = (0,50)); +endfig; + +beginfig(3); + State.interesting("Interesting state")(); + State_internalTransitions.interesting("OnEntry / doVeryHappy", "OnExit / doSomewhatSad"); + interesting.info.drawNameLine := 1; + + drawObject(interesting); +endfig; + +beginfig(4); + Begin.b; + End.e; + State.sa("A state")(); + State.sb("Another state")(); + setObjectJoin(pb.w = pa.e + (40, 0)); + joinObjects(b, sa, sb, e); + + State.composite("Composite state")(b, e, sa, sb); + drawObject(composite); + + clink(transition)(b, sa); + clink(transition)(sa, sb); + clink(transition)(sb, e); +endfig; + +beginfig(5); +endfig; + +beginfig(6); +endfig; + +beginfig(7); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_usecase.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_usecase.mp new file mode 100644 index 00000000000..dd75ac68be5 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_usecase.mp @@ -0,0 +1,197 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +input metauml; + +HumanInfoCopy.iDwarf(iHuman); +iDwarf.width := 60; +iDwarf.height := 20; +iDwarf.foreColor := blue; +iDwarf.shadeColor := .8blue; + +beginfig(1); + Human.h; + drawObject(h); + draw objectBox(h); + + Human.h1; + h1.n = (35, 0); + h1.info.foreColor := red; + drawObject(h1); + + Human.h2; + h2.info.height := 90; + h2.nw = (50,0); + drawObject(h2); + draw objectBox(h2); + + EHuman.d(iDwarf); + drawObjectAt(d)(d.s = (10,-50)); + + EHuman.d2(iDwarf); + d2.info.shadeColor := red; + drawObjectAt(d2)(d2.s = (10,-80)); +endfig; + +beginfig(2); + save a,b,c,d; + + show "***"; + show "Figure 2"; + show ""; + + Actor.a("foo"); + drawObject(a); + + Actor.b("Bar in debug mode", "fooling around"); + Actor_setDebugMode.b; + b.n = (70,0); + drawObject(b); + + Actor.c("Student"); + c.sw = b.n; + drawObject(c); + + Actor.d("."); + d.e = (30, -50); + drawObject(d); + label.rt("X", d.e); +endfig; + +beginfig(3); + Usecase.u("foo"); + drawObject(u); + + draw objectBox(u) withpen pencircle scaled .1; + + draw u.n withpen pencircle scaled 2 withcolor red; + draw u.s withpen pencircle scaled 2 withcolor red; + draw u.e withpen pencircle scaled 2 withcolor red; + draw u.w withpen pencircle scaled 2 withcolor red; + + draw u.ulft withpen pencircle scaled 2 withcolor blue; + draw u.urt withpen pencircle scaled 2 withcolor blue; + draw u.llft withpen pencircle scaled 2 withcolor blue; + draw u.lrt withpen pencircle scaled 2 withcolor blue; + + Usecase.login("Log in for an eagerly", "awaiting user", "which spans the 3rd line"); + login.s = (0, 5); + drawObject(login); + + Usecase.t("foo xasdf asdf as", "asdfa"); + t.s = login.n + (0,10); + drawObject(t); + + Usecase.q("foo xasdf asdf as", "asdfa", "cru asdf asdf ygh", "Sdfg s"); + q.s = t.n + (0,10); + drawObject(q); + +endfig; + +beginfig(4); + Actor.userA("User A2", "doesn't looks all too nice", "by today's standards"); + % Any Actor object is made of two sub-objects: nameStack and human. + % Each individual picture in the nameStack can be configured individually. + % + % However, it is not possible to configure all the lines in the nameStack at + % once now, saying something like: + % + % userA.nameStack.info.iPict.iFont.scale := 3; + % + % This happens because the information above is copied into the Picture objects + % in the Actor constructor (and it is useless to modify it afterwards). + % + % If you do want to make such global modifications of the settings, see the + % next two examples. + + userA.nameStack.pict[0].info.iFont.scale := 1.2; + userA.nameStack.pict[1].info.iFont.scale := .7; + userA.nameStack.info.borderColor := blue; + userA.nameStack.info.boxed := 1; + userA.nameStack.group.info.left := 30; + userA.nameStack.group.info.right := 5; + userA.human.info.foreColor := red; + + drawObject(userA); + %draw objectBox(userA.nameStack); + %draw objectBox(userA.human); +endfig; + +beginfig(5); + save userA; + % If you want to have preset a info for specific objects + + ActorInfoCopy.iBig(iActor); + + % ActorInfo contains info-s for two objects + % iNameStack: for the stack representing the actor's name + % iHuman: for the little human + + iBig.iNameStack.iPict.iFont.scale := 3; + iBig.iNameStack.spacing := 25; + iBig.iHuman.height := 25; + + EActor.userA(iBig)("User A", "on two lines"); + drawObject(userA); +endfig; + +beginfig(6); + save userA; + % If you want to have GLOBAL settings + + iActor.iNameStack.iPict.iFont.scale := 2; + iActor.iNameStack.spacing := 18; + + Actor.userA("User A", "reloaded"); + drawObject(userA); +endfig; + +beginfig(7); + save usecaseA; + Usecase.usecaseA("A highly customizable", "usecase. Foo bar!"); + usecaseA.info.iNameStack.iPict.iFont.scale := .5; + drawObject(usecaseA); +endfig; + +beginfig(8); + save usecaseA; + Usecase.usecaseA("A highly customizable", "usecase. Foo bar!"); + usecaseA.info.iNameStack.iPict.iFont.scale := 1.1; + usecaseA.info.foreColor := red; + usecaseA.info.borderColor := blue; + usecaseA.info.iShade.background := green; + usecaseA.info.iShade.shift := 4; + drawObject(usecaseA); +endfig; + +beginfig(9); + save usecaseA; + UsecaseInfoCopy.iMyUsecase(iUsecase); + iMyUsecase.iNameStack.iPict.iFont.scale := .6; + iMyUsecase.iNameStack.spacing := 5; + iMyUsecase.foreColor := green; + iMyUsecase.iShade.background := red; + + EUsecase.usecaseA(iMyUsecase)("A highly ", " customizable usecase."); + EUsecase.usecaseB(iMyUsecase)("Another very ", " customizable usecase."); + + leftToRight(20)(usecaseA, usecaseB); + drawObjects(usecaseA, usecaseB); +endfig; + +end + diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase.mp new file mode 100644 index 00000000000..ca8040f57b2 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase.mp @@ -0,0 +1,43 @@ +% Sample MetaUML figures. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +input metauml; + +beginfig(1); + Usecase.U("Authenticate user", + "by name, password"); + drawObject(U); +endfig; + +beginfig(2); + Actor.A("User"); + drawObject(A); +endfig; + +beginfig(3); + save A; + + Actor.A("Administrator"); + drawObject(A); + draw A.nw -- A.ne -- A.se -- A.sw -- cycle; + draw A.human.nw -- A.human.ne -- A.human.se -- A.human.sw -- cycle; + +endfig; + + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase_diagrams.mp b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase_diagrams.mp new file mode 100644 index 00000000000..110ca35c072 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase_diagrams.mp @@ -0,0 +1,48 @@ +% Part of the MetaUML manual. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +% for f in `find . | grep '.*\.[1-9]'`; do echo $f; done + +input metauml; + +beginfig(1); + Actor.user("User"); + Actor.db("Database"); + + Usecase.dbquery("Query database"); + Usecase.auth("Authentification"); + Usecase.authA("Authentification by", "username, password"); + Usecase.authB("Authentification by", "smartcard"); + + auth.w = user.human.e + (30,0); + dbquery.s = auth.n + (0,30); + db.human.w = dbquery.e + (30,0); + + authB.left - authA.right = 30; + authB.midy = authA.midy; + .5[authB.w, authA.e] = (auth.midx, auth.bottom - 50); + + drawObjects(user, auth, dbquery, db, authA, authB); + + clink(inheritance)(authA, auth); + clink(inheritance)(authB, auth); + clink(association)(auth, dbquery); + clink(association)(user.human, auth); + clink(association)(dbquery, db.human); +endfig; + +end diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/gnu-fdl.tex b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/gnu-fdl.tex new file mode 100644 index 00000000000..6602c824dab --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/gnu-fdl.tex @@ -0,0 +1,485 @@ + \begin{center} + + Version 1.2, November 2002 + + + Copyright \copyright 2000,2001,2002 Free Software Foundation, Inc. + + \bigskip + + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + \bigskip + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +\end{center} + + +\begin{center} +{\bf\large Preamble} +\end{center} + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +\begin{center} +{\bf 1. APPLICABILITY AND DEFINITIONS} +%\addcontentsline{toc}{section}{1. APPLICABILITY AND DEFINITIONS} +\end{center} + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The \textbf{"Document"}, below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as \textbf{"you"}. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A \textbf{"Modified Version"} of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A \textbf{"Secondary Section"} is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (Thus, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The \textbf{"Invariant Sections"} are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The \textbf{"Cover Texts"} are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A \textbf{"Transparent"} copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called \textbf{"Opaque"}. + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The \textbf{"Title Page"} means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +A section \textbf{"Entitled XYZ"} means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as \textbf{"Acknowledgements"}, +\textbf{"Dedications"}, \textbf{"Endorsements"}, or \textbf{"History"}.) +To \textbf{"Preserve the Title"} +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + + +\begin{center} +{\bf 2. VERBATIM COPYING} +%\addcontentsline{toc}{section}{2. VERBATIM COPYING} +\end{center} + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +\begin{center} +{\bf 3. COPYING IN QUANTITY} +%\addcontentsline{toc}{section}{3. COPYING IN QUANTITY} +\end{center} + + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +\begin{center} +{\bf 4. MODIFICATIONS} +%\addcontentsline{toc}{section}{4. MODIFICATIONS} +\end{center} + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +\begin{itemize} +\item[A.] + Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. + +\item[B.] + List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. + +\item[C.] + State on the Title page the name of the publisher of the + Modified Version, as the publisher. + +\item[D.] + Preserve all the copyright notices of the Document. + +\item[E.] + Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. + +\item[F.] + Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. + +\item[G.] + Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. + +\item[H.] + Include an unaltered copy of this License. + +\item[I.] + Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. + +\item[J.] + Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. + +\item[K.] + For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. + +\item[L.] + Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. + +\item[M.] + Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. + +\item[N.] + Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. + +\item[O.] + Preserve any Warranty Disclaimers. +\end{itemize} + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +\begin{center} +{\bf 5. COMBINING DOCUMENTS} +%\addcontentsline{toc}{section}{5. COMBINING DOCUMENTS} +\end{center} + + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + +\begin{center} +{\bf 6. COLLECTIONS OF DOCUMENTS} +%\addcontentsline{toc}{section}{6. COLLECTIONS OF DOCUMENTS} +\end{center} + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +\begin{center} +{\bf 7. AGGREGATION WITH INDEPENDENT WORKS} +%\addcontentsline{toc}{section}{7. AGGREGATION WITH INDEPENDENT WORKS} +\end{center} + + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +\begin{center} +{\bf 8. TRANSLATION} +%\addcontentsline{toc}{section}{8. TRANSLATION} +\end{center} + + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +\begin{center} +{\bf 9. TERMINATION} +%\addcontentsline{toc}{section}{9. TERMINATION} +\end{center} + + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + + +\begin{center} +{\bf 10. FUTURE REVISIONS OF THIS LICENSE} +%\addcontentsline{toc}{section}{10. FUTURE REVISIONS OF THIS LICENSE} +\end{center} + + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +\begin{center} +{\bf ADDENDUM: How to use this License for your documents} +%\addcontentsline{toc}{section}{ADDENDUM: How to use this License for your documents} +\end{center} + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +\bigskip +\begin{quote} + Copyright \copyright YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". +\end{quote} +\bigskip + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + +\bigskip +\begin{quote} + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. +\end{quote} +\bigskip + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/macro.tex b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/macro.tex new file mode 100644 index 00000000000..dc6bee1a4d5 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/macro.tex @@ -0,0 +1,11 @@ +% $Id$ +% This file defines some useful macros + +\def\newop#1 {\expandafter\def\csname #1\endcsname{\mathop{\rm #1}\nolimits}} + +\newop{Operator} % use with \Operator + +\def\fn(#1:#2->#3){#1:#2 \rightarrow #3} +\def\set(#1,#2...#3){\{#1,#2,\ldots,#3\}} +\def\enum(#1,#2...#3){#1,#2,\ldots,#3} +\def\ssets{\cal{P}}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/metauml_manual.tex b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/metauml_manual.tex new file mode 100644 index 00000000000..21c133eb342 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/metauml_manual.tex @@ -0,0 +1,1871 @@ +% MetaUML: Tutorial, Reference and Test Suite +% +% Copyright (c) 2005-2006 Ovidiu Gheorghies +% Permission is granted to copy, distribute and/or modify this document +% under the terms of the GNU Free Documentation License, Version 1.2 +% or any later version published by the Free Software Foundation; +% with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +% A copy of the license is included in the section entitled "GNU +% Free Documentation License". + +\documentclass{article} + +\usepackage[pdftex,colorlinks=true]{hyperref} +\usepackage{multicol} + +\ifx\pdftexversion\undefined + \usepackage[dvips]{graphicx} +\else + \usepackage[pdftex]{graphicx} + \DeclareGraphicsRule{*}{mps}{*}{} +\fi + +\newcommand{\code}{\ttfamily} +\newcommand{\metauml}{MetaUML} + +\setcounter{page}{1} + +\begin{document} + +\metauml: Tutorial, Reference and Test Suite + +\begin{quote} + Copyright \copyright 2005-2006 Ovidiu Gheorghie\c{s}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.2 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". +\end{quote} + +\pagebreak +This page is left intentionally blank. + +\pagebreak +\title{\metauml: Tutorial, Reference and Test Suite} + +\author{Ovidiu Gheorghie\c{s}} + +\maketitle + +\begin{abstract} +\metauml\ is a GNU GPL MetaPost library for typesetting UML diagrams, using a human-friendly textual notation. MetaUML offers a highly customizable, object-oriented API, designed with the ease of use in mind. Apart from being a reference, this manual is also a tutorial but, more importantly, a living example. You can look at its source code, getting direct accounts on ``how things are done''. +\end{abstract} + +%\begin{keywords} +%MetaPost, TeX, LaTeX, UML, class diagram, state machine diagram, +%use case diagram, activity diagram +%\end{keywords} + +\section{Introduction} + +Here are a few diagrams created with MetaUML, just to give you a glimpse of its features: + +\begin{multicols}{2} +\paragraph{A} Class Diagram\\ +\includegraphics[scale=.55]{fig/appetizer.1} +\paragraph{B} Activity Diagram\\ +\includegraphics[scale=.55]{fig/appetizer.2} +\paragraph{C} Notes\\ +\includegraphics[scale=.55]{fig/appetizer.5} +\columnbreak +\paragraph{D} Use Case Diagram\\ +\includegraphics[scale=.55]{fig/appetizer.3} +\paragraph{E} State Machine Diagram\\ +\includegraphics[scale=.55]{fig/appetizer.4} +\paragraph{F} Package Diagram\\ +\includegraphics[scale=.55]{fig/appetizer.6} +\end{multicols} + +\pagebreak + +The code which generates these diagrams is quite straightforward, combining a natural object-oriented parlance with the power of MetaPost equation solving; for more information on MetaPost see \cite {metapost}. + +An UML class, for example, can be drawn as follows: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("MyClass") + ("attr1: int", "attr2: int") + ("method1(): void", + "method2(): void"); + +A.nw = (0, 0); % optional, implied +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/appetizer.7} +\end{multicols} + +This piece of code creates an instance of {\code Class}, which will be afterward +identified as {\code A}. This object has the following content properties: a name +({\code MyClass}), a list of attributes ({\code attr1}, {\code attr2}) +and a list of methods ({\code method1}, {\code method2}). The one thing remaining +before actually drawing {\code A} is to set its location. + +\begin{figure} +\centering +\includegraphics{fig/properties.1} +\caption{Positioning properties of any MetaUML object (here a class object is depicted).} +\label{fig:properties} +\end{figure} + +In {\code A.nw} we refer to the ``north-west'' of the class rectangle, that is +to its upper-left corner. In general, every MetaUML object has the positioning +properties given in figure \ref{fig:properties}. These properties are used to set +where to draw a given object, whether by assigning them absolute values, or by setting +them relatively to other objects. Suppose that we have defined two classes +{\code A} and {\code B}. Then the following code would give a conceivable positioning: + +\begin{multicols}{2} +\begin{verbatim} +A.nw = (0,0); +B.e = A.w + (-20, 0); +\end{verbatim} +\columnbreak +\includegraphics{fig/appetizer.8} +\end{multicols} + +After the objects are drawn, one may draw links between them, such as inheritance +or association relations between classes in class diagrams, or transitions between states +in state machine diagrams. Whichever the purpose is, MetaUML provides a generic +way of drawing an edge in a diagram's graph: + +\begin{verbatim} +link(how-to-draw-information)(path-to-draw); +\end{verbatim} + +The ``how to draw information'' is actually an object which defines the style +of the line (e.g. solid, dashed) and the appearance of the heads (e.g. nothing, arrow, diamond). +One such object, called {\code inheritance}, defines a solid path ending in +a white triangle. The {\code path-to-draw} parameter is simply a MetaPost path. +For example, the following code can be used used to represent that class {\code B} is derived from {\code A}: + +\begin{verbatim} +link(inheritance)(B.e -- A.w); +\end{verbatim} + +Note that the direction of the path is important, and MetaUML uses it to determine the +type of adornment to attach at the link ends (if applicable). In our example, a white triangle, +denoting inheritance, points towards the end of the path, that is towards class {\code A}. + +To sum up, we present a short code and the resulting diagram, typical for just about +everything else in MetaUML. The positioning of {\code A} does not need to be +explicitly set because ``floating'' objects are automatically positioned at {\code (0,0)} by their +draw method. + +\begin{multicols}{2} + +\begin{verbatim} +input metauml; +beginfig(1); + Class.A("A")()(); + Class.B("B")()(); + B.e = A.w + (-20, 0); + drawObjects(A, B); + link(inheritance)(B.e -- A.w); +endfig; +end +\end{verbatim} +\columnbreak +\includegraphics{fig/appetizer.9} +\end{multicols} + +From a user's perspective, this is all there is to MetaUML. With a reference describing how other +UML elements are created, one can set out to typeset arbitrary complex diagrams. + +\section{Class Diagrams} + +A class is created as follows: + +\begin{verbatim} +Class.name(class-name) + (list-of-attributes) + (list-of-methods); +\end{verbatim} + +The suffix {\code name} gives a name to the {\code Class} object (which, of course, represents an UML class). +The name of the UML class is a string given by {\code class-name}; +the attributes are given as a comma separated list of strings, {\code list-of-attributes}; +the methods are given as a comma separated list of strings, {\code list-of-attributes}. +The list of attributes and the list of methods may be void. + +Each of the strings representing an attribute or a method may begin with a visibility marker: ``$+$'' for +public, ``\#'' for protected and ``$-$'' for private. MetaUML interprets this marker and renders a +graphic stereotype in form of a lock which may be opened, semi-closed and closed, respectively. + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("Point") + ("#x:int", "#y:int") + ("+set(x:int, y:int)", + "+getX():int", + "+getY():int", + "-debug():void"); +drawObject(A); +\end{verbatim} +\columnbreak +\includegraphics{fig/class.1} +\end{multicols} + +\subsection{Stereotypes} + +After a class is created, its stereotypes may be specified by using the macro {\code classStereotypes}: + +\begin{verbatim} +classStereotypes.name(list-of-stereotypes); +\end{verbatim} + +Here, {\code name} is the object name of a previously created class and {\code list-of-stereotypes} +is a comma separated list of strings. Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("User")()(); +classStereotypes.A("<<interface>>", + "<<home>>"); + +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class.2} +\end{multicols} + +\subsection{Interfaces and Abstract Classes} + +At times it is prefered to typeset the name of an interface in an oblique font, rather than using the ``interface'' stereotype. This can be easily achieved by using the macro: + +\begin{verbatim} +Interface.name(class-name) + (list-of-methods); +\end{verbatim} + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Interface.A("Observer") + ("+update(src:Object)"); + +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class.11} +\end{multicols} + +Note that {\code Interface} is a special kind of {\code Class}, the declaration code above being equivalent to: +\begin{verbatim} +EClass.A(iInterface)("Observer")() + ("+update(src:Object)"); +\end{verbatim} + +Along the same line, here's how abstract classes can be drawn: + +\begin{multicols}{2} +\begin{verbatim} +EClass.A(iAbstractClass)("Observable") + ("observers: Observer[0..*]") + ("+addObserver(o: Observer)", + "+notify()"); + +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class.12} +\end{multicols} + +If you prefer, you can use the syntactic sugar: + +\begin{verbatim} +AbstractClass.A("Observable") + ("observers: Observer[0..*]") + ("+addObserver(o: Observer)", + "+notify()"); +\end{verbatim} + +\subsection{Objects (or Class Instances)} + +An UML object (or class instance) is created as follows: + +\begin{verbatim} +Instance.name(object-name) + (list-of-attributes); +\end{verbatim} + +The suffix {\code name} gives a name to the {\code Instance} object. The name of the object (given by {\code object-name}) is typeset underlined. The attributes are given as a comma separated list of strings, {\code list-of-attributes}. + +\begin{multicols}{2} +\begin{verbatim} +Instance.order("o: Order") + ("name='book'", "{placed}", "{payed}"); +drawObject(order); +\end{verbatim} +\columnbreak +\hspace{2cm}\includegraphics{fig/instance.1} +\end{multicols} + + +\subsection{Parametrized Classes (Templates)} + +The most convenient way of typesetting a class template in \metauml\ is to use the macro {\code ClassTemplate}. +This macro creates a visual object which is appropriately positioned near the class object it adorns. + +\begin{verbatim} +ClassTemplate.name(list-of-templates) + (class-object); +\end{verbatim} + +The {\code name} is the name of the template object, {\code list-of-templates} is a comma separated list of strings and the {\code class-object} is the name of a class object. + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("Vector")()(); +ClassTemplate.T("T", "size: int")(A); + +drawObjects(A, T); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class.3} +\end{multicols} + +The macro {\code Template} can also be used to create a template object, but this time the resulting +object can be positioned freely. + +\begin{verbatim} +Template.name(list-of-templates); +\end{verbatim} + +Of course, one can specify both stereotypes and template parameters for a given class. + +\subsection{Types of Links} + +In this section we enumerate the relations that can be drawn between classes by means +of \metauml\ macros. Suppose that we have the declared two points, {\code A} (on the left) +and {\code B} (on the right): + +\begin{verbatim} +pair A, B; +A = (0,0); +B = (50,0); +\end{verbatim} + +\begin{tabular}{||l|c||} +\hline +{\code link(association)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.4} \\ +\hline +{\code link(associationUni)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.5} \\ +\hline +{\code link(inheritance)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.6} \\ +\hline +{\code link(aggregation)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.7} \\ +\hline +{\code link(associationUni)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.8} \\ +\hline +{\code link(composition)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.9} \\ +\hline +{\code link(compositionUni)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.10} \\ +\hline +{\code link(dependency)(X.e -- Y.w)} & \includegraphics{fig/class_diagrams.11} \\ +\hline +\end{tabular} + +\subsection{Associations} +In UML an association typically has two of association ends and may have a name specified for it. +In turn, each association end may specify a multiplicity, a role, a visibility, an ordering. +These entities are treated in \metauml\ as pictures having specific drawing information +(spacings, font). + +The first method of creating association ``items'' is by giving them explicit names. +Having a name for an association item comes in handy when referring to its properties +is later needed (see the non UML-compliant diagram below). Note that the last parameter of the macro {\code item} is an equation which uses the item name to perform positioning. + +\begin{multicols}{2} +\begin{verbatim} +Class.P("Person")()(); +Class.C("Company")()(); +% drawing code ommited + +item.aName(iAssoc)("works for") + (aName.s = .5[P.w, C.w]); +draw aName.n -- (aName.n + (20,20)); +label.urt("association name" infont "tyxtt", + aName.n + (20,20)); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics[scale=.8]{fig/class_association.1} +\end{multicols} + +However, giving names to every association item may become an annoying burden +(especially when there are many of them). Because of this, \metauml\ also allows for +``anonymous items''. In this case, the positioning is set by an equation +which refers to the anonymous item as {\code obj}. + +\begin{multicols}{2} +\begin{verbatim} +% P and C defined as in the previous example + +item(iAssoc)("employee")(obj.nw = P.s); +item(iAssoc)("1..*")(obj.ne = P.s); + +% other items are drawn similarly +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/class_association.2} +\end{multicols} + +\subsection{Dependencies and Stereotypes} + +Stereotypes are frequently used with dependencies. Below is an example. +\pagebreak + +\begin{multicols}{2} +\begin{verbatim} +Class.F("Factory")()(); +Class.O("Object")()(); + +O.n = F.s - (0, 50); +drawObjects(F, O); + +clink(dependency)(F, O); +item(iStereo)("<<creates>>")(obj.w = .5[F.s,O.n]) +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/class_association.3} +\end{multicols} + +\section{Notes} + +A note is created as follows: + +\begin{verbatim} +Note.name(list-of-lines); +\end{verbatim} + +The suffix {\code name} is the name of the {\code Note} object. The comma separated list of strings, {\code list-of-lines}, gives the text contents of the note object, each string being drawn on its own line. +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Note.A("This note", "has two lines."); +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/note.1} +\end{multicols} + +\subsection{Attaching notes to diagram elements} + +Notes can be attached to diagram elements by using a link of type {\code dashedLink}. + +\begin{multicols}{2} +\begin{verbatim} +Note.A("This is a class"); +Class.C("Object")()(); + +A.sw = C.ne + (20, 20); + +drawObject(A, C); + +clink(dashedLink)(A, C); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/note.2} +\end{multicols} + +Now let us see a more complex example, which demontrates the ability of accessing sub-elements in a \metauml\ diagram. +\pagebreak + +\begin{multicols}{2} +\begin{verbatim} +Note.nA("This is the class name"); +Note.nB("This is a key attribute"); +Note.nC("This is a nice method"); + +Class.C("Object")("+id:int") + ("+clone()", "+serialize()"); + +topToBottom.left(10)(nA, nB, nC); +leftToRight(10)(C, nB); + +drawObjects(C, nA, nB, nC); + +clink(dashedLink)(C.namePict, nA); +clink(dashedLink)(C.attributeStack.pict[0], nB); +clink(dashedLink)(C.methodStack.pict[1], nC); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/note.3} +\end{multicols} + +Macros like {\code leftToRight} and {\code topToBottom} are presented in section \ref{section:positioning}. + +\section{Packages} + +MetaUML allows for the creation of packages in various forms. Firstly, we have the option of writing the package name in the middle of the main box. Secondly, we can write the name on the tiny box above the main box, leaving the main box empty. Lastly, we can write the package name as in the second case, but the main box can have an arbitrary contents: classes, other packages, or even other UML items. + +The macro that creates a package has the following synopsis: + +\begin{verbatim} +Package.name(package-name)(subitems-list); +\end{verbatim} + +The parameter {\code package-name} is a string or a list of comma separated strings representing the package's name. The {\code subitems-list} parameter is used to specify the subitems (tipically classes or packages) of this package; its form is as a comma separated list of objects, which can be void. + +\begin{multicols}{2} +\begin{verbatim} +Package.P("java.lang")(); +drawObject(P); +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/package.1} +\end{multicols} + +Below is another example: + +\begin{multicols}{2} +\begin{verbatim} +Package.P("An important", "package")(); +drawObject(P); +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/package.2} +\end{multicols} + +If you wish to leave the main box empty, you can use the following code: + +\begin{multicols}{2} +\begin{verbatim} +Package.P("java.lang")(); +P.info.forceEmptyContent := 1; +drawObject(P); +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/package.3} +\end{multicols} + +The same effect as above can be achieved globally by doing: + +\begin{verbatim} +iPackage.forceEmptyContent := 1; +\end{verbatim} + +More information on MetaUML's way of managing global and per-object configuration data can be found in section \ref{section:infrastructure} and section \ref{section:customization}. + +Here is an example involving items contained in a package. + +\begin{multicols}{2} +\begin{verbatim} +Class.A("A")()(); +Class.B("B")()(); +Package.P("net.metauml")(A, B); + +leftToRight(10)(A, B); + +drawObject(P); +\end{verbatim} +\columnbreak +\hspace{3cm}\includegraphics{fig/package.4} +\end{multicols} + +\subsection{Types of Links} + +The nesting relation between packages is created by using the {\code nest} link information. + +\begin{tabular}{||l|c||} +\hline +{\code link(nest)(X.e -- Y.w)} & \includegraphics{fig/package.5} \\ +\hline +\end{tabular} + +\section{Use Case Diagrams} + +\subsection{Use Cases} +An use case is created by the macro {\code Usecase}: + +\begin{verbatim} +Usecase.name(list-of-lines); +\end{verbatim} + +The {\code list-of-lines} is a comma separated list of strings. These strings are placed +on top of each other, centered and surrounded by the appropriate visual UML notation. + +Here is an use case example: + +\begin{multicols}{2} +\begin{verbatim} +Usecase.U("Authenticate user", + "by name, password"); +drawObject(U); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/usecase.1} +\end{multicols} + +\subsection{Actors} + +An actor is created by the macro {\code Actor}: + +\begin{verbatim} +Actor.name(list-of-lines); +\end{verbatim} + +Here, {\code list-of-lines} represents the actor's name. For convenience, the name may be +given as a list of strings which are placed on top of each other, to provide support for +the situations when the role is quite long. Otherwise, giving a single string +as an argument to the Actor constructor is perfectly fine. + +Here is an actor example: + +\begin{multicols}{2} +\begin{verbatim} +Actor.A("User"); +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/usecase.2} +\end{multicols} + +Note that one may prefer to draw diagram relations positioned relatively to +the visual representation of an actor (the ``human'') rather than relatively to the whole +actor object (which also includes the text). Because of that, MetaUML provides access +to the ``human'' of every actor object {\code actor} by means of the sub-object {\code actor.human}. + +\begin{multicols}{2} +\begin{verbatim} +Actor.A("Administrator"); +drawObject(A); +draw objectBox(A); +draw objectBox(A.human); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/usecase.3} +\end{multicols} + +Note that in \metauml\ {\code objectBox(X)} is equivalent to {\code X.nw -- X.ne -- X.se -- X.sw -- cycle} for every object {\code X}. {\code A.human} is considered a \metauml\ object, so you can use expressions like {\code A.human.n} or {\code A.human.midx}. + +\subsection{Types of Links} + +Some of the types of links defined for class diagrams (such as inheritance, association etc.) can be used with similar semantics within use case diagrams. + +\section{Activity Diagrams} + +\subsection{Begin, End and Flow End} + +The begin and the end of an activity diagram can be marked by using the macros {\code Begin} +and {\code End} or {\code FlowFinal}, respectively. The constructors of these visual objects take no parameters: + +\begin{verbatim} +Begin.beginName; +End.endName; +\end{verbatim} + +Below is an example: + +\begin{multicols}{2} +\begin{verbatim} +Begin.b; +End.e; +FlowFinal.f; + +leftToRight(20)(b, e, f); + +drawObjects(b, e, f); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/activity.1} +\end{multicols} + +\subsection{Activity} + +An activity is constructed as follows: +\begin{verbatim} +Activity.name(list-of-strings); +\end{verbatim} + +The parameter {\code list-of-strings} is a comma separated list of strings. These strings are +centered on top of each other to allow for the accommodation of a longer activity description +within a reasonable space. + +An example is given below: + +\begin{multicols}{2} +\begin{verbatim} +Activity.A("Learn MetaUML -", + "the MetaPost UML library"); +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/activity.2} +\end{multicols} + +\subsection{Fork and Join} + +A fork or join is created by the macro: + +\begin{verbatim} +Fork.name(type, length); +\end{verbatim} + +The parameter {\code type} is a string and can be either of {\code "h"}, {\code "horiz"}, {\code "horizontal"} for horizontal bars, and either of {\code "v"}, {\code "vert"}, {\code "vertical"} for vertical bars. The {\code length} gives the bar's length. + +\begin{multicols}{2} +\begin{verbatim} +Fork.forkA("h", 100); +Fork.forkB("v", 20); + +leftToRight(10)(forkA, forkB); + +drawObject(forkA, forkB); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/activity.3} +\end{multicols} + +\subsection{Branch} + +A branch is created by the macro: + +\begin{verbatim} +Branch.name; +\end{verbatim} + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Branch.testA; + +drawObject(testA); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/activity.4} +\end{multicols} + + +\subsection{Types of Links} + +In activity diagrams, transitions between activities are needed. They are typeset +as in the example below. In section \ref{composite-states} such a transition +is showed. This type of link is also used for state machine diagrams. + +\begin{verbatim} +link(transition)( pointA -- pointB ); +\end{verbatim} + +\section{State Diagrams} + +The constructor of a state allows for aggregated sub-states: + +\begin{verbatim} +State.name(state-name)(substates-list); +\end{verbatim} + +The parameter {\code state-name} is a string or a list of comma separated strings representing +the state's name or description. The {\code substates-list} parameter is used to specify +the substates of this state as a comma separated list of objects; this list may be void. + +An example of a simple state: + +\begin{multicols}{2} +\begin{verbatim} +State.s("Take order")(); +drawObject(s); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/state.1} +\end{multicols} + + +\subsection{Composite States} +\label{composite-states} + +A composite state is defined by enumerating at the end of its constructor the inner +states. Interestingly enough, the composite state takes care of drawing the sub-states it +contains. The transitions must be drawn after the composite state, as seen in the +next example: + +\begin{multicols}{2} +\begin{verbatim} +Begin.b; +End.e; +State.c("Component")(); +State.composite("Composite")(b, e, c); + +b.midx = e.midx = c.midx; +c.top = b.bottom - 20; +e.top = c.bottom - 20; + +composite.info.drawNameLine := 1; +drawObject(composite); + +link(transition)(b.s -- c.n); +link(transition)(c.s -- e.n); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/state.2} +\end{multicols} + +\subsection{Internal Transitions} + +Internal transitions can be specified by using the macro: +\begin{verbatim} +stateTransitions.name(list-transitions); +\end{verbatim} + +Identifier {\code name} gives the state object whose internal transitions are being set, +and parameter {\code list-transitions} is a comma separated string list. + + +An example is given below: + +\begin{multicols}{2} +\begin{verbatim} +State.s("An interesting state", + "which is worth mentioning")(); +stateTransitions.s( + "OnEntry / Open eyes", + "OnExit / Sleep well"); +s.info.drawNameLine := 1; + +drawObject(s); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/state.3} +\end{multicols} + +\subsection{Special States} + +Similarly to the usage of {\code Begin} and {\code End} macros, one can define history states, +exit/entry point states and terminate pseudo-states, by using the following constructors. + +\begin{verbatim} +History.nameA; +ExitPoint.nameB; +EntryPoint.nameC; +Terminate.nameD; +\end{verbatim} + +\section{Drawing Paths} + +The {\code link} macro is powerful enough to draw relations following arbitrary paths: + +\begin{multicols}{2} +\begin{verbatim} +path cool; +cool := A.e .. A.e+(20,10) .. + B.s+(20,-40) .. B.s+(-10,-30) + -- B.s; +link(inheritance)(cool); + +link(aggregationUni) + (A.n ..(30,30)..B.w); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.1} +\end{multicols} + +Regardless of how amusing this feature might be, it does become a bit of a nuisance to +use it in its bare form. When typesetting UML diagrams in good style, one generally +uses rectangular paths. It is for this kind of style that \metauml\ offers extensive +support, providing a ``syntactic sugar'' for constructs which can otherwise be +done by hand, but with some extra effort. + +\subsection{Manhattan Paths} + +The ``Manhattan'' path macros generate a path between two points consisting of one +horizontal and one vertical segment. The macro {\code pathManhattanX} generates first a +horizontal segment, while the macro {\code pathManhattanY} generates first a +vertical segment. In \metauml\ it also matters the direction of a path, so you +can choose to reverse it by using {\code rpathManhattanX} and {\code rpathManhattanY} +(note the prefix ``{\code r}''): + +\begin{verbatim} +pathManhattanX(A, B) +pathManhattanY(A, B) + +rpathManhattanX(A, B) +rpathManhattanY(A, B) +\end{verbatim} + +\pagebreak +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("A")()(); +Class.B("B")()(); + +B.sw = A.ne + (10,10); +drawObjects(A, B); + +link(aggregationUni) + (rpathManhattanX(A.e, B.s)); +link(inheritance) + (pathManhattanY(A.n, B.w)); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.2} +\end{multicols} + +\subsection{Stair Step Paths} + +These path macros generate stair-like paths between two points. +The ``stair'' can ``rise'' first in the direction of $Ox$ axis ({\code pathStepX}) +or in the direction of $Oy$ axis ({\code pathStepY}). How much should a step +rise is given by an additional parameter, {\code delta}. Again, the macros +prefixed with ``{\code r}'' reverse the direction of the path given by their +unprefixed counterparts. + +\begin{verbatim} +pathStepX(A, B, delta) +pathStepY(A, B, delta) + +rpathStepX(A, B, delta) +rpathStepY(A, B, delta) +\end{verbatim} + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +stepX:=60; +link(aggregationUni) + (pathStepX(A.e, B.e, stepX)); + +stepY:=20; +link(inheritance) + (pathStepY(B.n, A.n, stepY)); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.3} +\end{multicols} + +\subsection{Horizontal and Vertical Paths} + +There are times when drawing horizontal or vertical links is required, +even when the objects are not properly aligned. To this aim, the following macros +are useful: + +\begin{verbatim} +pathHorizontal(pA, untilX) +pathVertical(pA, untilY) + +rpathHorizontal(pA, untilX) +rpathVertical(pA, untilY) +\end{verbatim} + +A path created by {\code pathHorizonal} starts from the point {\code pA} +and continues horizontally until coordinate {\code untilX} is reached. The macro +{\code pathVertical} constructs the path dually, working vertically. +The prefix ``{\code r}'' reverses the direction of the path. + +Usage example: + +\begin{multicols}{2} +\begin{verbatim} +untilX := B.left; +link(association) + (pathHorizontal(A.e, untilX)); + +untilY:= C.bottom; +link(association) + (pathVertical(A.n, untilY)); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.4} +\end{multicols} + +\subsection{Direct Paths} + +A direct path can be created with {\code directPath}. The call {\code directPath(A, B)} +is equivalent to {\code A -{}- B}. + +\subsection{Paths between Objects} + +Using the constructs presented above, it is clear that one can draw links between diagram +objects, using a code like: + +\begin{verbatim} +link(transition)(directPath(objA.nw, objB.se)); +\end{verbatim} + +There are times however this may yield unsatisfactory visual results, +especially when the appearance of the object's corners is round. MetaUML provides the macro +{\code pathCut} whose aim is to limit a given path exactly to the region outside the actual +borders of the objects it connects. The macro's synopsis is: + +\begin{verbatim} +pathCut(thePath)(objectA, objectB) +\end{verbatim} + +Here, {\code thePath} is a given MetaPost path and {\code objectA} and {\code objectB} +are two \metauml\ objects. By contract, each \metauml\ object of type, say, {\code X} +defines a macro {\code X\_border} which returns the path that surrounds it. Because +of that, {\code pathCut} can make the appropriate modifications to {\code thePath}. + +The following code demonstrates the benefits of the {\code pathCut} macro: + +\begin{multicols}{2} +\begin{verbatim} +z = A.se + (30, -10); +link(transition) + (pathCut(A, B)(A.c--z--B.c)); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.5} +\end{multicols} + +\subsubsection{Direct Paths between Centers} + +At times is quicker to just draw direct paths between the center of two objects, +minding of course the object margins. The macro which does this is {\code clink}: + +\begin{verbatim} +clink(how-to-draw-information)(objA, objB); +\end{verbatim} + +The parameter {\code how-to-draw-information} is the same as for the macro {\code link}; +{\code objA} and {\code objB} are two \metauml\ objects. + +Below is an example which involves the inheritance relation: + +\begin{multicols}{2} +\begin{verbatim} +clink(inheritance)(A, B); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/paths.6} +\end{multicols} + +\section{Arranging Diagram Items} +\label{section:positioning} + +Using equations involving cardinal points, such as {\code A.nw = B.ne + (10,0)}, is +good enough for achieving the desired results. However, programs are best to +be written for human audience, rather than for compilers. It does become a bit +tiresome to think all the time of cardinal points and figure out the +direction of positive or negative offsets. Because of that, \metauml\ offers +syntactic sugar which allows for an easier understanding of the intent behind +the positioning code. + +Suppose that we have three classes, {\code A}, {\code B}, {\code C} and their base class +{\code Base}. We want the base class to be at the top, and the derived classes to be +on a line below. A code like the following will do: + +\begin{verbatim} +A.ne = B.nw + (20,0); +B.ne = C.nw + (20,0); +Base.s = B.n + (0,-20); +\end{verbatim} + +Now, look at the code again. What strikes you is that you cannot visualize what it is all about, unless you really try --- decoding the intent line by line. What this code lacks is a feature called self-documenting: the code is good only if you can read it as a story and understand its meaning. + +Perhaps the following version of the code will make the point. All you need to know is that the numeric argument represents a distance. + +\begin{multicols}{2} +\begin{verbatim} +leftToRight(20)(A, B, C); +topToBottom(20)(Base, B); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/positioning.2} +\end{multicols} + +Below there are examples which show how these macros can be used. Suppose that we have the following definitions for objects {\code X}, {\code Y}, and {\code Z}; also, let's assume that {\code spacing} is a numeric variable set to {\code 5}. + +\begin{verbatim} +Picture.X("a"); +Picture.Y("..."); +Picture.Z("Cyan"); +\end{verbatim} + +\begin{tabular}{||l|c||} +\hline +{\code leftToRight.top(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.3} \\ +\hline +{\code leftToRight.midy(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.4} \\ +\hline +{\code leftToRight.bottom(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.5} \\ +\hline +{\code topToBottom.left(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.6} \\ +\hline +{\code topToBottom.midx(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.7} \\ +\hline +{\code topToBottom.right(spacing)(X, Y, Z);} & \includegraphics{fig/positioning.8} \\ +\hline +\end{tabular} \\ + +To make typesetting even quicker in frequent usage scenarios, the following equivalent contructs are also allowed: + +\begin{verbatim} +leftToRight.midy(spacing)(X, Y, Z); +leftToRight(spacing)(X, Y, Z); +\end{verbatim} + +\begin{verbatim} +topToBottom.midx(spacing)(X, Y, Z); +topToBottom(spacing)(X, Y, Z); +\end{verbatim} + +If you want to specify that some objects have a given property equal, while the distance between them is given elsewhere, you can use the macro {\code same}. +This macro accepts a variable number of parameters, but at least two. The following table gives the interpretation of the macro for a simple example. + +\begin{tabular}{||l|l||} +\hline +{\code same.top(X, Y, Z);} & {\code X.top = Y.top = Z.top;} \\ +\hline +{\code same.midy(X, Y, Z);} & {\code X.midy = Y.midy = Z.midy;} \\ +\hline +{\code same.bottom(X, Y, Z);} & {\code X.bottom = Y.bottom = Z.bottom;} \\ +\hline +{\code same.left(X, Y, Z);} & {\code X.left = Y.left = Z.left;} \\ +\hline +{\code same.midx(X, Y, Z);} & {\code X.midx = Y.midx = Z.midx;} \\ +\hline +{\code same.right(X, Y, Z);} & {\code X.right = Y.right = Z.right;} \\ +\hline +\end{tabular} \\ + + +To specify the relative position of two points more easily, one can use the macros {\code below}, {\code above}, {\code atright}, {\code atleft}. Let us assume that {\code A} and {\code B} are two points (objects of type {\code pair} in MetaPost). The following constructs are equivalent: + +\begin{tabular}{||l|l||} +\hline +{\code B = A + (5,0);} & {\code B = atright(A, 5);} \\ +{\code B = A - (5,0);} & {\code B = atleft(A, 5);} \\ +{\code B = A + (0,5);} & {\code B = above(A, 5);} \\ +{\code B = A - (0,5);} & {\code B = below(A, 5);} \\ +\hline +\end{tabular} + + +\section{The MetaUML Infrastructure} +\label{section:infrastructure} + +MetaPost is a macro language based on equation solving. Using it may seem quite +tricky at first for a programmer accustomed to modern object-oriented languages. +However, the great power of MetaPost consists in its versatility. Indeed, it is possible to write +a system which mimics quite well object-oriented behavior. Along this line, METAOBJ +(\cite{metaobj}) is a library worth mentioning: it provides a high-level objects +infrastructure along with a battery of predefined objects. + +Surprisingly enough, \metauml\ does not use METAOBJ. Instead, it uses a custom written, +lightweight object-oriented infrastructure, provisionally called ``{\code util}''. +METAOBJ's facilities, although impressive, were perceived by me as being a bit too much +for what was initially intented as a quick way of getting some UML diagrams layed out. +Inspired by METAOBJ, ``{\code util}'' was designed to fulfill with minimal effort +the specific tasks needed to confortably position, allign or group visual objects +which include text. + +Another library having some object-oriented traits is the {\code boxes} +library, which comes with the standard MetaPost distribution. Early versions of +MetaUML did use {\code boxes} as an infrastructure, but this approach had to be abandoned eventually. +The main reason was that it was difficult to achieve good visual results when stacking texts +(more on that further on). Also, it had a degree of flexibility which became apparent to be +insufficient. + +\subsection{Motivation} + +Suppose that we want to typeset two texts with their bottom lines aligned, using {\code boxit}: + +\begin{multicols}{2} +\begin{verbatim} +boxit.a ("yummy"); +boxit.b ("cool"); + +a.nw = (0,0); b.sw = a.se + (10,0); + +drawboxed (a, b); % or drawunboxed(a,b) +draw a.sw -- b.se dashed evenly + withpen pencircle scaled 1.1; +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/boxes_vs_util.1} +\end{multicols} + +Note that, despite supposedly having their bottoms alligned, +``yummy'' {\it looks} slightly higher than ``cool''. This would be unacceptable +in an UML class diagram, when roles are placed at the ends of a horizontal association. +Regardless of default spacing being smaller in the {\code util} library, +the very same unfortunate misalignment effect rears its ugly head: + +\pagebreak + +\begin{multicols}{2} +\begin{verbatim} +Picture.a("yummy"); +Picture.b("cool"); +% comment next line for unboxed +a.info.boxed := b.info.boxed := 1; + +b.sw = a.se + (10,0); + +drawObjects(a, b); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/boxes_vs_util.2} +\end{multicols} + +However, the strong point of {\code util} is that we have a recourse to this problem: + +\begin{multicols}{2} +\begin{verbatim} +iPict.ignoreNegativeBase := 1; + +Picture.a("yummy"); +Picture.b("cool"); +% the rest the same as above +drawObjects(a, b); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/boxes_vs_util.3} +\end{multicols} + +\subsection{The Picture Macro} + +We have seen previously the line {\code iPict.ignoreNegativeBase := 1}. +Who is {\code iPict} and what is it doing in our program? \metauml\ +aims at separating the ``business logic'' (what to draw) from the +``interface'' (how to draw). In order to achieve this, it records the ``how to draw'' +information within the so-called {\code Info} structures. The object {\code iPict} +is an instance of {\code PictureInfo} structure, which has the following properties +(or attributes): +\begin{verbatim} +left, right, top, bottom +ignoreNegativeBase +boxed, borderColor +\end{verbatim} + +The first four attributes specify how much space should be left around the +actual item to be drawn. The marvelous effect of {\code ignoreNegativeBase} +has just been shown (off), while the last two attributes control whether the border +should be drawn (when {\code boxed=1}) and if drawn, in which color. + +There's one more thing: the font to typeset the text in. This is specified +in a {\code FontInfo} structure which has two attributes: the font name +and the font scale. This information is kept within the {\code PictureInfo} structure +as a contained attribute {\code iFont}. Both {\code FontInfo} and {\code PictureInfo} +have ``copy constructors'' which can be used to make copies. We have already +the effect of these copy constructors at work, when we used: + +\begin{verbatim} +Picture.a("yummy"); +a.info.boxed := 1; +\end{verbatim} + +A copy of the default info for a picture, {\code iPict}, has been made within +the object {\code a} and can be accessed as {\code a.info}. Having a copy of the +info in each object may seem like an overkill, but it allows for a fine grained +control of the drawing mode of each individual object. This feature comes in very +handy when working with a large number of settings, as it is the case for \metauml. + +Let us imagine for a moment that we have two types of text to write: one with a small font +and a small margin and one with a big font and a big margin. We could in theory +configure each individual object or set back and forth global parameters, but +this is far for convenient. It is preferable to have two sets of settings and specify +them explicitly when they are needed. The following code could be placed somewhere +in a configuration file and loaded before any {\code beginfig} macro: +\begin{verbatim} +PictureInfoCopy.iBig(iPict); +iBig.left := iBig.right := 20; +iBig.top := 10; +iBig.bottom := 1; +iBig.boxed := 1; +iBig.ignoreNegativeBase := 1; +iBig.iFont.name := defaultfont; +iBig.iFont.scale := 3; + +PictureInfoCopy.iSmall(iPict); +iSmall.boxed := 1; +iSmall.borderColor := green; +\end{verbatim} + +Below is an usage example of these definitions. Note the name of the macro: {\code EPicture}. +The prefix comes form ``explicit'' and it's used to acknowledge that the +``how to draw'' information is given explicitly --- as a parameter, +rather than defaulted to what's recorded in {\code iPict}, as with the {\code Picture} macro. +Having predefined configurations yields short, convenient code. + +\begin{multicols}{2} +\begin{verbatim} +EPicture.a(iBig)("yummy"); +EPicture.b(iSmall)("cool"); +% you can still modify a.info, b.info + +b.sw = a.se + (10,0); + +drawObjects(a, b); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/picture_info.1} +\end{multicols} + +\subsection{Stacking Objects} + +It is possible to stack objects, much in the style of {\code setboxjoin} +from {\code boxes} library. + +\pagebreak + +\begin{multicols}{2} +\begin{verbatim} +Picture.a0("yummy"); +Picture.a1("cool"); +Picture.a2("fool"); + +setObjectJoin(pa.sw = pb.nw); +joinObjects(scantokens listArray(a)(3)); + +drawObjects(scantokens listArray(a)(3)); +% or drawObjects (a0, a1, a2); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/object_stack.1} +\end{multicols} + +The {\code listArray} macro provides here a shortcut for writing +{\code a0, a1, a2}. This macro is particularly useful for generic +code which does not know beforehand the number of elements to be drawn. +Having to write the {\code scantokens} keyword is admittedly a nuisance, but +this is required. + +\subsection{The Group Macro} + +It is possible to group objects in \metauml. This feature is the cornerstone +of \metauml, allowing for the easy development of complex objects, such as +composite stats in state machine diagrams. + +Similarly to the macro {\code Picture}, the structure {\code GroupInfo} +is used for specifying group properties; its default instantiation is +{\code iGroup}. Furthermore, the macro {\code EGroup} explicitely sets the +layout information. + +Here is an example: + +\begin{multicols}{2} +\begin{verbatim} +iGroup.left:=20; +iGroup.right:=15; +iGroup.boxed:=1; +iPicture.boxed:=1; + +Picture.a("yummy"); +Picture.b("cool"); +Picture.c("fool"); + +b.nw = a.nw + (20,20); % A +c.nw = a.nw + (15, 40); % B + +Group.g(a, b, c); +g.nw = (10,10); % C + +drawObject(g); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/group.1} +\end{multicols} + +Note that after some objects are grouped, they can all be drawn +by invoking the {\code drawObject} macro solely on the group that aggregates them. +Another important remark is that it is necessary only to set the relative +positioning of objects within a group (line A and B); afterward, one can +simply ``move'' the group to a given position (line C), and all the contained +objects will move along. + +\subsection{The PictureStack Macro} + +The {\code PictureStack} macro is a syntactic sugar for a set of pictures, +stacked according to predefined equations and grouped together. + +\begin{multicols}{2} +\begin{verbatim} +iStack.boxed := 1; +iStack.iPict.boxed := 1; +PictureStack.myStack("foo", + "bar: int" infont "tyxtt", + "nicely-centered" infont defaultfont, + "nice")("vcenter"); + +drawObject(myStack); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/picture_stack.1} +\end{multicols} + +Note the last parameter of the macro {\code PictureStack}, here {\code vcenter}. +It is used to generate appropriate equations based on a descriptive name. +The spacing between individual picture objects is set by the field +{\code iStack.spacing}. Currently, the following alignment names are +defined: {\code vleft}, {\code vright}, {\code vcenter}, +{\code vleftbase}, {\code vrightbase}, {\code vcenterbase}. All these +names refer to vertical alignment (the prefix ``{\code v}''); alignment can +be at left, right or centered. The variants having the suffix ``{\code base}'' align +the pictures so that {\code iStack.spacing} refer to the distance between the +bottom lines of the pictures. The unsuffixed variants use {\code iStack.spacing} as +the distance between one's bottom line and the next's top line. + +The ``{\code base}'' alignment is particularly useful for stacking text, since it +offers better visual appearance when {\code iPict.ignoreNegativeBase} is set to {\code 1}. + +\section{Components Design} + +Each MetaUML component (e.g. {\code Picture}, {\code PictureStack}, {\code Class}) is +designed according to an established pattern. This section gives more insight +on this. + +In order to draw a component, one must know the following information: +\begin{itemize} +\item what to draw, or what are the elements of a component. +\item how to draw, or how are the elements positioned in relation to each other within the component +\item where to draw +\end{itemize} + +For example, in order to draw a picture object we must know, respectively: +\begin{itemize} +\item what is the text or the native picture that needs to be drawn +\item what are the margins that should be left around the contents +\item where is the picture to be drawn +\end{itemize} + +Why do we bother with these questions? Why don't we just simply draw the picture +component as soon as it was created and get it over with? +That is, why doesn't the following code just work? + +\begin{verbatim} +Picture.pict("foo"); +\end{verbatim} + +Well, although we have the answer to question 1 (what to draw), +we still need to have question 3 answered. The code below becomes thus a +necessity (actually, you are not forced to specify the positioning of an object, +because its draw method positions it to {\code (0,0)} by default): + +\begin{verbatim} +% question 1: what to draw +Picture.pict("foo"); + +% question 3: where to draw +pict.nw = (10,10); + +% now we can draw +drawObject(pict); +\end{verbatim} + +How about question 2, how to draw? By default, this problem is addressed behind the +scenes by the component. This means, for the Picture object, that a native picture is created +from the given string, and around that picture certain margins are placed, by means of MetaPost equations. +(The margins come in handy when one wants to quickly place Picture objects near others, +so that the result doesn't look too cluttered.) +If these equations were defined within the Picture constructor, then an +usability problem would have appeared, because it wouldn't have been possible to modify the margins, +as in the code below: + +\begin{verbatim} +% question 1: what to draw +Picture.pict("foo"); + +% question 2: how to draw +pict.info.left := 10; +pict.info.boxed := 1; + +% question 3: where to draw +pict.nw = (0,0); + +% now we can draw +drawObject(pict); +\end{verbatim} + +To allow for this type of code, the equations that define the layout of the {\code Picture} object (here, what the margins are) +must be defined somewhere after the constructor. This is done by a macro called {\code Picture\_layout}. +This macro defines all the equations which link the ``what to draw'' information to the ``how to draw'' +information (which in our case is taken from the {\code info} member, a copy of {\code iPict}). +Nevertheless, notice that {\code Picture\_layouts} is not explicitly invoked. To the user's +great relief, this is taken care of automatically within the {\code Picture\_draw} macro. + +There are times however, when explicitly invoking a macro like {\code Picture\_layout} +becomes a necessity. This is because, by contract, it is only after the {\code layout} +macro is invoked that the final dimensions (width, height) of an object are +definitely and permanently known. Imagine that we have a component whose job is to +surround in a red-filled rectangle some other objects. This component +needs to know what the dimensions of the contained objects are, in order to be able to set +its own dimensions. At drawing time, the contained objects must not have been drawn already, +because the red rectangle of the container would overwrite them. +Therefore, the whole pseudo-code would be: +\begin{verbatim} +Create objects o1, o2, ... ok; +Create container c(o1, o2, ..., ok); +Optional: modify info-s for o1, o2, ... ok; +Optional: modify info for c; + +layout c, requiring layout of o1, o2, ... ok; +establish where to draw c; +draw red rectangle defined by c; +draw components o1, o2, ...ok within c +\end{verbatim} + +Note that an object mustn't be laid out more than once, because otherwise +inconsistent or superfluous equations would arise. To enforce this, by contract, +any object must keep record of whether its layout method has already been invoked, +and if the answer is affirmative, subsequent invocations of the layout macro would +do nothing. It is very important to mention that after the {\code layout} macro is +invoked over an object, modifying the {\code info} member of that object has +no subsequent effect, since the layout equations are declared and interpreted only once. + +\subsection{Notes on the Implementation of Links} + +\metauml\ considers edges in diagram graphs as links. A link is composed of a path and the +heads (possible none, one or two). For example, an association has no heads, and one must simply +draw along the path with a solid pen. An unidirectional aggregation has a solid path and two +heads: one is an arrow and the other is a diamond. So the template algorithm for drawing a link +is: + +\begin{verbatim} +0. Reserve space for heads +1. Draw the path (except for the heads) +2. Draw head 1 +3. Draw head 2 +\end{verbatim} + +Each of the UML link types define how the drawing should be done, in each of the +cases (1, 2 and 3). Consider the link type of unidirectional composition. +Its ``class'' is declared as: + +\begin{verbatim} +vardef CompositionUniInfo@# = + LinkInfo@#; + + @#widthA = defaultRelationHeadWidth; + @#heightA = defaultRelationHeadHeight; + @#drawMethodA = "drawArrow"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawDiamondBlack"; + + @#drawMethod = "drawLine"; +enddef; +\end{verbatim} + +Using this definition, the actual description is created like this: + +\begin{verbatim} +CompositionUniInfo.compositionUni; +\end{verbatim} + +As shown previously, is is the macro {\code link} which +performs the actual drawing, using the link description information +which is given as parameter (generally called {\code iLink}). +For example, we can use: + +\begin{verbatim} +link(aggregationUni)((0,0)--(40,0)); +\end{verbatim} + +%\begin{figure} +%\centering +%\includegraphics{fig/how-links-work.1} +%\caption{An example of a picture stack.} +%\label{fig:hlw} +%\end{figure} + +Let us see now the inner workings of macro {\code link}. Its definition is: + +\begin{verbatim} +vardef link(text iLink)(expr myPath)= + LinkStructure.ls(myPath, + iLink.widthA, iLink.widthB); + drawLinkStructure(ls)(iLink); +enddef; +\end{verbatim} + +\begin{figure} +\centering +\begin{tabular}{l|l} +$AB$ & the path specified by the user \\ +$|AA'|$ & {\code iLink.widthA}\\ +$|BB'|$ & {\code iLink.widthB} +\end{tabular} +\includegraphics{fig/how-links-work.2} +\caption{Details on how a link is drawn by \metauml.} +\label{fig:hlw2} +\end{figure} + +First, space is reserved for heads, by ``shortening'' the given path {\code myPath} +by {\code iLink.widthA} at the beginning and by {\code iLink.widthB} at the end. +After that, the shortened path is drawn with the ``method'' +given by {\code iLink.drawMethod} and the heads with the ``methods'' +{\code iLink.drawMethodA} and {\code iLink.drawMethodB}, +respectively (figure \ref{fig:hlw2}). + +\subsection{Object Definitions: Easier {\code generic\_declare}} + +In MetaPost, if somebody wants to define something resembling a class in an object-oriented language, +named, say, {\code Person}, he would do something like this: + +\begin{verbatim} +vardef Person@#(expr _name, _age)= + % @# prefix can be seen as `this` pointer + string @#name; + numeric @#age; + + @#name := _name; + @#age := _age; +enddef; +\end{verbatim} + +This allows for the creation of instances (or objects) of class {\code Person} by using +declarations like: + +\begin{verbatim} +Person.personA; +Person.personB; +\end{verbatim} + + However, if one also wants to able able to create indexed arrays of persons, such as +{\code Person.student0}, {\code Person.student1} etc., the definition of class +{\code Person} must read: + +\begin{verbatim} +vardef Person@#(expr _name, _age)= + _n_ := str @#; + generic_declare(string) _n.name; + generic_declare(numeric) _n.age; + + @#name := _name; + @#age := _age; +enddef; +\end{verbatim} + +This construction is rather inelegant. MetaUML offers alternative macros to achieve +the same effect, uncluttering the code by removing the need for the unaesthetic {\code \_n\_} and +{\code \_n}. + +\begin{verbatim} +vardef Person@#(expr _name, _age)= + attributes(@#); + var(string) name; + var(numeric) age; + + @#name := _name; + @#age := _age; +enddef; +\end{verbatim} + +\section{Customization in MetaUML: Examples} +\label{section:customization} + +We have seen that in MetaUML the ``how to draw'' information is memorized into the so-called +``{\code Info}'' structures. For example, the default way in which a {\code Picture} object is +to be drawn is recorded into an instance of {\code PictureInfo}, named {\code iPict}. In this section we +present a case study involving the customization of {\code Class} objects. The customization of +any other \metauml\ objects works similarly. Here we cannot possibly present all the customization +options for all kinds of \metauml\ objects: this would take too long. Nevertheless, an interested reader can refer +to the top of the appropriate \metauml\ library file, where {\code Info} structures are defined. +For example, class diagram related definitions are in {\code metauml\_class.mp}, activity diagram +definitions are in {\code metauml\_activity.mp} etc. + +\subsection{Global settings} + +Let us assume that we do not particularly like the default foreground color of all classes, and wish +to change it so something yellowish. In this scenario, one would most likely want to change +the appropriate field in {\code iClass}: + +\begin{verbatim} +iClass.foreColor := (.9, .9, 0); +\end{verbatim} + +After this, we can obtain the following result: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("A")()(); +Class.B("B")()(); +Class.C("C")()(); + +B.w = A.e + (20,0); +C.n = .5[A.se, B.sw] + (0, -10); + +drawObjects(A, B, C); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class_customization.1} +\end{multicols} + +\subsection{Individual settings} + +When one wants to make modifications to the settings of one particular +{\code Class} objects, another strategy is more appropriate. How about having class +{\code C} stand out with a light blue foreground color, a bigger font size for the class name and a blue border? + +\pagebreak +\begin{multicols}{2} +\begin{verbatim} +iPict.foreColor := (.9, .9, 0); + +Class.A("A")()(); +Class.B("B")()(); +Class.C("C")()(); +C.info.foreColor := (.9, .7, .7); +C.info.borderColor := green; +C.info.iName.iFont.scale := 2; + +% positioning code ommited +drawObjects(A, B, C); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class_customization.2} +\end{multicols} + +As an aside, note that for each {\code Class} object its {\code info} member is created as +a copy of {\code iClass}: the actual drawing is performed using this copied +information. Because of that, one can modify the {\code info} member after the object +has been created and still get the desired results. + +Another thing worth mentioning is that the {\code ClassInfo} structure contains +the {\code iName} member, which is an instance of {\code PictureInfo}. In our example we +do not want to modify the spacings around the {\code Picture} object, +but the characteristics of the font its contents is typeset into. To do that, +we modify the {\code iName.iFont} member, which by default is a copy of {\code iFont} +(an instance of {\code FontInfo}, defined in {\code util\_picture.mp}). +If, for example, we want to change the font the class name is rendered into, we would set +the attribute {\code iName.iFont.name} to a string representing a font name +on our system (as used with the MetaPost {\code infont} operator). + + +\subsection{Predefined settings} + +This usage scenario is perhaps more interesting. Suppose that we have two +types of classes which we want to draw differently. Making the setting adjustments +for each individual class object would soon become a nuisance. \metauml's solution consists in the +ability of using predefined ``how to draw'' {\code Info} objects. Let us create such objects: + +\begin{verbatim} +ClassInfoCopy.iHome(iClass); +iHome.foreColor := (0, .9, .9); + +ClassInfo.iRemote; +iRemote.foreColor := (.9, .9, 0); +iRemote.borderColor := green; +\end{verbatim} + +Object {\code iHome} is a copy of {\code iClass} (as it might have been set at +the time of the macro call). Object {\code iRemote} is created just as {\code iClass} +is originally created. We can now use these {\code Info} objects to easily set the +``how to draw'' information for classes. The result is depicted below, +please note the ``{\code E}'' prefix in {\code EClass}: + +\begin{multicols}{2} +\begin{verbatim} +EClass.A(iHome)("UserHome")()(); +EClass.B(iRemote)("UserRemote")()(); +EClass.C(iHome)("CartHome")()(); +EClass.D(iRemote)("CartRemote")()(); +\end{verbatim} +\columnbreak +\hspace{1cm}\includegraphics{fig/class_customization.3} +\end{multicols} + +\subsection{Extreme customization} + +When another font (or font size) is used, one may also want to modify the spacings between the +attributes' and methods' baselines. Figure below is the result of the +(unlikely) code: + +\begin{multicols}{2} +\begin{verbatim} +Class.A("Foo") + ("a: int", "b: int") + ("foo()", "bar()", "gar()"); + +A.info.iName.iFont.name := metauml_defaultFontBold; +A.info.iName.iFont.scale := 1.2; + +A.info.iAttributeStack.iPict.iFont.scale := 0.8; +A.info.iAttributeStack.top := 10; +A.info.iAttributeStack.spacing := 11; + +A.info.iMethodStack.iPict.iFont.scale := 2; +A.info.iMethodStack.spacing := 17; +A.info.iMethodStack.bottom := 10; + +drawObject(A); +\end{verbatim} +\columnbreak +\hspace{4cm}\includegraphics{fig/class_customization.4} +\end{multicols} + +\begin{verbatim} +\end{verbatim} + +Both {\code iAttributeStack} and {\code iMethodStack} are instances of +{\code PictureStackInfo}, which is used to control the display of {\code PictureStack} objects. +%We can also customize the size and colors of the ``locks'' by setting {\code A.info.iLock}. + +As font names, you can choose from the globally defined {\code metauml\_defaultFont}, {\code metauml\_defaultFontOblique}, {\code metauml\_defaultFontBold}, {\code metauml\_defaultFontBoldOblique}, or any other name of a font that is available on your system. + +%\theendnotes + +\bibliographystyle{apalike} + +\begin{thebibliography}{1} +\bibitem[Roegel, 2002]{metaobj} +Roegel, D. (2002). +\newblock {The METAOBJ tutorial and reference manual}. +\newblock Available from {\code www.loria.fr/~roegel/TeX/momanual.pdf}. + +\bibitem[Knuth, 1986]{knuth} +Knuth, D.~E. (1986). +\newblock {\em The {\TeX{}}book}. +\newblock Addison-Wesley Publishing Company. + +\bibitem[Lamport, 1994]{lamport} +Lamport, L. (1994). +\newblock {\em {\LaTeX} a Document Preparation System}. +\newblock Addison-Wesley Publishing Company, 2nd edition. + +%\bibitem[Gheorghies, 2005]{metaumlman} +%Gheorghies, O. (2005). +%\newblock {MetaUML: Tutorial, Reference and Test Suite}. +%\newblock Available from {\code http://metauml.sourceforge.net}. + +\bibitem[Hobby, 1992]{metapost} +Hobby, J. (1992) +\newblock {A User's Manual for MetaPost}. +\newblock Available from {\code http://www.tug.org/tutorials/mp/}. + +\bibitem[Gjelstad, 2001]{umlsty} +Gjelstad, E. (2001). +\newblock {uml.sty 0.09.09}. +\newblock Available from {\code http://heim.ifi.uio.no/\~{ }ellefg/uml.sty/}. + +\bibitem[Diamantini, 1998]{pstumlsty} +Diamantini, M. (1998). +\newblock {Interface utilisateur du package pst-uml}. +\newblock Available from {\code http://perce.de/LaTeX/pst-uml/}. + +\bibitem[Palmer, 1999]{umldoc} +Palmer, D. (1999). +\newblock {The umldoc UML Documentation Package}. +\newblock Available from {\code http://www.charvolant.org/\~{ }elements/}. + +\bibitem[OMG, 2003]{XMI} +Object Management Group (2003). +\newblock {XML Metadata Interchange (XMI) Specification}. +\newblock Available from {\code http://www.omg.org/}. +\end{thebibliography} + +\pagebreak +\pagebreak +\pagebreak +\input{test_suite} + +\pagebreak +\section{GNU Free Documentation License} +\input{gnu-fdl} + +\end{document} diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/my-bib.bib b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/my-bib.bib new file mode 100644 index 00000000000..3dea8fd262a --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/my-bib.bib @@ -0,0 +1,13 @@ +@inproceedings{ template, + author = "Nicholas Freitag McPhee and Riccardo Poli", + title = "A schema theory analysis of the evolution of size in genetic programming with linear representations", + booktitle = "Genetic Programming, Proceedings of EuroGP'2001", + volume = "2038", + month = "18-20", + publisher = "Springer-Verlag", + address = "Lake Como, Italy", + editor = "Julian F. Miller and Marco Tomassini and Pier Luca Lanzi and Conor Ryan and Andrea G. B. Tettamanzi and William B. Langdon", + isbn = "3-540-41899-7", + pages = "108--125", + year = "2001", + url = "citeseer.nj.nec.com/mcphee01schema.html" }
\ No newline at end of file diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual/test_suite.tex b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/test_suite.tex new file mode 100644 index 00000000000..18b47231436 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual/test_suite.tex @@ -0,0 +1,121 @@ +% Part of the MetaUML manual +% Copyright (c) 2005 Ovidiu Gheorghies +% +% Permission is granted to copy, distribute and/or modify this document +% under the terms of the GNU Free Documentation License, Version 1.2 +% or any later version published by the Free Software Foundation; +% with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +% A copy of the license is included in the section entitled "GNU +% Free Documentation License". + +\newcommand{\metaumltest}[2]{Test #2 --- \\ \includegraphics{fig/test_#1.#2} \\ } + +\section{Test suite} + +\subsection{Low-level} + \metaumltest{lowlevel}{1} + \metaumltest{lowlevel}{2} + +\subsection{Fonts} + \metaumltest{font}{1} + \metaumltest{font}{2} + \metaumltest{font}{3} + +\subsection{Cliparts} + Locks ---\\ + \includegraphics{fig/cliparts.1} + +\subsection{Util library} + \subsubsection{Picture tests} + \metaumltest{picture}{1} + \metaumltest{picture}{2} + \metaumltest{picture}{3} + \metaumltest{picture}{4} + \metaumltest{picture}{5} + \metaumltest{picture}{6} + + \subsubsection{Group tests} + \metaumltest{group}{1} + \metaumltest{group}{2} + + \subsubsection{PictureStack tests} + \metaumltest{picture_stack}{1} + \metaumltest{picture_stack}{2} + \metaumltest{picture_stack}{3} + + \subsubsection{Positioning tests} + \metaumltest{positioning}{1} + \metaumltest{positioning}{2} + \metaumltest{positioning}{3} + \metaumltest{positioning}{4} + \metaumltest{positioning}{5} + \metaumltest{positioning}{6} + +\subsection{Class diagram} + \subsubsection{Class tests} + \metaumltest{class}{1} + \metaumltest{class}{2} + \metaumltest{class}{3} + \metaumltest{class}{4} + \metaumltest{class}{5} + \metaumltest{class}{6} + \metaumltest{class}{7} + \metaumltest{class}{8} + \metaumltest{class}{9} + \metaumltest{class}{10} + \metaumltest{class}{11} + + \subsubsection{Class template tests} + \metaumltest{class_templates}{1} + \metaumltest{class_templates}{2} + \metaumltest{class_templates}{3} + + \subsubsection{Qualified Association tests} + \metaumltest{class_qual_assoc}{1} + \metaumltest{class_qual_assoc}{2} + +\subsection{Package diagram} +\subsubsection{Package tests} + \metaumltest{package}{1} + \metaumltest{package}{2} + +\subsection{Paths} + \metaumltest{paths}{1} + +\subsection{Behavioral diagrams} + \subsubsection{Activity tests} + \metaumltest{activity}{1} + \metaumltest{activity}{2} + + \subsubsection{State Machine tests} + \metaumltest{state}{1} + \metaumltest{state}{2} + \metaumltest{state}{3} + \metaumltest{state}{4} + \metaumltest{state}{5} + + \subsubsection{Usecase tests} + \metaumltest{usecase}{1} + \metaumltest{usecase}{2} + \metaumltest{usecase}{3} + \metaumltest{usecase}{4} + \metaumltest{usecase}{5} + \metaumltest{usecase}{6} + \metaumltest{usecase}{7} + \metaumltest{usecase}{8} + \metaumltest{usecase}{9} + +\subsection{Miscelaneous} + \subsubsection{Notes} + \metaumltest{note}{1} + \metaumltest{note}{2} + \subsubsection{Objects (Class Instances)} + \metaumltest{instance}{1} + +\subsection{User requests} + Test 1 --- \\ \includegraphics[scale=.2]{fig/test_lars_issues.1} \\ + \metaumltest{lars_issues}{2} + +\subsection{Skins} + \metaumltest{skins}{1} + \metaumltest{skins_global_defaults}{1} diff --git a/Master/texmf-dist/doc/metapost/metauml/metauml_manual_0.2.3.pdf b/Master/texmf-dist/doc/metapost/metauml/metauml_manual_0.2.3.pdf Binary files differnew file mode 100644 index 00000000000..8f33c5caae5 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/metauml/metauml_manual_0.2.3.pdf diff --git a/Master/texmf-dist/metapost/metauml/metauml.mp b/Master/texmf-dist/metapost/metauml/metauml.mp new file mode 100644 index 00000000000..6d0b29c86c8 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml.mp @@ -0,0 +1,60 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_mp: + expandafter endinput +fi; +_metauml_mp:=1; + +input boxes; + +input util_infrastructure; +input util_object; +input util_commons; +input util_margins; +input util_picture; +input util_group; +input util_picture_stack; +input util_positioning; +input util_shade; + +input metauml_base; + +input metauml_links; +input metauml_paths; + +input metauml_note; + +input metauml_stereotype; + +input metauml_class_clipart; +input metauml_class; +input metauml_instance; +input metauml_class_relations; +input metauml_class_assoc; + +input metauml_package; +input metauml_package_relations; + +input metauml_behavioral_common; +input metauml_activity; +input metauml_state; + +input metauml_usecase_clipart; +input metauml_usecase; + +input metauml_templates; diff --git a/Master/texmf-dist/metapost/metauml/metauml_activity.mp b/Master/texmf-dist/metapost/metauml/metauml_activity.mp new file mode 100644 index 00000000000..b5b99f16e86 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_activity.mp @@ -0,0 +1,231 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_activity_mp: + expandafter endinput +fi; +_metauml_activity_mp:=1; + +input metauml_defaults; +input util_log; + +vardef ActivityInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iText (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iStack (2, 2, 2, 2)(9)(@#iText); + + @#iStack.iPict.ignoreNegativeBase := 1; + + Margins.@#(2,2,2,2); + + @#fat := 5; + + ShadeInfo.@#iShade; + @#foreColor := .9white; + @#borderColor := black; +enddef; + +vardef ActivityInfoCopy@#(text src)= + log "ActivityInfoCopy: Copying activity info"; + + attributes(@#); + var(color) foreColor, borderColor; + + PictureStackInfoCopy.@#iStack (src.iStack); + MarginsCopy.@#(src); + @#fat := src.fat; + + ShadeInfoCopy.@#iShade(src.iShade); + + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; +enddef; + +ActivityInfo.iActivity; + +vardef Activity@#(text contents)= + EActivity.@#(iActivity)(contents); +enddef; + +vardef EActivity@#(text _info)(text contents)= + ObjectEquations(@#); + @#className := "Activity"; + + ActivityInfoCopy.@#info(_info); + + numeric @#nLines; @#nLines := 0; + string @#lines[]; + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; + + EPictureStack.@#stack(@#info.iStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); +enddef; + +vardef Activity_layout@#= + if @#layedout = 1: + log "Activity " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + + PictureStack_layout.@#stack; + + @#width = @#stack.width + @#info.left + @#info.right + 2 * @#info.fat; + @#height = @#stack.height + @#info.top + @#info.bottom; + + @#c = @#stack.c; + + pair @#urt, @#lrt, @#ulft, @#llft; + + @#urt := @#ne - (@#info.fat, 0); + @#lrt := @#se - (@#info.fat, 0); + @#ulft := @#nw + (@#info.fat, 0); + @#llft := @#sw + (@#info.fat, 0); + fi; +enddef; + +vardef Activity_draw@#= + Activity_layout@#; + objectEnsurePositioning.@#; + + attributes(@#); + var(path) border; + @#border := @#ulft -- @#urt .. @#e .. @#lrt -- @#llft .. @#w .. cycle; + + drawObjectShade(@#); + fill @#border withcolor @#info.foreColor; + draw @#border withcolor @#info.borderColor; + + drawObject(@#stack); +enddef; + +vardef Activity_border@#= + @#border +enddef; + + +vardef BranchInfo@#= + @#width := 10; + @#height := 10; + + numeric @#shade; + color @#shadeColor, @#foreColor; + @#shade := .3; + @#shadeColor := .6white; + @#foreColor := white; +enddef; + +BranchInfo.iBranch; + +vardef Branch@#= + ObjectEquations(@#); + @#className := "Branch"; + + @#width = iBranch.width; + @#height = iBranch.height; +enddef; + +vardef Branch_layout@#= + % nothing to do +enddef; + +vardef Branch_draw@#= + objectEnsurePositioning.@#; + + path @#border; + @#border := @#n -- @#e -- @#s -- @#w -- cycle; + + fill @#border shifted (iBranch.shade, -iBranch.shade) withcolor iBranch.shadeColor; + fill @#border withcolor iBranch.foreColor; + draw @#border; +enddef; + +vardef Branch_border@#= + @#border +enddef; + +vardef ForkInfo@#= + @#thickness := 3; + + numeric @#shade; + color @#shadeColor, @#foreColor; + @#shade := .3; + @#shadeColor := .6white; + @#foreColor := black; +enddef; + +ForkInfo.iFork; + +vardef Fork@#(expr orientation, length)= + ObjectEquations(@#); + @#className := "Fork"; + + if (orientation="h") or (orientation="horiz") or (orientation="horizontal"): + @#width = length; + @#height = iFork.thickness; + else: + @#height = length; + @#width = iFork.thickness; + fi; +enddef; + +vardef Fork_layout@#= + % nothing to do +enddef; + +vardef Fork_draw@#= + objectEnsurePositioning.@#; + + path @#border; + @#border := @#nw -- @#ne -- @#se -- @#sw -- cycle; + + fill @#border shifted (iFork.shade, -iFork.shade) withcolor iFork.shadeColor; + fill @#border withcolor iFork.foreColor; +enddef; + +vardef Fork_border@#= + @#border +enddef; + +defaultTransitionHeadWidth := 15; +defaultTransitionHeadHeight := 5; + +vardef TransitionInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultTransitionHeadWidth; + @#heightB = defaultTransitionHeadHeight; + @#drawMethodB = "drawArrow"; + + @#drawMethod = "drawLine"; +enddef; + +TransitionInfo.transition; + +FontInfo.guardFont(metauml_defaultFont, .7); +PictureInfo.iGuard(2, 2, 2, 2)(guardFont); +iGuard.ignoreNegativeBase := 1; diff --git a/Master/texmf-dist/metapost/metauml/metauml_base.mp b/Master/texmf-dist/metapost/metauml/metauml_base.mp new file mode 100644 index 00000000000..c44947ad43f --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_base.mp @@ -0,0 +1,147 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_base_mp: + expandafter endinput +fi; +_metauml_base_mp:=1; + +input util_log; + +vardef markPoint(text p)(text color) = + draw p withpen pencircle scaled 1 withcolor color; +enddef; + +vardef drawLine(text pA)(text pB)(text base) = + draw pA--pB; +enddef; + +vardef drawArrow(text pA)(text pB)(text base) = + numeric dx, dy; + dx = xpart(pB - pA); + dy = ypart(pB - pA); + + numeric alfa; + alfa = angle(dx, dy); + + pair pC, pD; + pC := (0, base/2); + pC := pC rotated (alfa) shifted pA; + pD := (0, base/2); + pD := pD rotated (180+alfa) shifted pA; + + %fill pA--pC--pB--pD--cycle withcolor .8white; + + draw pA--pB; + draw pB--pC; + draw pB--pD; +enddef; + +vardef drawTriangle(text pA)(text pB)(text base) = + numeric dx, dy; + dx = xpart(pB - pA); + dy = ypart(pB - pA); + + numeric alfa; + alfa = angle(dx, dy); + pair pC, pD; + pC := (0, base/2); + pC := pC rotated (alfa) shifted pA; + pD := (0, base/2); + pD := pD rotated (180+alfa) shifted pA; + + fill pA--pC--pB--pD--cycle withcolor white; + + draw pA--pC;% withcolor red; + draw pA--pD;% withcolor green; + draw pB--pC;% withcolor blue; + draw pB--pD; +enddef; + +vardef drawDiamond(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); + + path diamond; + diamond = (0,0)--(width/2, height/2)--(width, 0)--(width/2, -height/2)--cycle; + + fill diamond rotated alfa shifted pA withcolor white; + draw diamond rotated alfa shifted pA; +enddef; + +vardef drawDiamondBlack(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); + + path diamond; + diamond = (0,0)--(width/2, height/2)--(width, 0)--(width/2, -height/2)--cycle; + + fill diamond rotated alfa shifted pA; +enddef; + +vardef drawCrossedCircle(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, height/2 + 1); + pC := pC rotated (alfa) shifted pA; + pD := (width/2, -height/2 - 1); + pD := pD rotated (alfa) shifted pA; + + fill pA..pB..pA -- cycle withcolor white; + + draw pA -- pB; + draw pC -- pD; + draw pA .. pB .. pA; +enddef; + +vardef drawLine(expr my_path) = + draw my_path; +enddef; + +vardef drawLineDashed(expr my_path) = + draw my_path dashed evenly; +enddef; + +vardef drawNothing(text pA)(text pB)(text base) = +enddef; + +def shorterLineEndPoint(text pA)(text pB)(text delta) = + (xpart(pA) + _dx(pA)(pB)*(1 - delta/_length(pA)(pB)), ypart(pA) + _dy(pA)(pB) * (1 - delta/_length(pA)(pB)) ) +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp b/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp new file mode 100644 index 00000000000..0f52d206777 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_behavioral_common.mp @@ -0,0 +1,216 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_behavioral_common_mp: + expandafter endinput +fi; +_metauml_behavioral_common_mp:=1; + +input util_log; + +vardef SpecialStateInfo@#= + numeric @#diameter; + color @#discColor; + + numeric @#shade; + color @#shadeColor, @#foreColor; + + @#diameter := 0.4cm; + @#discColor := black; + @#foreColor := black; + + ShadeInfo.@#iShade; +enddef; + +vardef SpecialStateInfoCopy@#(text src)= + SpecialStateInfo.@#; + ShadeInfo_copy.@#iShade(src.iShade); + + @#diameter := src.diameter; + @#discColor := src.discColor; + @#foreColor := src.foreColor; +enddef; + +%%%%%%%%%%%%%%%%%% +% BEGIN % +%%%%%%%%%%%%%%%%%% + +SpecialStateInfo.iBegin; + +vardef Begin@#= + ObjectEquations(@#); + @#className := "Begin"; + + SpecialStateInfoCopy.@#info(iBegin); +enddef; + +vardef Begin_layout@#= + if @#layedout = 1: + log "Begin " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + + @#width = @#info.diameter; + @#height = @#info.diameter; + fi; +enddef; + +vardef Begin_draw@#= + Begin_layout@#; + objectEnsurePositioning.@#; + + path @#border; + @#border := @#n..@#e..@#s..@#w..cycle; + + drawObjectShade(@#); + + fill @#border withcolor @#info.discColor; + draw @#border withcolor @#info.foreColor; +enddef; + +vardef Begin_border@#= + @#border +enddef; + +%%%%%%%%%%%%%%%%%% +% END % +%%%%%%%%%%%%%%%%%% + +SpecialStateInfo.iEnd; +iEnd.innerSpacing := 2; +iEnd.discColor := white; + +vardef End@#= + ObjectEquations(@#); + @#className := "End"; + SpecialStateInfoCopy.@#info(iEnd); + @#info.innerSpacing := iEnd.innerSpacing; +enddef; + +vardef End_layout@#= + Begin_layout@#; +enddef; + +vardef End_draw@#= + Begin_draw.@#; + + path @#innerDisc; + @#innerDisc := @#n - (0, @#info.innerSpacing) .. + @#e - (@#info.innerSpacing, 0) .. + @#s + (0, @#info.innerSpacing) .. + @#w + (@#info.innerSpacing, 0) ..cycle; + + fill @#innerDisc withcolor @#info.foreColor; +enddef; + +vardef End_border@#= + @#border +enddef; + +%%%%%%%%%%%%%%%%%% +% ENTRY POINT % +%%%%%%%%%%%%%%%%%% + +SpecialStateInfo.iEntryPoint; +iEntryPoint.discColor := white; +iEntryPoint.innerSpacing := 2; + +vardef EntryPoint@#= + ObjectEquations(@#); + @#className := "EntryPoint"; + SpecialStateInfoCopy.@#info(iEntryPoint); + @#info.innerSpacing := iEntryPoint.innerSpacing; +enddef; + +vardef EntryPoint_layout@#= + Begin_layout@#; +enddef; + +vardef EntryPoint_draw@#= + Begin_draw.@#; +enddef; + +vardef EntryPoint_border@#= + @#border +enddef; + +%%%%%%%%%%%%%%%%%% +% EXIT POINT % +%%%%%%%%%%%%%%%%%% + +SpecialStateInfo.iExitPoint; +iExitPoint.discColor := white; +iExitPoint.innerSpacing := 2; + +vardef ExitPoint@#= + ObjectEquations(@#); + @#className := "ExitPoint"; + SpecialStateInfoCopy.@#info(iExitPoint); + @#info.innerSpacing := iExitPoint.innerSpacing; + @#info.iShade.shift := 0; +enddef; + +vardef ExitPoint_layout@#= + Begin_layout@#; +enddef; + +vardef ExitPoint_draw@#= + Begin_draw.@#; + + _n_ := str @#; + generic_declare(pair) _n.urt, _n.lrt, _n.llft, _n.ulft; + + @#urt := @#c + @#info.diameter/2 * (sind(45), cosd(45)); + @#lrt := @#c + @#info.diameter/2 * (sind(135), cosd(135)); + @#llft := @#c + @#info.diameter/2 * (sind(225), cosd(225)); + @#ulft := @#c + @#info.diameter/2 * (sind(315), cosd(315)); + + draw @#urt -- @#llft; + draw @#ulft -- @#lrt; +enddef; + +vardef ExitPoint_border@#= + @#border +enddef; + +%%%%%%%%%%%%%%%%%% +% FlowFinal % +%%%%%%%%%%%%%%%%%% + +SpecialStateInfo.iFlowFinal; +iFlowFinal.discColor := white; +iFlowFinal.innerSpacing := 2; + +vardef FlowFinal@#= + ObjectEquations(@#); + @#className := "FlowFinal"; + SpecialStateInfoCopy.@#info(iFlowFinal); + @#info.innerSpacing := iFlowFinal.innerSpacing; + %@#info.iShade.shift := 0; +enddef; + +vardef FlowFinal_layout@#= + Begin_layout@#; +enddef; + +vardef FlowFinal_draw@#= + ExitPoint_draw@# +enddef; + +vardef FlowFinal_border@#= + @#border +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_class.mp b/Master/texmf-dist/metapost/metauml/metauml_class.mp new file mode 100644 index 00000000000..6e8e4330e3b --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_class.mp @@ -0,0 +1,351 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_class_mp: + expandafter endinput +fi; +_metauml_class_mp:=1; + +input metauml_defaults; +input util_log; + +input util_picture; +input util_picture_stack; +input util_shade; + +string accessPublic, accessProtected, accessPrivate; +accessPublic:="+"; +accessProtected:="#"; +accessPrivate:="-"; + +vardef ClassInfo@#= + attributes(@#); + var(numeric) featureAccessSpacing, accessWidth, accessHeight; + var(color) foreColor, borderColor; + + FontInfo.@#nameFont(metauml_defaultFont, defaultscale); + + FontInfo.@#attributeFont (metauml_defaultFont, defaultscale); + FontInfo.@#methodFont (metauml_defaultFont, defaultscale); + FontInfo.@#stereotypeFont(metauml_defaultFont, .7); + + ShadeInfo.@#iShade; + + @#featureAccessSpacing := 2; + @#accessWidth := 7; + @#accessHeight := 6.75; + + @#foreColor := .9white; + @#borderColor := black; + + PictureInfo.@#iName (2, 2, 1, 3)(@#nameFont); + + PictureInfo.@#iStereotype(2, -5, 2, 2)(@#stereotypeFont); + PictureInfo.@#iAttribute (2, 2, 1.25, 0)(@#attributeFont); + PictureInfo.@#iMethod (2, 2, 1.25, 0)(@#methodFont); + + PictureStackInfo.@#iStereotypeStack(2, 2, 1, 1)(5.5)(@#iStereotype); + PictureStackInfo.@#iAttributeStack (2, 2, 2.5, 2)(10.5)(@#iAttribute); % 8.5 + PictureStackInfo.@#iMethodStack (2, 2, 2.5, 2)(10.5)(@#iMethod); + @#iAttributeStack.iPict.bottom := 2; + %@#iAttributeStack.iPict.boxed := 1; + @#iMethodStack.iPict.bottom := 2; + %@#iMethodStack.iPict.boxed := 1; + + LockInfo.@#iLock(@#accessWidth, @#accessHeight, .6, .15, .55, .4white, .6white, .7white, .3white); + + @#iName.ignoreNegativeBase := 1; + @#iAttributeStack.iPict.ignoreNegativeBase := 1; + @#iMethodStack.iPict.ignoreNegativeBase := 1; + @#iStereotypeStack.iPict.ignoreNegativeBase := 1; +enddef; + +vardef ClassInfoCopy@#(text src)= + log "ClassInfoCopy: Copying class"; + + attributes(@#); + var(numeric) featureAccessSpacing, accessWidth, accessHeight; + var(color) foreColor, borderColor; + + FontInfoCopy.@#nameFont(src.nameFont); + + FontInfoCopy.@#attributeFont(src.attributeFont); + FontInfoCopy.@#methodFont(src.methodFont); + FontInfoCopy.@#stereotypeFont(src.stereotypeFont); + + ShadeInfoCopy.@#iShade(src.iShade); + + @#featureAccessSpacing := src.featureAccessSpacing; + @#accessWidth := src.accessWidth; + @#accessHeight := src.accessHeight; + + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; + + PictureInfoCopy.@#iName (src.iName); + + PictureInfoCopy.@#iStereotype(src.iStereotype); + PictureInfoCopy.@#iAttribute (src.iAttribute); + PictureInfoCopy.@#iMethod (src.iMethod); + + PictureStackInfoCopy.@#iStereotypeStack(src.iStereotypeStack); + PictureStackInfoCopy.@#iAttributeStack (src.iAttributeStack); + PictureStackInfoCopy.@#iMethodStack (src.iMethodStack); + + LockInfoCopy.@#iLock(src.iLock); +enddef; + +ClassInfo.iClass; + +ClassInfoCopy.iInterface(iClass); +iInterface.iName.iFont.name := metauml_defaultFontOblique; + +ClassInfoCopy.iAbstractClass(iInterface); + +% +% CLASS +% +vardef defClass@#(expr pname) = + ObjectEquations(@#); + @#className := "Class"; + + string @#name; + @#name = pname; + + numeric @#nStereotypes; + string @#stereotypes[]; + + string @#attributes[]; + string @#attributesAccess[]; + + string @#methods[]; + string @#methodsAccess[]; + + numeric @#nAttrs; + numeric @#nMethods; + + @#nStereotypes := 0; + @#nAttrs := 0; + @#nMethods := 0; +enddef; + +vardef addAttribute@#(expr pcontent) = + string access; + access := substring(0,1) of pcontent; + if (not (access = accessPublic)) and + (not (access = accessPrivate)) and + (not (access = accessProtected)): + + @#.attributes[@#.nAttrs] := pcontent; + @#.attributesAccess[@#.nAttrs] := accessProtected; + else: + save from; + from := 1; + if (substring(1,2) of pcontent) = " ": from := 2; fi; + + @#.attributes[@#.nAttrs] := substring(from, infinity) of pcontent; + @#.attributesAccess[@#.nAttrs] := access; + fi; + + @#.nAttrs := @#.nAttrs + 1; +enddef; + +vardef addMethod@#(expr pcontent) = + string access; + access := substring(0,1) of pcontent; + if (not (access = accessPublic)) and + (not (access = accessPrivate)) and + (not (access = accessProtected)): + + @#.methods[@#.nMethods] := pcontent; + @#.methodsAccess[@#.nMethods] := accessProtected; + else: + @#.methods[@#.nMethods] := substring(1, 999) of pcontent; + @#.methodsAccess[@#.nMethods] := access; + fi; + + @#.nMethods := @#.nMethods + 1; +enddef; + +vardef classStereotype@#(expr pcontent) = + @#stereotypes[@#nStereotypes] := pcontent; + @#nStereotypes := @#nStereotypes + 1; +enddef; + +vardef classStereotypes@#(text stereotypes)= + for stereotype = stereotypes: + classStereotype@#(stereotype); + endfor; +enddef; + +vardef EClass@#(text _info)(expr name)(text attributes)(text methods)= + log "EClass begin: " & str @#; + defClass@#(name); + + log "Copying class info"; + ClassInfoCopy.@#info(_info); + + for a=attributes: + log "Adding attribute ", a; + addAttribute@#(a); + endfor; + for m=methods: + log "Adding method ", m; + addMethod@#(m); + endfor; +enddef; + +vardef Class@#(expr name)(text attributes)(text methods)= + EClass@#(iClass)(name)(attributes)(methods); +enddef; + +vardef Interface@#(expr name)(text methods)= + EClass@#(iInterface)(name)()(methods); +enddef; + +vardef EInterface@#(text _info)(expr name)(text methods)= + EClass@#(_info)(name)()(methods); +enddef; + +vardef AbstractClass@#(expr name)(text attributes)(text methods)= + EClass@#(iAbstractClass)(name)(attributes)(methods); +enddef; + +vardef EAbstractClass@#(text _info)(expr name)(text methods)= + EClass@#(_info)(name)()(methods); +enddef; + +vardef Class_border@#= + objectBox(@#) +enddef; + +vardef Class_layout@# = + if @#layedout = 1: + log "Class " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Class layout: " & (str @#); + + @#maxFeatureWidth := 0; + + EPictureStack.@#stereotypeStack(@#info.iStereotypeStack) + (scantokens listArray(@#stereotypes)(@#nStereotypes))("vcenterbase"); + + EPicture.@#namePict(@#info.iName)(@#name); + EPictureStack.@#attributeStack(@#info.iAttributeStack) + (scantokens listArray(@#attributes)(@#nAttrs))("vleftbase"); + EPictureStack.@#methodStack(@#info.iMethodStack) + (scantokens listArray(@#methods)(@#nMethods))("vleftbase"); + + layoutObjects(@#stereotypeStack, @#namePict, @#attributeStack, @#methodStack); + + log "Computing maxFeatureWidth"; + log @#stereotypeStack.width; + log @#namePict.width; + log @#attributeStack.width; + log @#methodStack.width; + log "..."; + @#maxFeatureWidth := lmax(@#stereotypeStack.width, @#namePict.width, + @#attributeStack.width, @#methodStack.width); + log "Done computing maxFeatureWidth"; + + log "max feature width: " & decimal @#maxFeatureWidth; + + @#namePict.midx = @#midx; + @#stereotypeStack.midx = @#namePict.midx; + + @#stereotypeStack.top = @#top; + @#namePict.top = @#stereotypeStack.bottom; + @#attributeStack.top = @#namePict.bottom; + @#methodStack.top = @#attributeStack.bottom; + + @#attributeStack.left = @#methodStack.left = + @#left + @#info.accessWidth + @#info.featureAccessSpacing; + + @#width = @#maxFeatureWidth + @#info.accessWidth + @#info.featureAccessSpacing; + @#bottom = @#methodStack.bottom; + + log "Class layout done..."; + fi; +enddef; + +vardef Class_paintAccess@#(expr _access, _se) = + save lock; + ELock.lock(@#info.iLock)(_access); + lock.se = _se; + drawObject(lock); +enddef; + +vardef Class_drawFeatures@#= + log "Drawing stereotypes"; + drawObject(@#stereotypeStack); + + log "Drawing name"; + drawObject(@#namePict); + log "Drawing attribute stack"; + drawObject(@#attributeStack); + + log "Drawing method stack"; + drawObject(@#methodStack); + + log "********************************** Drawing access locks"; + for i = 0 upto @#nAttrs-1: + log @#attributesAccess[i]; + Class_paintAccess@#(@#attributesAccess[i], + @#attributeStack.pict[i].sw + (-@#info.featureAccessSpacing, @#info.iAttributeStack.iPict.bottom)); + endfor; + + for i = 0 upto @#nMethods-1: + log @#methodsAccess[i]; + Class_paintAccess@#(@#methodsAccess[i], + @#methodStack.pict[i].sw + (-@#info.featureAccessSpacing, @#info.iMethodStack.iPict.bottom)); + endfor; +enddef; + +vardef Class_paintSkin@# = + log "Painting class skin..."; + nameAttributeY := @#attributeStack.top; + attributeMethodY := @#methodStack.top; + + %fill Class_border.@# shifted (@#info.shade,-@#info.shade) + % withcolor .7white withpen currentpen scaled 1; + drawObjectShade(@#); + + fill Class_border.@# withcolor @#info.foreColor; + draw Class_border.@# withcolor @#info.borderColor; + + draw (xpart @#nw, nameAttributeY)--(xpart @#se, nameAttributeY) withcolor @#info.borderColor; + draw (xpart @#nw, attributeMethodY)--(xpart @#se, attributeMethodY) withcolor @#info.borderColor; +enddef; + +vardef Class_draw@#= + log "draw class begin..."; + Class_layout.@#; + objectEnsurePositioning.@#; + Class_paintSkin.@#; + Class_drawFeatures.@#; +enddef; + +vardef Class_setDebugMode@#= + @#.info.iName.boxed := 1; + @#.info.iStereotypeStack.boxed := 1; + @#.info.iStereotypeStack.iPict.boxed := 1; + @#.info.iAttributeStack.boxed := 1; + @#.info.iAttributeStack.iPict.boxed := 1; + @#.info.iMethodStack.boxed := 1; + @#.info.iMethodStack.iPict.boxed := 1; +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp b/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp new file mode 100644 index 00000000000..457e3015d3a --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_class_assoc.mp @@ -0,0 +1,95 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_class_assoc_mp: + expandafter endinput +fi; +_metauml_class_assoc_mp:=1; + +input util_log; +input metauml_defaults; + +FontInfo.assocFont(metauml_defaultFont, .7); +PictureInfo.iAssoc(2, 2, 2, 2)(assocFont); +iAssoc.ignoreNegativeBase := 1; + +vardef QualifiedAssociationInfo@#= + color @#background; + color @#borderColor; + numeric @#borderScale; + + @#background := .9white; + @#borderColor := black; + @#borderScale := .5; + + FontInfo.@#iFont(metauml_defaultFont, .9); + PictureInfo.@#iPict(2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iStack(2, 2, 1, 1)(7)(@#iPict); + + @#iStack.iPict.ignoreNegativeBase := 1; +enddef; + +vardef QualifiedAssociationInfoCopy@#(text src)= + color @#background; + color @#borderColor; + numeric @#borderScale; + + @#background := src.background; + @#borderColor := src.borderColor; + @#borderScale := src.borderScale; + + FontInfoCopy.@#iFont(src.iFont); + PictureInfoCopy.@#iPict(src.iPict); + PictureStackInfoCopy.@#iStack(src.iStack); +enddef; + +QualifiedAssociationInfo.iQualifiedAssociation; + +% +% QualifiedAssociation +% +vardef EQualifiedAssociation@#(text _info)(text qualifiedAssociations) = + ObjectEquations(@#); + @#className := "QualifiedAssociation"; + + QualifiedAssociationInfoCopy.@#info(_info); + + EPictureStack.@#elementsStack(@#info.iStack)(qualifiedAssociations)("vleftbase"); + + @#nw = @#elementsStack.nw; + @#se = @#elementsStack.se; +enddef; + +vardef QualifiedAssociation@#(text qualifiedAssociations)= + EQualifiedAssociation@#(iQualifiedAssociation)(qualifiedAssociations); +enddef; + +vardef QualifiedAssociation_paintSkin@# = + log "Painting qualifiedAssociation skin..."; + + fill objectBox(@#) withcolor @#info.background; + + draw objectBox(@#) + withpen pencircle scaled @#info.borderScale withcolor @#info.borderColor; +enddef; + +vardef QualifiedAssociation_draw@# = + PictureStack_layout.@#elementsStack; + + QualifiedAssociation_paintSkin.@#; + drawObject(@#elementsStack); +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp b/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp new file mode 100644 index 00000000000..72bae5b93e3 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_class_clipart.mp @@ -0,0 +1,151 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_class_clipart_mp: + expandafter endinput +fi; +_metauml_class_clipart_mp:=1; + +input util_log; + +%% +%% This file contains various drawing which can be used in +%% UML class diagrams +%% + +vardef LockInfo@#(expr _width, _height, _y, _d, _span, _faceColor, _topColor, _rightColor, _lockColor)= + numeric @#y, @#d, @#span, @#width, @#height; + color @#faceColor, @#topColor, @#rightColor, @#lockColor; + + @#width := _width; + @#height := _height; + + @#heightRatio := _y; + @#depthRatio := _d; + @#span := _span; + + @#faceColor := _faceColor; + @#topColor := _topColor; + @#rightColor := _rightColor; + @#lockColor := _lockColor; +enddef; + +vardef LockInfoCopy@#(text src)= + LockInfo@#(src.width, src.height, src.heightRatio, src.depthRatio, src.span, + src.faceColor, src.topColor, src.rightColor, src.lockColor); +enddef; + +LockInfo.iLock(8, 8, .55, .15, .55, .4white, .6white, .7white, .3white); + +def lockLockPen=pencircle scaled .8pt enddef; +def lockLockTension=tension(1) enddef; + +vardef ELock@#(text lockInfo)(expr how)= + ObjectEquations(@#); + @#className := "Lock"; + + generic_declare(path) _n.pFace, _n.pRight, _n.pTop; + generic_declare(path) _n.pLock; + generic_declare(string) _n.mode; + + LockInfoCopy.@#info(lockInfo); + + @#height = @#info.height; + @#width = @#info.width; + + @#mode := how; + + log "ELock completed"; +enddef; + +vardef Lock@#(expr how)= + ELock@#(iLock)(how); +enddef; + +vardef Lock_draw@#= + log "Drawing lock"; + log @#nw; + log @#se; + generic_declare(numeric) _n.depth,_n.ya, _n.xa; + + @#depth = @#info.width * @#info.depthRatio; + @#ya = ypart @#nw - @#height * @#info.heightRatio; + @#xa = xpart @#se - @#depth; + + @#pFace = (xpart @#nw, @#ya) -- (@#xa, @#ya) -- (@#xa, ypart @#se) -- (xpart @#nw, ypart @#se) -- cycle; + @#pRight = (@#xa, ypart @#se) -- (xpart @#se, ypart @#se + @#depth) -- + (xpart @#se, @#ya + @#depth) -- (@#xa, @#ya) -- cycle; + @#pTop = (@#xa, @#ya) -- (xpart @#se, @#ya + @#depth) -- + (xpart @#nw + @#depth, @#ya + @#depth) -- (xpart @#nw, @#ya) -- cycle; + + save myMode; string myMode; + myMode = "base"; + if ((@#mode="private") or (@#mode="-")): + myMode := "closed"; + elseif ((@#mode="protected") or (@#mode="#")): + myMode := "opened"; + fi; + + if myMode="closed": + log "Closed!"; + generic_declare(pair) _n.A, _n.B, _n.C, _n.M; + generic_declare(numeric) _n.span; + @#span = @#info.span * @#width; + + @#M = ((xpart @#se + xpart @#nw) / 2, @#ya + @#depth/2); + log @#M; + @#A = (xpart @#M - (@#span / 2), ypart @#M); + log @#A; + @#B = (xpart @#M + (@#span / 2), ypart @#M); + log @#B; + @#C = (xpart @#M, ypart @#nw); + log @#C; + linecap:=butt; + + @#pLock = @#A {curl 0}..lockLockTension .. @#C .. lockLockTension .. {curl 0} @#B; + %withcolor @#info.lockColor withpen lockLockPen; + elseif myMode="opened": + log "Opened!"; + + generic_declare(pair) _n.A, _n.B, _n.C, _n.M; + generic_declare(numeric) _n.span; + @#span = @#info.span * @#width; + + @#M = ((xpart @#se + xpart @#nw) / 2, @#ya + @#depth/2); + @#A = (xpart @#M - (@#span / 2), ypart @#M) + (0, @#height/3); + @#B = (xpart @#M + (@#span / 2), ypart @#M); + @#C = (xpart @#M, ypart @#nw); + log @#M, @#A, @#B, @#C; + + linecap:=butt; + + @#pLock = @#A {curl 0}..lockLockTension .. @#C .. lockLockTension .. {curl 0} @#B; + %withcolor @#info.lockColor withpen lockLockPen; + fi; + + fill @#pFace withcolor @#info.faceColor; + fill @#pRight withcolor @#info.rightColor; + fill @#pTop withcolor @#info.topColor; + + if not ((myMode = "opened") or (myMode="closed")): + log "No lock to draw..."; + else: + draw @#pLock withcolor @#info.lockColor withpen lockLockPen; + fi; +enddef; + + diff --git a/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp b/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp new file mode 100644 index 00000000000..bcc4997b049 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_class_relations.mp @@ -0,0 +1,171 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_class_relations_mp: + expandafter endinput +fi; +_metauml_class_relations_mp:=1; + +defaultRelationHeadWidth := 25; +defaultRelationHeadHeight := 10; + +vardef AssociationInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = 0; + @#heightB = 0; + @#drawMethodB = "drawNothing"; + + @#drawMethod = "drawLine"; +enddef; + +vardef AssociationUniInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawArrow"; + + @#drawMethod = "drawLine"; +enddef; + +vardef InheritanceInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawTriangle"; + + @#drawMethod = "drawLine"; +enddef; + +vardef AggregationInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawDiamond"; + + @#drawMethod = "drawLine"; +enddef; + +vardef AggregationUniInfo@# = + LinkInfo@#; + + @#widthA = defaultRelationHeadWidth; + @#heightA = defaultRelationHeadHeight; + @#drawMethodA = "drawArrow"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawDiamond"; + + @#drawMethod = "drawLine"; +enddef; + +vardef CompositionInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawDiamondBlack"; + + @#drawMethod = "drawLine"; +enddef; + +vardef CompositionUniInfo@# = + LinkInfo@#; + + @#widthA = defaultRelationHeadWidth; + @#heightA = defaultRelationHeadHeight; + @#drawMethodA = "drawArrow"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawDiamondBlack"; + + @#drawMethod = "drawLine"; +enddef; + +vardef DashedLinkInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = 0; + @#heightB = 0; + @#drawMethodB = "drawNothing"; + + @#drawMethod = "drawLineDashed"; +enddef; + +vardef DependencyInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawArrow"; + + @#drawMethod = "drawLineDashed"; +enddef; + +AssociationInfo.association; +AssociationUniInfo.associationUni; +InheritanceInfo.inheritance; +AggregationInfo.aggregation; +AggregationUniInfo.aggregationUni; +CompositionInfo.composition; +CompositionUniInfo.compositionUni; +DashedLinkInfo.dashedLink; +DependencyInfo.dependency; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Deprecated, kept to support code using the older API. +% Using the generic formulation involving link, e.g. +% link(association)(A.n--B.s) is preferable. +% link and clink are defined in metauml_links +% +vardef drawRelation(text iLink)(expr myPath)= + link(iLink)(myPath); +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_defaults.mp b/Master/texmf-dist/metapost/metauml/metauml_defaults.mp new file mode 100644 index 00000000000..db1183a52bf --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_defaults.mp @@ -0,0 +1,45 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_defaults_mp: + expandafter endinput +fi; +_metauml_defaults_mp:=1; + +% txbtt + +if not known metauml_defaultFont: + string metauml_defaultFont; + metauml_defaultFont := "ptmr8r"; +fi; + +if not known metauml_defaultFontOblique: + string metauml_defaultFontOblique; + metauml_defaultFontOblique := "ptmro8r"; +fi; + +if not known metauml_defaultFontBold: + string metauml_defaultFontBold; + metauml_defaultFontBold := "ptmb8r"; +fi; + +if not known metauml_defaultFontBoldOblique: + string metauml_defaultFontBoldOblique; + metauml_defaultFontBoldOblique := "ptmbo8r"; +fi; + + diff --git a/Master/texmf-dist/metapost/metauml/metauml_instance.mp b/Master/texmf-dist/metapost/metauml/metauml_instance.mp new file mode 100644 index 00000000000..3732d600d4f --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_instance.mp @@ -0,0 +1,188 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 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 +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_instance_mp: + expandafter endinput +fi; +_metauml_instance_mp:=1; + +input metauml_defaults; +input util_log; + +input util_picture; +input util_picture_stack; +input util_shade; + +vardef InstanceInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + + FontInfo.@#nameFont(metauml_defaultFont, defaultscale); + + FontInfo.@#attributeFont(metauml_defaultFont, defaultscale); + + ShadeInfo.@#iShade; + + @#foreColor := .9white; + @#borderColor := black; + + PictureInfo.@#iName (2, 2, 1, 3)(@#nameFont); + + PictureInfo.@#iAttribute (2, 2, 1.25, 0)(@#attributeFont); + + PictureStackInfo.@#iAttributeStack (2, 2, 2.5, 2)(10.5)(@#iAttribute); % 8.5 + @#iAttributeStack.iPict.bottom := 2; + + @#iName.ignoreNegativeBase := 1; + @#iAttributeStack.iPict.ignoreNegativeBase := 1; +enddef; + +vardef InstanceInfoCopy@#(text src)= + log "InstanceInfoCopy: Copying Instance"; + + attributes(@#); + var(color) foreColor, borderColor; + + FontInfoCopy.@#nameFont(src.nameFont); + + FontInfoCopy.@#attributeFont(src.attributeFont); + + ShadeInfoCopy.@#iShade(src.iShade); + + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; + + PictureInfoCopy.@#iName (src.iName); + + PictureInfoCopy.@#iAttribute (src.iAttribute); + PictureStackInfoCopy.@#iAttributeStack (src.iAttributeStack); + +enddef; + +InstanceInfo.iInstance; + +% +% Instance +% +vardef defInstance@#(expr pname) = + ObjectEquations(@#); + @#className := "Instance"; + + string @#name; + @#name = pname; + + string @#attributes[]; + numeric @#nAttrs; + @#nAttrs := 0; +enddef; + +vardef Instance_addAttribute@#(expr pcontent) = + + @#.attributes[@#.nAttrs] := pcontent; + @#.nAttrs := @#.nAttrs + 1; + +enddef; + +vardef EInstance@#(text _info)(expr name)(text attributes)= + log "EInstance begin"; + defInstance@#(name); + + log "Copying Instance info"; + InstanceInfoCopy.@#info(_info); + + for a = attributes: + log "Adding attribute ", a; + Instance_addAttribute@#(a); + endfor; +enddef; + +vardef Instance@#(expr name)(text attributes)= + EInstance@#(iInstance)(name)(attributes); +enddef; + +vardef Instance_border@#= + objectBox(@#) +enddef; + +vardef Instance_layout@# = + if @#layedout = 1: + log "Instance " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Instance layout: " & (str @#); + + @#maxFeatureWidth := 0; + + EPicture.@#namePict(@#info.iName)(@#name); + EPictureStack.@#attributeStack(@#info.iAttributeStack) + (scantokens listArray(@#attributes)(@#nAttrs))("vleftbase"); + + layoutObjects(@#namePict, @#attributeStack); + + @#maxFeatureWidth := lmax(@#namePict.width, @#attributeStack.width) + 1; + + @#namePict.midx = @#midx; + + @#namePict.top = @#top - 1; + @#attributeStack.top = @#namePict.bottom - 1; + + @#attributeStack.left = @#left; + + @#width = @#maxFeatureWidth; + @#bottom = @#attributeStack.bottom; + + log "Layout done..."; + fi; +enddef; + +vardef Instance_drawFeatures@#= + log "Drawing name"; + drawObject(@#namePict); + log "Underlining name"; + pair A, B; + A := @#namePict.se + (-@#namePict.info.left, @#namePict.info.bottom-1); + B := @#namePict.sw + (@#namePict.info.right, @#namePict.info.bottom-1); + draw A--B; + log "Drawing attribute stack"; + drawObject(@#attributeStack); + +enddef; + +vardef Instance_paintSkin@# = + log "Painting Instance skin..."; + + drawObjectShade(@#); + + fill Instance_border.@# withcolor @#info.foreColor; + draw Instance_border.@# withcolor @#info.borderColor; + + draw (xpart @#nw, @#attributeStack.top)--(xpart @#se, @#attributeStack.top) withcolor @#info.borderColor; +enddef; + +vardef Instance_draw@#= + log "draw Instance begin..."; + Instance_layout.@#; + objectEnsurePositioning.@#; + Instance_paintSkin.@#; + Instance_drawFeatures.@#; +enddef; + +vardef Instance_setDebugMode@#= + @#.info.iName.boxed := 1; + @#.info.iAttributeStack.boxed := 1; + @#.info.iAttributeStack.iPict.boxed := 1; +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_links.mp b/Master/texmf-dist/metapost/metauml/metauml_links.mp new file mode 100644 index 00000000000..3b54368012b --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_links.mp @@ -0,0 +1,100 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +% A LinkStructure is used to compute the relevant elements +% of a link, such as what is the main path of the link and +% where the link ends are to be drawn. +% +% For example, for a unidirectional aggregation between points +% A and B one must reserve some space for one diamond to the left and one arrow +% to the right, and draw the continous line on a segment shorter than AB. +% + +if known _metauml_links_mp: + expandafter endinput +fi; +_metauml_links_mp:=1; + +vardef LinkStructure@#(expr my_path, widthA, widthB) = + pair @#pointA, @#pointB, @#pointAc, @#pointBc; + path @#circleA, @#circleB; + numeric @#timeA, @#timeB; + path @#actualPath; + + @#pointA = point 0 of my_path; + @#pointB = point infinity of my_path; + + @#circleA = fullcircle scaled widthA shifted @#pointA; + @#circleB = fullcircle scaled widthB shifted @#pointB; + + @#timeA = xpart (my_path intersectiontimes @#circleA); + @#timeB = xpart (my_path intersectiontimes @#circleB); + @#pointAc = point @#timeA of my_path; + @#pointBc = point @#timeB of my_path; + + @#actualPath = subpath (@#timeA, @#timeB) of my_path; +enddef; + +% Used for visual debugging purposes +% +vardef describeLinkStructure(text linkStruct)= + %draw linkStruct.pointA -- linkStruct.pointB withpen pencircle scaled 2 withcolor green; + + draw linkStruct.circleA; + draw linkStruct.circleB; + + dotlabel.lft("A", linkStruct.pointA); + dotlabel.rt ("B", linkStruct.pointB); + + dotlabel.urt("A1", linkStruct.pointAc); + dotlabel.ulft("B1", linkStruct.pointBc); + + draw linkStruct.actualPath withcolor red; +enddef; + +% Draws the path using graphical elements specified by iLink +% using the landmark points computed in the LinkStructure +% linkStruct. +% +vardef drawLinkStructure(text linkStruct)(text iLink) = + scantokens(iLink.drawMethod)(linkStruct.actualPath); + + scantokens(iLink.drawMethodA)(linkStruct.pointAc)(linkStruct.pointA)(iLink.heightA); + scantokens(iLink.drawMethodB)(linkStruct.pointBc)(linkStruct.pointB)(iLink.heightB); +enddef; + +vardef LinkInfo@# = + numeric @#widthA, @#heightA; + string @#drawMethodA; + + numeric @#widthB, @#heightB; + string @#drawMethodB; + + string @#drawMethod; +enddef; + +% Draws a link using the given path as support. +% +vardef link(text iLink)(expr myPath)= + LinkStructure.ls(myPath, iLink.widthA, iLink.widthB); + drawLinkStructure(ls)(iLink); +enddef; + +% Draws a direct link between the center of the objects. +vardef clink(text iLink)(suffix objectA, objectB)= + link(iLink)(pathCut(objectA, objectB)(objectA.c--objectB.c)); +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_note.mp b/Master/texmf-dist/metapost/metauml/metauml_note.mp new file mode 100644 index 00000000000..92d0aac93b9 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_note.mp @@ -0,0 +1,137 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_note_mp: + expandafter endinput +fi; +_metauml_note_mp:=1; + +% def metauml_note_debug text txt=log txt enddef; +def metauml_note_debug text txt= enddef; + +input metauml_defaults; +input util_log; + +input util_object; +input util_picture_stack; +input util_shade; +input util_margins; + +vardef NoteInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + var(numeric) horizontalFolding, verticalFolding; + + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iText (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iStack (0, 0, 0, 0)(9)(@#iText); + + @#iStack.iPict.ignoreNegativeBase := 1; + + ShadeInfo.@#iShade; + Margins.@#(2,2,2,2); + + @#foreColor := .9white; + @#borderColor := black; + @#horizontalFolding := 10; + @#verticalFolding := 10; +enddef; + +vardef NoteInfoCopy@#(text src)= + attributes(@#); + var(color) foreColor, borderColor; + + log "NoteInfoCopy: Copying usecase info"; + + PictureStackInfoCopy.@#iStack (src.iStack); + MarginsCopy.@#(src); + ShadeInfoCopy.@#iShade(src.iShade); + + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; + @#horizontalFolding := src.horizontalFolding; + @#verticalFolding := src.verticalFolding; +enddef; + +NoteInfo.iNote; + +vardef Note@#(text contents)= + ENote.@#(iNote)(contents); +enddef; + +vardef ENote@#(text _info)(text contents)= + ObjectEquations(@#); + @#className := "Note"; + + NoteInfoCopy.@#info(_info); + + numeric @#nLines; @#nLines := 0; + string @#lines[]; + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; + + EPictureStack.@#stack(@#info.iStack)(scantokens listArray(@#lines)(@#nLines))("vleftbase"); +enddef; + +vardef Note_layout@#= + if @#layedout = 1: + log "Note " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Note layout: " & (str @#); + + PictureStack_layout.@#stack; + + @#width = @#stack.width + @#info.left + @#info.right + @#info.horizontalFolding; + @#height = @#stack.height + @#info.top + @#info.bottom; + + @#top = @#stack.top + @#info.top; + @#left = @#stack.left - @#info.left; + fi; +enddef; + +vardef Note_draw@#= + Note_layout@#; + objectEnsurePositioning.@#; + + attributes(@#); + var(path) border, corner; + + @#border := @#nw -- (@#ne - (@#info.horizontalFolding, 0)) -- + (@#ne - (0, @#info.verticalFolding) ) -- @#se -- @#sw -- cycle; + + @#corner := (@#ne - (@#info.horizontalFolding, 0)) -- + (@#ne - (@#info.horizontalFolding, @#info.verticalFolding)) -- + (@#ne - (0, @#info.verticalFolding)); + + drawObjectShade(@#); + + fill Note_border.@# withcolor @#info.foreColor; + draw Note_border.@# withcolor @#info.borderColor; + + draw @#corner withcolor @#info.borderColor; + drawObject(@#stack); +enddef; + +vardef Note_border@#= + @#border +enddef; + diff --git a/Master/texmf-dist/metapost/metauml/metauml_package.mp b/Master/texmf-dist/metapost/metauml/metauml_package.mp new file mode 100644 index 00000000000..a2be4e920c0 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_package.mp @@ -0,0 +1,178 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2006 Radu-George Radulescu, Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_package_mp: + expandafter endinput +fi; +_metauml_package_mp:=1; + +input metauml_defaults; +input util_log; + +vardef PackageInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + var(numeric) forceEmptyContent; + var(numeric) minimumNameContentsDifference; + + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iText (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iNameStack (2, 2, 2, 2)(9)(@#iText); + @#iNameStack.iPict.ignoreNegativeBase := 1; + + Margins.@#(2,2,2,2); + + ShadeInfo.@#iShade; + @#foreColor := .9white; + @#borderColor := black; + + @#forceEmptyContent := 0; + + @#minimumNameContentsDifference := 20; + + GroupInfo.@#iContentsGroup(2, 2, 10, 2); +enddef; + +vardef PackageInfoCopy@#(text src)= + log "PackageInfoCopy: Copying package info"; + + attributes(@#); + var(color) foreColor, borderColor; + var(numeric) forceEmptyContent; + var(numeric) minimumNameContentsDifference; + + PictureStackInfoCopy.@#iNameStack (src.iNameStack); + MarginsCopy.@#(src); + + ShadeInfoCopy.@#iShade(src.iShade); + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; + + @#forceEmptyContent := src.forceEmptyContent; + + @#minimumNameContentsDifference := src.minimumNameContentsDifference; + + GroupInfoCopy.@#iContentsGroup(src.iContentsGroup); +enddef; + +PackageInfo.iPackage; + +vardef Package@#(text contents)(text _subItems)= + EPackage.@#(iPackage)(contents)(_subItems); +enddef; + +vardef EPackage@#(text _info)(text contents)(text _subItems)= + ObjectEquations(@#); + @#className := "Package"; + + PackageInfoCopy.@#info(_info); + + numeric @#nLines; @#nLines := 0; + string @#lines[]; +% numeric @#nSubItems; @#nSubItems := 0; + numeric @#nameInCenter; @#nameInCenter := 0; + + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; + +% for s=_subItems: +% @#nSubItems := @#nSubItems + 1; +% endfor; + + EGroup.@#subItems(@#info.iContentsGroup)(_subItems); + + EPictureStack.@#nameStack(@#info.iNameStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); +enddef; + +vardef Package_layout@#= + if @#layedout = 1: + log "Package '" & (str @#) & "' has already been layed out"; + else: + @#layedout := 1; + log "Package layout: '" & (str @#) & "'"; + + log "Package name layout '" & (str @#) & "'..."; + PictureStack_layout.@#nameStack; + log "SubItems for package layout '" & (str @#) & "'..."; + Group_layout.@#subItems; + + log "All elements in package '" & (str @#) & "' successfully layed out, integrating..."; + + if @#subItems.nObjects = 0: + if @#info.forceEmptyContent = 0: + @#nameInCenter := 1; + fi; + fi; + + if @#subItems.width < @#nameStack.width + @#info.minimumNameContentsDifference: + @#contentWidth = @#nameStack.width + @#info.minimumNameContentsDifference; + else: + @#contentWidth = lmax(@#nameStack.width, @#subItems.width); + fi; + + if @#nameInCenter = 1: + @#height = @#info.top + @#info.bottom + @#nameStack.height; + @#width = @#info.left + @#info.right + @#nameStack.width; + @#nameStack.sw = @#sw + (@#info.left, @#info.bottom); + else: + @#nameStack.sw = @#nw; + @#width = @#contentWidth + @#info.left + @#info.right; + @#height = @#info.top + @#info.bottom + @#subItems.height; + fi; + + @#subItems.n = @#n + (0, -((@#height - @#subItems.height)/2)); + + log "Package layout for " & (str @#) & " ended."; + fi; +enddef; + +vardef Package_draw@#= + Package_layout.@#; + objectEnsurePositioning.@#; + + attributes(@#); + var(path) border, nameStackBorder, emptyNameBorder; + + @#border := @#ne -- @#nw -- @#sw -- @#se -- cycle; + @#nameStackBorder := @#nameStack.ne -- @#nameStack.nw -- @#nameStack.sw -- @#nameStack.se -- cycle; + @#emptyNameBorder := @#nw -- @#nw + (0, 10) -- @#n + (0, 10) -- @#n -- cycle; + + drawObjectShade(@#); + + fill @#border withcolor @#info.foreColor; + draw @#border withcolor @#info.borderColor; + if @#nameInCenter = 0: + fill @#nameStackBorder withcolor @#info.foreColor; + draw @#nameStackBorder withcolor @#info.borderColor; + else: + fill @#emptyNameBorder withcolor @#info.foreColor; + draw @#emptyNameBorder withcolor @#info.borderColor; + fi; + + + drawObject(@#nameStack); + drawObject(@#subItems); + +enddef; + +vardef Package_border@#= + @#border +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp b/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp new file mode 100644 index 00000000000..5b740c0557f --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_package_relations.mp @@ -0,0 +1,51 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2006 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 +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_package_relations_mp: + expandafter endinput +fi; +_metauml_package_relations_mp:=1; + +defaultRelationHeadWidth := 25; +defaultRelationHeadHeight := 10; + +vardef NestInfo@# = + LinkInfo@#; + + @#widthA = 0; + @#heightA = 0; + @#drawMethodA = "drawNothing"; + + @#widthB = defaultRelationHeadWidth; + @#heightB = defaultRelationHeadHeight; + @#drawMethodB = "drawCrossedCircle"; + + @#drawMethod = "drawLine"; +enddef; + +NestInfo.nest; + +vardef drawRelation(text iLink)(expr myPath)= + link(iLink)(myPath); +enddef; + +vardef drawLine(expr my_path) = + draw my_path; +enddef; + +vardef drawNothing(text pA)(text pB)(text base) = +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_paths.mp b/Master/texmf-dist/metapost/metauml/metauml_paths.mp new file mode 100644 index 00000000000..cb307f8df00 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_paths.mp @@ -0,0 +1,86 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_paths_mp: + expandafter endinput +fi; +_metauml_paths_mp:=1; + +def pathDirect(expr pA,pB) = + pA--pB +enddef; + +vardef pathManhattanX(expr pA,pB) = + pA--(xpart(pB), ypart(pA))--pB +enddef; + +vardef rpathManhattanX(expr pA,pB) = + pB--(xpart(pB), ypart(pA))--pA +enddef; + +vardef pathManhattanY(expr pA,pB) = + pA--(xpart(pA), ypart(pB))--pB +enddef; + +vardef rpathManhattanY(expr pA,pB) = + pB--(xpart(pA), ypart(pB))--pA +enddef; + +vardef pathStepX(expr pA,pB, deltax) = + pA--(pA+(deltax, 0))--(((xpart pA)+deltax), ypart(pB))--pB +enddef; + +vardef rpathStepX(expr pA,pB, deltax) = + pB--(((xpart pA)+deltax), ypart(pB))--(pA+(deltax, 0))--pA +enddef; + +vardef pathStepY(expr pA,pB, deltay) = + pA--(pA+(0, deltay))--(xpart(pB), ((ypart pA)+deltay))--pB +enddef; + +vardef rpathStepY(expr pA,pB, deltay) = + pB--(xpart(pB), ((ypart pA)+deltay))--(pA+(0, deltay))--pA +enddef; + +vardef pathHorizontal(expr pA, untilX) = + pA--(untilX,ypart(pA)) +enddef; + +vardef rpathHorizontal(expr pA, untilX) = + (untilX,ypart(pA))--pA +enddef; + +vardef pathVertical(expr pA, untilY) = + pA--(xpart(pA), untilY) +enddef; + +vardef rpathVertical(expr pA, untilY) = + (xpart(pA), untilY)--pA +enddef; + +% Cuts path thePath so that it won't intersect the objects +% objectA and objectB. The border of the objects is obtained +% by invoking the method "_border". +% +vardef pathCut(suffix objectA, objectB)(expr thePath)= + save timeA, timeB; + + timeA = xpart (thePath intersectiontimes objectBorder(objectA)); + timeB = xpart (thePath intersectiontimes objectBorder(objectB)); + + subpath (timeA, timeB) of thePath +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp b/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp new file mode 100644 index 00000000000..afafe88fab8 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_skin_simple.mp @@ -0,0 +1,42 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +%% Usage of skins +%% +%% Skins are configuration files that, in geneal, customize the settings of +%% MetaUML *Info objects. You most likely want to include the skin file after +%% all other MetaUML files have been included: +%% +%% input metauml +%% input metauml_skin_simple +%% +%% % normal usage of MetaUML follows here +%% +%% More advanced skin files might customize fonts for specific elements +%% (eg for Class and Note), and also colors (eg foreground, shade, line etc.) + +if known _metauml_skin_simple_mp: + expandafter endinput +fi; +_metauml_skin_simple_mp:=1; + +iClass.foreColor := blue; +iClass.iName.iFont.name := "cmr12"; +iClass.iAttributeStack.iPict.iFont.name := "cmr10"; +iClass.iMethodStack.iPict.iFont.name := "cmr10"; + + diff --git a/Master/texmf-dist/metapost/metauml/metauml_state.mp b/Master/texmf-dist/metapost/metauml/metauml_state.mp new file mode 100644 index 00000000000..7d4b348afad --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_state.mp @@ -0,0 +1,203 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_state_mp: + expandafter endinput +fi; +_metauml_state_mp:=1; + +input metauml_defaults; +input util_log; + +vardef StateInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + var(numeric) round; + + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iText (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iStack (2, 2, 2, 2)(9)(@#iText); + + @#iStack.iPict.ignoreNegativeBase := 1; + + Margins.@#(2,2,0,6); + + GroupInfo.@#iGroupSubstates(2, 2, 4, 2); + + @#round := 5; + @#drawNameLine := 0; + + ShadeInfo.@#iShade; + @#foreColor := .9white; + @#borderColor := black; +enddef; + +vardef StateInfoCopy@#(text src)= + log "StateInfoCopy: Copying state info"; + attributes(@#); + var(color) foreColor, borderColor; + var(numeric) round; + + PictureStackInfoCopy.@#iStack (src.iStack); + MarginsCopy.@#(src); + @#round := src.round; + @#drawNameLine := src.drawNameLine; + + GroupInfoCopy.@#iGroupSubstates(src.iGroupSubstates); + + ShadeInfoCopy.@#iShade(src.iShade); + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; +enddef; + +StateInfo.iState; + +vardef State@#(text contents)(text _substates)= + EState.@#(iState)(contents)(_substates); +enddef; + +vardef EState@#(text _info)(text contents)(text _substates)= + ObjectEquations(@#); + @#className := "State"; + + StateInfoCopy.@#info(_info); + + numeric @#nLines; @#nLines := 0; + string @#lines[]; + + numeric @#nInternalTransitions; @#nInternalTransitions := 0; + string @#internalTransitions[]; + + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; + + EGroup.@#substates(@#info.iGroupSubstates)(_substates); + %@#substates.info.boxed := 1; + + EPictureStack.@#stack(@#info.iStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); +enddef; + +vardef stateTransitions@#(text transitions)= + State_internalTransitions@#(transitions); +enddef; + +vardef State_internalTransitions@#(text transitions)= + for transition=transitions: + @#internalTransitions[@#nInternalTransitions] := transition; + @#nInternalTransitions := @#nInternalTransitions + 1; + endfor; +enddef; + +vardef State_layout@#= + if @#layedout = 1: + log "State '" & (str @#) & "' has already been layed out"; + else: + @#layedout := 1; + log "State layout: '" & (str @#) & "'"; + + EPictureStack.@#internalTransitionsStack(@#info.iStack) + (scantokens listArray(@#internalTransitions)(@#nInternalTransitions))("vleftbase"); + + log "State name layout '" & (str @#) & "'..."; + PictureStack_layout.@#stack; + log "Internal transitions layout '" & (str @#) & "'..."; + PictureStack_layout.@#internalTransitionsStack; + log "Substates layout '" & (str @#) & "'..."; + Group_layout.@#substates; + + log "All elements in state '" & (str @#) & "' successfully layed out, integrating..."; + +% @#internalTransitionsStack.info.boxed := 1; + + @#contentWidth = lmax(@#stack.width, @#internalTransitionsStack.width, @#substates.width); + + @#width = @#contentWidth + @#info.left + @#info.right + 2 * @#info.round; + @#height = @#stack.height + @#info.top + @#info.bottom + + @#internalTransitionsStack.height + @#substates.height; + + @#stack.n = @#n + (0, -@#info.top); + @#substates.n = @#stack.s; + + @#internalTransitionsStack.sw = @#sw + (@#info.round, @#info.round); + + attributes(@#); + var(pair) urt, lrt, ulft, llft; + var(pair) urta, lrta, ulfta, llfta; + var(pair) urtb, lrtb, ulftb, llftb; + + @#urta := @#ne - (@#info.round, 0); + @#urtb := @#ne - (0, @#info.round); + + @#lrta := @#se + (0, @#info.round); + @#lrtb := @#se - (@#info.round, 0); + + @#ulfta := @#nw - (0, @#info.round); + @#ulftb := @#nw + (@#info.round, 0); + + @#llfta := @#sw + (@#info.round, 0); + @#llftb := @#sw + (0, @#info.round); + + @#urt := @#ne - (@#info.round, @#info.round) + @#info.round * (sind(45),cosd(45)); + @#lrt := @#se + (-@#info.round, @#info.round) + @#info.round * (sind(135),cosd(135)); + @#llft := @#sw + (@#info.round, @#info.round) + @#info.round * (sind(225),cosd(225)); + @#ulft := @#nw + (@#info.round, -@#info.round) + @#info.round * (sind(315),cosd(315)); + + var(pair) nameLineLeft, nameLineRight; + ypart @#nameLineLeft = ypart @#nameLineRight = @#stack.bottom; + xpart @#nameLineLeft = xpart @#nw; + xpart @#nameLineRight = xpart @#ne; + + log "State layout for " & (str @#) & " ended."; + fi; +enddef; + +vardef State_draw@#= + State_layout.@#; + objectEnsurePositioning.@#; + + attributes(@#); + var(path) border; + + @#border := @#urta .. @#urt .. @#urtb -- % + @#lrta .. @#lrt .. @#lrtb -- % + @#llfta .. @#llft .. @#llftb -- % + @#ulfta .. @#ulft .. @#ulftb -- cycle; + + %fill @#border shifted (@#info.shade, -@#info.shade) withcolor .7white; + drawObjectShade(@#); + + fill @#border withcolor @#info.foreColor; + draw @#border withcolor @#info.borderColor; + + + drawObject(@#internalTransitionsStack); + drawObject(@#stack); + drawObject(@#substates); + + if @#info.drawNameLine = 1: + draw @#nameLineLeft -- @#nameLineRight; + fi; +enddef; + +vardef State_border@#= + @#border +enddef; + diff --git a/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp b/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp new file mode 100644 index 00000000000..afc4ef14a8a --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_stereotype.mp @@ -0,0 +1,27 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_stereotype_mp: + expandafter endinput +fi; +_metauml_stereotype_mp:=1; + +input metauml_defaults; + +FontInfo.assocFont(metauml_defaultFont, .7); +PictureInfo.iStereo(2, 2, 2, 2)(assocFont); +iStereo.ignoreNegativeBase := 1; diff --git a/Master/texmf-dist/metapost/metauml/metauml_templates.mp b/Master/texmf-dist/metapost/metauml/metauml_templates.mp new file mode 100644 index 00000000000..f4125097108 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_templates.mp @@ -0,0 +1,134 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_templates_mp: + expandafter endinput +fi; +_metauml_templates_mp:=1; + +input metauml_defaults; +input util_log; + +vardef TemplateInfo@#= + color @#background; + color @#borderColor; + numeric @#borderScale; + + @#background := .9white; + @#borderColor := black; + @#borderScale := 1; + + FontInfo.@#iFont(metauml_defaultFont, .9); + PictureInfo.@#iPict(2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iStack(2, 2, 1, 1)(7)(@#iPict); + + @#iStack.iPict.ignoreNegativeBase := 1; +enddef; + +vardef TemplateInfoCopy@#(text src)= + color @#background; + color @#borderColor; + numeric @#borderScale; + + @#background := src.background; + @#borderColor := src.borderColor; + @#borderScale := src.borderScale; + + FontInfoCopy.@#iFont(src.iFont); + PictureInfoCopy.@#iPict(src.iPict); + PictureStackInfoCopy.@#iStack(src.iStack); +enddef; + +TemplateInfo.iTemplate; + +% +% Template +% +vardef ETemplate@#(text _info)(text templates) = + ObjectEquations(@#); + @#className := "Template"; + + TemplateInfoCopy.@#info(_info); + + EPictureStack.@#elementsStack(@#info.iStack)(templates)("vleftbase"); + + @#nw = @#elementsStack.nw; + @#se = @#elementsStack.se; +enddef; + +vardef Template@#(text templates) = + ETemplate@#(iTemplate)(templates); +enddef; + +vardef EClassTemplate@#(text _info)(text templates)(text theClass)= + ETemplate.@#(_info)(templates); + Template_attachToClass.@#(theClass); +enddef; + +vardef ClassTemplate@#(text templates)(text theClass)= + EClassTemplate.@#(iTemplate)(templates)(theClass); +enddef; + +vardef Template_layout@#= + if @#layedout = 1: + log "Template " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Template layout: " & (str @#); + PictureStack_layout.@#elementsStack; + fi; +enddef; + +vardef Template_paintSkin@# = + log "Painting template skin..."; + + fill objectBox(@#) withcolor @#info.background; + + draw objectBox(@#) dashed evenly scaled .8 + withpen pencircle scaled @#info.borderScale withcolor @#info.borderColor; +enddef; + +vardef Template_draw@# = + Template_layout.@#; + + Template_paintSkin.@#; + drawObject(@#elementsStack); +enddef; + +vardef Template_attachToClass@#(text theClass)= + Template_layout.@#; + Class_layout.theClass; + + log "--- Attaching template " & (str @#) & " to class " & (str theClass); + + save __nItems, __nameToRight; + + __nItems := @#elementsStack.nItems; + __nameToRight := theClass.right - theClass.namePict.right; + + @#elementsStack.pict[__nItems-1].midy = theClass.top; + + if __nameToRight > @#width/2: + @#midx = theClass.right; + log "X"; + else: + @#midx = theClass.right + (@#width/2 - __nameToRight) + 2; + log "Y"; + fi; + + %@#elementsStack.pict[__nItems-1].info.boxed:=1; +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_usecase.mp b/Master/texmf-dist/metapost/metauml/metauml_usecase.mp new file mode 100644 index 00000000000..1fc98b5879e --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_usecase.mp @@ -0,0 +1,217 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_usecase_mp: + expandafter endinput +fi; +_metauml_usecase_mp:=1; + +input metauml_defaults; +input util_log; + +vardef ActorInfo@#= + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iName (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iNameStack (1pt, 1pt, 1pt, 1pt)(9)(@#iName); + + @#iNameStack.iPict.ignoreNegativeBase := 1; + + HumanInfo.@#iHuman(25, 35, .3, .35, .5, 1, 1); +enddef; + +vardef ActorInfoCopy@#(text src)= + log "ActorInfoCopy: Copying actor info"; + + PictureStackInfoCopy.@#iNameStack (src.iNameStack); + + HumanInfoCopy.@#iHuman(src.iHuman); +enddef; + +ActorInfo.iActor; + +vardef Actor@#(text contents)= + EActor.@#(iActor)(contents); +enddef; + +vardef EActor@#(text _info)(text contents)= + ObjectEquations(@#); + @#className := "Actor"; + + ActorInfoCopy.@#info(_info); + + numeric @#nLines; @#nLines := 0; + string @#lines[]; + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; + EHuman.@#human(@#info.iHuman); + EPictureStack.@#nameStack(@#info.iNameStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); +enddef; + +vardef Actor_setDebugMode@#= + @#.nameStack.info.boxed := 1; +enddef; + +vardef Actor_layout@#= + if @#layedout = 1: + log "Actor " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Actor layout: " & (str @#); + Human_layout.@#human; + PictureStack_layout.@#nameStack; + + @#width = max(@#nameStack.width)(@#human.width); + @#height = @#nameStack.height + @#human.height; + + @#n = @#human.n; + @#nameStack.n=@#human.s; + @#s = @#nameStack.s; + fi; +enddef; + +vardef Actor_draw@#= + Actor_layout.@#; + + objectEnsurePositioning.@#; + + drawObjects(@#nameStack, @#human); +enddef; + +vardef Actor_border@#= + objectBox(@#); +enddef; + +vardef UsecaseInfo@#= + attributes(@#); + var(color) foreColor, borderColor; + + FontInfo.@#iFont(metauml_defaultFont, defaultscale); + @#iFont.ignoreNegativeBase := 1; + + PictureInfo.@#iName (2, 2, 2, 2)(@#iFont); + PictureStackInfo.@#iNameStack (0, 0, 0, 0)(9)(@#iName); + + @#iNameStack.iPict.ignoreNegativeBase := 1; + + Margins.@#(2,2,2,2); + + @#hFatRatio := .1; + @#vFatRatio := .15; + + ShadeInfo.@#iShade; + @#foreColor := .9white; + @#borderColor := black; +enddef; + +vardef UsecaseInfoCopy@#(text src)= + log "UsecaseInfoCopy: Copying usecase info"; + attributes(@#); + var(color) foreColor, borderColor; + + PictureStackInfoCopy.@#iNameStack (src.iNameStack); + MarginsCopy.@#(src); + @#hFatRatio := src.hFatRatio; + @#vFatRatio := src.vFatRatio; + + ShadeInfoCopy.@#iShade(src.iShade); + @#foreColor := src.foreColor; + @#borderColor := src.borderColor; +enddef; + +UsecaseInfo.iUsecase; + +vardef Usecase@#(text contents)= + EUsecase.@#(iUsecase)(contents); +enddef; + +vardef EUsecase@#(text _info)(text contents)= + ObjectEquations(@#); + @#className := "Usecase"; + + UsecaseInfoCopy.@#info(_info); + + attributes(@#); + var(numeric) nLines; + @#nLines := 0; + + string @#lines[]; + for l=contents: + @#lines[@#nLines] := l; + @#nLines := @#nLines + 1; + endfor; +enddef; + +vardef Usecase_layout@#= + if @#layedout = 1: + log "Usecase " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + + EPictureStack.@#nameStack(@#info.iNameStack)(scantokens listArray(@#lines)(@#nLines))("vcenterbase"); + PictureStack_layout.@#nameStack; + + numeric @#vFat, @#hFat; + + @#hFat = 0; + @#vFat = 10; + + @#width = @#nameStack.width + @#info.left + @#info.right + 2 * @#hFat; + @#height = @#nameStack.height + @#info.top + @#info.bottom + 2 * @#vFat; + + log "UC w,h"; + log @#hFat; + log @#vFat; + log @#nameStack.width; + log @#nameStack.height; + log @#width; + log @#height; + + @#c = @#nameStack.c; + fi; +enddef; + +vardef Usecase_draw@#= + Usecase_layout@#; + + pair @#urt, @#lrt, @#ulft, @#llft; + + @#urt = @#nameStack.ne; + @#lrt = @#nameStack.se; + @#ulft = @#nameStack.nw; + @#llft = @#nameStack.sw; + + objectEnsurePositioning.@#; + + path @#border; + %@#border := @#w .. @#ulft .. @#n .. @#urt .. @#e .. @#lrt .. @#s .. @#llft .. cycle; + @#border := @#w .. @#n .. @#e .. @#s .. cycle; + + drawObjectShade(@#); + + fill Usecase_border.@# withcolor @#info.foreColor; + draw Usecase_border.@# withcolor @#info.borderColor; + + drawObject(@#nameStack); +enddef; + +vardef Usecase_border@#= + @#border +enddef; diff --git a/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp b/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp new file mode 100644 index 00000000000..4e573fae3be --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/metauml_usecase_clipart.mp @@ -0,0 +1,160 @@ +% MetaUML, a MetaPost library for typesetting exquisite UML diagrams. +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +%% +%% This file contains various drawings which can be used in +%% UML usecase diagrams +%% + +if known _metauml_usecase_clipart_mp: + expandafter endinput +fi; +_metauml_usecase_clipart_mp:=1; + +input util_log; + +vardef HumanInfo@#(expr _width, _height, _yHeadRatio, _yBodyRatio, _yHandsRatio, _xHandsRatio, _xLegsRatio)= + attributes(@#); + + var(numeric) width, height, yHeadRatio, yBodyRatio, + yHandsRatio, xHandsRatio, xLegsRatip; + var(color) foreColor, shadeColor; + var(numeric) shade; + + @#width := _width; + @#height := _height; + @#yHeadRatio := _yHeadRatio; + @#yBodyRatio := _yBodyRatio; + @#yHandsRatio := _yHandsRatio; + @#xHandsRatio := _xHandsRatio; + @#xLegsRatio := _xLegsRatio; + + @#foreColor := black; + @#shadeColor := .7white; + @#shade := .5; + + Margins.@#(2,2,1,0); +enddef; + +vardef HumanInfoCopy@#(text src)= + HumanInfo@#(src.width, src.height, src.yHeadRatio, src.yBodyRatio, src.yHandsRatio, src.xHandsRatio, src.xLegsRatio); + + _n_ := str @#; + var(color) foreColor, shadeColor; + var(numeric) shade; + + @#foreColor := src.foreColor; + @#shadeColor := src.shadeColor; + @#shade := src.shade; + + MarginsCopy.@#(src); +enddef; + +HumanInfo.iHuman(25, 25, .3, .35, .55, 1, 1); + +vardef EHuman@#(text _info)= + ObjectEquations(@#); + @#className := "Human"; + + var(path) pHead, pBody, pHands, pLegs; + + HumanInfoCopy.@#info(_info); +enddef; + +vardef Human@#= + EHuman@#(iHuman); +enddef; + +vardef Human_layout@#= + if @#layedout = 1: + log "Human " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + log "Human layout: " & (str @#); + + attributes(@#); + + @#height = @#info.height; + @#width = @#info.width; + + log "(W, H) MUST BE SET. Their values are: " & (decimal @#height) &" "& (decimal @#width); + + var(numeric) actualHeight, actualWidth; + @#actualHeight = @#height - @#info.top - @#info.bottom; + @#actualWidth = @#width - @#info.left - @#info.right; + + % HEAD + var(pair) headS, headE, headW; + + ypart @#headW = ypart @#headE; + .5[@#n - (0, @#info.top), @#headS] = .5[@#headE, @#headW]; + (ypart @#n - @#info.top) - (ypart @#headS) = + (xpart @#headE) - (xpart @#headW) = + @#actualHeight * @#info.yHeadRatio; + (xpart @#headS) = (xpart @#n); + + % BODY + var(pair) bodyS; + xpart @#bodyS = xpart @#headS; + ypart @#headS - ypart @#bodyS = @#actualHeight * @#info.yBodyRatio; + + % HANDS + var(pair) handsW, handsE; + ypart @#handsW = ypart @#handsE = ypart @#n - (@#actualHeight * @#info.yHandsRatio); + .5[xpart @#handsE, xpart @#handsW] = @#midx; + xpart @#handsE - xpart @#handsW = @#actualWidth * @#info.xHandsRatio; + + % LEGS + var(pair) footW, footE; + ypart @#footW = ypart @#footE = ypart @#s + @#info.bottom; + .5[xpart @#footW, xpart @#footE] = @#midx; + xpart @#footE - xpart @#footW = @#actualWidth * @#info.xLegsRatio; + + log "Human layout completed"; + fi; +enddef; + +vardef Human_draw@#= + log "Drawing human"; + + Human_layout.@#; + objectEnsurePositioning.@#; + + % all coordinates must be set to known values in order to compute the paths + @#pHead := (@#n - (0, @#info.top)) .. @#headE .. @#headS .. @#headW .. cycle; + @#pBody := @#headS -- @#bodyS; + @#pHands := @#handsW -- @#handsE; + @#pLegs := @#footW -- @#bodyS -- @#footE; + + attributes(@#); + var(pair) shadeShift; + @#shadeShift = (@#info.shade, -@#info.shade); + + draw @#pHead shifted @#shadeShift withcolor @#info.shadeColor; + draw @#pBody shifted @#shadeShift withcolor @#info.shadeColor; + draw @#pHands shifted @#shadeShift withcolor @#info.shadeColor; + draw @#pLegs shifted @#shadeShift withcolor @#info.shadeColor; + + draw @#pHead withcolor @#info.foreColor; + draw @#pBody withcolor @#info.foreColor; + draw @#pHands withcolor @#info.foreColor; + draw @#pLegs withcolor @#info.foreColor; +enddef; + +vardef Human_border@#= + objectBox(@#) +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_commons.mp b/Master/texmf-dist/metapost/metauml/util_commons.mp new file mode 100644 index 00000000000..b333ee57a5a --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_commons.mp @@ -0,0 +1,139 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_commons_mp: + expandafter endinput +fi; +_util_commons_mp:=1; + +input util_log; + +vardef lmax(text items)= + log "finding lmax of items " & str items; + save current, nItems; + numeric current, nItems; + nItems := 0; + current:= 0; + + for item = items: + log nItems; + log item; + + if nItems = 0: + current := item; + else: + current := max(current)(item); + fi; + nItems := nItems + 1; + endfor; + + current +enddef; + +vardef lmin(text items)= + save current, nItems; + numeric current, nItems; + nItems := 0; + current:= 0; + + for item = items: + if nItems = 0: + current := item; + else: + current := min(current)(item); + fi; + nItems := nItems + 1; + endfor; + + current +enddef; + +def max(text a)(text b)= + if (a > b): a% + else:b% + fi; +enddef; + +def min(text a)(text b)= + if (a < b): a% + else:b% + fi; +enddef; + +vardef ensurePict(text pictOrText)(expr font, scale) = + save p; picture p; + if picture pictOrText: p=pictOrText + else: p = pictOrText infont font scaled scale + fi; + p +enddef; + +def pictHeight(text obj) = + (ypart (urcorner obj) - ypart (llcorner obj)) +enddef; + +def pictWidth(text obj) = + (xpart (urcorner obj) - xpart (llcorner obj)) +enddef; + +vardef listArray(text array)(text nElements)= + save objEnum; + string objEnum; + objEnum := ""; + + for i = 0 upto nElements-1: + if i>0: + objEnum := objEnum & ", "; + fi; + objEnum := objEnum & (str array) & (decimal i); + endfor; + + objEnum +enddef; + +vardef enumToString(text enumeration)(expr prefix)= + save ret, firstVar; + string ret; + ret := ""; + + numeric firstVar; + firstVar := 1; + + forsuffixes v = enumeration: + if firstVar = 0: + ret := ret & ","; + else: + firstVar := 0; + fi; + + ret := ret & prefix & (str v); + endfor; + + ret +enddef; + +def _dx(text pA)(text pB) = + (xpart(pB)-xpart(pA)) +enddef; + +def _dy(text pA, pB) = + (ypart(pB)-ypart(pA)) +enddef; + +def _length(text pA)(text pB) = + sqrt (_dx(pA)(pB)*_dx(pA)(pB) + _dy(pA)(pB)*_dy(pA)(pB)) +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_group.mp b/Master/texmf-dist/metapost/metauml/util_group.mp new file mode 100644 index 00000000000..732deba4bdf --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_group.mp @@ -0,0 +1,173 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_group_mp: + expandafter endinput +fi; +_util_group_mp:=1; + +input util_object; +input util_commons; +input util_margins; +input util_log; + +vardef GroupInfo@#(expr pleft, pright, ptop, pbottom)= + attributes(@#); + var(color) borderColor; + var(numeric) boxed; + + @#boxed := 0; + @#borderColor := red; + + Margins.@#(pleft, pright, ptop, pbottom); +enddef; + +vardef GroupInfoCopy@#(text src)= + GroupInfo@#(src.left, src.right, src.top, src.bottom); + + @#boxed := src.boxed; + @#borderColor := src.borderColor; + +enddef; + +GroupInfo.iGroup(2, 2, 2, 2); + +GroupInfoCopy.iGroupBoxed(iGroup); +iGroupBoxed.boxed := 1; + +vardef EGroup@#(text groupInfo)(text objects)= + ObjectEquations(@#); + @#className := "Group"; + + var(numeric) minx, maxx, miny, maxy; + var(numeric) nObjects; + var(string) objectsAsString; + + GroupInfoCopy.@#info(groupInfo); + + @#objectsAsString := enumToString(objects)(""); + log @#objectsAsString; + + @#nObjects := 0; + if @#objectsAsString <> "": + forsuffixes obj = scantokens @#objectsAsString: + @#nObjects := @#nObjects + 1; + endfor; + fi; + +enddef; + +vardef Group@#(text objects)= + EGroup@#(iGroup)(objects); +enddef; + +vardef Group_layout@#= + if @#layedout = 0: + log "Needing layout for group " & (str @#); + @#layedout := 1; + + if (@#objectsAsString = ""): + @#width = @#info.left + @#info.right; + @#height = @#info.top + @#info.bottom; + else: + log "Calling layout for objects group '" & (str @#) & "' ..."; + log " object are: '" & @#objectsAsString & "'."; + + layoutObjects(scantokens @#objectsAsString); + log "All objects in group '" & (str @#) & "' are now layed out."; + + % As already tested, @#objectsAsString must be <> "". + % See page 53, User's manual for MetaPost + % "if some of the suffixes are empty, the loop gets + % executed, with the loop index parameter set to + % the empty suffix" (!) + + log "Proceeding to finding min/max x/y of objects:"; + log " " & @#objectsAsString; + + __objectIndex := 0; + forsuffixes obj__ = scantokens @#objectsAsString: + if __objectIndex = 0: + log "First object " & str obj__; + @#minx := obj__.left; + log @#maxx; + log obj__.right; + @#maxx := obj__.right; + log @#maxx; + @#miny := obj__.bottom; + @#maxy := obj__.top; + + __objectIndex := __objectIndex + 1; + else: + log "Current object " & str obj__; + + log "comparing(min)"; + log @#minx; + log @#obj__.left; + @#minx := min(@#minx)(obj__.left); + + log "comparing(max)"; + log @#maxx; + log @#obj__.right; + @#maxx := max(@#maxx)(obj__.right); + + log "comparing(min)"; + log @#miny; + log @#obj__.bottom; + @#miny := min(@#miny)(obj__.bottom); + + log "comparing(max)"; + log @#maxy; + log @#obj__.top; + @#maxy := max(@#maxy)(obj__.top); + + __objectIndex := __objectIndex + 1; + fi; + endfor; + log "... done iterating"; + log "maxx = "; + log @#maxx; + + @#nw = (@#minx - @#info.left, @#maxy + @#info.top); + @#se = (@#maxx + @#info.right, @#miny - @#info.bottom); + + log "Done performing actual layout for group " & str @#; + fi; + else: + log "NOT needing layout for group " & (str @#); + fi; +enddef; + +vardef Group_draw@#= + log "Drawing group...."; + Group_layout@#; + objectEnsurePositioning.@#; + + if @#objectsAsString <> "": + drawObjects(scantokens @#objectsAsString); + fi; + + if (@#info.boxed = 1): + draw objectBox(@#) withcolor @#info.borderColor; + fi; +enddef; + +vardef Group_border@#= + objectBox(@#) +enddef; + + diff --git a/Master/texmf-dist/metapost/metauml/util_infrastructure.mp b/Master/texmf-dist/metapost/metauml/util_infrastructure.mp new file mode 100644 index 00000000000..26dc421cdb9 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_infrastructure.mp @@ -0,0 +1,58 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_infrastructure_mp: + expandafter endinput +fi; +_util_infrastructure_mp:=1; + +input util_log; + +vardef attributes(text objectName)= + _n_ := str objectName +enddef; + +vardef variables_ext text variables= + save ret, firstVar; + string ret; + ret := ""; + + numeric firstVar; + firstVar := 1; + + forsuffixes v = variables: + if firstVar = 0: + ret := ret & ","; + else: + firstVar := 0; + fi; + + ret := ret & " _n." & (str v); + endfor; + + ret +enddef; + +vardef var(text type) text variables = + save _variables; + string _variables; + _variables := variables_ext variables; + + generic_declare(type) scantokens _variables; +enddef; + + diff --git a/Master/texmf-dist/metapost/metauml/util_log.mp b/Master/texmf-dist/metapost/metauml/util_log.mp new file mode 100644 index 00000000000..20efc47fe08 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_log.mp @@ -0,0 +1,45 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_log_mp: + expandafter endinput +fi; +_util_log_mp:=1; + +util_loglevel_PARANOIA:=1; +util_loglevel_DEBUG:=2; +util_loglevel_RELEASE:=3; +util_loglevel_SILENT:=4; + +util_log_thresholdlevel := util_loglevel_DEBUG; +util_log_defaultlevel := util_loglevel_RELEASE; + +def elog(expr loglevel) text txt= + if (loglevel <= util_log_thresholdlevel): + show txt + else: + % do nothing + fi; +enddef; + +def log text txt= + if (util_log_defaultlevel <= util_log_thresholdlevel): + show txt + else: + % do nothing + fi; +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_margins.mp b/Master/texmf-dist/metapost/metauml/util_margins.mp new file mode 100644 index 00000000000..7b6b0446cfb --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_margins.mp @@ -0,0 +1,35 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_margins_mp: + expandafter endinput +fi; +_util_margins_mp:=1; + +vardef Margins@#(expr pleft, pright, ptop, pbottom)= + attributes(@#); + var(numeric) left, right, top, bottom; + + @#left := pleft; + @#right := pright; + @#top := ptop; + @#bottom := pbottom; +enddef; + +vardef MarginsCopy@#(text src)= + Margins@#(src.left, src.right, src.top, src.bottom); +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_object.mp b/Master/texmf-dist/metapost/metauml/util_object.mp new file mode 100644 index 00000000000..7cd6c0404c6 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_object.mp @@ -0,0 +1,217 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_object_mp: + expandafter endinput +fi; +_util_object_mp:=1; + +input util_infrastructure; +input util_log; + +def ObjectEquations(suffix $)= + attributes($); + var(pair) n, ne, e, se, s, sw, w, nw, c; + var(pair) dim; + var(numeric) width, height; + + var(numeric) left, right; + var(numeric) top, bottom; + var(numeric) midx, midy; + + var(picture) pict; + var(string) className; + + var(numeric) layedout, drawn; + + $.layedout := 0; + $.drawn := 0; + + $.left = xpart $.nw = xpart $.sw; + $.right = xpart $.ne = xpart $.se; + + $.top = ypart $.ne = ypart $.nw; + $.bottom = ypart $.se = ypart $.sw; + + $.w = .5[$.nw,$.sw]; + $.s = .5[$.sw,$.se]; + $.e = .5[$.ne,$.se]; + $.n = .5[$.ne,$.nw]; + + $.c = .5[$.nw, $.se]; + + $.width = $.right - $.left; + $.height = $.top - $.bottom; + + $.midx = xpart($.c); + $.midy = ypart($.c); + + xpart $.dim = $.width; + ypart $.dim = $.height; + + $.className := "Object"; +enddef; + +def objectBox(text obj)= + obj.nw -- obj.ne -- obj.se -- obj.sw -- cycle +enddef; + +vardef objectBorder(suffix @#)= + save methodName; + string methodName; + methodName := @#className & "_border"; + log "invoking " & methodName & " arg=" & str @#; + + scantokens (methodName).@# +enddef; + +vardef Object_toString(text obj)= + save ret; string ret; + ret := "Generic object"; + ret +enddef; + +vardef toString(suffix @#)= + scantokens (@#className & "_toString").@# +enddef; + +vardef layoutObject(suffix @#)= + save methodName; + string methodName; + methodName := @#className & "_layout"; + log "invoking " & methodName & " arg=" & str @#; + + scantokens (methodName).@#; +enddef; + +vardef drawObject(suffix @#)= + save methodName; + string methodName; + methodName := @#className & "_draw"; + log "invoking " & methodName & " arg=" & str @#; + + scantokens (methodName).@#; +enddef; + +vardef drawObjectShade(suffix @#)= + fill objectBorder(@#) shifted + (@#.info.iShade.shift, -@#.info.iShade.shift) withcolor @#.info.iShade.background; +enddef; + +vardef objectEnsurePositioning@#= + if unknown (xpart @#nw): + log "*** WARNING: DEFAULTING OBJECT'S (" & (str @#) & ") x TO 0"; + xpart @#nw = 0; + fi; + if unknown (ypart @#nw): + log "*** WARNING: DEFAULTING OBJECT'S (" & (str @#) & ") y TO 0"; + ypart @#nw = 0; + fi; +enddef; + +vardef drawObjectAt(suffix @#)(text eq)= + eq; + drawObject(@#); +enddef; + +vardef layoutObjects(text objects)= + log "Layout objects..."; + forsuffixes o = objects: + if (str o) <> "": + layoutObject(o); + fi; + endfor; +enddef; + +vardef drawObjects(text objects)= + % This needs to be done first in order to allow for equations which define + % relative positioning to be appropiately solved. Otherwise, for example, + % object0 may be positioned somewhere by default, and object1 also, leading + % to inconsitent equations. Inconsistency would have been caused by the fact that the + % positioning equations become meaningful only after object layout is performed + % --- but that would have been too late, since the positioning would have been + % done already to inappropriate values. + % + layoutObjects(objects); + + forsuffixes o = objects: + if (str o) <> "": + drawObject(o); + fi; + endfor; +enddef; + +%% +%% Joins the given pictures according to the equation given +%% by the pictureDoJoin macro. Note: the pictureDoJoin macro +%% can be conveniently set by calling setPicutureJoin macro. +%% +%% Usage example: +%% joinObjects (p, q, r); +%% +def joinObjects(text pictures)= + save skipFirstPicture; + skipFirstPicture := 1; + forsuffixes p=pictures: + if skipFirstPicture=0: + objectDoJoin(previousPic, p); + else: + % first picture is skipped + skipFirstPicture := 0; + fi; + def previousPic=p enddef; + endfor; +enddef; + +%% +%% Sets the macro pictureDoJoin, which is used by joinObjects to join +%% one picture into another. +%% +%% The pictureDoJoin macro has two arguments: pa and pb. +%% pa represents the first picture and pb the second picture. +%% The second picture is positioned relatively to pa as specified +%% by the given equation. +%% +%% Usage examples: +%% +%% % place the second picture at the bottom of the first +%% setPictureJoin(pa.sw = pb.nw); +%% +%% % place the second picture at the right of the first +%% setPictureJoin(pa.ne = pb.nw); +%% +def setObjectJoin(text eq)= + def objectDoJoin(suffix pa, pb)=eq enddef; +enddef; + +%% +%% A shortcut for setting the join equation and actually performing the join. +% +def joinObjectsEq(text objects)(text eq)= + setObjectJoin(eq); + joinObjects(objects); +enddef; + + +%% +%% Joins the pictures and draws them. A shorthand for +%% the corresponding two macro invocations. +%% +def joinDrawObjects(text pictures)= + joinObjects(pictures); + drawObjects(pictures); +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_picture.mp b/Master/texmf-dist/metapost/metauml/util_picture.mp new file mode 100644 index 00000000000..fc9133392d9 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_picture.mp @@ -0,0 +1,217 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_picture_mp: + expandafter endinput +fi; +_util_picture_mp:=1; + +input util_log; + +input util_margins; +if not known _n_cur_:input boxes;fi; + +vardef FontInfo@#(expr tname, tscale)= + attributes(@#); + var(string) className; + var(string) name; + var(numeric) scale; + + @#className := "FontInfo"; + + @#name := tname; + @#scale := tscale; +enddef; + +vardef FontInfoCopy@#(text fontInfo)= + FontInfo@#(fontInfo.name, fontInfo.scale); + @#ignoreNegativeBase := fontInfo.ignoreNegativeBase; +enddef; + +vardef FontInfo_toString@#= + save ret; string ret; + ret := "FontInfo(" & (str @#) & "): {" & (@#name) & ", " & (decimal @#scale) & "}"; + ret +enddef; + +log "()()() Creating iFont"; +FontInfo.iFont(defaultfont, defaultscale); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PICTURE % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +vardef PictureInfo@#(expr pleft, pright, ptop, pbottom)(text pfont)= + attributes(@#); + var(string) className; + @#className := "PictureInfo"; + + var(color) borderColor; + var(numeric) boxed; + + var(numeric) ignoreNegativeBase; + + @#boxed := 0; + @#borderColor := blue; + + @#ignoreNegativeBase := 0; + + Margins.@#(pleft, pright, ptop, pbottom); + + FontInfoCopy.@#iFont(pfont); +enddef; + +vardef PictureInfoCopy@#(text src)= + PictureInfo@#(src.left, src.right, src.top, src.bottom)(src.iFont); + + @#boxed := src.boxed; + @#borderColor := src.borderColor; + @#ignoreNegativeBase := src.ignoreNegativeBase; +enddef; + +vardef PictureInfo_toString@#= + save ret; string ret; + ret := "PictureInfo(" & (str @#) & "): {" & (decimal @#left) & ", " & (decimal @#right) & ", " & (decimal @#top) & ", " & (decimal @#bottom) & "}" & " boxed: " & (decimal @#boxed); + ret := ret & " Font: " & toString(@#iFont); + ret +enddef; + +PictureInfo.iPict(2, 2, 2, 2)(iFont); + +PictureInfoCopy.iPictBoxed(iPict); +iPictBoxed.boxed := 1; + +%% +%% Contructs a Picture object by wrapping around the +%% low-level picture thePict. +%% +vardef EPicture@#(text iPict)(expr thePict) = + ObjectEquations(@#); + @#className := "Picture"; + + var(pair) contentShift; + var(picture) pict; + var(numeric) negativeBase; + var(string) contentAsString; + var(picture) contentAsPicture; + + PictureInfoCopy.@#info(iPict); + + if string thePict: + log "Picture " & (str @#) & " is a text"; + @#contentAsString := thePict; + log @#contentAsString; + elseif picture thePict: + log "Picture " & (str @#) & " is a native pict"; + @#contentAsPicture := thePict; + log @#contentAsPicture; + else: + log "Picture " & (str @#) & " [error]"; + fi; + +enddef; + +%% +%% Contructs a Picture object by wrapping around the +%% low-level picture thePict. +%% +vardef Picture@#(expr thePict) = + EPicture@#(iPict)(thePict); +enddef; + +%% +%% Lays out the Picture. +%% +vardef Picture_layout@# = + if @#layedout = 0: + log "Laying out " & (str @#); + + @#layedout := 1; + + if known @#contentAsPicture: + log "Content is known to be a picture"; + @#pict = @#contentAsPicture; + elseif known @#contentAsString: + log "Content is known to be a string"; + log @#contentAsString; + @#pict = @#contentAsString infont @#info.iFont.name scaled @#info.iFont.scale; + else: + log "Show unknown parameter type in picture layout"; + 2 = 3; + fi; + + @#negativeBase = ypart llcorner @#pict; + + @#width = pictWidth(@#pict) + @#info.left + @#info.right; + + if @#info.ignoreNegativeBase = 0: + @#height = pictHeight(@#pict) + @#info.top + @#info.bottom; + @#contentShift = @#sw + (@#info.left, @#info.bottom - @#negativeBase) ; + else: + @#height = pictHeight(@#pict) + @#info.top + @#info.bottom + @#negativeBase; + @#contentShift = @#sw + (@#info.left, @#info.bottom); + fi; + + else: + log "Picture " & str @# & " already layed out."; + fi; +enddef; + +%% +%% Draws the Picture. +%% +vardef Picture_draw@# = + Picture_layout@#; + objectEnsurePositioning.@#; + + draw @#pict shifted @#contentShift; + + if (@#info.boxed = 1): + draw objectBox(@#) withcolor @#info.borderColor; + fi; +enddef; + +vardef Picture_border@#= + objectBox(@#) +enddef; + +vardef aitem(text pictInfo)(text thePict)(text equation)= + save obj; + EPicture.obj(pictInfo)(thePict); + equation; + drawObject(obj); +enddef; + +vardef item@#(text iPict)(text thePict)(text equation)= + save itemName; + string itemName; + itemName := str @#; + + log "Creating an item with name: '" & itemName & "'"; + + if itemName = "": + log "Name is empty, creating an anonymous item!"; + aitem(iPict)(thePict)(equation); + else: + EPicture@#(iPict)(thePict); + equation; + drawObject(@#); + fi; +enddef; + diff --git a/Master/texmf-dist/metapost/metauml/util_picture_stack.mp b/Master/texmf-dist/metapost/metauml/util_picture_stack.mp new file mode 100644 index 00000000000..11b6b7a16fa --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_picture_stack.mp @@ -0,0 +1,137 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_picture_stack_mp: + expandafter endinput +fi; +_util_picture_stack_mp:=1; + +input util_picture; +input util_commons; +input util_group; + +input util_log; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PICTURE STACK % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +vardef PictureStackInfo@#(expr pleft, pright, ptop, pbottom)(text pspacing)(text ppictInfo)= + attributes(@#); + var(numeric) boxed; + var(color) borderColor; + + var(numeric) left, right, top, bottom; + var(numeric) spacing; + + Margins@#(pleft, pright, ptop, pbottom); + + @#spacing := pspacing; + + @#boxed := 0; + @#borderColor := green; + + PictureInfoCopy.@#iPict(ppictInfo); +enddef; + +vardef PictureStackInfoCopy@#(text src)= + PictureStackInfo@#(src.left, src.right, src.top, src.bottom)(src.spacing)(src.iPict); + + @#boxed := src.boxed; + @#borderColor := src.borderColor; +enddef; + +log "*** Creating iStack..."; +PictureStackInfo.iStack(2, 2, 2, 2)(2)(iPict); + +vardef EPictureStack@#(text pictStackInfo)(text thePictures)(text how)= + ObjectEquations(@#); + @#className := "PictureStack"; + + PictureStackInfoCopy.@#info(pictStackInfo); + + attributes(@#); + var(numeric) nItems; + var(numeric) minx, miny, maxx, maxy; + var(string) picturesAsString; + var(string) joinMethod; + + @#joinMethod := how; + + @#nItems := 0; + for p=thePictures: + EPicture.@#pict[@#nItems](@#info.iPict)(p); + @#nItems := @#nItems + 1; + endfor; + + @#picturesAsString := listArray(@#pict)(@#nItems); + + EGroup.@#group(@#info)(scantokens @#picturesAsString); + + @#nw = @#group.nw; + @#se = @#group.se; +enddef; + +vardef PictureStack@#(text thePictures)(text how)= + EPictureStack@#(iStack)(thePictures)(how); +enddef; + +vardef PictureStack_layout@#= + if @#layedout = 1: + log "PictureStack " & (str @#) & " has already been layed out"; + else: + @#layedout := 1; + + layoutObjects(scantokens @#picturesAsString); + + if @#joinMethod = "vleft": + setObjectJoin(pa.left=pb.left; pa.bottom = pb.top + @#info.spacing); + elseif @#joinMethod = "vcenter": + setObjectJoin(pa.midx=pb.midx; pa.bottom = pb.top + @#info.spacing); + elseif @#joinMethod = "vright": + setObjectJoin(pa.right=pb.right; pa.bottom = pb.top + @#info.spacing); + elseif @#joinMethod = "vleftbase": + setObjectJoin(pa.left=pb.left; pa.bottom = pb.bottom + @#info.spacing); + elseif @#joinMethod = "vcenterbase": + setObjectJoin(pa.midx=pb.midx; pa.bottom = pb.bottom + @#info.spacing); + fi; + + joinObjects(scantokens @#picturesAsString); + + Group_layout.@#group; + fi; +enddef; + +vardef PictureStack_draw@#= + PictureStack_layout.@#; + objectEnsurePositioning.@#; + + for i=0 upto @#nItems-1: + Picture_draw.@#pict[i]; + endfor; + + if (@#info.boxed = 1): + draw objectBox(@#) withcolor @#info.borderColor; + fi; +enddef; + +vardef PictureStack_border@#= + objectBox(@#) +enddef; + diff --git a/Master/texmf-dist/metapost/metauml/util_positioning.mp b/Master/texmf-dist/metapost/metauml/util_positioning.mp new file mode 100644 index 00000000000..442fc534d55 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_positioning.mp @@ -0,0 +1,236 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _util_positioning_mp: + expandafter endinput +fi; +_util_positioning_mp:=1; + +input util_log; + +%% Gives a point which is below the given @point with the given @value. +%% +def below(expr point, value) = + (point - (0, value)) +enddef; + +%% Gives a point which is above the given @point with the given @value. +%% +def above(expr point, value) = + (point + (0, value)) +enddef; + +%% Gives a point which is at the right of the given @point with the given @value. +%% +def atright(expr point, value) = + (point + (value, 0)) +enddef; + +%% Gives a point which is at the left of the given @point with the given @value. +%% +def atleft(expr point, value) = + (point - (value, 0)) +enddef; + +%% Positions the given objects so that they: +%% * have their tops alligned +%% * the distance between the objects is @distance +%% * the center of gravity of the objects (taken on the top line) is at @middlePoint +%% +%% @distance +%% |---------------------------| +%% | | +%% | @middlePoint | +%% __________|_____________._____________|____________ the same top +%% [objectA] | [objectB] +%% +vardef centered_allign_top(suffix objectA, objectB)(expr distance, middlePoint)= + log middlePoint; + objectA.top = objectB.top; + objectB.left - objectA.right = distance; + middlePoint = .5[objectB.nw, objectA.ne]; +enddef; + + +%% theString means here not a sequence of characters but +%% the horizontal or vertical line on which objects are placed. +%% For example, if theString is top, then the objects are +%% "hanging" on a horizontal line, like freshly washed +%% clothes on a string. + +vardef allign(suffix theString, extremityNew, extremityOld) + (text distanceBetweenObjects)(expr sign)(text objects)= + string objectsAsString__; + objectsAsString__ := enumToString(objects)(""); + + log "Alligning '" & objectsAsString__ & "' at " & str theString; + log sign; + + if (objectsAsString__ = ""): + log "Nothing to do, bailing out."; + else: + string previousObject__; + previousObject__ := ""; + objectIndex__ := 0; + + forsuffixes obj = objects: + log "object: " & str obj; + if objectIndex__ = 0: + objectIndex__ := objectIndex__ + 1; + previousObject__ := str obj; + else: + objectIndex__ := objectIndex__ + 1; + + log str theString; + log str extremityOld; + log str extremityNew; + log distanceBetweenObjects; + + string eqA__, eqB__; + eqA__ := previousObject__ & "." & str theString & " = " & str obj & "." & str theString; + + if (sign = "+"): + eqB__ := previousObject__ & "." & str extremityOld & " + " & (str distanceBetweenObjects) & " = " & str obj & "." & str extremityNew; + %eqB__ := previousObject__ & "." & str extremityOld & " + distanceBetweenObjects = " & str obj & "." & str extremityNew; + else: + eqB__ := previousObject__ & "." & str extremityOld & " - " & (str distanceBetweenObjects) & " = " & str obj & "." & str extremityNew; + fi; + + log eqA__, eqB__; + scantokens eqA__; + scantokens eqB__; + + previousObject__ := str obj; + fi; + endfor; + fi; +enddef; + +vardef leftToRight@#(text distanceBetweenObjects)(text objects)= + if str @# = "": + log "String is empty, alligning to midy"; + allign(midy, left, right)(distanceBetweenObjects)("+")(objects); + else: + allign(@#, left, right)(distanceBetweenObjects)("+")(objects); + fi; +enddef; + +vardef rightToLeft@#(text distanceBetweenObjects)(text objects)= + if str @# = "": + log "String is empty, alligning to midy"; + allign(midy, right, left)(distanceBetweenObjects)("-")(objects); + else: + allign(@#, right, left)(distanceBetweenObjects)("-")(objects); + fi; +enddef; + +vardef topToBottom@#(text distanceBetweenObjects)(text objects)= + if str @# = "": + log "String is empty, alligning to midx"; + allign(midx, top, bottom)(distanceBetweenObjects)("-")(objects); + else: + allign(@#, top, bottom)(distanceBetweenObjects)("-")(objects); + fi; +enddef; + +vardef bottomToTop@#(text distanceBetweenObjects)(text objects)= + if str @# = "": + log "String is empty, alligning to midx"; + allign(midx, bottom, top)(distanceBetweenObjects)("+")(objects); + else: + allign(@#, bottom, top)(distanceBetweenObjects)("+")(objects); + fi; +enddef; + +%% +%% Defines an equation which sets the given prefix to be equal for all the given objects. +%% For example: +%% +%% same.top(a, b, c); +%% +%% is equivalent to +%% a.top = b.top = c.top; +%% +vardef same@#(text objects)= + log "begin macro: same@#(text objects)="; + + string equation__, property__; + equation__ := ""; + property__ := str @#; + + objectIndex__ := 0; + forsuffixes obj = objects: + log "object: " & str obj; + + if objectIndex__ = 0: + objectIndex__ := objectIndex__ + 1; + equation__ := equation__ & str obj & "." & property__; + else: + objectIndex__ := objectIndex__ + 1; + equation__ := equation__ & "=" & str obj & "." & property__; + fi; + endfor; + + equation__ := equation__ & ";"; + + log "Equation is: '" & equation__ & "'"; + + if objectIndex__ <= 1: + log "One or no objects, nothing to do!"; + else: + scantokens equation__; + fi; +enddef; + +%% this macro is NOT usable (yet) +vardef leftToRightCentered@#(expr distanceBetweenObjects, middlePoint)(text objects)= + string objectsAsString__; + objectsAsString__ := enumToString(objects)(""); + + if (objectsAsString__ = ""): + log "Nothing to do, bailing out."; + else: + log "ASDFGHJ"; + leftToRight@#(distanceBetweenObjects)(objects); + + string firstObject__, lastObject__; + objectIndex__ := 0; + forsuffixes obj = objects: + if objectIndex__ = 0: + objectIndex__ := objectIndex__ + 1; + firstObject__ := str obj; + else: + objectIndex__ := objectIndex__ + 1; + lastObject__ := str obj; + fi; + endfor; + + log "___"; + .5[authA.nw,authB.ne] = middlePoint; + log "___"; + + string eqCenter__; + eqCenter__ := ".5[" & firstObject__ & ".nw," & lastObject__ & ".ne] = middlePoint"; + + log eqCenter__; + log middlePoint; + + log "XXX"; + scantokens eqCenter__; + log "XXX"; + fi; +enddef; diff --git a/Master/texmf-dist/metapost/metauml/util_shade.mp b/Master/texmf-dist/metapost/metauml/util_shade.mp new file mode 100644 index 00000000000..2cc6f99af91 --- /dev/null +++ b/Master/texmf-dist/metapost/metauml/util_shade.mp @@ -0,0 +1,55 @@ +% MetaUtil, an easier MetaPost life +% Copyright (C) 2005 Ovidiu Gheorghies +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License +% as published by the Free Software Foundation; either version 2 +% of the License, or (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program; if not, write to the Free Software +% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +if known _metauml_shade_mp: + expandafter endinput +fi; +_metauml_shade_mp:=1; + +input util_log; + +vardef ShadeInfo@#= + _n_ := str @#; + generic_declare(numeric) _n.shift; + generic_declare(color) _n.background; + + @#shift := 1; + @#background := .7white; +enddef; + +vardef ShadeInfoCopy@#(text src)= + ShadeInfo.@#; + ShadeInfo_copy@#(src); +enddef; + +vardef ShadeInfo_copy@#(text src)= + @#shift := src.shift; + @#background := src.background; +enddef; + +vardef ShadeInfo_toString@#= + save @#ret; + string @#ret; + @#ret := "Shade (shift: " & (decimal @#shift) & " back: (" & + (decimal redpart @#background) & ", " & + (decimal greenpart @#background) & ", " & + (decimal bluepart @#background) & ")"; + + @#ret +enddef; + + diff --git a/Master/texmf-dist/tpm/metauml.tpm b/Master/texmf-dist/tpm/metauml.tpm new file mode 100644 index 00000000000..d8885b98a1e --- /dev/null +++ b/Master/texmf-dist/tpm/metauml.tpm @@ -0,0 +1,108 @@ +<!DOCTYPE rdf:RDF SYSTEM "../../support/tpm.dtd"> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:TPM="http://texlive.dante.de/"> + <rdf:Description about="http://texlive.dante.de/texlive/Package/metauml.zip"> + <TPM:Name>metauml</TPM:Name> + <TPM:Type>Package</TPM:Type> + <TPM:Date>2006/03/21 11:27:00</TPM:Date> + <TPM:Version></TPM:Version> + <TPM:Creator>karl</TPM:Creator> + <TPM:Title>The metauml package.</TPM:Title> + <TPM:Description></TPM:Description> + <TPM:Author></TPM:Author> + <TPM:Size>695575</TPM:Size> + <TPM:Build/> + <TPM:RunFiles size="124720"> +texmf-dist/metapost/metauml/metauml.mp +texmf-dist/metapost/metauml/metauml_activity.mp +texmf-dist/metapost/metauml/metauml_base.mp +texmf-dist/metapost/metauml/metauml_behavioral_common.mp +texmf-dist/metapost/metauml/metauml_class.mp +texmf-dist/metapost/metauml/metauml_class_assoc.mp +texmf-dist/metapost/metauml/metauml_class_clipart.mp +texmf-dist/metapost/metauml/metauml_class_relations.mp +texmf-dist/metapost/metauml/metauml_defaults.mp +texmf-dist/metapost/metauml/metauml_instance.mp +texmf-dist/metapost/metauml/metauml_links.mp +texmf-dist/metapost/metauml/metauml_note.mp +texmf-dist/metapost/metauml/metauml_package.mp +texmf-dist/metapost/metauml/metauml_package_relations.mp +texmf-dist/metapost/metauml/metauml_paths.mp +texmf-dist/metapost/metauml/metauml_skin_simple.mp +texmf-dist/metapost/metauml/metauml_state.mp +texmf-dist/metapost/metauml/metauml_stereotype.mp +texmf-dist/metapost/metauml/metauml_templates.mp +texmf-dist/metapost/metauml/metauml_usecase.mp +texmf-dist/metapost/metauml/metauml_usecase_clipart.mp +texmf-dist/metapost/metauml/util_commons.mp +texmf-dist/metapost/metauml/util_group.mp +texmf-dist/metapost/metauml/util_infrastructure.mp +texmf-dist/metapost/metauml/util_log.mp +texmf-dist/metapost/metauml/util_margins.mp +texmf-dist/metapost/metauml/util_object.mp +texmf-dist/metapost/metauml/util_picture.mp +texmf-dist/metapost/metauml/util_picture_stack.mp +texmf-dist/metapost/metauml/util_positioning.mp +texmf-dist/metapost/metauml/util_shade.mp +texmf-dist/tpm/metauml.tpm + </TPM:RunFiles> + <TPM:DocFiles size="576689"> +texmf-dist/doc/metapost/metauml/README +texmf-dist/doc/metapost/metauml/license.txt +texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/appetizer.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/boxes_vs_util.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_association.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization2.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_templates.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/cliparts.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/group.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/how-links-work.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/instance.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/mptrace.tmp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/note.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/object_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/package.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths_man.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_info.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/positioning.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/properties.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/state.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/statemachine_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_activity.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_qual_assoc.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_templates.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_font.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_group.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_instance.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lars_issues.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lowlevel.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_note.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_package.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_paths.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_positioning.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins_global_defaults.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_state.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_usecase.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/gnu-fdl.tex +texmf-dist/doc/metapost/metauml/metauml_manual/macro.tex +texmf-dist/doc/metapost/metauml/metauml_manual/metauml_manual.tex +texmf-dist/doc/metapost/metauml/metauml_manual/my-bib.bib +texmf-dist/doc/metapost/metauml/metauml_manual/test_suite.tex +texmf-dist/doc/metapost/metauml/metauml_manual_0.2.3.pdf + </TPM:DocFiles> + <TPM:Provides>Package/metauml</TPM:Provides> + </rdf:Description> +</rdf:RDF> + diff --git a/Master/texmf/lists/metauml b/Master/texmf/lists/metauml new file mode 100644 index 00000000000..7d1c1bf8228 --- /dev/null +++ b/Master/texmf/lists/metauml @@ -0,0 +1,90 @@ +texmf-dist/doc/metapost/metauml/README +texmf-dist/doc/metapost/metauml/license.txt +texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/activity_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/appetizer.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/boxes_vs_util.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_association.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_customization2.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/class_templates.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/cliparts.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/group.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/how-links-work.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/instance.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/mptrace.tmp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/note.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/object_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/package.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/paths_man.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_info.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/picture_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/positioning.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/properties.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/state.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/statemachine_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_activity.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_qual_assoc.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_class_templates.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_font.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_group.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_instance.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lars_issues.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_lowlevel.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_note.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_package.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_paths.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_picture_stack.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_positioning.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_skins_global_defaults.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_state.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/test_usecase.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase.mp +texmf-dist/doc/metapost/metauml/metauml_manual/fig/usecase_diagrams.mp +texmf-dist/doc/metapost/metauml/metauml_manual/gnu-fdl.tex +texmf-dist/doc/metapost/metauml/metauml_manual/macro.tex +texmf-dist/doc/metapost/metauml/metauml_manual/metauml_manual.tex +texmf-dist/doc/metapost/metauml/metauml_manual/my-bib.bib +texmf-dist/doc/metapost/metauml/metauml_manual/test_suite.tex +texmf-dist/doc/metapost/metauml/metauml_manual_0.2.3.pdf + +texmf-dist/metapost/metauml/metauml.mp +texmf-dist/metapost/metauml/metauml_activity.mp +texmf-dist/metapost/metauml/metauml_base.mp +texmf-dist/metapost/metauml/metauml_behavioral_common.mp +texmf-dist/metapost/metauml/metauml_class.mp +texmf-dist/metapost/metauml/metauml_class_assoc.mp +texmf-dist/metapost/metauml/metauml_class_clipart.mp +texmf-dist/metapost/metauml/metauml_class_relations.mp +texmf-dist/metapost/metauml/metauml_defaults.mp +texmf-dist/metapost/metauml/metauml_instance.mp +texmf-dist/metapost/metauml/metauml_links.mp +texmf-dist/metapost/metauml/metauml_note.mp +texmf-dist/metapost/metauml/metauml_package.mp +texmf-dist/metapost/metauml/metauml_package_relations.mp +texmf-dist/metapost/metauml/metauml_paths.mp +texmf-dist/metapost/metauml/metauml_skin_simple.mp +texmf-dist/metapost/metauml/metauml_state.mp +texmf-dist/metapost/metauml/metauml_stereotype.mp +texmf-dist/metapost/metauml/metauml_templates.mp +texmf-dist/metapost/metauml/metauml_usecase.mp +texmf-dist/metapost/metauml/metauml_usecase_clipart.mp +texmf-dist/metapost/metauml/util_commons.mp +texmf-dist/metapost/metauml/util_group.mp +texmf-dist/metapost/metauml/util_infrastructure.mp +texmf-dist/metapost/metauml/util_log.mp +texmf-dist/metapost/metauml/util_margins.mp +texmf-dist/metapost/metauml/util_object.mp +texmf-dist/metapost/metauml/util_picture.mp +texmf-dist/metapost/metauml/util_picture_stack.mp +texmf-dist/metapost/metauml/util_positioning.mp +texmf-dist/metapost/metauml/util_shade.mp +texmf-dist/tpm/metauml.tpm + +texmf/lists/metauml diff --git a/Master/texmf/tpm/collection-metapost.tpm b/Master/texmf/tpm/collection-metapost.tpm index b59bcf2a35c..ea716363034 100644 --- a/Master/texmf/tpm/collection-metapost.tpm +++ b/Master/texmf/tpm/collection-metapost.tpm @@ -25,6 +25,7 @@ <TPM:Package name="metaobj"/> <TPM:Package name="metaplot"/> <TPM:Package name="metapost"/> + <TPM:Package name="metauml"/> <TPM:Package name="mfpic"/> <TPM:Package name="mp3d"/> <TPM:Package name="mpattern"/> |