ScalePropertyItem.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 terralib/qt/widgets/se/ScalePropertyItem.cpp
22 
23 \brief A widget used to define the scale values.
24 */
25 
26 #include "../../../se/SvgParameter.h"
27 #include "../../../se/Utils.h"
28 #include "../propertybrowser/AbstractPropertyManager.h"
29 #include "ScalePropertyItem.h"
30 
31 // STL
32 #include <cassert>
33 #include <limits>
34 
35 te::qt::widgets::ScalePropertyItem::ScalePropertyItem(QtTreePropertyBrowser* pb, QColor c)
36  : te::qt::widgets::AbstractPropertyItem(pb, c),
37  m_minScale(0.0),
38  m_maxScale(std::numeric_limits<double>::infinity())
39 {
40  //build property browser basic fill
41  QtProperty* scaleProperty = te::qt::widgets::AbstractPropertyManager::getInstance().m_groupManager->addProperty(tr("Scale Denominator"));
42 
43  QStringList list;
44 
45  //min scale
46  m_minScaleProperty = te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager->addProperty(tr("Minimum"));
49  te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager->setMaximum(m_minScaleProperty, std::numeric_limits<double>::infinity());
51  scaleProperty->addSubProperty(m_minScaleProperty);
52 
53  //max scale
54  m_maxScaleProperty = te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager->addProperty(tr("Maximum"));
57  te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager->setMaximum(m_maxScaleProperty, std::numeric_limits<double>::infinity());
58  te::qt::widgets::AbstractPropertyManager::getInstance().m_doubleManager->setValue(m_maxScaleProperty, std::numeric_limits<double>::infinity());
59  scaleProperty->addSubProperty(m_maxScaleProperty);
60 
61  addProperty(scaleProperty, tr("Scale Denominator"), QColor(250, 208, 190));
62 }
63 
65 
67 {
68  m_minScale = value;
69 
71 }
72 
74 {
75  return m_minScale;
76 }
77 
79 {
80  m_maxScale = value;
81 
83 }
84 
86 {
87  return m_maxScale;
88 }
89 
90 void te::qt::widgets::ScalePropertyItem::valueChanged(QtProperty *p, double value)
91 {
92  if (p == m_minScaleProperty)
93  {
94  m_minScale = value;
95 
96  emit scaleMinChanged();
97  }
98  else if (p == m_maxScaleProperty)
99  {
100  m_maxScale = value;
101 
102  emit scaleMaxChanged();
103  }
104 }
A widget used to define the main property items that can be used to describe a se object...
ScalePropertyItem(QtTreePropertyBrowser *pb, QColor c=QColor())
Constructor.
virtual void valueChanged(QtProperty *p, double value)
void setMaxScaleDenominator(const double &value)
static AbstractPropertyManager & getInstance()
It returns a reference to the singleton instance.
A widget used to define the scale values.
URI C++ Library.
Definition: Attributes.h:37
te::gm::Polygon * p
void addProperty(QtProperty *property, const QString &id, QColor c)
void setMinScaleDenominator(const double &value)