![]()  | 
  
    Isis Developer Reference
    
   | 
 
Reads and stores visible DN values. More...
#include <ViewportBuffer.h>


Public Slots | |
| void | DataReady (void *requester, int cubeId, const Isis::Brick *brick) | 
| This method is called when requested bricks become available.   | |
Signals | |
| void | ReadCube (int cubeId, int startSample, int startLine, int endSample, int endLine, int band, void *caller) | 
| Ask the cube data thread for data.   | |
| void | DoneWithData (int, const Isis::Brick *) | 
| Tell cube data thread we're done with a brick.   | |
Public Member Functions | |
| ViewportBuffer (CubeViewport *viewport, CubeDataThread *cubeData, int cubeId) | |
| ViewportBuffer constructor.   | |
| virtual | ~ViewportBuffer () | 
| Updates total buffer size on destruction.   | |
| const std::vector< double > & | getLine (int line) | 
| Retrieves a line from the buffer.   | |
| void | resizedViewport () | 
| Call this when the viewport is resized (not zoomed).   | |
| void | pan (int deltaX, int deltaY) | 
| Call this when the viewport is panned.   | |
| void | scaleChanged () | 
| Call this when zoomed, re-reads visible area.   | |
| void | fillBuffer (QRect rect) | 
| This method will convert the rect to sample/line positions and read from the cube into the buffer.   | |
| void | fillBuffer (QRect rect, const Brick *data) | 
| This method will convert the rect to sample/line positions and read from the cube into the buffer.   | |
| void | emptyBuffer (bool force=false) | 
| This is meant to clear up ram on non-active viewports.   | |
| QRect | bufferXYRect () | 
| Returns a rect, in screen pixels, of the area this buffer covers.   | |
| void | setBand (int band) | 
| Sets the band to read from, the buffer will be re-read if the band changes.   | |
| int | getBand () | 
| Return the band associated with this viewport buffer.   | |
| void | enable (bool enabled) | 
| This turns on or off reading from the cube.   | |
| void | addStretchAction () | 
| When all current operations finish the cube viewport will be asked to do a stretch if you call this.   | |
| double | currentProgress () | 
| Returns the viewport buffer's loading progress.   | |
| double | totalUnfilledArea () | 
| This returns the amount of area in the queue that needs new cube data/will be filled by fill actions.   | |
| bool | enabled () | 
| Returns whether the buffer is enabled (reading data) or not.   | |
| bool | working () | 
| This tests if queued actions exist in the viewport buffer.   | |
| bool | hasEntireCube () | 
| Method to see if the entire cube is in the buffer.   | |
Reads and stores visible DN values.
This class manages visible pixels in a CubeViewport. This class is responsible for reading from the Cube only what is necessary and gives fast access to visible DNs.
| Isis::ViewportBuffer::ViewportBuffer | ( | CubeViewport * | viewport, | 
| CubeDataThread * | cubeData, | ||
| int | cubeId ) | 
ViewportBuffer constructor.
Viewport and Cube can not be null. Band is not initialized
| viewport | viewport that will use the buffer | 
| cubeData | cube to read from | 
| cubeId | The identifier for the cube in the data thread | 
References DataReady(), DoneWithData(), and ReadCube().
      
  | 
  virtual | 
Updates total buffer size on destruction.
References DataReady(), DoneWithData(), emptyBuffer(), and ReadCube().
| void Isis::ViewportBuffer::addStretchAction | ( | ) | 
When all current operations finish the cube viewport will be asked to do a stretch if you call this.
Existing requests will be removed.
References Isis::ViewportBufferAction::stretch.
Referenced by Isis::IndependentCubeViewport::resetKnownGlobal(), Isis::CubeViewport::showEvent(), Isis::CubeViewport::viewGray(), and Isis::CubeViewport::viewRGB().
| QRect Isis::ViewportBuffer::bufferXYRect | ( | ) | 
Returns a rect, in screen pixels, of the area this buffer covers.
Referenced by fillBuffer(), fillBuffer(), Isis::StretchTool::histFromBuffer(), Isis::StretchTool::histFromBuffer(), Isis::ScatterPlotWindow::paint(), Isis::CubeViewport::scrollContentsBy(), and Isis::StretchTool::statsFromBuffer().
| double Isis::ViewportBuffer::currentProgress | ( | ) | 
Returns the viewport buffer's loading progress.
References totalUnfilledArea(), and working().
Referenced by Isis::CubeViewport::onProgressTimer().
      
  | 
  slot | 
This method is called when requested bricks become available.
This processes the new cube data and requests more if necessary.
| requester | |
| cubeId | |
| brick | 
References _FILEINFO_, Isis::ViewportBufferFill::doneReading(), DoneWithData(), Isis::ViewportBufferAction::fill, Isis::ViewportBufferFill::getLeftmostPixelPosition(), Isis::ViewportBufferFill::getReadPosition(), Isis::ViewportBufferFill::getRect(), Isis::ViewportBufferFill::getTopmostPixelPosition(), Isis::ViewportBufferFill::incReadPosition(), Isis::IException::Programmer, Isis::ViewportBufferFill::shouldRequestMore(), Isis::ViewportBufferFill::viewportToLine(), and Isis::ViewportBufferFill::viewportToSample().
Referenced by ViewportBuffer(), and ~ViewportBuffer().
      
  | 
  signal | 
