Home  >  Article  >  Development Tools  >  Analysis on how to draw UML in PhpStorm

Analysis on how to draw UML in PhpStorm

藏色散人
藏色散人forward
2021-07-13 14:49:132384browse

IDE support

  • Phpstorm

    • Installation in Plugins PlantUML integrationplug-in

    • ##Go to

      http://www.graphviz.org/ website to downloadgraphviz.exe and install (this The software can support more UML syntax)

    • Add the

      dot.exe path in the graphviz installation directory to the PlantUML settings

Documentation

  • Document address:

    http://plantuml.com/

  • It is recommended to use

    Activity Diagram-Activity-bateSyntax: Activity Diagram Activity-Beta(https://plantuml.com/zh/activity-diagram-beta)

  • Activity diagram (new syntax)

The current syntax of activity diagram (activity diagram) has many limitations and shortcomings, such as the code is difficult to maintain. Therefore, starting from V7947, a new and better syntax format and software implementation are proposed for users to use (beta version). Just like sequence diagrams, another advantage of the new software implementation is that it no longer relies on Graphviz.

The new syntax will replace the old syntax. However, for compatibility reasons, the old syntax can still be used to ensure forward compatibility.
But we encourage users to use the new syntax format.

Grammar

Basics

  • @startuml, @endumlStart and end tags , representing the UML parsing part

  • start, end represents the start and end of the diagram. The beginning and end of the illustration.

  • :Hello world;The activity label starts with a colon and ends with a semicolon. Activities are installed by default in the order in which they are defined.

  • if, then, else, and elseif set up branch tests. Label text is placed in brackets.

  • repeat, repeatwhile Repeat the loop.

  • while and endwhile perform a while loop. You can also add a label after the keyword endwhile. Another way is to use the keyword is.

  • fork, fork again and end fork represent parallel processing.

  • note, end note, floating note left, etc. represent comments, for example:

floating note left: This is a note
:foo2;
note right
  This note is on several
  //lines// and can
  contain <b>HTML</b>
  ====
  * Calling the method ""foo()"" is prohibited
end note
  • #HotPin:activity;#AAAAAA:ending of the process; represents the color

  • Using the

    -> tag, you can add text to the arrow or change the arrow color. dotted, dashed, bold or hidden arrows and color tags, such as -[#blue]->

  • By defining partitions, you can group multiple activities together. By defining partitions, you can group multiple activities together. For example:

partition Initialization {
    :read config file;
    :init internal variable;
}
  • Use the pipe character | to define swim lanes. You can also change the color of the swim lanes.

|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
  • Keywords

    detachRemove the arrow.

  • You can set different shapes for activities by modifying the semicolon separator (;) at the end of the activity label.

    |,,/,],}

:next(o)|
:Receiving;
split
 :nak(i)
split again
 :ack(i)
split again
 :err(i)
split again
 :foo/
split again
 :i > 5}
stop
end split
:finish;
An example

@startuml
start
if (is login?) then (Y)
    if (gived box?) then (Y)
        :illegal request;
        detach
    else (N)
        :release box;
        :get boxOid;
    endif
else (N)
    if (has boxOid?) then (N)
        :illegal request;
        detach
    endif
endif

:check wechat broswer;
if (wechat broswer?) then (Y)
    if (get openid from cookie?) then (Y)
        if (get userInfo from DB by openid?) then (N)
            :clear openid in cookie;
            :re-request Url;
            detach
        endif
    else (N)
        :location wechat auth;
        detach
    endif
endif

:receive chocolate;

end
@enduml

Analysis on how to draw UML in PhpStorm


For more phpstorm technical articles, please visit the

phpstorm tutorial column!

The above is the detailed content of Analysis on how to draw UML in PhpStorm. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete