当一个元素属于两个组时,UML图中对象的交集是什么?

3
请告诉我如何将此代码中的 [VirtualService] 作为 VS,以便它既属于“Ingress”组,也属于“Application”组。 结果证明,交集和组件 [VirtualService] 可以在“Ingress”组或“Application”组中,您需要在这两个组中都有。请帮忙。
@startuml
' Remove shadows
skinparam shadowing false
skinparam BackgroundColor transparent
skinparam componentStyle rectangle
skinparam roundCorner 15
 
left to right direction
skinparam linetype polyline
skinparam linetype ortho

И3#transparent;line:transparent;text:transparent
rectangle "Кластер OpenShift" #MOTIVATION  {
    component "Точка входа" as TV #white{
[Rout] as ROUT #grey;text:white
И3->ROUT #blue
И3<..ROUT #blue
}
rectangle "OS Namespase" as OS #white {
component Application as PR #LightPink {

[VirtualService] as VS #grey;text:white


[App Service] as AS #grey;text:white
[App\nPod] as AP

}
    
 component Ingress as IG #LightSkyBlue {

 [Ingress\nService] as IS #grey;text:white

[Geteway)] as G #grey;text:white
[Ingress\nPod] as IP
 [VirtualService] as VS #grey;text:white
 }

component Приложение as PR #LightPink {

[VirtualService] as VS #grey;text:white


[App Service] as AS #grey;text:white
[App\nPod] as AP

}
}
}

ROUT ->IS #blue 
ROUT  <.. IS #blue
IS ->G #blue 
IS <..G #blue

G->IP #blue 
G<..IP #blue

IP->VS #blue 
IP<..VS #blue

VS->AS #blue 
VS<..AS #blue

AS->AP #blue 
AS<..AP #blue



@enduml


enter image description here


这个问题和 https://stackoverflow.com/questions/66381662/intersection-of-objects-in-a-uml-diagram-when-one-element-belongs-to-two-groups 这个问题有什么区别? - albert
1个回答

2
由于GraphViz是底层引擎,所以不可能实现(参见这个答案)。
但是,您可以有创意地创建一个共享组,该组具有两种颜色。
@startuml
' Remove shadows
skinparam shadowing false
skinparam BackgroundColor transparent
skinparam componentStyle rectangle
skinparam roundCorner 0
 
left to right direction
skinparam linetype ortho

И3#transparent;line:transparent;text:transparent
rectangle "Кластер OpenShift" #MOTIVATION  {
  component "Точка входа" as TV #white{
    [Rout] as ROUT #grey;text:white
    И3->ROUT #blue
    И3<..ROUT #blue
  }
  rectangle "OS Namespace" as OS #white {
    rectangle Application as PR #LightPink;line:transparent {
      [App Service] as AS #grey;text:white
      [App\nPod] as AP
    }
    
    rectangle Ingress as IG #LightSkyBlue;line:transparent {
      [Ingress\nService] as IS #grey;text:white
      [Gateway] as G #grey;text:white
      [Ingress\nPod] as IP
    }

    rectangle "//(shared)//\n" as hidden #LightSkyBlue|LightPink;line:transparent{
      [VirtualService] as VS #grey;text:white
    }
  }
}


ROUT ->IS #blue 
ROUT  <.. IS #blue
IS ->G #blue 
IS <..G #blue

G-> IP #blue 
G<..IP #blue

IP->VS #blue 
IP<..VS #blue

VS->AS #blue 
VS<..AS #blue

AS->AP #blue 
AS<..AP #blue

@enduml

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接