27 #include "../../../../dataaccess/utils/Utils.h"
29 #include "ui_LayerSearchWidgetForm.h"
36 m_ui(new Ui::LayerSearchWidgetForm)
45 connect(
m_ui->m_nameLineEdit, SIGNAL(textChanged(
const QString&)), SLOT(
onFilter()));
46 connect(
m_ui->m_repAllRadioButton, SIGNAL(clicked(
bool)), SLOT(
onFilter()));
47 connect(
m_ui->m_repGeomRadioButton, SIGNAL(clicked(
bool)), SLOT(
onFilter()));
48 connect(
m_ui->m_repRstRadioButton, SIGNAL(clicked(
bool)), SLOT(
onFilter()));
64 m_ui->m_treeWidget->setSelectionMode(QAbstractItemView::MultiSelection);
68 m_ui->m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
74 std::list<te::map::AbstractLayerPtr> list;
76 QList<QTreeWidgetItem*> sel = m_ui->m_treeWidget->selectedItems();
78 QList<QTreeWidgetItem*>::iterator it = sel.begin();
80 while(it != sel.end())
82 QTreeWidgetItem* item = *it;
84 QVariant v = item->data(0, Qt::UserRole);
98 m_layerList = layerList;
100 fillTreeView(m_layerList);
105 m_ui->m_repRstRadioButton->setChecked(
true);
107 m_ui->m_filterByRepGroupBox->setEnabled(
false);
114 m_ui->m_repGeomRadioButton->setChecked(
true);
116 m_ui->m_filterByRepGroupBox->setEnabled(
false);
123 m_ui->m_repAllRadioButton->setChecked(
true);
125 m_ui->m_filterByRepGroupBox->setEnabled(
false);
132 m_minRasterBandsValue = value;
134 m_minRasterBandsDefined =
true;
141 m_maxRasterBandsValue = value;
143 m_maxRasterBandsDefined =
true;
150 std::list<te::map::AbstractLayerPtr>::iterator it = layerList.begin();
152 while(it != layerList.end())
156 QTreeWidgetItem* item =
new QTreeWidgetItem(m_ui->m_treeWidget);
158 item->setText(0, l->getTitle().c_str());
159 item->setIcon(0, QIcon::fromTheme(
"layer"));
160 item->setData(0, Qt::UserRole, QVariant::fromValue(l));
166 item->setText(1, lParent->
getTitle().c_str());
168 item->setText(1,
"");
171 item->setText(2, l->getType().c_str());
177 m_ui->m_treeWidget->resizeColumnToContents(0);
178 m_ui->m_treeWidget->resizeColumnToContents(2);
180 m_ui->m_treeWidget->expandAll();
185 QTreeWidgetItemIterator it(m_ui->m_treeWidget);
189 QTreeWidgetItem* layerItem = *it;
190 bool hide = items.indexOf(layerItem) == -1;
191 layerItem->setHidden(hide);
201 QString str = m_ui->m_nameLineEdit->text();
203 QList<QTreeWidgetItem*> items = m_ui->m_treeWidget->findItems(str, Qt::MatchContains | Qt::MatchRecursive, 0);
205 QList<QTreeWidgetItem*> result;
207 for(
int i = 0; i < items.size(); ++i)
209 QTreeWidgetItem* item = items.at(i);
211 QVariant v = item->data(0, Qt::UserRole);
215 std::auto_ptr<te::da::DataSetType> dsType = l->getSchema();
217 if(m_ui->m_repAllRadioButton->isChecked())
219 result.push_back(item);
221 else if(m_ui->m_repGeomRadioButton->isChecked())
223 if(dsType.get() && dsType->hasGeom())
224 result.push_back(item);
226 else if(m_ui->m_repRstRadioButton->isChecked())
228 if(dsType.get() && dsType->hasRaster())
231 if(m_minRasterBandsDefined || m_maxRasterBandsDefined)
233 std::auto_ptr<te::da::DataSet> ds = l->getData();
237 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
239 if(m_minRasterBandsDefined && m_maxRasterBandsDefined)
241 if(inputRst->getNumberOfBands() >= m_minRasterBandsValue && inputRst->getNumberOfBands() <= m_maxRasterBandsValue)
243 result.push_back(item);
246 else if(m_minRasterBandsDefined)
248 if(inputRst->getNumberOfBands() >= m_minRasterBandsValue)
250 result.push_back(item);
253 else if(m_minRasterBandsDefined)
255 if(inputRst->getNumberOfBands() <= m_maxRasterBandsValue)
257 result.push_back(item);
263 result.push_back(item);
This is the base class for layers.
virtual const std::string & getTitle() const
It returns the layer title.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr