All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SystematicScaleOutside.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 PageSetupOutside.cpp
22 
23  \brief
24 
25  \ingroup layout
26 */
27 
28 // TerraLib
29 #include "SystematicScaleOutside.h"
30 #include "ui_SystematicScale.h"
31 #include "../../core/pattern/mvc/OutsideObserver.h"
32 #include "../../core/pattern/mvc/OutsideController.h"
33 #include "../../core/pattern/singleton/Context.h"
34 
35 // STL
36 #include <string>
37 #include <sstream>
38 
39 // Qt
40 #include <QColorDialog>
41 #include <QFrame>
42 #include <QLineEdit>
43 #include <QValidator>
44 #include <QComboBox>
45 #include <QCheckBox>
46 #include <QMessageBox>
47 #include <QObjectList>
48 
50  QDialog(0),
51  OutsideObserver(controller, o),
52  m_ui(new Ui::SystematicScale)
53 {
54  m_ui->setupUi(this);
55 
56  setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint
57  | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint );
58 
59 }
60 
62 {
63 
64 }
65 
67 {
68  setVisible(context.isShow());
69  if(context.isShow() == true)
70  show();
71  else
72  hide();
73 }
74 
75 void te::layout::SystematicScaleOutside::setPosition( const double& x, const double& y )
76 {
77  move(x,y);
78  refresh();
79 }
80 
82 {
83  QPointF posF = pos();
84  qreal valuex = posF.x();
85  qreal valuey = posF.y();
86 
87  te::gm::Coord2D coordinate;
88  coordinate.x = valuex;
89  coordinate.y = valuey;
90 
91  return coordinate;
92 }
93 
95 {
96  double scale = 0.;
97 
98  scale = m_ui->cmbScale->currentText().toDouble();
99  SystematicScaleType type = getType(scale);
100  emit systematicApply(scale, type);
101 
102  accept();
103 }
104 
106 {
107  reject();
108 }
109 
110 te::layout::SystematicScaleType te::layout::SystematicScaleOutside::getType( double scale )
111 {
112  te::layout::SystematicScaleType type = S0;
113 
114  if(scale == 250.000)
115  {
116  type = S250000;
117  }
118  else if(scale == 100.000)
119  {
120  type = S100000;
121  }
122  else if(scale == 50.000)
123  {
124  type = S50000;
125  }
126  else if(scale == 25.000)
127  {
128  type = S25000;
129  }
130 
131  return type;
132 }
Abstract class to represent an observable. "Model" part of MVC component.
Definition: Observable.h:56
Class responsible for maintaining the drawing context of a MVC component. It is always used by the "M...
Definition: ContextItem.h:49
double y
y-coordinate.
Definition: Coord2D.h:114
virtual te::gm::Coord2D getPosition()
Method that returns the position llx, lly Reimplement this function in a ItemObserver subclass to pro...
double x
x-coordinate.
Definition: Coord2D.h:113
Abstract class to represent an observer. "View" part of MVC widget. All classes representing the grap...
virtual void updateObserver(ContextItem context)
Reimplemented from Observer.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
S250000
Definition: AbstractType.h:121
virtual SystematicScaleType getType(double scale)
S100000
Definition: AbstractType.h:121
virtual void setPosition(const double &x, const double &y)
Change coordinate llx,lly of the MVC widget. Reimplement this function in a ItemController subclass t...
std::auto_ptr< Ui::SystematicScale > m_ui
SystematicScaleOutside(OutsideController *controller, Observable *o)
S50000
Definition: AbstractType.h:121
S25000
Definition: AbstractType.h:121
Abstract class to represent a controller. "Controller" part of MVC widget. All classes representing t...