All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PaperConfig.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 PaperConfig.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "PaperConfig.h"
30 
32  m_paperType(te::layout::A4),
33  m_paperOrientationType(Portrait),
34  m_customW(0),
35  m_customH(0)
36 {
37 
38 }
39 
41  m_paperOrientationType(Portrait)
42 {
43  m_paperType = paperType;
44 }
45 
47 {
48 
49 }
50 
52 {
53  m_paperType = paperType;
54 }
55 
57 {
58  return m_paperType;
59 }
60 
61 void te::layout::PaperConfig::getPaperSize( double &w, double &h )
62 {
63  switch(m_paperType)
64  {
65  case Letter:
66  w=216;
67  h=279;
68  break;
69  case Legal:
70  w=216;
71  h=356;
72  break;
73  case Executive:
74  w=191;
75  h=254;
76  break;
77  case A0 :
78  w=841;
79  h=1189;
80  break;
81  case A1 :
82  w=594;
83  h=841;
84  break;
85  case A2 :
86  w=420;
87  h=594;
88  break;
89  case A3 :
90  w=297;
91  h=420;
92  break;
93  case A4 :
94  w=210;
95  h=297;
96  break;
97  case A5 :
98  w=148;
99  h=210;
100  break;
101  case A6 :
102  w=105;
103  h=148;
104  break;
105  case A7 :
106  w=74;
107  h=105;
108  break;
109  case A8 :
110  w=52;
111  h=74;
112  break;
113  case A9 :
114  w=37;
115  h=52;
116  break;
117  case Custom:
118  w = m_customW;
119  h = m_customH;
120  break;
121  default:
122  w = 0;
123  h = 0;
124  }
125 
126  if(m_paperOrientationType == Landscape)
127  {
128  double copy = w;
129  w = h;
130  h = copy;
131  }
132 }
133 
135 {
136  m_paperOrientationType = orientation;
137 }
138 
140 {
141  return m_paperOrientationType;
142 }
143 
145 {
146  m_customW = w;
147  m_customH = h;
148 }
landScape orientation
Definition: AbstractType.h:86
virtual ~PaperConfig()
Destructor.
Definition: PaperConfig.cpp:46
LayoutAbstractPaperType
Enum TdkAbstractComponentType. This is the enumeration of the components types.
Definition: AbstractType.h:65
virtual void setPaperSizeCustom(double w, double h)
Custom paper size.
Class responsible for paper setting. Size, orientation, custom size, etc.
portrait orientation
Definition: AbstractType.h:85
virtual LayoutOrientationType getPaperOrientantion()
Returns paper orientation type enum.
PaperConfig()
Constructor.
Definition: PaperConfig.cpp:31
LayoutAbstractPaperType m_paperType
paper type enum. Ex.: A4
Definition: PaperConfig.h:112
virtual void getPaperSize(double &w, double &h)
Returns paper size. Height and Width.
Definition: PaperConfig.cpp:61
virtual LayoutAbstractPaperType getPaperType()
Returns paper type.
Definition: PaperConfig.cpp:56
virtual void setPaperOrientation(LayoutOrientationType orientation)
Sets paper orientation type enum. Ex.: Portrait.
virtual void setPaperType(LayoutAbstractPaperType paperType)
Sets paper type enum. Ex.: A4.
Definition: PaperConfig.cpp:51