TrajectoryAction.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/st/TrajectoryAction.cpp
22 
23  \brief This file defines the Trajectory Action class
24 */
25 
26 
27 //Terralib
28 #include "../../../qt/af/events/LayerEvents.h"
29 #include "../../../qt/widgets/dataset/selector/DataSetSelectorWizardPage.h"
30 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWizardPage.h"
31 //#include "../../../qt/widgets/layer/explorer/AbstractTreeItemFactory.h"
32 #include "../../../qt/widgets/st/TrajectoryWizard.h"
33 #include "../../../st/loader/STDataLoader.h"
34 #include "../../af/ApplicationController.h"
35 #include "TrajectoryAction.h"
36 
37 // Qt
38 #include <QMessageBox>
39 #include <QWizard>
40 #include <QWizardPage>
41 
42 //STL
43 #include <memory>
44 
45 // Boost
46 #include <boost/bind.hpp>
47 #include <boost/functional/factory.hpp>
48 
50 : te::qt::plugins::st::AbstractAction(menu)
51 {
52  createAction(tr("Trajectory...").toUtf8().data(), "trajectory-layer");
53  //te::qt::widgets::AbstractTreeItemFactory::reg("TRAJECTORYDATASETLAYER", boost::bind(boost::factory<TrajectoryLayerItem*>(),_1, _2));
54 }
55 
57 
59 {
60  QWidget* parent = te::qt::af::AppCtrlSingleton::getInstance().getMainWindow();
61 
62  std::auto_ptr<te::qt::widgets::TrajectoryWizard> trajWiz;
63  trajWiz.reset( new te::qt::widgets::TrajectoryWizard(parent));
64 
65  int res = trajWiz->exec();
66  if (res == QDialog::Accepted)
67  {
68  //Initialize STDataLoader support
70 
71  std::list<te::st::TrajectoryDataSetLayerPtr> layers = trajWiz->getTrajectoryLayers();
72  std::list<te::st::TrajectoryDataSetLayerPtr>::const_iterator layerItB = layers.begin();
73  std::list<te::st::TrajectoryDataSetLayerPtr>::const_iterator layerItE = layers.end();
74 
75  while(layerItB != layerItE)
76  {
77  te::qt::af::evt::LayerAdded evt(*layerItB, 0);
78  emit triggered(&evt);
79 
80  layerItB++;
81  }
82  }
83 }
This event signals that a new layer was created.
Definition: LayerEvents.h:71
This is an abstract class used to register actions into st pluging.
void triggered(te::qt::af::evt::Event *e)
static void initialize()
It returns the spatial extent of the observations of a coverage series.
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.
virtual void onActionActivated(bool checked)
This file defines the Trajectory Action class.