|
@@ -40,6 +40,10 @@ public class TemplateUtils {
|
|
|
int width = template.getWidth();
|
|
|
int x1 = room.getX()+template.getX();
|
|
|
int y1 = room.getY()+template.getY();
|
|
|
+
|
|
|
+ Graphics2D g2d = (Graphics2D) g.create();
|
|
|
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
+ g2d.setColor(Color.RED);
|
|
|
if(length < 0){
|
|
|
length=-length;
|
|
|
x1 = x1-length;
|
|
@@ -48,16 +52,28 @@ public class TemplateUtils {
|
|
|
width=-width;
|
|
|
y1=y1-width;
|
|
|
}
|
|
|
- Graphics2D g2d = (Graphics2D) g.create();
|
|
|
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
- g2d.setColor(Color.RED);
|
|
|
g2d.drawRect(x1,y1,length,width);
|
|
|
+ drawAlignWall(template, length, width, x1, y1, g2d);
|
|
|
+
|
|
|
+ g2d.dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * x1 y1 为四边形左上角顶点
|
|
|
+ * @param template
|
|
|
+ * @param length
|
|
|
+ * @param width
|
|
|
+ * @param x1
|
|
|
+ * @param y1
|
|
|
+ * @param g2d
|
|
|
+ */
|
|
|
+ private static void drawAlignWall(Template template, int length, int width, int x1, int y1, Graphics2D g2d) {
|
|
|
//绘制贴墙边
|
|
|
List<Integer> alignWall = template.getAlignWall();
|
|
|
for (int alignWallValue : alignWall){
|
|
|
switch (alignWallValue){
|
|
|
case 1:
|
|
|
- g2d.fillRect(x1,y1+ Constant.CLOSE_WALL_LINE_WIDTH/2,length,Constant.CLOSE_WALL_LINE_WIDTH);
|
|
|
+ g2d.fillRect(x1,y1+width- Constant.CLOSE_WALL_LINE_WIDTH/2,length,Constant.CLOSE_WALL_LINE_WIDTH);
|
|
|
break;
|
|
|
case 2:
|
|
|
g2d.fillRect(x1+length-Constant.CLOSE_WALL_LINE_WIDTH/2,y1,length,Constant.CLOSE_WALL_LINE_WIDTH);
|
|
@@ -70,7 +86,6 @@ public class TemplateUtils {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- g2d.dispose();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -109,7 +124,7 @@ public class TemplateUtils {
|
|
|
routeTemplateShadow(template,rotateRange);
|
|
|
}
|
|
|
|
|
|
- private static void routeTemplateShadow(Template template, int rotateRange) {
|
|
|
+ public static void routeTemplateShadow(Template template, int rotateRange) {
|
|
|
TemplateShadow shadow = template.getShadow();
|
|
|
int routeX = template.getX();
|
|
|
int routeY = template.getY();
|