|
@@ -26,7 +26,7 @@ public class TemplateUtils {
|
|
|
}
|
|
|
drawTemplateName(template,g);
|
|
|
drawTemplateSelf(template,g);
|
|
|
-// drawShadow(template,g);
|
|
|
+ drawShadow(template,g);
|
|
|
}
|
|
|
|
|
|
private static void drawTemplateName(Template template, Graphics g) {
|
|
@@ -132,19 +132,19 @@ public class TemplateUtils {
|
|
|
int shadowY = shadow.getY();
|
|
|
switch (rotateRange){
|
|
|
case 1:
|
|
|
- shadow.setX(-shadowY);
|
|
|
- shadow.setY(shadowX);
|
|
|
+ shadow.setX(shadowY);
|
|
|
+ shadow.setY(-shadowX);
|
|
|
break;
|
|
|
case 2:
|
|
|
shadow.setX(-shadowX);
|
|
|
shadow.setY(-shadowY);
|
|
|
break;
|
|
|
case 3:
|
|
|
- shadow.setX(shadowY);
|
|
|
- shadow.setY(-shadowX);
|
|
|
+ shadow.setX(-shadowY);
|
|
|
+ shadow.setY(shadowX);
|
|
|
break;
|
|
|
}
|
|
|
- shadow.setDirect((shadow.getDirect()+rotateRange)%4);
|
|
|
+ shadow.setDirect((shadow.getDirect()+rotateRange-1)%4+1);
|
|
|
}
|
|
|
|
|
|
public static void changeTemplateAlignWall(Template template,int rotateRange){
|
|
@@ -162,7 +162,7 @@ public class TemplateUtils {
|
|
|
* @param template
|
|
|
* @param x,y
|
|
|
*/
|
|
|
- private static void routeTemplate(TemplateConfig template, int x, int y) {
|
|
|
+ private static void moveTemplate(TemplateConfig template, int x, int y) {
|
|
|
x = x*Constant.ENLARGE/Constant.NARROW;
|
|
|
y = y*Constant.ENLARGE/Constant.NARROW;
|
|
|
template.setX(template.getX()+x);
|
|
@@ -172,34 +172,39 @@ public class TemplateUtils {
|
|
|
TemplateShadow shadow = template.getShadow();
|
|
|
int cx = room.getX()+template.getX()+shadow.getX();
|
|
|
int cy = room.getY()+template.getY()+shadow.getY();
|
|
|
+ System.out.println(template.getName()+"阴影接入点:"+cx+","+cy);
|
|
|
int x1,y1,x2,y2;
|
|
|
+// g.drawArc(cx,cy,6,6,0,360);
|
|
|
+// if(1==1){
|
|
|
+// return;
|
|
|
+// }
|
|
|
Graphics2D g2d = (Graphics2D) g.create();
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
g2d.setColor(Color.GRAY);
|
|
|
+ int shadowWidth = shadow.getWidth();
|
|
|
+ if(shadowWidth < 0){
|
|
|
+ shadowWidth = -shadowWidth;
|
|
|
+ }
|
|
|
switch (shadow.getDirect()){
|
|
|
- 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());
|
|
|
+ x1 = cx-shadow.getWidth()/2;
|
|
|
+ y1 = cy;
|
|
|
+ g2d.fillRect(x1,y1,shadowWidth,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(),shadow.getRadis());
|
|
|
+ x1 = cx;
|
|
|
+ y1 = cy - shadowWidth/2;
|
|
|
+ g2d.fillRect(x1,y1,shadow.getRadis(),shadowWidth);
|
|
|
break;
|
|
|
case 3:
|
|
|
x1 = cx-shadow.getRadis()/2;
|
|
|
- y1 = cy;
|
|
|
- x2 = cx+shadow.getRadis();
|
|
|
- y2 = cy + template.getWidth()/2;
|
|
|
- g2d.fillRect(x1,y1,shadow.getRadis(),shadow.getRadis());
|
|
|
+ y1 = cy-shadowWidth;
|
|
|
+ g2d.fillRect(x1,y1,shadowWidth,shadow.getRadis());
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ x1 = cx-shadow.getRadis();
|
|
|
+ y1 = cy-shadowWidth/2;
|
|
|
+ g2d.fillRect(x1,y1,shadow.getRadis(),shadowWidth);
|
|
|
break;
|
|
|
default:break;
|
|
|
}
|