Class MapImageService


  • public class MapImageService
    extends java.lang.Object
    Providing image service methods for the map.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2015 Created on Dec 28, 2015
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private IMap map  
      private java.util.Random rnd  
    • Constructor Summary

      Constructors 
      Constructor Description
      MapImageService()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int countLandPixels​(java.awt.image.BufferedImage img, javafx.geometry.Point2D point, int radius, java.util.List<ECircleSegment> segments)  
      double distanceToShore​(java.awt.image.BufferedImage img, javafx.geometry.Point2D point, double max)  
      java.awt.image.BufferedImage getBlackWhiteMap​(IMap map)  
      javafx.geometry.Point2D getLocationAtOtherEndOfMap​(java.awt.image.BufferedImage img, javafx.geometry.Point2D point)  
      javafx.geometry.Point2D getRandomPointAtSea​(java.awt.image.BufferedImage img)  
      javafx.geometry.Point2D getRandomPointAtSeaNear​(java.awt.image.BufferedImage img, javafx.geometry.Point2D location)  
      private javafx.geometry.Point2D getRandomPointAtSeaNear​(java.awt.image.BufferedImage img, javafx.geometry.Point2D location, int radius)  
      static boolean isOnSea​(java.awt.image.BufferedImage img, int x, int y)  
      private java.awt.image.BufferedImage loadMap​(IMap map)  
      • 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
      • rnd

        @Autowired
        private java.util.Random rnd
    • Constructor Detail

      • MapImageService

        public MapImageService()
    • Method Detail

      • loadMap

        private java.awt.image.BufferedImage loadMap​(IMap map)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getBlackWhiteMap

        public java.awt.image.BufferedImage getBlackWhiteMap​(IMap map)
                                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • isOnSea

        public static boolean isOnSea​(java.awt.image.BufferedImage img,
                                      int x,
                                      int y)
      • distanceToShore

        public double distanceToShore​(java.awt.image.BufferedImage img,
                                      javafx.geometry.Point2D point,
                                      double max)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • countLandPixels

        public int countLandPixels​(java.awt.image.BufferedImage img,
                                   javafx.geometry.Point2D point,
                                   int radius,
                                   java.util.List<ECircleSegment> segments)
      • getRandomPointAtSea

        public javafx.geometry.Point2D getRandomPointAtSea​(java.awt.image.BufferedImage img)
      • getRandomPointAtSeaNear

        public javafx.geometry.Point2D getRandomPointAtSeaNear​(java.awt.image.BufferedImage img,
                                                               javafx.geometry.Point2D location)
      • getRandomPointAtSeaNear

        private javafx.geometry.Point2D getRandomPointAtSeaNear​(java.awt.image.BufferedImage img,
                                                                javafx.geometry.Point2D location,
                                                                int radius)
      • getLocationAtOtherEndOfMap

        public javafx.geometry.Point2D getLocationAtOtherEndOfMap​(java.awt.image.BufferedImage img,
                                                                  javafx.geometry.Point2D point)