1

我想知道是否有可能在 UMLet 中表示序列图的 UML2 边界/控制/实体符号?( http://www.uml.org.cn/oobject/images/seq02.gif )

我必须自己编写他们的java代码还是它已经存在于某个地方?

4

3 回答 3

1

这是我用来在 UMLet 中创建边界符号的片段。您可以根据需要对其进行更改。

int h = height - textHeight() * textlines.size();
int radius = h/2;
drawCircle(width-radius, radius, radius);
drawLine(0, 10, 0, h-10);
drawLine(0, radius, width-h, radius);

int y = textHeight()+5;
for(String textline : textlines) {
    printCenter(textline, height-3);
}

预览:

在此处输入图像描述

于 2015-04-20T00:16:10.093 回答
0

我不确定您是指序列,还是序列一体机。

虽然不支持这些新生命线,但您可以轻松地向前者添加自定义元素。有一个很好的简单教程如何在这里添加一个新元素http://www.umlet.com/ce/ce.htm

如果要将其添加到一体机中,则需要深入研究内部结构,因为它还需要对文本解析器进行更改。

于 2015-04-02T08:11:07.583 回答
0

所以我根据诺亚自己的模型做了一些模型。它远非专业的东西,而且是相当肮脏的代码,但我猜它确实有一段时间了。因此,如果在 UMLet 中更好地实现这些符号之前,有人遇到与我相同的问题:

实体 :

int h = height - textHeight() * textlines.size();
int radius = h*2/5;
int w = radius*2 ;

double x = (width - w)/2 + radius ;
double y = h/10 + radius;

double x2 = x + radius/4 * Math.sqrt(3);
double y2 = y - radius/4 ;

drawCircle((int)x, (int) y, radius);
drawLine((int)x-radius , (int)y + radius  ,  (int) x+ radius, (int) y+radius);
drawLine((int)x - radius , (int) y - 2*radius  , (int) x + radius, (int) y - 2*radius);

for(String textline : textlines) {
    printCenter(textline, h);
}

控制 :

    int h = height - textHeight() * textlines.size();
int radius = h*2/5;
int w = radius*2 ;

double x1 = (width - w)/2 + radius ;
double y1 = h/10;

double x2 = x1 + radius/4 * Math.sqrt(3);
double y2 = y1 - radius/4 ;

double x3 =  x1 +  radius/4 * Math.sqrt(3);
double y3 =  y1 + radius/4;

drawCircle((int)x1, (int) y1+radius, radius);
drawLine((int)x1, (int) y1 , (int)x2, (int)y2);
drawLine((int)x1, (int) y1 , (int)x3, (int)y3);

int y = textHeight()+5;

for(String textline : textlines) {
    printCenter(textline, h);
}
于 2015-05-02T20:49:36.510 回答