2
** File: evisimagedisplaywidget.h
3
** Author: Peter J. Ersts ( ersts at amnh.org )
4
** Creation Date: 2007-03-13
6
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
8
** This library/program is free software; you can redistribute it
9
** and/or modify it under the terms of the GNU Library General Public
10
** License as published by the Free Software Foundation; either
11
** version 2 of the License, or ( at your option ) any later version.
13
** This library/program is distributed in the hope that it will be useful,
14
** but WITHOUT ANY WARRANTY; without even the implied warranty of
15
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
** Library General Public License for more details.
18
** This work was made possible through a grant by the the John D. and
19
** Catherine T. MacArthur Foundation. Additionally, this program was prepared by
20
** the American Museum of Natural History under award No. NA05SEC46391002
21
** from the National Oceanic and Atmospheric Administration, U.S. Department
22
** of Commerce. The statements, findings, conclusions, and recommendations
23
** are those of the author( s ) and do not necessarily reflect the views of the
24
** National Oceanic and Atmospheric Administration or the Department of Commerce.
28
#ifndef EVISIMAGEDISPLAYWIDGET_H
29
#define EVISIMAGEDISPLAYWIDGET_H
33
#include <QScrollArea>
34
#include <QPushButton>
37
#include <QResizeEvent>
40
* \class eVisGenericEventBrowserGui
41
* \brief Generic viewer for browsing event
42
* The eVisImageDisplayWidget is a component of the eVisGenericEventBrowser. This widget provides
43
* the ability to display an image on the widget and basic zoom capabilities. This class was created
44
* so the same display features could be easily added to other widgets as needed.
46
class eVisImageDisplayWidget : public QWidget
52
/** \brief Constructor */
53
eVisImageDisplayWidget( QWidget* parent = 0, Qt::WFlags fl = 0 );
55
/** \brief Destructor */
56
~eVisImageDisplayWidget();
58
/** \brief Load an image from disk and display */
59
void displayImage( QString );
61
/** \brief Load an image from a remote location using http and display */
62
void displayUrlImage( QString );
65
* There needs to be more logic around setting the zoom steps as you could change it mid display
66
* and end up getting not being able to zoom in or out
68
/** \brief Accessor for ZOOM_STEPS */
69
int getZoomSteps( ) { return ZOOM_STEPS; }
71
/** \brief Mutator for ZOON_STEPS */
72
void setZoomSteps( int steps ) { ZOOM_STEPS = steps; }
75
void resizeEvent( QResizeEvent *event );
79
/** \brief Used to hold the http request to match the correct emits with the correct result */
80
int mCurrentHttpImageRequestId;
82
/** \brief CUrrent Zoom level */
85
/** \brief widget to display the image in */
86
QScrollArea* mDisplayArea;
88
/** \brief Method that acually display the image in the widget */
91
/** \brief Pointer to the http buffer */
94
/** \brief Pointer to the http connection if needed */
95
QHttp* mHttpConnection;
97
/** \brief This is a point to the actual image being displayed */
100
/** \brief Label to hold the image */
103
/** \brief Flag to indicate the success of the last load request */
106
/** \brief Ratio if height to width or width to height for the original image, which ever is smaller */
107
double mImageSizeRatio;
109
/** \brief Boolean to indicate which feature the mImageSizeRation corresponds to */
112
/** \brief Boolean to indicate which feature the mImageSizeRation corresponds to */
115
/** \brief The increment by which the image is scaled during each scaling event */
118
/** \brief The single factor by which the original image needs to be scaled to fit into current display area */
121
/** \brief Zoom in button */
122
QPushButton* pbtnZoomIn;
124
/** \brief Zoom out button */
125
QPushButton* pbtnZoomOut;
127
/** \brief Zoom to full extent button */
128
QPushButton* pbtnZoomFull;
130
/** \brief Method called to compute the various scaling parameters */
133
/** \brief The number of steps between the scale to fit image and full resolution */
137
void on_pbtnZoomIn_clicked( );
139
void on_pbtnZoomOut_clicked( );
141
void on_pbtnZoomFull_clicked( );
143
/** \brief Slot called when the http request is completed */
144
void displayUrlImage( int, bool );