Class MapSegmentCreator

  • All Implemented Interfaces:
    IMapSegmentImageCreator

    public class MapSegmentCreator
    extends java.lang.Object
    implements IMapSegmentImageCreator
    Create map segments from the map image and store them in the user directory. If they are already there load them from there and make them available to the image loader.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2015 Created on Dec 15, 2015
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.PirateHideout hideout, java.lang.String mapImage)
      Create an image from the data of a pirate hideout map.
      void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.PirateNest priateNest, java.lang.String mapImage)
      Create an image from the data of a pirate nest.
      void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.SunkenTreasure treasure, java.lang.String mapImage)
      Create an image from the data of a treasure map.
      private void createMapSegment​(java.lang.String mapImage, int topLeftX, int topLeftY, int width, int height, int x, int y, java.lang.String baseName)  
      void loadMap​(java.lang.String fileName)
      Retrieve the map image and store it in the image loader under the key map
      private void storeInImageLoader​(javafx.scene.image.Image image, java.lang.String fileName)  
      • Methods inherited from class java.lang.Object

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

      • MapSegmentCreator

        public MapSegmentCreator()
    • Method Detail

      • createMapSegment

        public void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.PirateNest priateNest,
                                     java.lang.String mapImage)
                              throws java.io.IOException
        Description copied from interface: IMapSegmentImageCreator
        Create an image from the data of a pirate nest.
        Specified by:
        createMapSegment in interface IMapSegmentImageCreator
        Parameters:
        priateNest - for which to create the map segment
        mapImage - image name tag
        Throws:
        java.io.IOException - failure in creating a map segment from the image
      • createMapSegment

        public void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.SunkenTreasure treasure,
                                     java.lang.String mapImage)
                              throws java.io.IOException
        Description copied from interface: IMapSegmentImageCreator
        Create an image from the data of a treasure map.
        Specified by:
        createMapSegment in interface IMapSegmentImageCreator
        Parameters:
        treasure - for which to create the map segment
        mapImage - image name tag
        Throws:
        java.io.IOException - failure in creating a map segment from the image
      • createMapSegment

        public void createMapSegment​(ch.sahits.game.openpatrician.data.xmlmodel.map.Map.MapSegments.PirateHideout hideout,
                                     java.lang.String mapImage)
                              throws java.io.IOException
        Description copied from interface: IMapSegmentImageCreator
        Create an image from the data of a pirate hideout map.
        Specified by:
        createMapSegment in interface IMapSegmentImageCreator
        Parameters:
        hideout - for which to create the map segment
        mapImage - image name tag
        Throws:
        java.io.IOException - failure in creating a map segment from the image
      • createMapSegment

        private void createMapSegment​(java.lang.String mapImage,
                                      int topLeftX,
                                      int topLeftY,
                                      int width,
                                      int height,
                                      int x,
                                      int y,
                                      java.lang.String baseName)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • storeInImageLoader

        private void storeInImageLoader​(javafx.scene.image.Image image,
                                        java.lang.String fileName)
      • loadMap

        public void loadMap​(java.lang.String fileName)
        Description copied from interface: IMapSegmentImageCreator
        Retrieve the map image and store it in the image loader under the key map
        Specified by:
        loadMap in interface IMapSegmentImageCreator
        Parameters:
        fileName - map name tag