Package net.sf.gridarta.gui.map.mapview
Class AbstractMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.gui.map.mapview.AbstractMapView<G,A,R>
-
- All Implemented Interfaces:
MapView<G,A,R>
- Direct Known Subclasses:
DefaultMapView
public abstract class AbstractMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements MapView<G,A,R>
Abstract base class forMapViewimplementations.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcenterMapView(@NotNull java.awt.Point centerSquare)Centers the map view on a map square.voidcloseNotify()This function must be called when the view is closed.@NotNull MapCursor<G,A,R>getMapCursor()Returns theMapCursorof this view.@NotNull MapGridgetMapGrid()Returns theMapGridof this view.GgetSelectedGameObject()Return one selected game object.@NotNull java.util.List<G>getSelectedGameObjects()Return all selected game objects.@NotNull java.util.List<MapSquare<G,A,R>>getSelectedSquares()Returns the selected squares.voidsetCursorLocation(@NotNull java.awt.Point point)Sets the cursor location.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.gridarta.gui.map.mapview.MapView
activate, getComponent, getInternalFrame, getMapControl, getRenderer, getScrollPane, getWindowTitle, setViewPosition
-
-
-
-
Constructor Detail
-
AbstractMapView
protected AbstractMapView(@NotNull @NotNull MapModel<G,A,R> mapModel, @NotNull @NotNull MapGrid mapGrid, @NotNull @NotNull MapCursor<G,A,R> mapCursor)Creates a new instance.- Parameters:
mapModel- the map model of this map viewmapGrid- the map grid of this map viewmapCursor- the map cursor of this map view
-
-
Method Detail
-
closeNotify
public void closeNotify()
Description copied from interface:MapViewThis function must be called when the view is closed.- Specified by:
closeNotifyin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
getSelectedSquares
@NotNull public @NotNull java.util.List<MapSquare<G,A,R>> getSelectedSquares()
Description copied from interface:MapViewReturns the selected squares.- Specified by:
getSelectedSquaresin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the selected squares; the list may be modified by the caller
-
getSelectedGameObjects
@NotNull public @NotNull java.util.List<G> getSelectedGameObjects()
Description copied from interface:MapViewReturn all selected game objects. If nothing is selected, return all game objects from the entire map.- Specified by:
getSelectedGameObjectsin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the selected game objects
-
getSelectedGameObject
@Nullable public G getSelectedGameObject()
Description copied from interface:MapViewReturn one selected game object. If more than one game object is selected, return a random one. If nothing is selected, return a random game object from the entire map.- Specified by:
getSelectedGameObjectin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- one random selected game object, or
nullif no game object is selected
-
getMapGrid
@NotNull public @NotNull MapGrid getMapGrid()
Description copied from interface:MapViewReturns theMapGridof this view.- Specified by:
getMapGridin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the map grid of this view
-
getMapCursor
@NotNull public @NotNull MapCursor<G,A,R> getMapCursor()
Description copied from interface:MapViewReturns theMapCursorof this view.- Specified by:
getMapCursorin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Returns:
- the map cursor of this view
-
setCursorLocation
public void setCursorLocation(@NotNull @NotNull java.awt.Point point)Description copied from interface:MapViewSets the cursor location. If the map location is not within map bounds the cursor is set to the nearest valid location.- Specified by:
setCursorLocationin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
point- the new location will be modified to the actually set cursor location
-
centerMapView
public void centerMapView(@NotNull @NotNull java.awt.Point centerSquare)Description copied from interface:MapViewCenters the map view on a map square.- Specified by:
centerMapViewin interfaceMapView<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
centerSquare- the map square
-
-