Ejemplo n.º 1
0
    public void reset(final int x, final int y) throws IOException {

      final long lTime = System.currentTimeMillis();

      final int xMin = Math.max(x - blockSize, 0);
      final int xMax = Math.min(x + blockSize, m_iCols);
      final int yMin = Math.max(y - blockSize, 0);
      final int yMax = Math.min(y + blockSize, m_iRows);

      final IPnt pnt = new DblPnt();
      // start with the top left
      pnt.setCoords(xMin, yMin);
      final IPnt size = new DblPnt();
      final int width = xMax - xMin;
      final int height = yMax - yMin;
      size.setCoords(width, height);
      final IPixelBlock pixelBlk = rawPix.createPixelBlock(size);
      // reads the data into the pixelBlk
      rawPix.read(pnt, pixelBlk);
      pixelBlock = new IPixelBlock3Proxy(pixelBlk);
      // get the value at the first band and the first cell in the block
      array = pixelBlock.getPixelData(0);
      setArray(array);
      this.x = xMin;
      this.y = yMin;
      this.width = width;
      this.height = height;

      final long lTime2 = System.currentTimeMillis();
      System.out.println("Reseting pixel block:" + Long.toString(lTime2 - lTime));
    }
Ejemplo n.º 2
0
 public void write() throws IOException {
   if (pixelBlock != null) {
     pixelBlock.setPixelData(iBand, array);
     final IPixelBlock pblock = new IPixelBlockProxy(pixelBlock);
     final IPnt pnt = new DblPnt();
     pnt.setCoords(this.x, this.y);
     rawPix.write(pnt, pblock);
   }
 }