`

PlantUML连线的注意事项

 
阅读更多

PlantUML教程中(http://s.plantuml.com/PlantUML_Language_Reference_Guide_ZH.pdf),4.5更多分支一节,代码如下:

 

@startuml

(*) --> if "Some Test" then

-->[true] "activity 1"

if "" then

-> "activity 3" as a3

else

if "Other test" then

-left-> "activity 5"

else

--> "activity 6"

endif

endif

 

else

->[false] "activity 2"

endif

 

a3 --> if "last test"then

--> "activity 7"

else

-> "activity 8"

endif

 

@enduml

 

如果不用 a3 --> if "last test"... 而是直接写 --> if "last test"...,那么活动图里面activity 2节点就会有线连接到 "last test"节点,这里需要注意一下。

 

 

如果想从别的分区A的point 1节点连到分区B,然后分区B连回"point 2"节点,不想让point 1节点与point 2节点相连,就要给写成如下代码,并且p2的定义必须在引用它之前才行。

 

partition A {

   ...

   --> "point 1" as p1

 

   "point 2" as p2 --> ...

}

 

partition B {

   p1 --> ...

   --> p2

}

 

另外,poing 2 as p2必须和后面的--> xxx 写在同一行。就类似(*) --> xxx一样。如果只写poing 2 as p2,会报错。

 

另外,如果partition B 里面写了"point 1" --> ...,而没有使用别名p1,那么出来的图就是A区显示point 1节点,B区显示point 1节点,但是两个节点之间没有连线。

 

 

  • 大小: 24 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics