我正在使用EA的形状脚本来定义标准连接器的自定义添加。我想在连接器的源端添加一个圆,并使用标记值内联颜色/填充。我还隐藏了连接器上的构造型标签。我可以做所有这些(参见下面的形状脚本)。
我创建了一个MDG技术,允许我创建与此格式和标记值的关系。
问题是这些关系没有默认的目标结束。该行保持默认状态,源处的圆圈符合要求,并根据标记值进行格式化,但目标结束箭头消失。
shape source { //draw circle at source end of line
if(HasTag("Confidence","Remote or Highly Unlikely")) {
SetPen(255,0,0,1);
Print("1");
} else if(HasTag("Confidence","Improbable or Unlikely")) {
SetPen(255,0,0,1);
SetFillColor(255,0,0);
Print("2");
} else if(HasTag("Confidence","Realistic Possibility")) {
SetPen(255,191,0,1);
Print("3");
} else if(HasTag("Confidence","Probable or Likely")) {
SetPen(255,191,0,1);
SetFillColor(255,191,0);
Print("4");
} else if(HasTag("Confidence","Highly/Very Probable/Likely")) {
SetPen(0,255,0,1);
Print("5");
} else if(HasTag("Confidence","Almost Certain")) {
SetPen(0,255,0,1);
SetFillColor(0,255,0);
Print("6");
}
StartPath();
Ellipse(0,-3,6,3);
EndPath();
FillAndStrokePath();
}
shape MiddleBottomLabel { //hide <<stereotype>> label
}
我尝试过添加
shape target {
}
和
shape target {
DrawNativeShape();
}
没有变化。
答案 0 :(得分:1)
Sparx已经确认这是一个将在Enterprise Architect的未来版本中修复的错误(问题ID:17025526)。解决方法是重绘目标形状,如下所示。可能还有另一个错误,我无法填充合成的目标形状。我尝试了几种方法,包括填充多边形和绘制几条线以填充形状 - 没有工作。
shape target { //redraw targets
if(HasProperty("type","Aggregation")) {
MoveTo(0,0);
LineTo(8,4);
LineTo(16,0);
LineTo(8,-4);
LineTo(0,0);
} else if(HasProperty("type","Composition")) {
Polygon(-4,0,4,4,45);
} else if(HasProperty("type","Connector")) {
print("C");
} else if(HasProperty("type","ControlFlow")) {
MoveTo(0,0);
LineTo(8,4);
MoveTo(0,0);
LineTo(8,-4);
} else if(HasProperty("type","Dependency")) {
MoveTo(0,0);
LineTo(8,4);
MoveTo(0,0);
LineTo(8,-4);
} else if(HasProperty("type","Extension")) {
MoveTo(0,0);
LineTo(8,4);
MoveTo(0,0);
LineTo(8,-4);
} else if(HasProperty("type","Realization")) {
MoveTo(0,0);
LineTo(8,4);
LineTo(8,-4);
LineTo(0,0);
} else if(HasProperty("type","CommunicationPath")){
MoveTo(0,0);
LineTo(8,4);
MoveTo(0,0);
LineTo(8,-4);
} else if(HasProperty("type","InformationFlow")){
MoveTo(0,0);
LineTo(8,4);
MoveTo(0,0);
LineTo(8,-4);
} else if(HasProperty("type","Generalization")){
MoveTo(0,0);
LineTo(8,4);
LineTo(8,-4);
LineTo(0,0);
}
}