TreeItemFactory.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2013 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 TreeItemFactory.h
22 
23  \brief A class for building layer items.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_TREEITEMFACTORY_H
27 #define __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_TREEITEMFACTORY_H
28 
29 // TerraLib
30 #include "../../../../common/Static.h"
31 #include "../../../../maptools/AbstractLayer.h"
32 #include "../../Config.h"
33 
34 // STL
35 #include <map>
36 #include <string>
37 
38 // Boost
39 #include <boost/function.hpp>
40 
41 // Forward declaration
42 class QObject;
43 
44 namespace te
45 {
46  namespace qt
47  {
48  namespace widgets
49  {
50  class TreeItem;
51 
52  /*!
53  \class TreeItemFactory
54 
55  \brief A class for building layer items.
56 
57  \ingroup widgets
58  */
60  {
61  public:
62 
63  typedef boost::function<TreeItem* (const te::map::AbstractLayerPtr&)> FactoryFnctType;
64 
65  static TreeItem* make(const te::map::AbstractLayerPtr& layer);
66 
67  static void reg(const std::string& key, const FactoryFnctType& f);
68 
69  static void initialize();
70 
71  static void finalize();
72 
73  private:
74 
75  static std::map<std::string, FactoryFnctType> sm_factories;
76  };
77  } // end namespace widgets
78  } // end namespace qt
79 } // end namespace te
80 
81 #endif // __TERRALIB_QT_WIDGETS_LAYER_EXPLORER_INTERNAL_TREEITEMFACTORY_H
static std::map< std::string, FactoryFnctType > sm_factories
A class for building layer items.
Defines a hierarchical structure.
Definition: TreeItem.h:72
URI C++ Library.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::function< TreeItem *(const te::map::AbstractLayerPtr &)> FactoryFnctType
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
A base type for static classes.
Definition: Static.h:43