I am using EA's Shape Script to define custom additions to standard connectors. I want to add a circle at the source end of the connector and color/fill that inline with a tagged value. I also hide the stereotype label on the connector. I can do all of these (see Shape Script below).
I created an MDG Technology that allows me to create relationships with this formatting and the tagged values.
The problem is that these relationships don't have the default target end. The line stays as default, the circle at source is as required and formats according to tagged values, but the target end arrow disappears.
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
}
I have tried adding
shape target {
}
and
shape target {
DrawNativeShape();
}
with no change.
Sparx have confirmed that this is a bug that will be fixed in a future release of Enterprise Architect (Issue ID: 17025526). The workaround is to redraw the target shapes as shown below. There may be another bug in that I could not fill the target shape for Composition. I tried several methods including filling a polygon and drawing several lines to fill the shape - none worked.
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);
}
}