All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TimeSliderWidgetAction.cpp
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/plugins/layout/TimeSliderWidgetAction.cpp
22 
23  \brief This file defines the TimeSliderWidgetAction class
24 */
25 
26 // Terralib
27 #include "../../../qt/widgets/canvas/MapDisplay.h"
28 #include "../../af/ApplicationController.h"
29 #include "../../af/BaseApplication.h"
30 #include "../../af/connectors/MapDisplay.h"
31 #include "../../af/connectors/InterfaceController.h"
32 #include "../../af/Project.h"
33 #include "TimeSliderWidgetAction.h"
34 
36  : te::qt::plugins::st::AbstractAction(menu),
37  m_timeSliderWidget(0)
38 {
39  createAction(tr("Time Slider...").toStdString());
40 
41  //GEnerating the slider
42  QWidget* mainWindow = te::qt::af::ApplicationController::getInstance().getMainWindow();
45  //if(display->getExtent().isValid() == false)
46  //{
47  // // WGS84
48  // te::gm::Envelope e(-180, -180, 360, 360);
49  // display->setExtent(e);
50  // display->setSRID(4326);
51  //}
53  connect(m_timeSliderWidget, SIGNAL(deleteTimeSliderWidget()), this, SLOT(onDeleteTimeSliderWidget()));
54  connect(ba, SIGNAL(applicationClose()), this, SLOT(onDeleteTimeSliderWidget()));
55 
57  m_timeSliderWidget->hide();
58 }
59 
61 {
62  if(m_timeSliderWidget)
63  {
64  QWidget* mainWindow = te::qt::af::ApplicationController::getInstance().getMainWindow();
66 
67  ba->getInterfaceController()->removeInteface(m_timeSliderWidget);
68  delete m_timeSliderWidget;
69  }
70  m_menu->removeAction(m_action);
71  delete m_action;
72 }
73 
75 {
76  if(m_timeSliderWidget->isHidden())
77  {
78  m_timeSliderWidget->show();
79  }
80  else
81  {
82  m_timeSliderWidget->hide();
83  }
84 }
85 
87 {
88  if(m_timeSliderWidget)
89  delete m_timeSliderWidget;
90  m_timeSliderWidget = 0;
91 }
te::qt::widgets::MapDisplay * getDisplay()
Definition: MapDisplay.cpp:116
void addInterface(te::qt::widgets::InterfaceController *i)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:66
A QMainWindow to be used as the basis for TerraLib applications.
InterfaceController * getInterfaceController()
This is an abstract class used to register actions into st pluging.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
void removeInteface(te::qt::widgets::InterfaceController *i)
void createAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
te::qt::widgets::TimeSliderWidget * m_timeSliderWidget
A wdiget used to control the visualization of temporal data.