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(MapModel<G,A,R> mapModel,
boolean isPickmap,
MapWriter<G,A,R> mapWriter,
ProjectSettings projectSettings)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
acquire()
Increases the use counter.
|
void |
addMapControlListener(MapControlListener<G,A,R> listener)
Registers a
MapControlListener . |
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(MapControlListener<G,A,R> listener)
Unregisters a
MapControlListener . |
void |
save()
Saves the map to a file.
|
void |
saveAs(MapFile mapFile)
Saves the file with the given map file.
|
public DefaultMapControl(@NotNull MapModel<G,A,R> mapModel, boolean isPickmap, @NotNull MapWriter<G,A,R> mapWriter, @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 MapControlListener<G,A,R> listener)
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 MapControlListener<G,A,R> listener)
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()
acquire
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public void release()
release
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public int getUseCounter()
getUseCounter
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
public boolean isPickmap()
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
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 MapFile mapFile) throws java.io.IOException
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 MapModel<G,A,R> getMapModel()
getMapModel
in interface MapControl<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>