All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ProxyProject.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2013-2014 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 ProxyProject.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "ProxyProject.h"
30 #include "../../af/Project.h"
31 #include "../../af/ApplicationController.h"
32 
34 {
35 
36 }
37 
39 {
40 
41 }
42 
43 std::list<te::map::AbstractLayerPtr> te::qt::plugins::layout::ProxyProject::getAllLayers( bool invalid /*= true*/ )
44 {
45  std::list<te::map::AbstractLayerPtr> layers = te::qt::af::ApplicationController::getInstance().getProject()->getAllLayers(false);
46  return layers;
47 }
48 
49 const std::list<te::map::AbstractLayerPtr> te::qt::plugins::layout::ProxyProject::getSelectedLayers( bool invalid /*= true*/ ) const
50 {
51  std::list<te::map::AbstractLayerPtr> layers = te::qt::af::ApplicationController::getInstance().getProject()->getSelectedLayers(false);
52  return layers;
53 }
54 
56 {
58 
59  std::list<te::map::AbstractLayerPtr> layers = te::qt::af::ApplicationController::getInstance().getProject()->getAllLayers(false);
60 
61  std::list<te::map::AbstractLayerPtr>::iterator it;
62 
63  for(it = layers.begin() ; it != layers.end() ; ++it)
64  {
65  te::map::AbstractLayerPtr layerPtr = (*it);
66  if(!layerPtr)
67  continue;
68 
69  if(layerPtr->getTitle().compare(name) == 0)
70  {
71  layer = layerPtr;
72  break;
73  }
74  }
75  return layer;
76 }
Provide a surrogate or placeholder for te::qt::af::Project to control access to it. A wrapper to access without complexity. This proxy is required because module not must have dependence te::qt::af. Useful to access the Layers belonging to the project.
std::list< te::map::AbstractLayerPtr > getAllLayers(bool invalid=true)
Reimplemented from AbstractProxyProject.
te::map::AbstractLayerPtr contains(std::string name)
Reimplemented from AbstractProxyProject.
const std::list< te::map::AbstractLayerPtr > getSelectedLayers(bool invalid=true) const
Reimplemented from AbstractProxyProject.
static ApplicationController & getInstance()
It returns a reference to the singleton instance.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr