1 package tim.prune.save;
3 import java.awt.image.BufferedImage;
5 import tim.prune.data.DoubleRange;
9 * Class to represent the result of the MapGrouter's assembly of map tiles
10 * into a single image. Includes information about how complete the result is.
12 public class GroutedImage
14 private BufferedImage _image = null;
15 private int _numTilesFound = 0;
16 private int _numTilesMissing = 0;
17 private DoubleRange _xRange = null;
18 private DoubleRange _yRange = null;
22 * @param inImage image, or null if no image possible
23 * @param inTilesUsed number of tiles used
24 * @param inTilesMissing number of tiles which could not be found
26 public GroutedImage(BufferedImage inImage, int inTilesUsed, int inTilesMissing)
29 _numTilesFound = inTilesUsed;
30 _numTilesMissing = inTilesMissing;
34 * @return true if any content at all was found
36 public boolean isValid() {
37 return _image != null && _numTilesFound > 0;
41 * @return the pixel dimensions of the result image
43 public int getImageSize()
45 if (_image == null) {return -1;}
46 return _image.getWidth();
50 * @return the image object
52 public BufferedImage getImage() {
57 * @return the number of tiles used in the image
59 public int getNumTilesUsed() {
60 return _numTilesFound;
64 * @return the number of tiles which could not be found, leaving gaps in the image
66 public int getNumTilesMissing() {
67 return _numTilesMissing;
71 * @return the total number of tiles
73 public int getNumTilesTotal() {
74 return _numTilesFound + _numTilesMissing;
78 * @param inRange x range of data
80 public void setXRange(DoubleRange inRange) {
85 * @return x range of data
87 public DoubleRange getXRange() {
92 * @param inRange y range of data
94 public void setYRange(DoubleRange inRange) {
99 * @return y range of data
101 public DoubleRange getYRange() {