20 package net.sf.gridarta.gui.map.mapview;
22 import java.awt.Point;
24 import java.io.IOException;
25 import java.util.IdentityHashMap;
26 import java.util.Iterator;
27 import java.util.List;
40 import org.jetbrains.annotations.NotNull;
41 import org.jetbrains.annotations.Nullable;
94 public void gridVisibleChanged(
final boolean gridVisible) {
99 public void lightVisibleChanged(
final boolean lightVisible) {
104 public void smoothingChanged(
final boolean smoothing) {
109 public void tileStretchingChanged(
final boolean tileStretching) {
114 public void doubleFacesChanged(
final boolean doubleFaces) {
119 public void alphaTypeChanged(
final int alphaType) {
125 public void editTypeChanged(
final int editType) {
130 public void autojoinChanged(
final boolean autojoin) {
147 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
158 mapViews.remove(mapControl);
171 public MapViewsManager(@NotNull
final MapViewSettings mapViewSettings, @NotNull
final MapViewFactory<G, A, R> mapViewFactory, @NotNull
final MapManager<G, A, R> mapManager, @NotNull
final MapManager<G, A, R> pickmapManager, @NotNull
final PathManager pathManager) {
176 mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener);
177 mapManager.addMapManagerListener(mapManagerListener);
178 pickmapManager.addMapManagerListener(mapManagerListener);
234 mapControl.getMapModel().addActiveEditType(mapViewSettings.
getEditType());
235 return getMapViewsInt(mapControl).newMapView(mapControl, viewPosition, centerSquare, mapViewFactory);
280 if (existingMapViews != null) {
281 return existingMapViews;
285 mapViews.put(mapControl, newMapViews);
298 public void newMapWithView(@Nullable
final List<G> objects, @NotNull
final A mapArchObject, @Nullable
final Point viewPosition, @Nullable
final MapFile mapFile) {
303 mapManager.
release(mapControl);
341 return newMapView(mapControl, viewPosition, centerSquare);
343 mapManager.
release(mapControl);
356 public void openMapFileWithView(@NotNull
final File file, @Nullable
final Point viewPosition, @Nullable
final Point centerSquare)
throws IOException {
375 mapControl.getMapModel().addActiveEditType(newType);
int getEditType()
Returns the currently set edit type.
final PathManager pathManager
The PathManager for converting File instance.
void addMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
Adds a MapViewsListener to be notified of events.
void removeMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
Removes a MapViewsListener to be notified of events.
This class contains methods for converting relative map paths to absolute map paths and vice versa...
A MapManager manages all opened maps.
void closeMapView(@NotNull final MapView< G, A, R > mapView)
Invoked when the user wants to close a map view.
void release(@NotNull MapControl< G, A, R > mapControl)
Releases a MapControl instance.
Reading and writing of maps, handling of paths.
MapControl< G, A, R > newMap(@Nullable List< G > objects, @NotNull A mapArchObject, @Nullable MapFile mapFile, boolean interactive)
Creates a new map control without view.
void addEditType(final int newType)
Calculate a new type for all opened maps.
void repaintAllViews(@NotNull final MapControl< G, A, R > mapControl)
Repaints all MapViews of a MapControl.
int getUseCounter()
Returns the use counter.
MapView< G, A, R > newMapView(@NotNull final MapControl< G, A, R > mapControl, @Nullable final Point viewPosition, @Nullable final Point centerSquare)
Creates a new map view.
void refreshAllMaps()
Refreshes all map views.
MapFile getMapFile(@NotNull final AbsoluteMapPath mapPath)
Returns a MapFile instance from an AbsoluteMapPath.
Stores all existing MapViews.
A list of MapViews for one MapControl instance.
void newMapWithView(@Nullable final List< G > objects, @NotNull final A mapArchObject, @Nullable final Point viewPosition, @Nullable final MapFile mapFile)
Create a new map control and an initial map view.
void openMapFileWithView(@NotNull final File file, @Nullable final Point viewPosition, @Nullable final Point centerSquare)
Load a map file and create a map view.
Base package of all Gridarta classes.
MapViewsManager(@NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewFactory< G, A, R > mapViewFactory, @NotNull final MapManager< G, A, R > mapManager, @NotNull final MapManager< G, A, R > pickmapManager, @NotNull final PathManager pathManager)
Creates a new instance.
final MapManager< G, A, R > mapManager
The MapManager to use.
Reflects a game object (object on a map).
final MapManagerListener< G, A, R > mapManagerListener
The MapManagerListener attached to mapManager.
MapView< G, A, R > openMapFileWithView(@NotNull final MapFile mapFile, @Nullable final Point viewPosition, @Nullable final Point centerSquare)
Load a map file and create a map view.
int getMapViews(@NotNull final MapControl< G, A, R > mapControl)
Returns the number of views of a MapControl.
MapViews< G, A, R > getMapViewsInt(@NotNull final MapControl< G, A, R > mapControl)
Returns the MapViews instance for a MapControl.
Interface for listeners listening to MapManager changes.
Interface for event listeners that are interested in changes on MapViewSettings.
Container for settings that affect the rendering of maps.
GameObjects are the objects based on Archetypes found on maps.
final MapViewSettings mapViewSettings
The MapViewSettings instance.
MapView< G, A, R > getMapViewFrame(@NotNull final MapControl< G, A, R > mapControl)
Returns the last used view of a MapControl.
Currently nothing more than a marker interface for unification.
void closeMap(@NotNull MapControl< G, A, R > mapControl)
Closes the given map, ignoring modified status.
final MapViewSettingsListener mapViewSettingsListener
The listener tracking alpha types changes to repaint map views after changes.
FileControl< G, A, R > fileControl
The FileControl to use.
void setFileControl(@NotNull final FileControl< G, A, R > fileControl)
MapControl< G, A, R > openMapFile(@NotNull MapFile mapFile, boolean interactive)
Loads a map file.
Iterator< MapView< G, A, R > > getMapViewIterator(@NotNull final MapControl< G, A, R > mapControl)
Returns an Iterator returning all MapViews of a MapControl.
boolean confirmSaveChanges(@NotNull MapControl< G, A, R > mapControl)
Asks the user whether to save changes of a map.
void closeView(@NotNull final MapView< G, A, R > mapView)
Closes a view of a MapControl.
final Map< MapControl< G, A, R >, MapViews< G, A, R > > mapViews
All existing MapViews.
List< MapControl< G, A, R > > getOpenedMaps()
Returns all opened maps.
The location of a map file with a map directory.
Interface for MapArchObjects.
final MapViewFactory< G, A, R > mapViewFactory
The MapViewFactory to use.
void setFocus(@NotNull final MapView< G, A, R > mapView)
Sets a MapView as the main view.