1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
package tim.prune.save;
import java.awt.image.BufferedImage;
import tim.prune.data.DoubleRange;
/**
* Class to represent the result of the MapGrouter's assembly of map tiles
* into a single image. Includes information about how complete the result is.
*/
public class GroutedImage
{
private BufferedImage _image = null;
private int _numTilesFound = 0;
private int _numTilesMissing = 0;
private DoubleRange _xRange = null;
private DoubleRange _yRange = null;
/**
* Constructor
* @param inImage image, or null if no image possible
* @param inTilesUsed number of tiles used
* @param inTilesMissing number of tiles which could not be found
*/
public GroutedImage(BufferedImage inImage, int inTilesUsed, int inTilesMissing)
{
_image = inImage;
_numTilesFound = inTilesUsed;
_numTilesMissing = inTilesMissing;
}
/**
* @return true if any content at all was found
*/
public boolean isValid() {
return _image != null && _numTilesFound > 0;
}
/**
* @return the pixel dimensions of the result image
*/
public int getImageSize()
{
if (_image == null) {return -1;}
return _image.getWidth();
}
/**
* @return the image object
*/
public BufferedImage getImage() {
return _image;
}
/**
* @return the number of tiles used in the image
*/
public int getNumTilesUsed() {
return _numTilesFound;
}
/**
* @return the number of tiles which could not be found, leaving gaps in the image
*/
public int getNumTilesMissing() {
return _numTilesMissing;
}
/**
* @return the total number of tiles
*/
public int getNumTilesTotal() {
return _numTilesFound + _numTilesMissing;
}
/**
* @param inRange x range of data
*/
public void setXRange(DoubleRange inRange) {
_xRange = inRange;
}
/**
* @return x range of data
*/
public DoubleRange getXRange() {
return _xRange;
}
/**
* @param inRange y range of data
*/
public void setYRange(DoubleRange inRange) {
_yRange = inRange;
}
/**
* @return y range of data
*/
public DoubleRange getYRange() {
return _yRange;
}
}
|