Tell cube data thread we're done with a brick.
Referenced by DataReady(), ViewportBuffer(), and ~ViewportBuffer().
| void Isis::ViewportBuffer::emptyBuffer | ( | bool | force = false | ) | 
This is meant to clear up ram on non-active viewports.
cubeViewport is supposed to call this method on viewports buffers that are not related to the active viewport.
| force | If true, memory will be freed regardless of current total buffer size (b/w -> rgb for example). | 
Referenced by ~ViewportBuffer().
| void Isis::ViewportBuffer::enable | ( | bool | enabled | ) | 
This turns on or off reading from the cube.
If enabled is true the buffer will be re-read.
| enabled | 
References enabled().
Referenced by Isis::CubeViewport::CubeViewport(), Isis::CubeViewport::setScale(), and Isis::CubeViewport::showEvent().
      
  | 
  inline | 
Returns whether the buffer is enabled (reading data) or not.
Referenced by enable(), Isis::CubeViewport::setScale(), and Isis::CubeViewport::showEvent().
| void Isis::ViewportBuffer::fillBuffer | ( | QRect | rect | ) | 
This method will convert the rect to sample/line positions and read from the cube into the buffer.
The rect is in viewport pixels.
| rect | 
References _FILEINFO_, bufferXYRect(), and Isis::IException::Programmer.
Referenced by Isis::CubeViewport::cubeContentsChanged(), and Isis::CubeViewport::cubeDataChanged().
| void Isis::ViewportBuffer::fillBuffer | ( | QRect | rect, | 
| const Brick * | data ) | 
This method will convert the rect to sample/line positions and read from the cube into the buffer.
The rect is in viewport pixels.
| rect | |
| data | 
References _FILEINFO_, Isis::Buffer::at(), bufferXYRect(), Isis::ViewportBufferFill::getLeftmostPixelPosition(), Isis::ViewportBufferFill::getRequestPosition(), Isis::ViewportBufferFill::getTopmostPixelPosition(), Isis::ViewportBufferFill::incReadPosition(), Isis::ViewportBufferFill::incRequestPosition(), Isis::Buffer::Index(), Isis::Buffer::Line(), Isis::Buffer::LineDimension(), Isis::IException::Programmer, Isis::Buffer::Sample(), Isis::Buffer::SampleDimension(), Isis::ViewportBufferFill::shouldRequestMore(), Isis::Buffer::size(), Isis::ViewportBufferFill::viewportToLine(), and Isis::ViewportBufferFill::viewportToSample().
      
  | 
  inline | 
Return the band associated with this viewport buffer.
Referenced by Isis::CubeViewport::getAllWhatsThisInfo(), Isis::CubeViewport::viewGray(), and Isis::CubeViewport::viewRGB().
| const vector< double > & Isis::ViewportBuffer::getLine | ( | int | line | ) | 
Retrieves a line from the buffer.
Line is relative to the top of the visible area of the cube in the viewport.
| line | 
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::StretchTool::histFromBuffer(), Isis::ScatterPlotWindow::paint(), and Isis::StretchTool::statsFromBuffer().
| bool Isis::ViewportBuffer::hasEntireCube | ( | ) | 
Method to see if the entire cube is in the buffer.
References Isis::CubeViewport::cubeLines(), Isis::CubeViewport::cubeSamples(), and working().
| void Isis::ViewportBuffer::pan | ( | int | deltaX, | 
| int | deltaY ) | 
Call this when the viewport is panned.
DeltaX and deltaY are relative to the direction the buffer needs to shift.
| deltaX | |
| deltaY | 
References Isis::ViewportBufferTransform::resizeFirst(), round, Isis::CubeViewport::scale(), Isis::ViewportBufferTransform::setResize(), and Isis::ViewportBufferTransform::setTranslation().
Referenced by Isis::CubeViewport::center(), and Isis::CubeViewport::scrollContentsBy().
      
  | 
  signal | 
Ask the cube data thread for data.
| cubeId | |
| startSample | |
| startLine | |
| endSample | |
| endLine | |
| band | |
| caller | 
Referenced by ViewportBuffer(), and ~ViewportBuffer().
| void Isis::ViewportBuffer::resizedViewport | ( | ) | 
Call this when the viewport is resized (not zoomed).
References Isis::ViewportBufferTransform::resizeFirst(), round, Isis::CubeViewport::scale(), Isis::ViewportBufferTransform::setResize(), and Isis::ViewportBufferTransform::setTranslation().
Referenced by Isis::CubeViewport::resizeEvent().
| void Isis::ViewportBuffer::scaleChanged | ( | ) | 
Call this when zoomed, re-reads visible area.
| iException | - "Unable to change scale" | 
References _FILEINFO_, and Isis::IException::Programmer.
Referenced by Isis::CubeViewport::setScale().
| void Isis::ViewportBuffer::setBand | ( | int | band | ) | 
Sets the band to read from, the buffer will be re-read if the band changes.
| band | 
Referenced by Isis::CubeViewport::CubeViewport(), Isis::CubeViewport::viewGray(), and Isis::CubeViewport::viewRGB().
| double Isis::ViewportBuffer::totalUnfilledArea | ( | ) | 
This returns the amount of area in the queue that needs new cube data/will be filled by fill actions.
References Isis::ViewportBufferAction::fill, Isis::ViewportBufferFill::getReadPosition(), and Isis::ViewportBufferFill::getRect().
Referenced by currentProgress().
| bool Isis::ViewportBuffer::working | ( | ) | 
This tests if queued actions exist in the viewport buffer.
References Isis::ViewportBufferAction::fill.
Referenced by Isis::CubeViewport::bufferUpdated(), currentProgress(), hasEntireCube(), Isis::CubeViewport::onProgressTimer(), Isis::ScatterPlotWindow::paint(), Isis::CubeViewport::scrollContentsBy(), and Isis::StretchTool::statsFromBuffer().