Class MapImageServiceFacade

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int countLandPixels​(javafx.geometry.Point2D point, int radius, java.util.List<ECircleSegment> segments)
      Count the number of black pixels in a circle around point with radius.
      double distanceToShore​(javafx.geometry.Point2D point, double max)
      Check the if there is shore within a certain radius of max.
      int getHeight()
      Retrieve the height of the map in pixels.
      javafx.geometry.Point2D getLocationAtOtherEndOfMap​(javafx.geometry.Point2D point)
      Retrieve a random ponint that is at sea.
      javafx.geometry.Point2D getRandomPointAtSea()
      Retrieve a random ponint that is at sea.
      javafx.geometry.Point2D getRandomPointAtSeaNear​(javafx.geometry.Point2D location)
      Retrieve a random ponint that is at sea.
      int getWidth()
      £Retrieve the width of the map in pixels.
      (package private) void init()  
      boolean isOnSea​(int x, int y)
      Check if a location on the image is white meaning it is at sea.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • map

        @Autowired
        private IMap map
      • bwMap

        private java.awt.image.BufferedImage bwMap
    • Constructor Detail

      • MapImageServiceFacade

        public MapImageServiceFacade()
    • Method Detail

      • init

        @PostConstruct
        void init()
           throws java.io.IOException
        Throws:
        java.io.IOException
      • isOnSea

        public boolean isOnSea​(int x,
                               int y)
        Description copied from interface: IMapImageServiceFacade
        Check if a location on the image is white meaning it is at sea.
        Specified by:
        isOnSea in interface IMapImageServiceFacade
        Parameters:
        x - location to be checked
        y - location to be checked
        Returns:
        true if the coordinates represent a coordinate at sea.
      • distanceToShore

        public double distanceToShore​(javafx.geometry.Point2D point,
                                      double max)
                               throws java.io.IOException
        Description copied from interface: IMapImageServiceFacade
        Check the if there is shore within a certain radius of max. If there is the approximate distance is returned.
        Specified by:
        distanceToShore in interface IMapImageServiceFacade
        Parameters:
        point - that is to be checked.
        max - maximum radius
        Returns:
        maximum radius or approximate distance to the shore, whatever is smaller. If the approximate distance is returned it may be smaller than the actual distance to the nearest land.
        Throws:
        java.io.IOException
      • countLandPixels

        public int countLandPixels​(javafx.geometry.Point2D point,
                                   int radius,
                                   java.util.List<ECircleSegment> segments)
                            throws java.io.IOException
        Description copied from interface: IMapImageServiceFacade
        Count the number of black pixels in a circle around point with radius.
        Specified by:
        countLandPixels in interface IMapImageServiceFacade
        Parameters:
        point - center point around which should be checked
        radius - radius of the area that should be checked.
        Returns:
        number of pixels that represent land.
        Throws:
        java.io.IOException
      • getLocationAtOtherEndOfMap

        public javafx.geometry.Point2D getLocationAtOtherEndOfMap​(javafx.geometry.Point2D point)
        Description copied from interface: IMapImageServiceFacade
        Retrieve a random ponint that is at sea.
        Specified by:
        getLocationAtOtherEndOfMap in interface IMapImageServiceFacade
        Parameters:
        point - near where the random point has to be located.
        Returns:
        point located on the sea.