|
@@ -26,7 +26,7 @@ public class TemplateUtils {
|
|
|
}
|
|
|
drawTemplateName(template,g);
|
|
|
drawTemplateSelf(template,g);
|
|
|
- drawShadow(template,g);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private static void drawTemplateName(Template template, Graphics g) {
|
|
@@ -144,6 +144,7 @@ public class TemplateUtils {
|
|
|
shadow.setY(-shadowX);
|
|
|
break;
|
|
|
}
|
|
|
+ shadow.setDirect((shadow.getDirect()+rotateRange)%4);
|
|
|
}
|
|
|
|
|
|
public static void changeTemplateAlignWall(Template template,int rotateRange){
|
|
@@ -179,11 +180,21 @@ public class TemplateUtils {
|
|
|
case 0:
|
|
|
x1 = cx;
|
|
|
y1 = cy - template.getWidth()/2;
|
|
|
+ g2d.fillRect(x1,y1,shadow.getRadis(),template.getWidth());
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ x1 = cx-shadow.getRadis()/2;
|
|
|
+ y1 = cy-template.getWidth();
|
|
|
+ g2d.fillRect(x1,y1,shadow.getRadis(),shadow.getRadis());
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ x1 = cx-shadow.getRadis();
|
|
|
+ y1 = cy-template.getWidth();
|
|
|
x2 = cx+shadow.getRadis();
|
|
|
y2 = cy + template.getWidth()/2;
|
|
|
- g2d.fillRect(x1,y1,shadow.getRadis(),template.getWidth());
|
|
|
+ g2d.fillRect(x1,y1,shadow.getRadis(),shadow.getRadis());
|
|
|
break;
|
|
|
- case 90:
|
|
|
+ case 3:
|
|
|
x1 = cx-shadow.getRadis()/2;
|
|
|
y1 = cy;
|
|
|
x2 = cx+shadow.getRadis();
|
|
@@ -216,8 +227,26 @@ public class TemplateUtils {
|
|
|
System.out.println("room.getLength()=" + room.getLength());
|
|
|
return templateTotalLength<=room.getLength();
|
|
|
}
|
|
|
- public static void drawTemplates(List<TemplateConfig> templateConfigs){
|
|
|
-
|
|
|
+ public static void calcYizhiTemplatesAndDraw(List<TemplateConfig> templateConfigs,Graphics g){
|
|
|
+ int roomAlign = 3;
|
|
|
+ int positionOff = 0;
|
|
|
+ for (TemplateConfig templateConfig : templateConfigs){
|
|
|
+ Template template = new Template(templateConfig);
|
|
|
+ List<Integer> alignWall = template.getAlignWall();
|
|
|
+ int templateAlignWall = alignWall.get(0);
|
|
|
+ int routeTimes = roomAlign-templateAlignWall%4;
|
|
|
+ if(routeTimes<0){
|
|
|
+ routeTimes+=4;
|
|
|
+ }
|
|
|
+ if(routeTimes!=0){
|
|
|
+ routeTemplate(template,routeTimes);
|
|
|
+ }
|
|
|
+ template.setY(template.getY()-room.getWidth());
|
|
|
+ if(template.getLength()<0){
|
|
|
+ template.setX(template.getX()-template.getLength());
|
|
|
+ }
|
|
|
+ drawTemplate(template,g);
|
|
|
+ }
|
|
|
}
|
|
|
public static void setRoom(Room room) {
|
|
|
TemplateUtils.room = room;
|