ImageHandler Class Reference

Publish view and layer images via HTTP. More...

#include <ImageHandler.h>

Inheritance diagram for ImageHandler:

Inheritance graph

List of all members.

Public Member Functions

 ImageHandler (QObject *pParent=NULL)
 ImageHandler (int port, QObject *pParent=NULL)
 ~ImageHandler ()

Static Public Member Functions

static bool getSessionItemImage (SessionItem *pItem, QBuffer &buffer, const QString &format, int band, int *pBbox=NULL)

Protected Member Functions

MuHttpServer::Response getRequest (const QString &uri, const QString &contentType, const QString &body, const FormValueMap &form)


Detailed Description

Publish view and layer images via HTTP.

Definition at line 22 of file ImageHandler.h.


Constructor & Destructor Documentation

ImageHandler::ImageHandler ( QObject *  pParent = NULL  ) 

Construct a new ImageHandler.

Parameters:
pParent Qt parent object

ImageHandler::ImageHandler ( int  port,
QObject *  pParent = NULL 
)

Construct a new ImageHandler.

Parameters:
port TCP port where the server should listen. If this is 0, a server will not be started. This is used to add the ImageHandler to an existing server using MuHttpServer::registerPath().
pParent Qt parent object

ImageHandler::~ImageHandler (  ) 

Destructor.


Member Function Documentation

static bool ImageHandler::getSessionItemImage ( SessionItem pItem,
QBuffer &  buffer,
const QString &  format,
int  band,
int *  pBbox = NULL 
) [static]

Retrieve an image for a SessionItem and place the result in a buffer.

Parameters:
pItem The SessionItem whose image is to be retrieved. Currently, this must be a: SpatialDataView or a Layer
buffer A sufficiently large buffer which will hold the resultant image.
format The format of the image data. This is anything which corresponds to a loaded Qt image format plugin. Common examples are: JPEG, PNG, TIFF, or BMP
band If pItem is a RasterLayer, change to this active band before grabbing the image. If pItem is not a RasterLayer or band is negative, this is ignored.
pBbox If this is not NULL, the bounding box as returned by SpatialDataView::getLayerImage() will be returned in this out param.
Returns:
True if the image was successfully generated, false otherwise.

MuHttpServer::Response ImageHandler::getRequest ( const QString &  uri,
const QString &  contentType,
const QString &  body,
const FormValueMap &  form 
) [protected, virtual]

This handles HTTP GET requests.

GET requests encode form data in the request URL using ? and &.

Parameters:
uri The URI of the request. If this object is handling sub requests via registerPath(), this will be a partial URI rooted at the path this object is registered to handle.
contentType The HTTP Content-type of the request.
body The body of the request. This is usually empty with GET requests.
form Form data encoded in the request URL.
Returns:
An HTTP Response.

This method serves view and layer images. The request URL should be the SessionItem ID of the view or layer. The file extension represents the format of the image generated. Any image format supported by the current build of Qt is supported. This requires at least PNG support. If no extension is specified, PNG is assumed.

Implements MuHttpServer.


Software Development Kit - Opticks 4.9.0 Build 16218