public class DefaultMapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements MapControl<G,A,R>
Constructor and Description |
---|
DefaultMapControl(@NotNull MapModel<G,A,R> mapModel,
boolean isPickmap,
@NotNull MapWriter<G,A,R> mapWriter,
@NotNull ProjectSettings projectSettings)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
acquire()
Increases the use counter.
|
void |
addMapControlListener(@NotNull MapControlListener<G,A,R> listener)
Registers a
MapControlListener . |
@NotNull MapModel<G,A,R> |
getMapModel()
Returns the map model.
|
int |
getUseCounter()
Returns the use counter.
|
boolean |
isPickmap()
Return flag that indicates whether this is a pickmap or not.
|
void |
release()
Decreases the use counter and possibly frees the map control.
|
void |
removeMapControlListener(@NotNull MapControlListener<G,A,R> listener)
Unregisters a
MapControlListener . |
void |
save()
Saves the map to a file.
|
void |
saveAs(@NotNull MapFile mapFile)
Saves the file with the given map file.
|
public DefaultMapControl(@NotNull @NotNull MapModel<G,A,R> mapModel, boolean isPickmap, @NotNull @NotNull MapWriter<G,A,R> mapWriter, @NotNull @NotNull ProjectSettings projectSettings)
mapModel
- the map model to useisPickmap
- true if this is a pickmapmapWriter
- the map writer for saving map control instancesprojectSettings
- the project settings to usepublic void addMapControlListener(@NotNull @NotNull MapControlListener<G,A,R> listener)
MapControl
MapControlListener
.addMapControlListener
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- the listener to registerpublic void removeMapControlListener(@NotNull @NotNull MapControlListener<G,A,R> listener)
MapControl
MapControlListener
.removeMapControlListener
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
listener
- the listener to unregisterpublic void acquire()
MapControl
acquire
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void release()
MapControl
release
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public int getUseCounter()
MapControl
getUseCounter
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public boolean isPickmap()
MapControl
isPickmap
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void save() throws java.io.IOException
MapControl
save
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
java.io.IOException
- if saving failspublic void saveAs(@NotNull @NotNull MapFile mapFile) throws java.io.IOException
MapControl
saveAs
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
mapFile
- the map file to be saved tojava.io.IOException
- if saving fails; in this case the modified flag is
not reset@NotNull public @NotNull MapModel<G,A,R> getMapModel()
MapControl
getMapModel
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>