27 #include "../../../../dataaccess/utils/Utils.h" 29 #include "ui_LayerSearchWidgetForm.h" 34 te::qt::widgets::LayerSearchWidget::LayerSearchWidget(
QWidget* parent, Qt::WindowFlags f)
36 m_ui(new
Ui::LayerSearchWidgetForm)
41 m_minRasterBandsDefined =
false;
42 m_maxRasterBandsDefined =
false;
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()));
62 m_ui->m_treeWidget->setSelectionMode(QAbstractItemView::MultiSelection);
66 m_ui->m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
72 std::list<te::map::AbstractLayerPtr> list;
74 QList<QTreeWidgetItem*> sel =
m_ui->m_treeWidget->selectedItems();
76 QList<QTreeWidgetItem*>::iterator it = sel.begin();
78 while(it != sel.end())
82 QVariant v = item->data(0, Qt::UserRole);
103 m_ui->m_repRstRadioButton->setChecked(
true);
105 m_ui->m_filterByRepGroupBox->setEnabled(
false);
112 m_ui->m_repGeomRadioButton->setChecked(
true);
114 m_ui->m_filterByRepGroupBox->setEnabled(
false);
121 m_ui->m_repAllRadioButton->setChecked(
true);
123 m_ui->m_filterByRepGroupBox->setEnabled(
false);
148 std::list<te::map::AbstractLayerPtr>::iterator it = layerList.begin();
150 while(it != layerList.end())
156 item->setText(0, l->getTitle().c_str());
157 item->setIcon(0, QIcon::fromTheme(
"layer"));
158 item->setData(0, Qt::UserRole, QVariant::fromValue(l));
164 item->setText(1, lParent->
getTitle().c_str());
166 item->setText(1,
"");
169 item->setText(2, l->getType().c_str());
171 if (it == layerList.begin())
172 m_ui->m_treeWidget->setItemSelected(item,
true);
178 m_ui->m_treeWidget->resizeColumnToContents(0);
179 m_ui->m_treeWidget->resizeColumnToContents(2);
181 m_ui->m_treeWidget->expandAll();
186 QTreeWidgetItemIterator it(
m_ui->m_treeWidget);
191 bool hide = items.indexOf(layerItem) == -1;
192 layerItem->setHidden(hide);
202 QString str =
m_ui->m_nameLineEdit->text();
204 QList<QTreeWidgetItem*> items =
m_ui->m_treeWidget->findItems(str, Qt::MatchContains | Qt::MatchRecursive, 0);
206 QList<QTreeWidgetItem*> result;
208 for(
int i = 0; i < items.size(); ++i)
212 QVariant v = item->data(0, Qt::UserRole);
216 std::unique_ptr<te::da::DataSetType> dsType = l->getSchema();
218 if(
m_ui->m_repAllRadioButton->isChecked())
220 result.push_back(item);
222 else if(
m_ui->m_repGeomRadioButton->isChecked())
224 if(dsType.get() && dsType->hasGeom())
225 result.push_back(item);
227 else if(
m_ui->m_repRstRadioButton->isChecked())
229 if(dsType.get() && dsType->hasRaster())
234 std::unique_ptr<te::da::DataSet>
ds = l->getData();
238 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
244 result.push_back(item);
251 result.push_back(item);
258 result.push_back(item);
264 result.push_back(item);
This is the base class for layers.
virtual const std::string & getTitle() const
It returns the layer title.
static te::dt::Date ds(2010, 01, 01)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr