X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fthreedee%2FTerrainDefinition.java;fp=src%2Ftim%2Fprune%2Fthreedee%2FTerrainDefinition.java;h=d6cf3854f9525dc2fbf1c6754ad3dfa20ea488c1;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/threedee/TerrainDefinition.java b/src/tim/prune/threedee/TerrainDefinition.java new file mode 100644 index 0000000..d6cf385 --- /dev/null +++ b/src/tim/prune/threedee/TerrainDefinition.java @@ -0,0 +1,68 @@ +package tim.prune.threedee; + +/** + * Holds the definition of the terrain to use + * (whether or not to use a terrain, and the resolution) + */ +public class TerrainDefinition +{ + private boolean _useTerrain = false; + private int _gridSize = 0; + + /** + * Empty constructor specifying no terrain + */ + public TerrainDefinition() + { + this(false, 0); + } + + /** + * Constructor + * @param inUse true to use a terrain + * @param inGridSize size of grid + */ + public TerrainDefinition(boolean inUse, int inGridSize) + { + setUseTerrain(inUse, inGridSize); + } + + /** + * Set the parameters + * @param inUse true to use a terrain + * @param inGridSize size of grid + */ + public void setUseTerrain(boolean inUse, int inGridSize) + { + _useTerrain = inUse; + _gridSize = inGridSize; + } + + /** + * @return true if terrain should be used, false otherwise + */ + public boolean getUseTerrain() { + return _useTerrain && _gridSize > 2; + } + + /** + * @return grid size + */ + public int getGridSize() { + return _gridSize; + } + + @Override + /** + * Compare two TerrainDefinitions to see if they're equal + */ + public boolean equals(Object obj) + { + if (obj == null || !(obj instanceof TerrainDefinition)) { + return false; + } + TerrainDefinition other = (TerrainDefinition) obj; + return _useTerrain == other._useTerrain + && _gridSize == other._gridSize; + } +}