Zoom.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/tools/Zoom.h
22 
23  \brief This is a utility class to geographic zoom operation.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_ZOOM_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_ZOOM_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #include "AbstractTool.h"
32 
33 namespace te
34 {
35  namespace qt
36  {
37  namespace widgets
38  {
39 // Forward declarations
40  class MapDisplay;
41 
42  /*!
43  \class Zoom
44 
45  \brief This is a utility class to geographic zoom operation.
46 
47  \ingroup widgets
48  */
50  {
51  public:
52 
53  /*!
54  \enum ZoomType
55 
56  \brief Defines the zoom type.
57  */
58  enum ZoomType
59  {
60  In, /*!< Performs the zoom in operation. */
61  Out /*!< Performs the zoom out operation. */
62  };
63 
64  /** @name Initializer Methods
65  * Methods related to instantiation and destruction.
66  */
67  //@{
68 
69  /*!
70  \brief It constructs a zoom associated with the given map display.
71 
72  \param display The map display associated with the zoom operation.
73 
74  \note The class will NOT take the ownership of the given pointer.
75  */
76  Zoom(MapDisplay* display, const double& zoomFactor = 2.0, const ZoomType& type = In, QObject* parent = 0);
77 
78  /*! \brief Destructor. */
79  virtual ~Zoom();
80 
81  //@}
82 
83  /*!
84  \brief Sets the zoom operation type.
85 
86  \param type The zoom operation type - ZoomIn | ZoomOut;
87  */
88  void setZoomType(const ZoomType& type);
89 
90  /*!
91  \brief Performs the zoom operation on map display, considering the zoom factor, zoom type and the given point.
92 
93  \param point A point in world coordinates.
94  \param centralize If the reference point is given, its possible to choose between centering this reference point or keeping it in the same position that it was.
95 
96  \note If the given point is not null, the new extent will be centered on this point. Otherwise, the current center will be kepped.
97  */
98  void applyZoom(const QPointF& point = QPointF(), bool centralize = true);
99 
100  protected:
101 
102  double m_zoomFactor; //!< Factor used to zoom. i.e. A factor value of 2.0 (default) will generate a new extent twice (%) bigger or smaller, depending of ZoomType.
103  ZoomType m_zoomType; //!< Enum that indicates the zoom type.
104  };
105 
106  } // end namespace widgets
107  } // end namespace qt
108 } // end namespace te
109 
110 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_ZOOM_H
double m_zoomFactor
Factor used to zoom. i.e. A factor value of 2.0 (default) will generate a new extent twice (%) bigger...
Definition: Zoom.h:102
Abstract tool concept.
This is a utility class to geographic zoom operation.
Definition: Zoom.h:49
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
This class defines an interface for objects that can receive application events and respond to them...
Definition: AbstractTool.h:62
ZoomType
Defines the zoom type.
Definition: Zoom.h:58
ZoomType m_zoomType
Enum that indicates the zoom type.
Definition: Zoom.h:103
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63