 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.floodfill;
22 import java.awt.Point;
23 import java.util.List;
32 import org.jetbrains.annotations.NotNull;
64 private static final byte BORDER = 1;
77 public void floodFill(@NotNull
final MapModel<G, A, R> mapModel, @NotNull
final Point start, @NotNull
final List<? extends
BaseObject<G, A, R, ?>> archList, @NotNull
final InsertionModeSet<G, A, R> insertionModeSet) {
82 mapModel.beginTransaction(
"Flood Fill");
86 final Point p =
new Point();
87 for (p.x = 0; p.x < mapSize.
getWidth(); p.x++) {
88 for (p.y = 0; p.y < mapSize.
getHeight(); p.y++) {
91 if (mapArchObject.
isPointValid(p) && mapModel.getMapSquare(p).isEmpty()) {
94 mapModel.insertBaseObject(gameObject, p,
false,
false, insertionModeSet.getTopmostInsertionMode());
101 }
catch (
final ArrayIndexOutOfBoundsException ignored) {
110 }
catch (
final ArrayIndexOutOfBoundsException ignored) {
119 }
catch (
final ArrayIndexOutOfBoundsException ignored) {
128 }
catch (
final ArrayIndexOutOfBoundsException ignored) {
139 mapModel.endTransaction();
int getWidth()
Returns the width of the area.
A MapModel reflects the data of a map.
Base package of all Gridarta classes.
boolean isPointValid(@Nullable Point pos)
Checks whether the given coordinate is within map bounds.
Reflects a game object (object on a map).
Size2D getMapSize()
Returns the map size.
GameObjects are the objects based on Archetypes found on maps.
int getHeight()
Returns the height of the area.
static final byte WAS_EMPTY
static final Random RND
Global random number generator.
Interface for MapArchObjects.
This document describes some hints and requirements for general development on the CrossfireEditor If you plan to make changes to the editor code or setup please read the following and keep it in derived from a basic editor application called Gridder by Pasi Ker�nen so please communicate with best through the cf devel mailing before considering any fundamental changes About code DO NOT USE TABS No matter what Java development platform you are please configure insert indent Tabs are displayed totally different in every editor and there are millions of different editors out there The insertion of tabs in the source code is messing up the syntax formatting in a way that is UNREPAIRABLE Apart from please keep code indentation accurate This is not just good it helps to keep code readable and in that way dramatically decreases the chance for overlooked bugs Everyone is welcomed to correct indentation errors wherever they are spotted Before you start to do this please double check that your editor is really configured to insert spaces Line feeds may be checked in either in windows or in unix linux style All reasonable text and java editors can deal with both linefeed formats Converting line feeds is but in this case please make sure that only linefeed characters are changed and nothing else is affected Due to the platform independent nature of the editor has the potential to run on almost any given operating system the build process differs greatly between systems as well as java environments In the several people have attempted to add build scripts along with structural changes to optimize the setup on one particular system environment which has led to conflict Please do *not *attempt to change the structure or any directories for the mere purpose of improving a build process or performance in a java environment Build scripts may be placed in the root it would be especially fine if it is just one or two files but the latter is not required Please excuse me for placing such restriction I and many users of the editor greatly appreciate build scripts We just had some real troubles over this issue in the past and I don t want to have them repeated the editor has relatively high performance requirements I ve spent a lot of extra work to keep everything as fast and memory efficient as possible when you add new data fields or calculations in the archetype area
static final byte BLOCKED
static final byte NOT_LOOKED_AT
Constants for lookArea.
Implements flood-filling.
The class Size2D represents a 2d rectangular area.
void floodFill(@NotNull final MapModel< G, A, R > mapModel, @NotNull final Point start, @NotNull final List<? extends BaseObject< G, A, R, ?>> archList, @NotNull final InsertionModeSet< G, A, R > insertionModeSet)
Flood-fill the map.