All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ImageOutlineWidget.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/ImageOutlineWidget.cpp
22 
23  \brief A dialog used to build a Symbolizer element.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../se.h"
29 #include "ImageOutlineWidget.h"
30 #include "LineSymbolizerWidget.h"
32 #include "SymbolPreviewWidget.h"
33 #include "ui_ImageOutlineWidgetForm.h"
34 
35 // STL
36 #include <cassert>
37 
39  : QWidget(parent, f),
40  m_ui(new Ui::ImageOutlineWidgetForm),
41  m_psWidget(0),
42  m_io(new te::se::ImageOutline)
43 {
44  m_ui->setupUi(this);
45 
46  //adjust interface
47  m_layout = new QGridLayout(m_ui->m_scrollArea);
48 
49  m_ui->m_previewGroupBox->setVisible(false);
50 
51  // Preview
52  QGridLayout* l = new QGridLayout(m_ui->m_previewWidget);
53  l->setContentsMargins(0,0,0,0);
54  l->setAlignment(Qt::AlignTop);
55 
56  m_preview = new te::qt::widgets::SymbolPreviewWidget(QSize(120, 120), m_ui->m_previewWidget);
57 
58  l->addWidget(m_preview);
59 
60  // Signals & slots
61  connect(m_ui->m_NoneSymbolizerRadioButton, SIGNAL(clicked()), SLOT(onNoneSymbolizerClicked()));
62  connect(m_ui->m_polygonSymbolizerRadioButton, SIGNAL(clicked()), SLOT(onPolygonSymbolizerClicked()));
63 }
64 
66 {
67  delete m_io;
68 }
69 
71 {
72  assert(io);
73 
74  delete m_io;
75 
76  m_io = io->clone();
77 
78  if(m_io->getSymbolizer())
79  {
80  m_ui->m_polygonSymbolizerRadioButton->setChecked(true);
81 
82  onPolygonSymbolizerClicked();
83  }
84  else
85  {
86  m_ui->m_NoneSymbolizerRadioButton->setChecked(true);
87 
88  onNoneSymbolizerClicked();
89  }
90 }
91 
93 {
94  return m_io->clone();
95 }
96 
98 {
99  te::se::Symbolizer* s = m_io->getSymbolizer();
100 
101  m_ui->m_previewGroupBox->setVisible(true);
102 
103  m_preview->updatePreview(s);
104 
105  delete s;
106 }
107 
109 {
110  delete m_psWidget;
111  m_psWidget = 0;
112 }
113 
115 {
116  deleteInterfaces();
117 
118  m_io->setSymbolizer(0);
119 
120  m_ui->m_previewGroupBox->setVisible(false);
121 }
122 
124 {
125  deleteInterfaces();
126 
127  m_psWidget = new te::qt::widgets::PolygonSymbolizerWidget(m_ui->m_scrollArea);
128 
129  if(m_io->getSymbolizer())
130  {
131  te::se::Symbolizer* s = m_io->getSymbolizer();
132 
133  m_psWidget->setSymbolizer((te::se::PolygonSymbolizer*)s);
134 
135  delete s;
136  }
137 
138  connect(m_psWidget, SIGNAL(symbolizerChanged()), SLOT(onPolygonSymbolizerCreated()));
139 
140  m_layout->addWidget(m_psWidget);
141 
142  m_psWidget->show();
143 
144  m_io->setSymbolizer(m_psWidget->getSymbolizer());
145 
146  updateUi();
147 }
148 
150 {
151  m_io->setSymbolizer(m_psWidget->getSymbolizer());
152 
153  updateUi();
154 }
ImageOutline * clone() const
It creates a new copy of this object.
A widget used to build Symbolizer element.
A widget used to preview symbol elements.
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
ImageOutlineWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a ImageOutlineWidget dialog which is a child of parent, with widget flags set to f...
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::se::ImageOutline * getImageOutline() const
void setImageOutline(const te::se::ImageOutline *io)
A widget used to build a line symbolizer element.
ImageOutline specifies how individual source rasters in a multi-raster set (such as a set of satellit...
Definition: ImageOutline.h:53
std::auto_ptr< Ui::ImageOutlineWidgetForm > m_ui
Dialog form.
A widget used to build a polygon symbolizer element.
A widget used to preview symbol elements.
A widget used to build a polygon symbolizer element.
te::qt::widgets::SymbolPreviewWidget * m_preview
Preview Widget used to visualize the symbol.
QGridLayout * m_layout
Qt Layout object.
void updateUi()
Updates the widget form based on internal mark element.