Use Enterprise Architect to draw UML class diagram

The following is the process I used to use Enterprise Architect 10 (build1005) trial print UML class diagram:

First, click the File menu to select the New Project menu item, create a new project, select the path to save, the following dialog box will pop up, select "Basic UML 2 Technology", check "Class"

Open the Project Browser, as shown below

Then, right-click "Class Model" and click the "Add Diagram" menu item in the "Add" menu, as shown below

Select "UML Structural" in the picture below, then select "Class", the name is defined by yourself

Then select "Class" in Toolbox and drag it to the middle artboard, as shown below

After dragging, a Class attribute box will pop up, you can enter the name of the class, the name of the author, you can also choose the language, such as PHP, as shown below

Next, you can set the properties and methods of the class. There are several ways:

(1) Select the class you want to set, such as "MyClass", and then select the "Attributes" menu item of the "Features & Properties" menu in the pop-up menu after right-clicking, and the "Operations" menu item to set the attributes of the class And method, as shown below:

(2) Select the class you want to set, click the small icon similar to the magnifying glass, and select the two small squares in the floating toolbar that pops up, one is for setting properties and the other is for setting methods, as shown below

(3) Shortcut keys:

Ctrl + Shift + F9: Set properties

Ctrl + Shift + F10: Setting method

Use the above two methods (1), (2) to set the property, the following dialog box will pop up, enter the property name, type, scope in the dialog box, then remember to click the "Save" button to save, then click "New" The button can continue to add properties without closing the following dialog box

After clicking the "Close" button in the picture above, it is set, as shown below:

Use the above (1), (2) method to set the method, the following dialog box will pop up, and then you can enter the method name, method parameters, return value type, scope, also remember to click the "Save" button to save your Set it!

Then click on the "Close" button to set up, as shown below:

If you use shortcut keys to set properties, you will be able to directly edit the name and type of the property in the following screen. More detailed settings can be set in the property dialog box that pops up after clicking the property.

After editing, the effect is as follows:

Use the shortcut keys to set the method, the following screen will appear, you can directly edit the method parameters, return value type, scope, more detailed settings in the method dialog box that pops up after clicking the method.

After editing, the effect is as follows:

Next we have to draw the relationship between the classes

First, select a class and find the small icon of the small upward arrow in the figure below, as shown below

After clicking this small icon, select "Class" in the pop-up menu, and then according to your choice of relationship type (generalization, association, combination, etc.), as shown below

For example, select the "Dependency" (dependency) type, then a class setting dialog box will pop up, as shown below:

After setting this class, there is a dotted arrow between the two classes, the effect is as follows:

The above is to create a relationship and create a new class under the premise of an existing class. Let's talk about how to add a relationship to two existing classes. For example, the following pictures MyClass2 and MyClass3

First select a class, for example, select MyClass3, select the "Parent" menu item of the "Advanced" menu in the menu that pops up after right-clicking, as shown below

Then a dialog box for setting the parent class pops up, as shown below:

Click the "Choose" button in the picture above, a dialog box will pop up to let you choose a class, we choose MyClass2, as shown below:

Then return to the dialog box of setting the parent class just now, the relationship between MyClass3 and MyClass2 is shown in the red box in the figure below

After clicking the "Close" button in the figure above, there is a solid arrow between MyClass2 and MyClass3, as shown in the following figure:

Click on the relationship and select the "Changed Type" menu item from the "Advanced" menu in the pop-up menu, as shown below:

After clicking "Change Type", a dialog box for selecting the relationship type pops up, as shown below:

For example, I want to change to Dependency, as shown below:

Then a confirmation dialog box will pop up, click "Yes", as shown below:

After confirmation, the relationship changes, and the arrow becomes a dotted line, the effect is as follows:


————————————————
Copyright Statement: This article is an original article by CSDN blogger "cfeibiao", following the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement for reprint .
Original link: https://blog.csdn.net/cfeibiao/article/details/8545083

Published 13 original articles · Likes6 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/majianting/article/details/103011727