Package ch.sahits.game.graphic.image
Class MapSegmentCreator
- java.lang.Object
-
- ch.sahits.game.graphic.image.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
baseDir
private SelectiveCachableXMLImageLoader
imageLoader
private SwingFXImageConvertor
swingUtils
-
Constructor Summary
Constructors Constructor Description MapSegmentCreator()
-
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 mapprivate void
storeInImageLoader(javafx.scene.image.Image image, java.lang.String fileName)
-
-
-
Field Detail
-
baseDir
private final java.lang.String baseDir
-
imageLoader
@Autowired private SelectiveCachableXMLImageLoader imageLoader
-
swingUtils
@Autowired private SwingFXImageConvertor swingUtils
-
-
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 interfaceIMapSegmentImageCreator
- Parameters:
priateNest
- for which to create the map segmentmapImage
- 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 interfaceIMapSegmentImageCreator
- Parameters:
treasure
- for which to create the map segmentmapImage
- 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 interfaceIMapSegmentImageCreator
- Parameters:
hideout
- for which to create the map segmentmapImage
- 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 interfaceIMapSegmentImageCreator
- Parameters:
fileName
- map name tag
-
-