Sfoglia il codice sorgente

contains method for walking area added

Gilian Joosen 10 anni fa
parent
commit
1b35d951b7
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 8 1
      src/gui/simulator/DrawEngine.java

+ 8 - 1
src/gui/simulator/DrawEngine.java

@@ -56,7 +56,14 @@ public abstract class DrawEngine {
         Shape shape = new Rectangle2D.Double(0, 0, Images.getImage(image).getWidth(null),Images.getImage(image).getHeight(null));
         return this.getAffineTransform().createTransformedShape(shape).contains(point);
     }
-    
+
+    public boolean containsWalkArea(Point2D point){
+        if(this.walkArea == null){
+            return false;
+        }
+        return this.getAffineTransform().createTransformedShape(this.walkArea).contains(point);
+    }
+
     public Image getImage(){
     	return Images.getImage(image);
     }