|
@@ -5,6 +5,7 @@ import config.subConfig.TemplateConfig;
|
|
|
import config.subConfig.TemplateShadowConfig;
|
|
|
import constant.Constant;
|
|
|
import model.Room;
|
|
|
+import model.template.Template;
|
|
|
|
|
|
import java.awt.*;
|
|
|
import java.util.ArrayList;
|
|
@@ -18,23 +19,23 @@ import java.util.List;
|
|
|
public class TemplateUtils {
|
|
|
private static Room room;
|
|
|
private static AxisConfig axisPointConfig;
|
|
|
- public static void drawTemplate(TemplateConfig template, Graphics g){
|
|
|
+ public static void drawTemplate(Template template, Graphics g){
|
|
|
if(null == room){
|
|
|
System.out.println("--------------room is not exist !!");
|
|
|
return;
|
|
|
}
|
|
|
drawTemplateName(template,g);
|
|
|
drawTemplateSelf(template,g);
|
|
|
-// drawShadow(template,g);
|
|
|
+ drawShadow(template,g);
|
|
|
}
|
|
|
|
|
|
- private static void drawTemplateName(TemplateConfig template, Graphics g) {
|
|
|
+ private static void drawTemplateName(Template template, Graphics g) {
|
|
|
int x1 = room.getX()+template.getX()+template.getLength()/2;
|
|
|
int y1 = room.getY()+template.getY()+template.getWidth()/2;
|
|
|
g.drawString(template.getName(), x1, y1);
|
|
|
}
|
|
|
|
|
|
- private static void drawTemplateSelf(TemplateConfig template, Graphics g){
|
|
|
+ private static void drawTemplateSelf(Template template, Graphics g){
|
|
|
int length = template.getLength();
|
|
|
int width = template.getWidth();
|
|
|
int x1 = room.getX()+template.getX();
|
|
@@ -72,7 +73,7 @@ public class TemplateUtils {
|
|
|
* @param g
|
|
|
* @param rotateRange
|
|
|
*/
|
|
|
- private static void drawTemplateSelfByRotate(TemplateConfig template, Graphics g,int rotateRange){
|
|
|
+ private static void drawTemplateSelfByRotate(Template template, Graphics g,int rotateRange){
|
|
|
routeTemplateConfig(template,rotateRange);
|
|
|
}
|
|
|
|
|
@@ -81,7 +82,7 @@ public class TemplateUtils {
|
|
|
* @param template
|
|
|
* @param rotateRange
|
|
|
*/
|
|
|
- private static void routeTemplateConfig(TemplateConfig template, int rotateRange) {
|
|
|
+ private static void routeTemplateConfig(Template template, int rotateRange) {
|
|
|
int length = template.getLength();
|
|
|
int width = template.getWidth();
|
|
|
changeTemplateAlignWall(template,rotateRange);
|
|
@@ -97,7 +98,7 @@ public class TemplateUtils {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- public static void changeTemplateAlignWall(TemplateConfig template,int rotateRange){
|
|
|
+ public static void changeTemplateAlignWall(Template template,int rotateRange){
|
|
|
List<Integer> list = template.getAlignWall();
|
|
|
List<Integer> newlist = new ArrayList<>();
|
|
|
for(int i = 0;i<list.size();i++){
|
|
@@ -118,10 +119,10 @@ public class TemplateUtils {
|
|
|
template.setX(template.getX()+x);
|
|
|
template.setY(template.getY()+y);
|
|
|
}
|
|
|
- private static void drawShadow(TemplateConfig template, Graphics g){
|
|
|
+ private static void drawShadow(Template template, Graphics g){
|
|
|
TemplateShadowConfig shadow = template.getShadow();
|
|
|
- int cx = room.getX()+shadow.getX();
|
|
|
- int cy = room.getY()+shadow.getY();
|
|
|
+ int cx = room.getX()+template.getX()+shadow.getX();
|
|
|
+ int cy = room.getY()+template.getY()+shadow.getY();
|
|
|
int x1,y1,x2,y2;
|
|
|
Graphics2D g2d = (Graphics2D) g.create();
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|