X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fsave%2FGroutedImage.java;fp=src%2Ftim%2Fprune%2Fsave%2FGroutedImage.java;h=d5cbc05bd3a51a69af748a5d42f7d71e93ee7420;hp=0000000000000000000000000000000000000000;hb=ce6f2161b8596f7018d6a76bff79bc9e571f35fd;hpb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465 diff --git a/src/tim/prune/save/GroutedImage.java b/src/tim/prune/save/GroutedImage.java new file mode 100644 index 0000000..d5cbc05 --- /dev/null +++ b/src/tim/prune/save/GroutedImage.java @@ -0,0 +1,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; + } +}