Gridarta Editor
net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

Attaches maps to adjacent tiled maps. More...

+ Inheritance diagram for net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

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...
 

Detailed Description

Attaches maps to adjacent tiled maps.

Author
Michael Toennies
Christian Hujer
Andreas Kirschbaum

Definition at line 50 of file AttachTiledMaps.java.

Constructor & Destructor Documentation

◆ AttachTiledMaps()

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.

Parameters
mapManagerthe map manager to use
tileLinksthe tile links to use

Definition at line 69 of file AttachTiledMaps.java.

Member Function Documentation

◆ attachTiledMaps()

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.

Parameters
mapModelthe map model to update
tilePathsthe new tile paths; empty slots will be filled in
mapsDirectorythe maps directory
performActionwhether the action should be performed
Exceptions
CannotLoadMapFileExceptionif a map file cannot be loaded
CannotSaveMapFileExceptionif a map file cannot be saved
MapSizeMismatchExceptionif adjacent map sizes do not match
UnsavedMapExceptionif a map file is not saved

Definition at line 85 of file AttachTiledMaps.java.

Referenced by net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane< net.sf.gridarta.var.daimonin.model.gameobject.GameObject, net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject, net.sf.gridarta.var.daimonin.model.archetype.Archetype >.mapTilesAttach().

+ Here is the caller graph for this function:

◆ fillAdjacentMaps()

void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.fillAdjacentMaps ( @NotNull final List< MapControl< G, A, R >>  mapControls) throws CannotLoadMapFileException
private

Fills missing adjacent map slots.

Parameters
mapControlsthe loaded maps; will be updated
Exceptions
CannotLoadMapFileExceptionif 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().

+ Here is the caller graph for this function:

◆ getLastSlashIndex()

static int net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getLastSlashIndex ( @NotNull final String  base)
staticprivate

Returns the index of the last '/' or File#separator within a string.

Parameters
basethe string
Returns
the index or
-1
if not found

Definition at line 320 of file AttachTiledMaps.java.

Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.getTilePath().

+ Here is the caller graph for this function:

◆ getTilePath()

static String net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getTilePath ( @NotNull final String  base,
@NotNull final String  link,
@NotNull final File  mapsDirectory 
) throws CannotSaveMapFileException
staticprivate

Returns the map path for a tile of a map and a tile path.

Parameters
basethe map path of the map
linkthe tile path of the map; may be relative to
base
mapsDirectorythe maps directory
Returns
the map path
Exceptions
CannotSaveMapFileExceptionif an I/O error occurs

Definition at line 284 of file AttachTiledMaps.java.

Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.updateTilePaths().

+ Here is the caller graph for this function:

◆ loadAdjacentMaps()

void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.loadAdjacentMaps ( @NotNull final MapModel< G, A, R >  mapModel,
@NotNull final Collection< MapControl< G, A, R >>  mapControls,
@NotNull final String @NotNull[]  tilePaths 
) throws CannotLoadMapFileException
private

Loads adjacent map files by "filling" them by checking the "side" path links of the loaded ones.

Parameters
mapModelthe map model
mapControlsthe return value
tilePathsthe new tile paths
Exceptions
CannotLoadMapFileExceptionif 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().

+ Here is the caller graph for this function:

◆ loadMapControl()

MapControl<G, A, R> net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.loadMapControl ( @NotNull final MapModel< G, A, R >  mapModel,
@NotNull final String  path 
) throws IOException
private

Loads an adjacent MapControl, ignoring any (I/O-)errors.

Parameters
mapModelthe map model for relative map paths
paththe map path
Returns
the map control or
null
if the map cannot be loaded
Exceptions
IOExceptionif 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().

+ Here is the caller graph for this function:

◆ saveAdjacentMaps()

void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.saveAdjacentMaps ( @NotNull final Iterable< MapControl< G, A, R >>  mapControls) throws CannotSaveMapFileException
private

Saves adjacent maps.

I/O errors are reported to the user but otherwise ignored.

Parameters
mapControlsthe adjacent maps to save
Exceptions
CannotSaveMapFileExceptionif the map cannot be saved

Definition at line 147 of file AttachTiledMaps.java.

Referenced by net.sf.gridarta.actions.AttachTiledMaps< G, A, R >.attachTiledMaps().

+ Here is the caller graph for this function:

◆ updateTilePaths()

void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.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
private

Updates map tile paths to match the loaded maps.

Parameters
mapModelthe map model
mapControlsthe loaded maps
tilePathsthe tile paths to update
mapsDirectorythe maps directory
Exceptions
CannotSaveMapFileExceptionif 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().

+ Here is the caller graph for this function:

◆ validateMapSizes()

void net.sf.gridarta.actions.AttachTiledMaps< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.validateMapSizes ( @NotNull final MapModel< G, A, R >  mapModel,
@NotNull final Iterable< MapControl< G, A, R >>  mapControls 
) throws MapSizeMismatchException
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.

Parameters
mapModelthe map model
mapControlsthe attached maps to check
Exceptions
MapSizeMismatchExceptionif 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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ mapManager

◆ tileLinks


The documentation for this class was generated from the following file: