All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include "TrajectoryLayerItem.h"
37 
38 // Qt
39 #include <QMessageBox>
40 #include <QWizard>
41 #include <QWizardPage>
42 
43 //STL
44 #include <memory>
45 
46 // Boost
47 #include <boost/bind.hpp>
48 #include <boost/functional/factory.hpp>
49 
51 : te::qt::plugins::st::AbstractAction(menu)
52 {
53  createAction(tr("Trajectory...").toStdString(), "trajectory-layer");
54  te::qt::widgets::AbstractTreeItemFactory::reg("TRAJECTORYDATASETLAYER", boost::bind(boost::factory<TrajectoryLayerItem*>(),_1, _2));
55 }
56 
58 {
59 }
60 
62 {
63  QWidget* parent = te::qt::af::ApplicationController::getInstance().getMainWindow();
64 
65  std::auto_ptr<te::qt::widgets::TrajectoryWizard> trajWiz;
66  trajWiz.reset( new te::qt::widgets::TrajectoryWizard(parent));
67 
68  int res = trajWiz->exec();
69  if (res == QDialog::Accepted)
70  {
71  //Initialize STDataLoader support
73 
74  std::list<te::st::TrajectoryDataSetLayerPtr> layers = trajWiz->getTrajectoryLayers();
75  std::list<te::st::TrajectoryDataSetLayerPtr>::const_iterator layerItB = layers.begin();
76  std::list<te::st::TrajectoryDataSetLayerPtr>::const_iterator layerItE = layers.end();
77 
78  while(layerItB != layerItE)
79  {
80  te::qt::af::evt::LayerAdded evt(*layerItB, 0);
82  layerItB++;
83  }
84  }
85 }
This event signals that a new layer was created.
Definition: LayerEvents.h:66
static void reg(const std::string &key, const FactoryFnctType &f)
This is an abstract class used to register actions into st pluging.
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.
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.