├── COPYING ├── LICENSE-GPL2.txt ├── LICENSE-LPPL1.3c.txt ├── README ├── demo ├── abstract-class.tex ├── abstract-factory.svg ├── abstract-factory.tex ├── aggregation.tex ├── association.tex ├── class.tex ├── color.tex ├── composition.tex ├── implement-interface.tex ├── inheritance.tex ├── interface.tex ├── multiple-inheritance.tex ├── note.tex ├── object-include-methods.tex ├── object.tex ├── package.tex ├── unidirectional-association.tex └── visibility.tex ├── logo.png ├── pgf-umlcd-manual.pdf ├── pgf-umlcd-manual.tex └── pgf-umlcd.sty /COPYING: -------------------------------------------------------------------------------- 1 | This file is part of pgf-umlcd. 2 | 3 | Copyright 2009-2020 Yuan Xu 4 | 5 | pgf-umlcd is licensed under the terms of the The LaTeX Project Public License (LPPL) 1.3c, or 6 | alternatively under the terms of the General Public License (GPL) Version 2. 7 | 8 | The terms of each license can be found in the source repository: 9 | 10 | Apache License: ./LICENSE-LPPL1.3c.txt 11 | GPL2 License: ./LICENSE-GPL2.txt 12 | -------------------------------------------------------------------------------- /LICENSE-GPL2.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /LICENSE-LPPL1.3c.txt: -------------------------------------------------------------------------------- 1 | The LaTeX Project Public License 2 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 3 | 4 | LPPL Version 1.3c 2008-05-04 5 | 6 | Copyright 1999 2002-2008 LaTeX3 Project 7 | Everyone is allowed to distribute verbatim copies of this 8 | license document, but modification of it is not allowed. 9 | 10 | 11 | PREAMBLE 12 | ======== 13 | 14 | The LaTeX Project Public License (LPPL) is the primary license under 15 | which the LaTeX kernel and the base LaTeX packages are distributed. 16 | 17 | You may use this license for any work of which you hold the copyright 18 | and which you wish to distribute. This license may be particularly 19 | suitable if your work is TeX-related (such as a LaTeX package), but 20 | it is written in such a way that you can use it even if your work is 21 | unrelated to TeX. 22 | 23 | The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', 24 | below, gives instructions, examples, and recommendations for authors 25 | who are considering distributing their works under this license. 26 | 27 | This license gives conditions under which a work may be distributed 28 | and modified, as well as conditions under which modified versions of 29 | that work may be distributed. 30 | 31 | We, the LaTeX3 Project, believe that the conditions below give you 32 | the freedom to make and distribute modified versions of your work 33 | that conform with whatever technical specifications you wish while 34 | maintaining the availability, integrity, and reliability of 35 | that work. If you do not see how to achieve your goal while 36 | meeting these conditions, then read the document `cfgguide.tex' 37 | and `modguide.tex' in the base LaTeX distribution for suggestions. 38 | 39 | 40 | DEFINITIONS 41 | =========== 42 | 43 | In this license document the following terms are used: 44 | 45 | `Work' 46 | Any work being distributed under this License. 47 | 48 | `Derived Work' 49 | Any work that under any applicable law is derived from the Work. 50 | 51 | `Modification' 52 | Any procedure that produces a Derived Work under any applicable 53 | law -- for example, the production of a file containing an 54 | original file associated with the Work or a significant portion of 55 | such a file, either verbatim or with modifications and/or 56 | translated into another language. 57 | 58 | `Modify' 59 | To apply any procedure that produces a Derived Work under any 60 | applicable law. 61 | 62 | `Distribution' 63 | Making copies of the Work available from one person to another, in 64 | whole or in part. Distribution includes (but is not limited to) 65 | making any electronic components of the Work accessible by 66 | file transfer protocols such as FTP or HTTP or by shared file 67 | systems such as Sun's Network File System (NFS). 68 | 69 | `Compiled Work' 70 | A version of the Work that has been processed into a form where it 71 | is directly usable on a computer system. This processing may 72 | include using installation facilities provided by the Work, 73 | transformations of the Work, copying of components of the Work, or 74 | other activities. Note that modification of any installation 75 | facilities provided by the Work constitutes modification of the Work. 76 | 77 | `Current Maintainer' 78 | A person or persons nominated as such within the Work. If there is 79 | no such explicit nomination then it is the `Copyright Holder' under 80 | any applicable law. 81 | 82 | `Base Interpreter' 83 | A program or process that is normally needed for running or 84 | interpreting a part or the whole of the Work. 85 | 86 | A Base Interpreter may depend on external components but these 87 | are not considered part of the Base Interpreter provided that each 88 | external component clearly identifies itself whenever it is used 89 | interactively. Unless explicitly specified when applying the 90 | license to the Work, the only applicable Base Interpreter is a 91 | `LaTeX-Format' or in the case of files belonging to the 92 | `LaTeX-format' a program implementing the `TeX language'. 93 | 94 | 95 | 96 | CONDITIONS ON DISTRIBUTION AND MODIFICATION 97 | =========================================== 98 | 99 | 1. Activities other than distribution and/or modification of the Work 100 | are not covered by this license; they are outside its scope. In 101 | particular, the act of running the Work is not restricted and no 102 | requirements are made concerning any offers of support for the Work. 103 | 104 | 2. You may distribute a complete, unmodified copy of the Work as you 105 | received it. Distribution of only part of the Work is considered 106 | modification of the Work, and no right to distribute such a Derived 107 | Work may be assumed under the terms of this clause. 108 | 109 | 3. You may distribute a Compiled Work that has been generated from a 110 | complete, unmodified copy of the Work as distributed under Clause 2 111 | above, as long as that Compiled Work is distributed in such a way that 112 | the recipients may install the Compiled Work on their system exactly 113 | as it would have been installed if they generated a Compiled Work 114 | directly from the Work. 115 | 116 | 4. If you are the Current Maintainer of the Work, you may, without 117 | restriction, modify the Work, thus creating a Derived Work. You may 118 | also distribute the Derived Work without restriction, including 119 | Compiled Works generated from the Derived Work. Derived Works 120 | distributed in this manner by the Current Maintainer are considered to 121 | be updated versions of the Work. 122 | 123 | 5. If you are not the Current Maintainer of the Work, you may modify 124 | your copy of the Work, thus creating a Derived Work based on the Work, 125 | and compile this Derived Work, thus creating a Compiled Work based on 126 | the Derived Work. 127 | 128 | 6. If you are not the Current Maintainer of the Work, you may 129 | distribute a Derived Work provided the following conditions are met 130 | for every component of the Work unless that component clearly states 131 | in the copyright notice that it is exempt from that condition. Only 132 | the Current Maintainer is allowed to add such statements of exemption 133 | to a component of the Work. 134 | 135 | a. If a component of this Derived Work can be a direct replacement 136 | for a component of the Work when that component is used with the 137 | Base Interpreter, then, wherever this component of the Work 138 | identifies itself to the user when used interactively with that 139 | Base Interpreter, the replacement component of this Derived Work 140 | clearly and unambiguously identifies itself as a modified version 141 | of this component to the user when used interactively with that 142 | Base Interpreter. 143 | 144 | b. Every component of the Derived Work contains prominent notices 145 | detailing the nature of the changes to that component, or a 146 | prominent reference to another file that is distributed as part 147 | of the Derived Work and that contains a complete and accurate log 148 | of the changes. 149 | 150 | c. No information in the Derived Work implies that any persons, 151 | including (but not limited to) the authors of the original version 152 | of the Work, provide any support, including (but not limited to) 153 | the reporting and handling of errors, to recipients of the 154 | Derived Work unless those persons have stated explicitly that 155 | they do provide such support for the Derived Work. 156 | 157 | d. You distribute at least one of the following with the Derived Work: 158 | 159 | 1. A complete, unmodified copy of the Work; 160 | if your distribution of a modified component is made by 161 | offering access to copy the modified component from a 162 | designated place, then offering equivalent access to copy 163 | the Work from the same or some similar place meets this 164 | condition, even though third parties are not compelled to 165 | copy the Work along with the modified component; 166 | 167 | 2. Information that is sufficient to obtain a complete, 168 | unmodified copy of the Work. 169 | 170 | 7. If you are not the Current Maintainer of the Work, you may 171 | distribute a Compiled Work generated from a Derived Work, as long as 172 | the Derived Work is distributed to all recipients of the Compiled 173 | Work, and as long as the conditions of Clause 6, above, are met with 174 | regard to the Derived Work. 175 | 176 | 8. The conditions above are not intended to prohibit, and hence do not 177 | apply to, the modification, by any method, of any component so that it 178 | becomes identical to an updated version of that component of the Work as 179 | it is distributed by the Current Maintainer under Clause 4, above. 180 | 181 | 9. Distribution of the Work or any Derived Work in an alternative 182 | format, where the Work or that Derived Work (in whole or in part) is 183 | then produced by applying some process to that format, does not relax or 184 | nullify any sections of this license as they pertain to the results of 185 | applying that process. 186 | 187 | 10. a. A Derived Work may be distributed under a different license 188 | provided that license itself honors the conditions listed in 189 | Clause 6 above, in regard to the Work, though it does not have 190 | to honor the rest of the conditions in this license. 191 | 192 | b. If a Derived Work is distributed under a different license, that 193 | Derived Work must provide sufficient documentation as part of 194 | itself to allow each recipient of that Derived Work to honor the 195 | restrictions in Clause 6 above, concerning changes from the Work. 196 | 197 | 11. This license places no restrictions on works that are unrelated to 198 | the Work, nor does this license place any restrictions on aggregating 199 | such works with the Work by any means. 200 | 201 | 12. Nothing in this license is intended to, or may be used to, prevent 202 | complete compliance by all parties with all applicable laws. 203 | 204 | 205 | NO WARRANTY 206 | =========== 207 | 208 | There is no warranty for the Work. Except when otherwise stated in 209 | writing, the Copyright Holder provides the Work `as is', without 210 | warranty of any kind, either expressed or implied, including, but not 211 | limited to, the implied warranties of merchantability and fitness for a 212 | particular purpose. The entire risk as to the quality and performance 213 | of the Work is with you. Should the Work prove defective, you assume 214 | the cost of all necessary servicing, repair, or correction. 215 | 216 | In no event unless required by applicable law or agreed to in writing 217 | will The Copyright Holder, or any author named in the components of the 218 | Work, or any other party who may distribute and/or modify the Work as 219 | permitted above, be liable to you for damages, including any general, 220 | special, incidental or consequential damages arising out of any use of 221 | the Work or out of inability to use the Work (including, but not limited 222 | to, loss of data, data being rendered inaccurate, or losses sustained by 223 | anyone as a result of any failure of the Work to operate with any other 224 | programs), even if the Copyright Holder or said author or said other 225 | party has been advised of the possibility of such damages. 226 | 227 | 228 | MAINTENANCE OF THE WORK 229 | ======================= 230 | 231 | The Work has the status `author-maintained' if the Copyright Holder 232 | explicitly and prominently states near the primary copyright notice in 233 | the Work that the Work can only be maintained by the Copyright Holder 234 | or simply that it is `author-maintained'. 235 | 236 | The Work has the status `maintained' if there is a Current Maintainer 237 | who has indicated in the Work that they are willing to receive error 238 | reports for the Work (for example, by supplying a valid e-mail 239 | address). It is not required for the Current Maintainer to acknowledge 240 | or act upon these error reports. 241 | 242 | The Work changes from status `maintained' to `unmaintained' if there 243 | is no Current Maintainer, or the person stated to be Current 244 | Maintainer of the work cannot be reached through the indicated means 245 | of communication for a period of six months, and there are no other 246 | significant signs of active maintenance. 247 | 248 | You can become the Current Maintainer of the Work by agreement with 249 | any existing Current Maintainer to take over this role. 250 | 251 | If the Work is unmaintained, you can become the Current Maintainer of 252 | the Work through the following steps: 253 | 254 | 1. Make a reasonable attempt to trace the Current Maintainer (and 255 | the Copyright Holder, if the two differ) through the means of 256 | an Internet or similar search. 257 | 258 | 2. If this search is successful, then enquire whether the Work 259 | is still maintained. 260 | 261 | a. If it is being maintained, then ask the Current Maintainer 262 | to update their communication data within one month. 263 | 264 | b. If the search is unsuccessful or no action to resume active 265 | maintenance is taken by the Current Maintainer, then announce 266 | within the pertinent community your intention to take over 267 | maintenance. (If the Work is a LaTeX work, this could be 268 | done, for example, by posting to comp.text.tex.) 269 | 270 | 3a. If the Current Maintainer is reachable and agrees to pass 271 | maintenance of the Work to you, then this takes effect 272 | immediately upon announcement. 273 | 274 | b. If the Current Maintainer is not reachable and the Copyright 275 | Holder agrees that maintenance of the Work be passed to you, 276 | then this takes effect immediately upon announcement. 277 | 278 | 4. If you make an `intention announcement' as described in 2b. above 279 | and after three months your intention is challenged neither by 280 | the Current Maintainer nor by the Copyright Holder nor by other 281 | people, then you may arrange for the Work to be changed so as 282 | to name you as the (new) Current Maintainer. 283 | 284 | 5. If the previously unreachable Current Maintainer becomes 285 | reachable once more within three months of a change completed 286 | under the terms of 3b) or 4), then that Current Maintainer must 287 | become or remain the Current Maintainer upon request provided 288 | they then update their communication data within one month. 289 | 290 | A change in the Current Maintainer does not, of itself, alter the fact 291 | that the Work is distributed under the LPPL license. 292 | 293 | If you become the Current Maintainer of the Work, you should 294 | immediately provide, within the Work, a prominent and unambiguous 295 | statement of your status as Current Maintainer. You should also 296 | announce your new status to the same pertinent community as 297 | in 2b) above. 298 | 299 | 300 | WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE 301 | ====================================================== 302 | 303 | This section contains important instructions, examples, and 304 | recommendations for authors who are considering distributing their 305 | works under this license. These authors are addressed as `you' in 306 | this section. 307 | 308 | Choosing This License or Another License 309 | ---------------------------------------- 310 | 311 | If for any part of your work you want or need to use *distribution* 312 | conditions that differ significantly from those in this license, then 313 | do not refer to this license anywhere in your work but, instead, 314 | distribute your work under a different license. You may use the text 315 | of this license as a model for your own license, but your license 316 | should not refer to the LPPL or otherwise give the impression that 317 | your work is distributed under the LPPL. 318 | 319 | The document `modguide.tex' in the base LaTeX distribution explains 320 | the motivation behind the conditions of this license. It explains, 321 | for example, why distributing LaTeX under the GNU General Public 322 | License (GPL) was considered inappropriate. Even if your work is 323 | unrelated to LaTeX, the discussion in `modguide.tex' may still be 324 | relevant, and authors intending to distribute their works under any 325 | license are encouraged to read it. 326 | 327 | A Recommendation on Modification Without Distribution 328 | ----------------------------------------------------- 329 | 330 | It is wise never to modify a component of the Work, even for your own 331 | personal use, without also meeting the above conditions for 332 | distributing the modified component. While you might intend that such 333 | modifications will never be distributed, often this will happen by 334 | accident -- you may forget that you have modified that component; or 335 | it may not occur to you when allowing others to access the modified 336 | version that you are thus distributing it and violating the conditions 337 | of this license in ways that could have legal implications and, worse, 338 | cause problems for the community. It is therefore usually in your 339 | best interest to keep your copy of the Work identical with the public 340 | one. Many works provide ways to control the behavior of that work 341 | without altering any of its licensed components. 342 | 343 | How to Use This License 344 | ----------------------- 345 | 346 | To use this license, place in each of the components of your work both 347 | an explicit copyright notice including your name and the year the work 348 | was authored and/or last substantially modified. Include also a 349 | statement that the distribution and/or modification of that 350 | component is constrained by the conditions in this license. 351 | 352 | Here is an example of such a notice and statement: 353 | 354 | %% pig.dtx 355 | %% Copyright 2005 M. Y. Name 356 | % 357 | % This work may be distributed and/or modified under the 358 | % conditions of the LaTeX Project Public License, either version 1.3 359 | % of this license or (at your option) any later version. 360 | % The latest version of this license is in 361 | % http://www.latex-project.org/lppl.txt 362 | % and version 1.3 or later is part of all distributions of LaTeX 363 | % version 2005/12/01 or later. 364 | % 365 | % This work has the LPPL maintenance status `maintained'. 366 | % 367 | % The Current Maintainer of this work is M. Y. Name. 368 | % 369 | % This work consists of the files pig.dtx and pig.ins 370 | % and the derived file pig.sty. 371 | 372 | Given such a notice and statement in a file, the conditions 373 | given in this license document would apply, with the `Work' referring 374 | to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being 375 | generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' 376 | referring to any `LaTeX-Format', and both `Copyright Holder' and 377 | `Current Maintainer' referring to the person `M. Y. Name'. 378 | 379 | If you do not want the Maintenance section of LPPL to apply to your 380 | Work, change `maintained' above into `author-maintained'. 381 | However, we recommend that you use `maintained', as the Maintenance 382 | section was added in order to ensure that your Work remains useful to 383 | the community even when you can no longer maintain and support it 384 | yourself. 385 | 386 | Derived Works That Are Not Replacements 387 | --------------------------------------- 388 | 389 | Several clauses of the LPPL specify means to provide reliability and 390 | stability for the user community. They therefore concern themselves 391 | with the case that a Derived Work is intended to be used as a 392 | (compatible or incompatible) replacement of the original Work. If 393 | this is not the case (e.g., if a few lines of code are reused for a 394 | completely different task), then clauses 6b and 6d shall not apply. 395 | 396 | 397 | Important Recommendations 398 | ------------------------- 399 | 400 | Defining What Constitutes the Work 401 | 402 | The LPPL requires that distributions of the Work contain all the 403 | files of the Work. It is therefore important that you provide a 404 | way for the licensee to determine which files constitute the Work. 405 | This could, for example, be achieved by explicitly listing all the 406 | files of the Work near the copyright notice of each file or by 407 | using a line such as: 408 | 409 | % This work consists of all files listed in manifest.txt. 410 | 411 | in that place. In the absence of an unequivocal list it might be 412 | impossible for the licensee to determine what is considered by you 413 | to comprise the Work and, in such a case, the licensee would be 414 | entitled to make reasonable conjectures as to which files comprise 415 | the Work. 416 | 417 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Some LaTeX macros for UML Class Diagrams. 2 | Home page of project: https://github.com/xuyuan/pgf-umlcd 3 | Please read pgf-umlcd-manual.pdf for more information. 4 | -------------------------------------------------------------------------------- /demo/abstract-class.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{abstractclass}[text width=5cm]{BankAccount}{0,0} 3 | \attribute{owner : String} 4 | \attribute{balance : Dollars = 0} 5 | 6 | \operation{deposit(amount : Dollars)} 7 | \operation[0]{withdrawl(amount : Dollars)} 8 | \end{abstractclass} 9 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/abstract-factory.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | -------------------------------------------------------------------------------- /demo/abstract-factory.tex: -------------------------------------------------------------------------------- 1 | 2 | \begin{tikzpicture}[show background grid] 3 | \begin{interface}{AbstractFactory}{0,0} 4 | \operation[0]{+ CreateProductA()} 5 | \operation[0]{+ CreateProductB()} 6 | \end{interface} 7 | 8 | \begin{class}{ConcreteFactory2}{-3,-4} 9 | \implement{AbstractFactory} 10 | \operation{+ CreateProductA()} 11 | \operation{+ CreateProductB()} 12 | \end{class} 13 | 14 | \begin{class}{ConcreteFactory1}{3,-4} 15 | \implement{AbstractFactory} 16 | \operation{+ CreateProductA()} 17 | \operation{+ CreateProductB()} 18 | \end{class} 19 | 20 | \begin{interface}{AbstractProductA}{15,-2} 21 | \end{interface} 22 | 23 | \begin{class}{ProductA1}{12,-5} 24 | \implement{AbstractProductA} 25 | \end{class} 26 | 27 | \begin{class}{ProductA2}{18,-5} 28 | \implement{AbstractProductA} 29 | \end{class} 30 | 31 | \draw[umlcd style dashed line,->] (ConcreteFactory1) --node[above, 32 | sloped, black]{$<<$instantiate$>>$} (ProductA1); 33 | 34 | \draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++ 35 | (1,0) -- ++(0,-1) -- node[above, sloped, 36 | black]{$<<$instantiate$>>$} ++(20,0) -| (ProductA2); 37 | 38 | \begin{interface}{AbstractProductB}{15,-8} 39 | \end{interface} 40 | 41 | \begin{class}{ProductB1}{12,-11} 42 | \implement{AbstractProductB} 43 | \end{class} 44 | 45 | \begin{class}{ProductB2}{18,-11} 46 | \implement{AbstractProductB} 47 | \end{class} 48 | 49 | \draw[umlcd style dashed line,->] (ConcreteFactory1) |-node[above, 50 | sloped, black]{$<<$instantiate$>>$} (ProductB1); 51 | 52 | \draw[umlcd style dashed line,->] (ConcreteFactory2.south) ++ 53 | (-1,0) -- ++(0,-7) -- node[above, sloped, 54 | black]{$<<$instantiate$>>$} ++(20,0) -| (ProductB2); 55 | 56 | \begin{class}{Client}{22,-0.5} 57 | \end{class} 58 | 59 | \draw[umlcd style dashed line,->] (Client) --node[above, sloped, 60 | black]{$<<$import$>>$} (AbstractFactory); 61 | 62 | \draw[umlcd style dashed line,->] (Client) |-node[above, sloped, 63 | black]{$<<$import$>>$} (AbstractProductA); 64 | 65 | \draw[umlcd style dashed line,->] (Client) |-node[above, sloped, 66 | black]{$<<$import$>>$} (AbstractProductB); 67 | \end{tikzpicture} 68 | 69 | 70 | -------------------------------------------------------------------------------- /demo/aggregation.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}[show background grid] 2 | \begin{class}{Car}{0,0} 3 | \end{class} 4 | 5 | \begin{class}{Wheel}{7.5,0} 6 | \end{class} 7 | 8 | \aggregation{Car}{wheels}{4}{Wheel} 9 | 10 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/association.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{class}[text width=7cm]{Flight}{0,0} 3 | \attribute{flightNumber : Integer} 4 | \attribute{departureTime : Date} 5 | \attribute{flightDuration : Minutes} 6 | \attribute{departingAirport : String} 7 | \attribute{arrivingAirport : String} 8 | 9 | \operation{delayFlight ( numberOfMinutes : Minutes )} 10 | \operation{getArrivalTime ( ) : Date} 11 | \end{class} 12 | 13 | \begin{class}{Plane}{11,0} 14 | \attribute{airPlaneType : String} 15 | \attribute{maximumSpeed : MPH} 16 | \attribute{maximumDistance : Miles} 17 | \attribute{tailID : String} 18 | \end{class} 19 | 20 | \association{Plane}{assignedPlane}{0..1}{Flight}{0..*}{assignedFlights} 21 | 22 | \end{tikzpicture} 23 | -------------------------------------------------------------------------------- /demo/class.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{class}[text width=8cm]{ClassName}{0,0} 3 | \attribute{name : attribute type} 4 | \attribute{name : attribute type = default value} 5 | 6 | \operation{name(parameter list) : type of value returned} 7 | % virtual operation 8 | \operation[0]{name(parameters list) : type of value returned} 9 | \end{class} 10 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/color.tex: -------------------------------------------------------------------------------- 1 | \renewcommand{\umltextcolor}{red} 2 | \renewcommand{\umlfillcolor}{green} 3 | \renewcommand{\umldrawcolor}{blue} 4 | 5 | \begin{tikzpicture} 6 | \begin{class}[text width=8cm]{ClassName}{0,0} 7 | \attribute{name : attribute type} 8 | \attribute{name : attribute type = default value} 9 | 10 | \operation{name(parameter list) : type of value returned} 11 | % virtual operation 12 | \operation[0]{name(parameters list) : type of value returned} 13 | \end{class} 14 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/composition.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}[show background grid] 2 | \begin{class}{Company}{0,0} 3 | \end{class} 4 | 5 | \begin{class}{Department}{10,0} 6 | \end{class} 7 | 8 | \composition{Company}{theDepartment}{1..*}{Department} 9 | 10 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/implement-interface.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}%[show background grid] 2 | \begin{interface}{Person}{0,0} 3 | \attribute{firstName : String} 4 | \attribute{lastName : String} 5 | \end{interface} 6 | 7 | \begin{class}{Professor}{-5,-5} 8 | \implement{Person} 9 | \attribute{salary : Dollars} 10 | \end{class} 11 | 12 | \begin{class}{Student}{5,-5} 13 | \implement{Person} 14 | \attribute{major : String} 15 | \end{class} 16 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/inheritance.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{class}[text width=5cm]{BankAccount}{0,0} 3 | \attribute{owner : String} 4 | \attribute{balance : Dollars = 0} 5 | 6 | \operation{deposit(amount : Dollars)} 7 | \operation[0]{withdrawl(amount : Dollars)} 8 | \end{class} 9 | 10 | \begin{class}[text width=7cm]{CheckingAccount}{-5,-5} 11 | \inherit{BankAccount} 12 | \attribute{insufficientFundsFee : Dollars} 13 | 14 | \operation{processCheck ( checkToProcess : Check )} 15 | \operation{withdrawal ( amount : Dollars )} 16 | \end{class} 17 | 18 | \begin{class}[text width=7cm]{SavingsAccount}{5,-5} 19 | \inherit{BankAccount} 20 | \attribute{annualInteresRate : Percentage} 21 | 22 | \operation{depositMonthlyInterest ( )} 23 | \operation{withdrawal ( amount : Dollars )} 24 | \end{class} 25 | 26 | \end{tikzpicture} 27 | -------------------------------------------------------------------------------- /demo/interface.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}%[show background grid] 2 | \begin{interface}{Person}{0,0} 3 | \attribute{firstName : String} 4 | \attribute{lastName : String} 5 | \end{interface} 6 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/multiple-inheritance.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}%[show background grid] 2 | \begin{class}[text width = 2cm]{TArg}{0, 0} 3 | \end{class} 4 | 5 | \begin{class}[text width = 2cm]{TGroup}{5, 0} 6 | \end{class} 7 | 8 | \begin{class}[text width = 2cm]{TProgInit}{10, 0} 9 | \end{class} 10 | 11 | \begin{class}[text width = 2cm]{TProgram}{5, -2} 12 | \inherit{TProgInit} 13 | \inherit{TGroup} 14 | \inherit{TArg} 15 | \end{class} 16 | \end{tikzpicture} 17 | -------------------------------------------------------------------------------- /demo/note.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \umlnote (note) {This is a note.}; 3 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/object-include-methods.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{object}[text width=6cm]{Thomas' account}{0,0} 3 | \instanceOf{BankAccount} 4 | \attribute{owner = Thomas} 5 | \attribute{balance = 100} 6 | 7 | \operation{deposit(amount : Dollars)} 8 | \operation[0]{withdrawl(amount : Dollars)} 9 | \end{object} 10 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/object.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{object}[text width=6cm]{Instance Name}{0,0} 3 | \instanceOf{Class Name} 4 | \attribute{attribute name = value} 5 | \end{object} 6 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/package.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | \begin{package}{Accounts} 3 | \begin{class}[text width=5cm]{BankAccount}{0,0} 4 | \attribute{owner : String} 5 | \attribute{balance : Dollars = 0} 6 | 7 | \operation{deposit(amount : Dollars)} 8 | \operation[0]{withdrawl(amount : Dollars)} 9 | \end{class} 10 | 11 | \begin{class}[text width=7cm]{CheckingAccount}{-5,-5} 12 | \inherit{BankAccount} 13 | \attribute{insufficientFundsFee : Dollars} 14 | 15 | \operation{processCheck ( checkToProcess : Check )} 16 | \operation{withdrawal ( amount : Dollars )} 17 | \end{class} 18 | 19 | \begin{class}[text width=7cm]{SavingsAccount}{5,-5} 20 | \inherit{BankAccount} 21 | \attribute{annualInteresRate : Percentage} 22 | 23 | \operation{depositMonthlyInterest ( )} 24 | \operation{withdrawal ( amount : Dollars )} 25 | \end{class} 26 | \end{package} 27 | 28 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/unidirectional-association.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture} 2 | % \draw[help lines] (-7,-6) grid (6,0); 3 | 4 | \begin{class}[text width=6cm]{OverdrawnAccountsReport}{0,0} 5 | \attribute{generatedOn : Date} 6 | 7 | \operation{refresh ( )} 8 | \end{class} 9 | 10 | \begin{class}{BankAccount}{12,0} 11 | \attribute{owner : String} 12 | \attribute{balance : Dollars} 13 | 14 | \operation{deposit(amount : Dollars)} 15 | \operation[0]{withdrawl(amount : Dollars)} 16 | \end{class} 17 | 18 | \unidirectionalAssociation{OverdrawnAccountsReport}{overdrawnAccounts}{0..*}{BankAccount} 19 | 20 | \end{tikzpicture} -------------------------------------------------------------------------------- /demo/visibility.tex: -------------------------------------------------------------------------------- 1 | \begin{tikzpicture}%[show background grid] 2 | \begin{class}[text width=7cm]{Class}{0,0} 3 | \attribute{+ Public} 4 | \attribute{\# Protected} 5 | \attribute{- Private} 6 | \attribute{$\sim$ Package} 7 | \end{class} 8 | 9 | \begin{class}[text width=7cm]{BankAccount}{0,-3} 10 | \attribute{+ owner : String} 11 | \attribute{+ balance : Dollars} 12 | 13 | \operation{+ deposit( amount : Dollars )} 14 | \operation{+ withdrawal( amount : Dollars )} 15 | \operation{\# updateBalance( newBalance : Dollars )} 16 | \end{class} 17 | \end{tikzpicture} -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuyuan/pgf-umlcd/4778ab8e2203579d66735576a3fd93ab6dffcd97/logo.png -------------------------------------------------------------------------------- /pgf-umlcd-manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xuyuan/pgf-umlcd/4778ab8e2203579d66735576a3fd93ab6dffcd97/pgf-umlcd-manual.pdf -------------------------------------------------------------------------------- /pgf-umlcd-manual.tex: -------------------------------------------------------------------------------- 1 | % Manual of pgf-umlcd.sty, a convenient set of macros for drawing UML 2 | % class diagrams. 3 | % Written by Xu Yuan 4 | % This file is part of pgf-umlcd 5 | % you may get it at http://code.google.com/p/pgf-umlcd/ 6 | 7 | \documentclass{article} 8 | \usepackage[margin=12mm]{geometry} 9 | \usepackage{hyperref} 10 | 11 | \usepackage[ 12 | % school, 13 | % simplified 14 | ]{pgf-umlcd} 15 | 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | \usepackage{listings} 18 | \usepackage{color} 19 | \definecolor{listinggray}{gray}{0.92} 20 | \lstset{ % 21 | language=[LaTeX]TeX, 22 | breaklines=true, 23 | frame=single, 24 | % frameround=tttt, 25 | basicstyle=\footnotesize\ttfamily, 26 | backgroundcolor=\color{listinggray}, 27 | keywordstyle=\color{blue} 28 | } 29 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 30 | 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | \hypersetup{ 33 | colorlinks=true, 34 | linkcolor=blue, 35 | anchorcolor=black, 36 | citecolor=olive, 37 | filecolor=magenta, 38 | menucolor=red, 39 | urlcolor=blue 40 | } 41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 42 | 43 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 44 | \newcommand{\demo}[2][1]{ 45 | \begin{minipage}{.49\linewidth} 46 | \centering 47 | \resizebox{#1\linewidth}{!}{ 48 | \input{demo/#2} 49 | } 50 | \end{minipage} 51 | \hspace{0.01\linewidth} 52 | \begin{minipage}{.5\linewidth} 53 | \lstinputlisting{demo/#2} 54 | \end{minipage} 55 | } 56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 57 | 58 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 59 | \newcommand{\example}[1]{ 60 | \resizebox{\linewidth}{!}{ 61 | \input{demo/#1} 62 | } 63 | \lstinputlisting{demo/#1} 64 | } 65 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 | 67 | \begin{document} 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69 | \title{Drawing UML Class Diagram by using \texttt{pgf-umlcd}} 70 | \author{\href{mailto:xuyuan.cn@gmail.com}{Yuan Xu}} 71 | \date{\today{}~(v0.2.1)} 72 | \maketitle 73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 74 | 75 | \begin{abstract} 76 | \texttt{pgf-umlcd} is a LaTeX package for drawing UML Class 77 | Diagrams. As stated by its name, it is based on a very popular 78 | graphic package \texttt{PGF/TikZ}. This document presents the usage 79 | of \texttt{pgf-umlcd} and collects some UML class diagrams as 80 | examples. \texttt{pgf-umlcd} can be downloaded from 81 | \href{http://code.google.com/p/pgf-umlcd/}{http://code.google.com/p/pgf-umlcd/}. 82 | \end{abstract} 83 | 84 | \tableofcontents 85 | 86 | \section{Basics} 87 | \subsection{Class with attributes and operations} 88 | Note: If you don't want to show empty parts in the diagrams, please 89 | use \texttt{simplified} option, e.g. \lstinline|\usepackage[simplified]{pgf-umlcd}|.\\ 90 | \demo{class} 91 | 92 | \subsubsection{Visibility of attributes and operations} 93 | \demo[0.8]{visibility} 94 | 95 | \subsubsection{Abstract class and interface} 96 | \demo[0.5]{abstract-class} 97 | \demo[0.5]{interface} 98 | 99 | \subsubsection{Object} 100 | \demo[0.7]{object} 101 | Note: Object with rounded corners and methods are used in German school for didactic reasons. You get the rounded corners with \lstinline|\usepackage[school]{pgf-umlcd}|. If you need both in one document you can switch it with \lstinline|\switchUmlcdSchool| \\ 102 | \switchUmlcdSchool 103 | \demo[0.7]{object} 104 | \demo[0.7]{object-include-methods} 105 | 106 | \subsubsection{Note} 107 | The \lstinline|\umlnote| use the same syntax as tikz command 108 | \lstinline|\node|, e.g. \lstinline|\umlnote[style] (name) at (coordinate) {text};| 109 | 110 | \demo[0.7]{note} 111 | 112 | \subsection{Inheritance and implement} 113 | \subsubsection{Inheritance} 114 | \demo{inheritance} 115 | \subsubsection{Multiple Inheritance} 116 | \demo{multiple-inheritance} 117 | 118 | \subsubsection{Implement an interface} 119 | \demo{implement-interface} 120 | 121 | \subsection{Association, Aggregation and Composition} 122 | \subsubsection{Association} 123 | \demo{association} 124 | 125 | \subsubsection{Unidirectional association} 126 | \demo{unidirectional-association} 127 | 128 | \subsubsection{Aggregation} 129 | \demo{aggregation} 130 | 131 | \subsubsection{Composition} 132 | \demo{composition} 133 | 134 | \subsection{Package} 135 | \demo{package} 136 | 137 | \section{Customization} 138 | \subsection{Color settings} 139 | The color of digram is defined by \lstinline|\umltextcolor|, \lstinline|\umldrawcolor| and \lstinline|\umlfillcolor|, such as: 140 | 141 | \demo{color} 142 | 143 | 144 | \section{Examples} 145 | \subsection{Abstract Factory} 146 | \example{abstract-factory} 147 | 148 | \section{Acknowledgements} 149 | Many people contributed to \texttt{pgf-umlcd} by reporting problems, 150 | suggesting various improvements or submitting code. Here is a list of 151 | these people: \href{mailto:martin.quinson@loria.fr}{Martin Quinson}, 152 | \href{mailto:johannes_pieper@yahoo.de}{Johannes Pieper}, 153 | \href{mailto:lwghsh@gmail.com}{sh w}, 154 | and \href{mailto:maartenvandessel@hotmail.com}{Maarten van Dessel}. 155 | 156 | \end{document} 157 | %%% Local Variables: 158 | %%% mode: Tex-PDF 159 | %%% TeX-master: t 160 | %%% End: 161 | -------------------------------------------------------------------------------- /pgf-umlcd.sty: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Start of pgf-umlcd.sty 3 | % 4 | % Some macros for UML Class Diagrams. 5 | % Home page of project: http://pgf-umlcd.googlecode.com/ 6 | % Author: Xu Yuan , Humboldt University, Berlin 7 | % Style from: http://www.ibm.com/developerworks/cn/rational/r-uml/ 8 | % 9 | 10 | \NeedsTeXFormat{LaTeX2e}[1999/12/01] 11 | \ProvidesPackage{pgf-umlcd}[2011/10/01 v0.3dev Some LaTeX macros for 12 | UML Class Diagrams.] 13 | 14 | \RequirePackage{tikz} 15 | 16 | \usetikzlibrary{arrows,shapes.multipart,backgrounds,fit} 17 | \tikzstyle{help lines}+=[blue!50,very thin,dashed] 18 | 19 | \newcommand{\umltextcolor}{black} 20 | \newcommand{\umldrawcolor}{purple} 21 | \newcommand{\umlfillcolor}{yellow!20} 22 | \tikzstyle{umlcolor}=[color=\umldrawcolor,fill=\umlfillcolor,text=\umltextcolor] 23 | \tikzstyle{umlcd style}=[umlcolor, >=angle 90] 24 | 25 | \tikzstyle{package}=[matrix, column sep=1mm, row sep=1cm, node distance=2cm] 26 | \tikzstyle{packagename}=[rectangle, minimum height=2em] 27 | 28 | \tikzstyle{umlcd style implement line}=[color=\umldrawcolor, open triangle 45-,dashed] 29 | \tikzstyle{objectline}=[color=\umldrawcolor, diamond->] 30 | \tikzstyle{umlcd style inherit line}=[color=\umldrawcolor, open triangle 45-] 31 | \tikzstyle{splitline}=[color=\umldrawcolor, dotted,font=\itshape] 32 | 33 | \tikzstyle{umlcd style class}=[rectangle split, rectangle split parts=3, 34 | every text node part/.style={text centered}, 35 | draw, minimum height=2em, umlcolor, minimum width=2cm, text width=5cm, 36 | minimum height=1cm, node distance=2cm] 37 | 38 | 39 | \tikzstyle{umlcd style dashed line}=[color=\umldrawcolor, >=angle 90,dashed] 40 | 41 | \tikzstyle{umlcd style school}=[] 42 | \newif\ifschool\schoolfalse 43 | \DeclareOption{school}{\tikzstyle{umlcd style school}=[rounded corners] \schooltrue} 44 | \newif\ifsimplified\simplifiedfalse 45 | \DeclareOption{simplified}{\simplifiedtrue} 46 | \ProcessOptions\relax 47 | 48 | 49 | % declare layers 50 | \pgfdeclarelayer{background} 51 | \pgfdeclarelayer{connectionlayers} 52 | \pgfsetlayers{background,connectionlayers,main} 53 | 54 | \newcounter{umlcdClassAttributesNum} 55 | \newcounter{umlcdClassOperationsNum} 56 | \newcounter{umlcdClassAbstractClassNum} 57 | \newcounter{umlcdClassInterfaceNum} 58 | \newcounter{umlcdClassSplitPartNum} 59 | 60 | \def\umlcdPackageFit{} 61 | 62 | \newenvironment{class}[3][]% 63 | { 64 | \begin{classAndInterfaceCommon}{#1}{#2}{#3} 65 | }% 66 | {\calcuateNumberOfParts{} 67 | \node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) 68 | {\textbf{\umlcdClassName} 69 | \insertAttributesAndOperations{} 70 | }; 71 | 72 | \end{classAndInterfaceCommon} 73 | } 74 | 75 | \newenvironment{interface}[3][]% 76 | { 77 | \begin{classAndInterfaceCommon}{#1}{#2}{#3} 78 | }% 79 | {\calcuateNumberOfParts{} 80 | \node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) 81 | {$<<$interface$>>$ \\ \textbf{\umlcdClassName} 82 | \insertAttributesAndOperations{} 83 | }; 84 | 85 | \end{classAndInterfaceCommon} 86 | } 87 | 88 | \newenvironment{abstractclass}[3][]% 89 | { 90 | \begin{classAndInterfaceCommon}{#1}{#2}{#3} 91 | }% 92 | {\calcuateNumberOfParts{} 93 | \node[this umlcd style, anchor=north] (\umlcdClassName) at (\umlcdClassPos) 94 | {$<<$abstract$>>$ \\ \textbf{\umlcdClassName} 95 | \insertAttributesAndOperations{} 96 | }; 97 | 98 | \end{classAndInterfaceCommon} 99 | } 100 | 101 | % TODO: here the name of \umlcdClassName and \umlObjectName should be 102 | % switched, it is only for reusing \classAndInterfaceCommon at the 103 | % moment. 104 | \newenvironment{object}[3][]% 105 | { 106 | \begin{classAndInterfaceCommon}{#1}{#2}{#3} 107 | \def\@instanceOf{} 108 | \def\@@instanceOf{} 109 | }% 110 | { 111 | % customized 112 | \ifsimplified 113 | \calcuateNumberOfParts{} 114 | \else 115 | \ifnum\c@umlcdClassOperationsNum>0 116 | \setcounter{umlcdClassSplitPartNum}{3} 117 | \protected@xdef\umlcdSplitPart{3} 118 | \else 119 | \setcounter{umlcdClassSplitPartNum}{2} 120 | \protected@xdef\umlcdSplitPart{2} 121 | \fi 122 | \fi 123 | 124 | \ifx\@instanceOf\@@instanceOf 125 | \def\umldObjectName{\umlcdClassName} 126 | \else 127 | \def\umldObjectName{\umlcdClassName : \@instanceOf} 128 | \fi 129 | 130 | \node[this umlcd style, anchor=north, umlcd style school] (\umlcdClassName) at (\umlcdClassPos) 131 | { \ifschool 132 | \textbf{\umldObjectName} 133 | \else 134 | \underline{\textbf{\umldObjectName}} 135 | \fi 136 | \insertAttributesAndOperations{} 137 | }; 138 | 139 | \end{classAndInterfaceCommon} 140 | } 141 | 142 | \newcommand*{\insertAttributesAndOperations} 143 | { 144 | \ifnum\c@umlcdClassSplitPartNum>1 145 | \nodepart{second} 146 | \fi 147 | \umlcdClassAttributes 148 | \ifnum\c@umlcdClassSplitPartNum>2 149 | \nodepart{third} 150 | \fi 151 | \umlcdClassOperations 152 | } 153 | 154 | \newcommand*{\calcuateNumberOfParts} 155 | { 156 | % calcuate the number of parts 157 | \ifsimplified 158 | \setcounter{umlcdClassSplitPartNum}{1} 159 | \ifnum\c@umlcdClassAttributesNum>0 160 | \stepcounter{umlcdClassSplitPartNum} 161 | \fi 162 | \ifnum\c@umlcdClassOperationsNum>0 163 | \stepcounter{umlcdClassSplitPartNum} 164 | \fi 165 | \else 166 | \setcounter{umlcdClassSplitPartNum}{3}% three parts by default 167 | \fi 168 | 169 | \protected@xdef\umlcdSplitPart{3} 170 | \ifnum\c@umlcdClassSplitPartNum=1 171 | \protected@xdef\umlcdSplitPart{1} 172 | \fi 173 | \ifnum\c@umlcdClassSplitPartNum=2 174 | \protected@xdef\umlcdSplitPart{2} 175 | \fi 176 | } 177 | 178 | \newenvironment*{classAndInterfaceCommon}[3] 179 | { 180 | \def\umlcdClassName{#2}% 181 | \def\umlcdClassPos{#3} 182 | \def\umlcdClassAttributes{}% 183 | \def\umlcdClassOperations{}% 184 | \def\umlcdClassAbstractClass{}% 185 | \def\umlcdClassInterface{}% 186 | \setcounter{umlcdClassAttributesNum}{0}% 187 | \setcounter{umlcdClassOperationsNum}{0}% 188 | \setcounter{umlcdClassAbstractClassNum}{0}% 189 | \setcounter{umlcdClassInterfaceNum}{0}% 190 | \tikzstyle{this umlcd style}=[umlcd style class, rectangle split 191 | parts=\umlcdSplitPart, #1] 192 | }% 193 | { 194 | %% connections 195 | \begin{pgfonlayer}{connectionlayers} 196 | \ifnum\c@umlcdClassAbstractClassNum>0 197 | \foreach \c in \umlcdClassAbstractClass { 198 | \draw [umlcd style inherit line] (\c) -- (\umlcdClassName); 199 | } 200 | \fi 201 | 202 | \ifnum\c@umlcdClassInterfaceNum>0 203 | \foreach \c in \umlcdClassInterface { 204 | \draw [umlcd style implement line] (\c) -- (\umlcdClassName); 205 | } 206 | \fi 207 | \end{pgfonlayer} 208 | 209 | %% add to fit 210 | \let\umlcdPackageFitOld\umlcdPackageFit 211 | \protected@xdef\umlcdPackageFit{\umlcdPackageFitOld (\umlcdClassName)} 212 | } 213 | 214 | \newcommand{\attribute}[1]{% 215 | \ifnum\c@umlcdClassAttributesNum=0 216 | \protected@xdef\umlcdClassAttributes{#1} 217 | \else 218 | \let\umlcdClassAttributesOld\umlcdClassAttributes 219 | \protected@xdef\umlcdClassAttributes{\umlcdClassAttributesOld \ \newline 220 | #1} 221 | \fi 222 | \stepcounter{umlcdClassAttributesNum} 223 | } 224 | 225 | \newcommand{\operation}[2][1]{% 226 | \stepcounter{umlcdClassOperationsNum} 227 | 228 | \def\virtualoperation{#2} 229 | \ifnum0=#1 230 | \def\virtualoperation{\textit{#2}} 231 | \fi 232 | 233 | \ifnum\c@umlcdClassOperationsNum=1 234 | \protected@xdef\umlcdClassOperations{\virtualoperation} 235 | \else 236 | \let\umlcdClassOperationsOld\umlcdClassOperations 237 | \protected@xdef\umlcdClassOperations{\umlcdClassOperationsOld \ \newline 238 | \virtualoperation} 239 | \fi 240 | } 241 | 242 | \newcommand{\inherit}[1] 243 | { 244 | \stepcounter{umlcdClassAbstractClassNum} 245 | \ifnum\c@umlcdClassAbstractClassNum=1 246 | \protected@xdef\umlcdClassAbstractClass{#1} 247 | \else 248 | \let\umlcdClassAbstractClassOld\umlcdClassAbstractClass 249 | \protected@xdef\umlcdClassAbstractClass{\umlcdClassAbstractClassOld, 250 | #1} 251 | \fi 252 | } 253 | 254 | \newcommand{\implement}[1] 255 | { 256 | \stepcounter{umlcdClassInterfaceNum} 257 | \ifnum\c@umlcdClassInterfaceNum=1 258 | \protected@xdef\umlcdClassInterface{#1} 259 | \else 260 | \let\umlcdClassInterfaceOld\umlcdClassInterface 261 | \protected@xdef\umlcdClassInterface{\umlcdClassInterfaceOld, 262 | #1} 263 | \fi 264 | } 265 | 266 | \newcommand{\instanceOf}[1]{\def\@instanceOf{#1}} 267 | 268 | \newcommand{\association}[6]{ 269 | \draw [umlcd style] (#1) -- (#4) 270 | node[near start, above]{#2} 271 | node[near start, below]{#3} 272 | node[near end, above]{#5} 273 | node[near end, below]{#6}; 274 | } 275 | 276 | \newcommand{\unidirectionalAssociation}[4]{ 277 | \draw [umlcd style, ->] (#1) -- (#4) 278 | node[near end, above]{#2} 279 | node[near end, below]{#3}; 280 | } 281 | 282 | \newcommand{\aggregation}[4] 283 | { 284 | \draw[umlcd style, open diamond->] (#1) -- (#4) 285 | node[near end, above]{#2} 286 | node[near end, below]{#3}; 287 | } 288 | 289 | \newcommand{\composition}[4] 290 | { 291 | \draw[umlcd style, fill=\umldrawcolor, diamond->] (#1) -- (#4) 292 | node[near end, above]{#2} 293 | node[near end, below]{#3}; 294 | } 295 | 296 | \newenvironment{package}[1]{ 297 | \def\umlcdPackageFit{} 298 | \def\umlcdPackageName{#1} 299 | }{ 300 | \begin{pgfonlayer}{background} 301 | \node[umlcd style, draw, inner sep=0.5cm, fit = \umlcdPackageFit] (\umlcdPackageName) {}; 302 | \node[umlcd style, draw, outer ysep=-0.5, anchor=south west] (\umlcdPackageName caption) at 303 | (\umlcdPackageName.north west) {\umlcdPackageName}; 304 | \end{pgfonlayer} 305 | } 306 | 307 | \newcommand{\switchUmlcdSchool}{ 308 | \ifschool 309 | \tikzstyle{umlcd style school}=[] 310 | \schoolfalse 311 | \else 312 | \tikzstyle{umlcd style school}=[rounded corners] 313 | \schooltrue 314 | \fi 315 | } 316 | 317 | \pgfdeclareshape{umlcdnote}{ 318 | \inheritsavedanchors[from=rectangle] % this is nearly a rectangle 319 | \inheritanchorborder[from=rectangle] 320 | \inheritanchor[from=rectangle]{center} 321 | \inheritanchor[from=rectangle]{north} 322 | \inheritanchor[from=rectangle]{south} 323 | \inheritanchor[from=rectangle]{west} 324 | \inheritanchor[from=rectangle]{east} 325 | % ... and possibly more 326 | \backgroundpath{% this is new 327 | % store lower right in xa/ya and upper right in xb/yb 328 | \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y 329 | \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y 330 | % compute corner of flipped page 331 | \pgf@xc=\pgf@xb \advance\pgf@xc by-10pt % this should be a parameter 332 | \pgf@yc=\pgf@yb \advance\pgf@yc by-10pt 333 | % construct main path 334 | \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} 335 | \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}} 336 | \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}} 337 | \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}} 338 | \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}} 339 | \pgfpathclose 340 | % add little corner 341 | \pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}} 342 | \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}} 343 | \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yc}} 344 | \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}} 345 | } 346 | } 347 | 348 | \newcommand{\umlnote}[1][]{ 349 | \node[umlcd style, anchor=north, draw,shape=umlcdnote, text width=4cm, #1] 350 | } 351 | 352 | %%% End of pgf-umlcd.sty 353 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 354 | --------------------------------------------------------------------------------