public class CopyBuffer<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
extends java.lang.Object
Constructor and Description |
---|
CopyBuffer(@NotNull MapViewSettings mapViewSettings,
@NotNull GameObjectFactory<G,A,R> gameObjectFactory,
@NotNull MapArchObjectFactory<A> mapArchObjectFactory,
@NotNull MapModelFactory<G,A,R> mapModelFactory,
@NotNull InsertionModeSet<G,A,R> insertionModeSet)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapModelListener(@NotNull MapModelListener<G,A,R> listener)
Adds a
MapModelListener to be notified about changes of the
cut/copied game objects. |
void |
clear(@NotNull MapView<G,A,R> mapView,
@NotNull java.awt.Rectangle selectedRec)
Executes the Clear command.
|
void |
copy(@NotNull MapView<G,A,R> mapView,
@NotNull java.awt.Rectangle selectedRec)
Executes the Copy command.
|
void |
cut(@NotNull MapView<G,A,R> mapView,
@NotNull java.awt.Rectangle selectedRec)
Executes the Cut command.
|
@NotNull java.util.List<G> |
getAllGameObjects()
Returns all game objects.
|
boolean |
isEmpty()
Returns whether this copy buffer contains any game objects.
|
void |
paste(@NotNull MapView<G,A,R> mapView,
@NotNull java.awt.Point startLocation)
Executes the Paste command.
|
void |
pasteTiled(@NotNull MapView<G,A,R> mapView,
@NotNull java.lang.Iterable<MapSquare<G,A,R>> selectedSquares,
@NotNull java.awt.Point origin)
Executes the Paste Tiled command.
|
void |
removeMapModelListener(@NotNull MapModelListener<G,A,R> listener)
Removes a
MapModelListener to be notified about changes of the
cut/copied game objects. |
public CopyBuffer(@NotNull @NotNull MapViewSettings mapViewSettings, @NotNull @NotNull GameObjectFactory<G,A,R> gameObjectFactory, @NotNull @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull @NotNull MapModelFactory<G,A,R> mapModelFactory, @NotNull @NotNull InsertionModeSet<G,A,R> insertionModeSet)
mapViewSettings
- the map view settings instancegameObjectFactory
- the game object factory to usemapArchObjectFactory
- the map arch object factory to usemapModelFactory
- the map model factory to useinsertionModeSet
- the insertion mode set to usepublic void addMapModelListener(@NotNull @NotNull MapModelListener<G,A,R> listener)
MapModelListener
to be notified about changes of the
cut/copied game objects.listener
- the listenerpublic void removeMapModelListener(@NotNull @NotNull MapModelListener<G,A,R> listener)
MapModelListener
to be notified about changes of the
cut/copied game objects.listener
- the listenerpublic void clear(@NotNull @NotNull MapView<G,A,R> mapView, @NotNull @NotNull java.awt.Rectangle selectedRec)
mapView
- the map view to clearselectedRec
- the rectangle to operate onpublic void cut(@NotNull @NotNull MapView<G,A,R> mapView, @NotNull @NotNull java.awt.Rectangle selectedRec)
mapView
- the map view to cut fromselectedRec
- the rectangle to operate onpublic void copy(@NotNull @NotNull MapView<G,A,R> mapView, @NotNull @NotNull java.awt.Rectangle selectedRec)
mapView
- the map view to copy fromselectedRec
- the rectangle to operate onpublic void paste(@NotNull @NotNull MapView<G,A,R> mapView, @NotNull @NotNull java.awt.Point startLocation)
mapView
- the map view to paste onstartLocation
- the location to paste intopublic void pasteTiled(@NotNull @NotNull MapView<G,A,R> mapView, @NotNull @NotNull java.lang.Iterable<MapSquare<G,A,R>> selectedSquares, @NotNull @NotNull java.awt.Point origin)
mapView
- the map view to paste onselectedSquares
- the square to paste intoorigin
- the origin where to start pasting@NotNull public @NotNull java.util.List<G> getAllGameObjects()
public boolean isEmpty()