All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ItemFactory.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2014-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 ItemFactory.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "ItemFactory.h"
30 #include "RectangleItem.h"
31 #include "HorizontalRulerItem.h"
32 #include "VerticalRulerItem.h"
33 #include "ItemGroup.h"
34 #include "PaperItem.h"
35 #include "MapItem.h"
36 #include "Observer.h"
37 #include "MapGridItem.h"
38 #include "LegendItem.h"
39 #include "ScaleItem.h"
40 
42 {
43 
44 }
45 
47 {
48 
49 }
50 
52 {
53  Observer* item = 0;
54 
55  switch (type)
56  {
57 
58  case TPRetangleItem:
59  {
60  RectangleItem* rectangle = new RectangleItem(params.getController(), params.getModel());
61  item = (Observer*)rectangle;
62  return item;
63  break;
64  }
65  case TPLegendItem:
66  {
67  LegendItem* legend = new LegendItem(params.getController(), params.getModel());
68  item = (Observer*)legend;
69  return item;
70  break;
71  }
72  case TPHorizontalRuler:
73  {
74  HorizontalRulerItem* ruler = new HorizontalRulerItem(params.getController(), params.getModel());
75  item = (Observer*)ruler;
76  return item;
77  break;
78  }
79  case TPVerticalRuler:
80  {
81  VerticalRulerItem* ruler = new VerticalRulerItem(params.getController(), params.getModel());
82  item = (Observer*)ruler;
83  return item;
84  break;
85  }
86  case TPText:
87  {
88  break;
89  }
90  case TPItemGroup:
91  {
92  ItemGroup* group = new ItemGroup(params.getController(), params.getModel());
93  item = (Observer*)group;
94  return item;
95  break;
96  }
97  case TPPaperItem:
98  {
99  PaperItem* paper = new PaperItem(params.getController(), params.getModel());
100  item = (Observer*)paper;
101  return item;
102  break;
103  }
104  case TPMapItem:
105  {
106  MapItem* map = new MapItem(params.getController(), params.getModel());
107  item = (Observer*)map;
108  return item;
109  break;
110  }
111  case TPMapGridItem:
112  {
113  MapGridItem* mapGrid = new MapGridItem(params.getController(), params.getModel());
114  item = (Observer*)mapGrid;
115  return item;
116  break;
117  }
118  case TPScaleItem:
119  {
120  ScaleItem* scale = new ScaleItem(params.getController(), params.getModel());
121  item = (Observer*)scale;
122  return item;
123  break;
124  }
125  }
126 
127  return 0;
128 }
ItemController * getController()
LayoutAbstractObjectType
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:38
virtual Observer * make(LayoutAbstractObjectType type, ItemParamsCreate params=ItemParamsCreate())
Definition: ItemFactory.cpp:51