![]() |
Gridarta Editor
|
Attaches maps to adjacent tiled maps. More...
Public Member Functions | |
AttachTiledMaps (@NotNull final MapManager< G, A, R > mapManager, @NotNull final TileLink @NotNull[] tileLinks) | |
Creates a new instance. More... | |
void | attachTiledMaps (@NotNull final MapModel< G, A, R > mapModel, @NotNull final String @NotNull[] tilePaths, @NotNull final File mapsDirectory, final boolean performAction) throws CannotLoadMapFileException, CannotSaveMapFileException, MapSizeMismatchException, UnsavedMapException |
Updates tile paths of a map. More... | |
Private Member Functions | |
void | fillAdjacentMaps (@NotNull final List< MapControl< G, A, R >> mapControls) throws CannotLoadMapFileException |
Fills missing adjacent map slots. More... | |
void | loadAdjacentMaps (@NotNull final MapModel< G, A, R > mapModel, @NotNull final Collection< MapControl< G, A, R >> mapControls, @NotNull final String @NotNull[] tilePaths) throws CannotLoadMapFileException |
Loads adjacent map files by "filling" them by checking the "side" path links of the loaded ones. More... | |
MapControl< G, A, R > | loadMapControl (@NotNull final MapModel< G, A, R > mapModel, @NotNull final String path) throws IOException |
Loads an adjacent MapControl, ignoring any (I/O-)errors. More... | |
void | saveAdjacentMaps (@NotNull final Iterable< MapControl< G, A, R >> mapControls) throws CannotSaveMapFileException |
Saves adjacent maps. More... | |
void | updateTilePaths (@NotNull final MapModel< G, A, R > mapModel, @NotNull final List< MapControl< G, A, R >> mapControls, @NotNull final String @NotNull[] tilePaths, @NotNull final File mapsDirectory) throws CannotSaveMapFileException |
Updates map tile paths to match the loaded maps. More... | |
void | validateMapSizes (@NotNull final MapModel< G, A, R > mapModel, @NotNull final Iterable< MapControl< G, A, R >> mapControls) throws MapSizeMismatchException |
Validates all links to check that attached maps have matching width/height. More... | |
Static Private Member Functions | |
static int | getLastSlashIndex (@NotNull final String base) |
Returns the index of the last '/' or File#separator within a string. More... | |
static String | getTilePath (@NotNull final String base, @NotNull final String link, @NotNull final File mapsDirectory) throws CannotSaveMapFileException |
Returns the map path for a tile of a map and a tile path. More... | |
Private Attributes | |
final MapManager< G, A, R > | mapManager |
The mainControl to use. More... | |
final TileLink[] | tileLinks |
The tile links for the attach map algorithm. More... | |
Attaches maps to adjacent tiled maps.
Definition at line 50 of file AttachTiledMaps.java.
net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.AttachTiledMaps | ( | @NotNull final MapManager< G, A, R > | mapManager, |
@NotNull final TileLink @NotNull[] | tileLinks | ||
) |
Creates a new instance.
mapManager | the map manager to use |
tileLinks | the tile links to use |
Definition at line 69 of file AttachTiledMaps.java.
void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.attachTiledMaps | ( | @NotNull final MapModel< G, A, R > | mapModel, |
@NotNull final String @NotNull[] | tilePaths, | ||
@NotNull final File | mapsDirectory, | ||
final boolean | performAction | ||
) | throws CannotLoadMapFileException, CannotSaveMapFileException, MapSizeMismatchException, UnsavedMapException |
Updates tile paths of a map.
mapModel | the map model to update |
tilePaths | the new tile paths; empty slots will be filled in |
mapsDirectory | the maps directory |
performAction | whether the action should be performed |
CannotLoadMapFileException | if a map file cannot be loaded |
CannotSaveMapFileException | if a map file cannot be saved |
MapSizeMismatchException | if adjacent map sizes do not match |
UnsavedMapException | if a map file is not saved |
Definition at line 85 of file AttachTiledMaps.java.
|
private |
Fills missing adjacent map slots.
mapControls | the loaded maps; will be updated |
CannotLoadMapFileException | if a map file cannot be loaded |
Definition at line 168 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().
|
staticprivate |
Returns the index of the last '/' or File#separator within a string.
base | the string |
Definition at line 320 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.getTilePath().
|
staticprivate |
Returns the map path for a tile of a map and a tile path.
base | the map path of the map |
link | the tile path of the map; may be relative to base
|
mapsDirectory | the maps directory |
CannotSaveMapFileException | if an I/O error occurs |
Definition at line 284 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.updateTilePaths().
|
private |
Loads adjacent map files by "filling" them by checking the "side" path links of the loaded ones.
mapModel | the map model |
mapControls | the return value |
tilePaths | the new tile paths |
CannotLoadMapFileException | if a map file cannot be loaded |
Definition at line 125 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().
|
private |
Loads an adjacent MapControl, ignoring any (I/O-)errors.
mapModel | the map model for relative map paths |
path | the map path |
IOException | if an I/O error occurs |
Definition at line 266 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.fillAdjacentMaps(), and net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.loadAdjacentMaps().
|
private |
Saves adjacent maps.
I/O errors are reported to the user but otherwise ignored.
mapControls | the adjacent maps to save |
CannotSaveMapFileException | if the map cannot be saved |
Definition at line 147 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().
|
private |
Updates map tile paths to match the loaded maps.
mapModel | the map model |
mapControls | the loaded maps |
tilePaths | the tile paths to update |
mapsDirectory | the maps directory |
CannotSaveMapFileException | if a map file cannot be saved |
Definition at line 229 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().
|
private |
Validates all links to check that attached maps have matching width/height.
Reports an error to the user if a non-matching size is detected.
mapModel | the map model |
mapControls | the attached maps to check |
MapSizeMismatchException | if a mismatched map size was detected |
Definition at line 204 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().
|
private |
The mainControl to use.
Definition at line 56 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.AttachTiledMaps(), net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps(), and net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.loadMapControl().
|
private |
The tile links for the attach map algorithm.
Definition at line 62 of file AttachTiledMaps.java.
Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.AttachTiledMaps(), net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.fillAdjacentMaps(), and net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.updateTilePaths().