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/ApplicationController.h"
33 #include "../../../qt/af/events/LayerEvents.h"
34 //#include "../../af/Project.h"
35 #include "TimeSliderWidgetAction.h"
36 
38  : te::qt::plugins::st::AbstractAction(menu),
39  m_timeSliderWidget(0)
40 {
41  createAction(tr("Time Slider...").toUtf8().data());
42 }
43 
45 {
47  {
49  delete m_timeSliderWidget;
50  }
51  m_menu->removeAction(m_action);
52  delete m_action;
53 }
54 
56  bool /*checked*/)
57 {
58  if (m_timeSliderWidget == 0)
59  {
60  //Create the time slider
61  QWidget* mainWindow = te::qt::af::AppCtrlSingleton::getInstance().getMainWindow();
65  connect(m_timeSliderWidget, SIGNAL(deleteTimeSliderWidget()), this, SLOT(onDeleteTimeSliderWidget()));
66 // connect(ba, SIGNAL(applicationClose()), this, SLOT(onDeleteTimeSliderWidget())); alguem já providencia isso mesmo sem ter este coonect
68  }
69 
70  if (m_timeSliderWidget->isHidden())
72  else
74 }
75 
77 {
79  delete m_timeSliderWidget;
81 }
82 
84 {
85  switch (e->m_id)
86  {
88  {
89  int a = 0;
90  }
91  break;
92 
94  {
97  if (layer->getType() == "TRAJECTORYDATASETLAYER")
99  }
100  break;
101 
103  {
105  std::list<te::map::AbstractLayerPtr> layers = ev->m_layers;
106  std::list<te::map::AbstractLayerPtr>::iterator it;
107 
108  for (it = layers.begin(); it != layers.end(); ++it)
109  {
110  if ((*it)->getType() == "TRAJECTORYDATASETLAYER")
112  }
113  }
114  break;
115 
117  {
118  int a = 0;
119  }
120  break;
121 
123  {
124  int a = 0;
125  }
126  break;
127 
128  default:
129  return;
130  }
131 }
132 
virtual void layerRemoved(te::map::AbstractLayerPtr layer)
This method is used to remove a layer.
A base class for application events.
te::map::AbstractLayerPtr m_layer
Pointer to the selected layer.
Definition: LayerEvents.h:196
A widget to control the display of a set of layers.
void onApplicationTriggered(te::qt::af::evt::Event *e)
This is an abstract class used to register actions into st pluging.
This event indicates that the layer has been selected.
Definition: LayerEvents.h:183
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
URI C++ Library.
Definition: Attributes.h:37
void createAction(std::string name, std::string pixmap="")
Create and set the actions parameters.
This file defines the TimeSliderWidgetAction class.
te::qt::widgets::MapDisplay * getMapDisplay()
std::list< te::map::AbstractLayerPtr > m_layers
Layer removed.
Definition: LayerEvents.h:154
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
te::qt::widgets::TimeSliderWidget * m_timeSliderWidget
QAction * m_action
Action used to call the process.
A wdiget used to control the visualization of temporal data.
virtual void layerAdded(te::map::AbstractLayerPtr layer)
This method is used to add a new layer.