Commit 0db9ec1c authored by Letitia Li's avatar Letitia Li

TML2Avatar fixes

parent 8a72e270
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9342,12 +9342,17 @@ public class GTURTLEModeling {
if (originDestMap.containsKey(bl1.split("__")[bl1.split("__").length-1])){
originDestMap.get(bl1.split("__")[bl1.split("__").length-1]).add(bl2.split("__")[bl2.split("__").length-1]);
}
else if (originDestMap.containsKey(bl2.split("__")[bl2.split("__").length-1])){
originDestMap.get(bl2.split("__")[bl2.split("__").length-1]).add(bl1.split("__")[bl1.split("__").length-1]);
}
else {
Set<String> hs= new HashSet<String>();
hs.add(bl2.split("__")[bl2.split("__").length-1]);
originDestMap.put(bl1.split("__")[bl1.split("__").length-1], hs);
}
}
//System.out.println(originDestMap);
//Add Relations
for (String bl1: originDestMap.keySet()){
......
......@@ -187,10 +187,13 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
mutexStates = null;
}
public void internalDrawing(Graphics g) {
Font f = g.getFont();
Font fold = f;
f = f.deriveFont(minFontSize);
//width = g.getFontMetrics().stringWidth(value)+2*textX;
//height=width/3;
//System.out.println("width=" + width + " height=" + height);
if ((rescaled) && (!tdp.isScaled())) {
......@@ -210,8 +213,12 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
f = f.deriveFont((float)maxCurrentFontSize);
g.setFont(f);
//System.out.println("max current font size:" + maxCurrentFontSize);
while(maxCurrentFontSize > (minFontSize-1)) {
w0 = g.getFontMetrics().stringWidth(value);
if (w0 < (width - (2*textX))) {
break;
}
......@@ -231,7 +238,6 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
}
//System.out.println("Current font size:" + currentFontSize);
Color c = g.getColor();
//g.setColor(ColorManager.AVATAR_STATE);
......@@ -242,7 +248,6 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
g.drawRoundRect(x, y, width, height, 5, 5);
// Strings
int w;
int h = 0;
......@@ -407,6 +412,10 @@ public class AvatarSMDState extends TGCScalableWithInternalComponent implements
}
public void recalculateSize(){
width=Math.max(width,value.length()*11);
// System.out.println(width + " " + value);
}
public int getType() {
return TGComponentManager.AVATARSMD_STATE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment