Gridarta Editor
MapModel.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.mapmodel;
21 
22 import java.awt.Point;
23 import java.io.Serializable;
24 import java.util.List;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
32 
75 public interface MapModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Iterable<MapSquare<G, A, R>>, Serializable {
76 
80  void mapClosed();
81 
86  void clearMap();
87 
93  boolean isEmpty();
94 
99  @NotNull
100  A getMapArchObject();
101 
106  void addMapModelListener(@NotNull MapModelListener<G, A, R> listener);
107 
112  void prependMapModelListener(@NotNull MapModelListener<G, A, R> listener);
113 
118  void removeMapModelListener(@NotNull MapModelListener<G, A, R> listener);
119 
125 
131 
136  void beginSquareChange(@NotNull MapSquare<G, A, R> mapSquare);
137 
145  void endSquareChange(@NotNull MapSquare<G, A, R> mapSquare);
146 
151  void beginGameObjectChange(@NotNull G gameObject);
152 
160  void endGameObjectChange(@NotNull G gameObject);
161 
169  void transientGameObjectChange(@NotNull G gameObject);
170 
189  void beginTransaction(@NotNull String name);
190 
207  void endTransaction();
208 
235  void endTransaction(boolean fireEvent);
236 
248  void endAllTransactions();
249 
262  int getTransactionDepth();
263 
276  boolean isAnyTransactionActive();
277 
285  @NotNull
286  MapSquare<G, A, R> getMapSquare(@NotNull Point pos);
287 
292  void addObjectListToMap(@NotNull Iterable<G> objects);
293 
303  void addGameObjectToMap(@NotNull G gameObject, @NotNull Point pos, @NotNull InsertionMode insertionMode);
304 
311  void moveEnv(@NotNull G gameObject, @NotNull Point pos, @NotNull G nextGameObject);
312 
318  void moveInv(@NotNull G gameObject, @NotNull GameObject<G, A, R> prevGameObject);
319 
332  @Nullable
333  G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode insertionMode);
334 
347  @Nullable
348  G insertArchToMap(@NotNull BaseObject<G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join);
349 
355  void removeGameObject(@NotNull G gameObject, boolean join);
356 
368  boolean isMultiArchFittingToMap(@NotNull Archetype<G, A, R> archetype, @NotNull Point pos, boolean allowDouble);
369 
375 
380  @NotNull
382 
391  boolean isAreaEmpty(int left, int top, int width, int height);
392 
399  void addActiveEditType(int editType);
400 
406  void setMapFile(@Nullable MapFile mapFile);
407 
412  @Nullable
414 
425  @NotNull
427 
433  @NotNull
434  List<G> getAllGameObjects();
435 
440  boolean isModified();
441 
445  void resetModified();
446 
450  void facesReloaded();
451 
457  void nextPoint(Point point, int direction);
458 
459 }
net.sf.gridarta.model.mapmodel.MapModel.setMapFile
void setMapFile(@Nullable MapFile mapFile)
net.sf.gridarta.model.mapmodel.MapFile
Definition: MapFile.java:31
net.sf.gridarta.model.mapmodel.MapModel.prependMapModelListener
void prependMapModelListener(@NotNull MapModelListener< G, A, R > listener)
net.sf.gridarta.model.mapmodel.MapModel.insertArchToMap
G insertArchToMap(@NotNull BaseObject< G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join)
net.sf.gridarta.model.mapmodel.MapModel.clearMap
void clearMap()
net.sf.gridarta.model.mapmodel.MapModel.isMultiArchFittingToMap
boolean isMultiArchFittingToMap(@NotNull Archetype< G, A, R > archetype, @NotNull Point pos, boolean allowDouble)
net.sf.gridarta.model.mapmodel.MapModel.isEmpty
boolean isEmpty()
net.sf.gridarta
net.sf.gridarta.model.maparchobject.MapArchObject
Definition: MapArchObject.java:40
net.sf.gridarta.model.mapmodel.MapModel.beginGameObjectChange
void beginGameObjectChange(@NotNull G gameObject)
net.sf
net.sf.gridarta.model.mapmodel.MapModel.moveInv
void moveInv(@NotNull G gameObject, @NotNull GameObject< G, A, R > prevGameObject)
net.sf.gridarta.model.mapmodel.MapModel.addActiveEditType
void addActiveEditType(int editType)
net.sf.gridarta.model.mapmodel.MapModel.getErrors
ErrorCollector< G, A, R > getErrors()
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.model.mapmodel.SameMapException
Definition: SameMapException.java:26
net.sf.gridarta.model.mapmodel.MapModel.endSquareChange
void endSquareChange(@NotNull MapSquare< G, A, R > mapSquare)
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.mapmodel.MapModel.getTransactionDepth
int getTransactionDepth()
net.sf.gridarta.model.mapmodel.MapModel.moveEnv
void moveEnv(@NotNull G gameObject, @NotNull Point pos, @NotNull G nextGameObject)
net.sf.gridarta.model.mapmodel.MapPath
Definition: MapPath.java:31
net.sf.gridarta.model.mapmodel.MapModel.removeMapTransactionListener
void removeMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
net.sf.gridarta.model.mapmodel.MapModel
Definition: MapModel.java:75
net.sf.gridarta.model.mapmodel.MapSquare< G, A, R >
net.sf.gridarta.model.gameobject.GameObject
Definition: GameObject.java:36
net.sf.gridarta.model.mapmodel.MapModel.nextPoint
void nextPoint(Point point, int direction)
net.sf.gridarta.model.mapmodel.MapModel.setErrors
void setErrors(@NotNull ErrorCollector< G, A, R > errors)
net.sf.gridarta.model.mapmodel.MapModel.isAreaEmpty
boolean isAreaEmpty(int left, int top, int width, int height)
net.sf.gridarta.model.gameobject
Definition: AbstractGameObject.java:20
net.sf.gridarta.model.mapmodel.MapModel.beginSquareChange
void beginSquareChange(@NotNull MapSquare< G, A, R > mapSquare)
net
net.sf.gridarta.model.mapmodel.MapModel.beginTransaction
void beginTransaction(@NotNull String name)
net.sf.gridarta.model.mapmodel.InsertionMode
Definition: InsertionMode.java:33
net.sf.gridarta.model.mapmodel.MapModel.getMapSquare
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
net.sf.gridarta.model.mapmodel.MapModel.endAllTransactions
void endAllTransactions()
net.sf.gridarta.model.mapmodel.MapModel.isAnyTransactionActive
boolean isAnyTransactionActive()
errors
errors
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:1
net.sf.gridarta.model.mapmodel.MapModel.getMapFile
MapFile getMapFile()
net.sf.gridarta.model.mapmodel.MapModel.removeGameObject
void removeGameObject(@NotNull G gameObject, boolean join)
net.sf.gridarta.model.mapmodel.MapModel.endTransaction
void endTransaction()
net.sf.gridarta.model.mapmodel.MapModel.facesReloaded
void facesReloaded()
net.sf.gridarta.model.mapmodel.MapModel.getMapArchObject
A getMapArchObject()
name
name
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:2
net.sf.gridarta.model.mapmodel.UnsavedMapException
Definition: UnsavedMapException.java:26
net.sf.gridarta.model.validation
Definition: AbstractValidator.java:20
net.sf.gridarta.model.mapmodel.MapModel.removeMapModelListener
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
net.sf.gridarta.model.mapmodel.MapModel.isModified
boolean isModified()
net.sf.gridarta.model.mapmodel.MapModel.resetModified
void resetModified()
net.sf.gridarta.model.mapmodel.MapModel.transientGameObjectChange
void transientGameObjectChange(@NotNull G gameObject)
net.sf.gridarta.model.mapmodel.MapModel.mapClosed
void mapClosed()
net.sf.gridarta.model
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.model.mapmodel.MapModel.insertBaseObject
G insertBaseObject(@NotNull BaseObject< G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode insertionMode)
net.sf.gridarta.model.mapmodel.MapTransactionListener< G, A, R >
net.sf.gridarta.model.mapmodel.MapModel.addMapModelListener
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
net.sf.gridarta.model.mapmodel.MapModel.addObjectListToMap
void addObjectListToMap(@NotNull Iterable< G > objects)
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.mapmodel.MapModelListener< G, A, R >
net.sf.gridarta.model.mapmodel.MapModel.endGameObjectChange
void endGameObjectChange(@NotNull G gameObject)
net.sf.gridarta.model.mapmodel.MapModel.addMapTransactionListener
void addMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
net.sf.gridarta.model.archetype.Archetype
Definition: Archetype.java:41
net.sf.gridarta.model.mapmodel.MapModel.getAllGameObjects
List< G > getAllGameObjects()
net.sf.gridarta.model.mapmodel.MapModel.addGameObjectToMap
void addGameObjectToMap(@NotNull G gameObject, @NotNull Point pos, @NotNull InsertionMode insertionMode)
net.sf.gridarta.model.validation.ErrorCollector
Definition: ErrorCollector.java:33