27 #include "../../../geometry/Coord2D.h"
28 #include "../../../geometry/Envelope.h"
29 #include "../canvas/MapDisplay.h"
33 #include <QtGui/QMouseEvent>
38 :
AbstractTool(display, parent), m_zoomFactor( zoomFactor )
48 if(e->button() == Qt::LeftButton)
57 QPointF point( m_display->transform( e->posF() ) );
61 double w = currentExtent.
getWidth() * ( 1.0 / m_zoomFactor ) * 0.5;
62 double h = currentExtent.
getHeight() * ( 1.0 / m_zoomFactor ) * 0.5;
67 m_display->setExtent(e);
69 else if( e->button() == Qt::RightButton)
78 QPointF point( m_display->transform( e->posF() ) );
82 double w = currentExtent.
getWidth() * m_zoomFactor * 0.5;
83 double h = currentExtent.
getHeight() * m_zoomFactor * 0.5;
88 m_display->setExtent(e);
bool isValid() const
It tells if the rectangle is valid or not.
double getWidth() const
It returns the envelope width.
This class defines an interface for objects that can receive application events and respond to them...
double getHeight() const
It returns the envelope height.
An utility struct for representing 2D coordinates.
ZoomLeftAndRightClick(MapDisplay *display, const double &zoomFactor=2.0, QObject *parent=0)
It constructs a zoom click tool associated with the given map display.
A widget to control the display of a set of layers.
This class implements a concrete tool to geographic zoom operation using the left and right mouse cli...
Coord2D getCenter() const
It returns the rectangle's center coordinate.
~ZoomLeftAndRightClick()
Destructor.
bool mousePressEvent(QMouseEvent *e)
An Envelope defines a 2D rectangular region.