Good afternoon,
I'm currently trying to create a custom shapescript for a stereotype derived from Port.
shape main{
startpath();
rectangle(0,0,100,100);
endpath();
setfillcolor(0,0,0);
fillandstrokepath();
}
shape label {
if (hasproperty("parentedge","top"))
{
setorigin("NE",0,0);
println("top");
}
if (hasproperty("parentedge","bottom"))
{
setorigin("SE",0,0);
println("bottom");
}
if (hasproperty("parentedge","left"))
{
setorigin("NW",0,0);
println("left");
}
if (hasproperty("parentedge","right"))
{
setorigin("NE",0,0);
println("right");
}
}
As you probably see, I want the port's label to change its relative position depending on the ports position relative to its parent element. The text of the labels is always correct, so that I can assume that the right if statement is entered! But the position change doesn't work at all.
1) How does setorigin() work?
2) Where is the reference origin to which I specify the offsets?
3) Is setorigin() the right method to do the job?
Thanks in advance!