Package de.tum.cit.ase.editor.utlis
Class MapGenerator
java.lang.Object
de.tum.cit.ase.editor.utlis.MapGenerator
The MapGenerator class is responsible for generating, saving, importing, and validating maps.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidExports a Map object to a specified file.static voidstatic MapimportMap(com.badlogic.gdx.files.FileHandle mapFile) Imports a map from a file and converts it into a Map object.static voidloadMapIntoGame(Map map) Loads a map into the game.static MapreadMapProject(com.badlogic.gdx.files.FileHandle mapFile) Reads a map project file and converts it into a Map object.static voidsaveMapProject(com.badlogic.gdx.files.FileHandle mapFile, Map mapToSave) Saves a map project to a specified file.static voidvalidateExport(Map map) Validates an exported map by checking for check specified inEditorConfig.
-
Constructor Details
-
MapGenerator
public MapGenerator()
-
-
Method Details
-
saveMapProject
Saves a map project to a specified file.- Parameters:
mapFile- TheFileHandlerepresenting the file to save the map project to.mapToSave- TheMapobject to save.- Throws:
InvalidMapFile- if the map is invalid.
-
validateExport
Validates an exported map by checking for check specified inEditorConfig.- Parameters:
map- TheMapobject to validate.- Throws:
InvalidMapFile- If the map is invalid.
-
loadMapIntoGame
Loads a map into the game.- Parameters:
map- TheMapobject representing the map to be loaded.- Throws:
MapLoadingException- if an error occurs while loading the map.
-
importMap
Imports a map from a file and converts it into a Map object.- Parameters:
mapFile- TheFileHandlerepresenting the file to import the map from.- Returns:
- The imported Map object.
-
readMapProject
Reads a map project file and converts it into a Map object.- Parameters:
mapFile- TheFileHandlerepresenting the file to read the map project from.- Returns:
- The
Mapobject representing the map project.
-
exportMap
Exports a Map object to a specified file.- Parameters:
map- The Map object to export.exportFile- The FileHandle representing the file to export the Map object to.
-
exportMap
public static void exportMap(Map map, com.badlogic.gdx.files.FileHandle exportFile, boolean validate)
-