Gridarta Editor
MapManager.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.mapmanager;
21 
22 import java.io.File;
23 import java.io.IOException;
24 import java.util.List;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
32 
37 public interface MapManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> {
38 
48  @NotNull
49  MapControl<G, A, R> openMapFile(@NotNull MapFile mapFile, boolean interactive) throws IOException;
50 
60  @NotNull
61  MapControl<G, A, R> openMapFile(@NotNull File file, boolean interactive) throws IOException;
62 
67  void closeMap(@NotNull MapControl<G, A, R> mapControl);
68 
79  @NotNull
80  MapControl<G, A, R> newMap(@Nullable List<G> objects, @NotNull A mapArchObject, @Nullable MapFile mapFile, boolean interactive);
81 
86  void setCurrentMap(@Nullable MapControl<G, A, R> mapControl);
87 
92  @NotNull
93  List<MapControl<G, A, R>> getOpenedMaps();
94 
99  @Nullable
101 
106  @Nullable
108 
113  void addMapManagerListener(@NotNull MapManagerListener<G, A, R> listener);
114 
120 
126  void revert(@NotNull MapControl<G, A, R> mapControl) throws IOException;
127 
132  File getLocalMapDir();
133 
138  void release(@NotNull MapControl<G, A, R> mapControl);
139 
140 }
net.sf.gridarta.model.mapmanager.MapManager
A MapManager manages all opened maps.
Definition: MapManager.java:37
net.sf.gridarta.model.mapmanager.MapManager.removeMapManagerListener
void removeMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
Removes a MapManagerListener to be notified.
net.sf.gridarta
Base package of all Gridarta classes.
net.sf
net.sf.gridarta.model.mapmanager.MapManagerListener< G, A, R >
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.model.mapmanager.MapManager.newMap
MapControl< G, A, R > newMap(@Nullable List< G > objects, @NotNull A mapArchObject, @Nullable MapFile mapFile, boolean interactive)
Creates a new map control without view.
net.sf.gridarta.model.mapmanager.MapManager.addMapManagerListener
void addMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
Adds a MapManagerListener to be notified.
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.model.mapcontrol
Definition: DefaultMapControl.java:20
net.sf.gridarta.model.mapmanager.MapManager.getOpenedMaps
List< MapControl< G, A, R > > getOpenedMaps()
Returns all opened maps.
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.model.mapmanager.MapManager.getLocalMapDir
File getLocalMapDir()
Returns a guess for a script directory to use.
net.sf.gridarta.model.mapmanager.MapManager.openMapFile
MapControl< G, A, R > openMapFile(@NotNull MapFile mapFile, boolean interactive)
Loads a map file.
net.sf.gridarta.model.mapmanager.MapManager.getCurrentMap
MapControl< G, A, R > getCurrentMap()
Returns the current map.
net.sf.gridarta.model.mapmodel.MapFile
The location of a map file with a map directory.
Definition: MapFile.java:31
net.sf.gridarta.model.mapmanager.MapManager.release
void release(@NotNull MapControl< G, A, R > mapControl)
Releases a MapControl instance.
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.model.mapmanager.MapManager.revert
void revert(@NotNull MapControl< G, A, R > mapControl)
Reverts one map.
net.sf.gridarta.model.mapmanager.MapManager.getOpenMap
MapControl< G, A, R > getOpenMap()
Returns one open map.
net.sf.gridarta.model.mapcontrol.MapControl
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.mapmanager.MapManager.setCurrentMap
void setCurrentMap(@Nullable MapControl< G, A, R > mapControl)
Sets the given map as the current one.
net.sf.gridarta.model.mapmanager.MapManager.closeMap
void closeMap(@NotNull MapControl< G, A, R > mapControl)
Closes the given map, ignoring modified status.