2007-08-13 09:13:58 +00:00
|
|
|
/* This file is part of Mapnik (c++ mapping toolkit)
|
2011-10-23 14:09:12 +00:00
|
|
|
*
|
2011-10-23 13:04:25 +00:00
|
|
|
* Copyright (C) 2011 Artem Pavlenko
|
2007-08-13 09:13:58 +00:00
|
|
|
*
|
|
|
|
* Mapnik is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "layer_info_dialog.hpp"
|
|
|
|
|
2010-03-10 17:08:37 +00:00
|
|
|
// mapnik
|
2014-07-23 15:19:14 +00:00
|
|
|
#include <mapnik/datasource.hpp>
|
2013-01-10 03:12:20 +00:00
|
|
|
#include <mapnik/params.hpp>
|
|
|
|
#include <mapnik/params_impl.hpp>
|
2010-03-10 17:08:37 +00:00
|
|
|
#include <mapnik/layer.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget *parent)
|
2007-08-13 09:13:58 +00:00
|
|
|
: QDialog(parent)
|
|
|
|
{
|
2010-03-10 17:08:37 +00:00
|
|
|
ui.setupUi(this);
|
2011-10-23 14:09:12 +00:00
|
|
|
|
2010-03-10 17:08:37 +00:00
|
|
|
ui.tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Name"));
|
|
|
|
ui.tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Value"));
|
2011-10-23 14:09:12 +00:00
|
|
|
|
2010-03-10 17:08:37 +00:00
|
|
|
// Layer name
|
|
|
|
ui.layerNameEdit->setText(QString(lay.name().c_str()));
|
|
|
|
|
|
|
|
// Named Styles : TODO!!!
|
2011-10-23 14:09:12 +00:00
|
|
|
|
2010-03-10 17:08:37 +00:00
|
|
|
// Datasource
|
|
|
|
mapnik::datasource_ptr ds = lay.datasource();
|
|
|
|
if (ds)
|
|
|
|
{
|
2011-05-04 15:53:36 +00:00
|
|
|
mapnik::parameters ps = ds->params();
|
2010-03-10 17:08:37 +00:00
|
|
|
|
2011-05-04 15:53:36 +00:00
|
|
|
ui.tableWidget->setRowCount(ps.size());
|
|
|
|
ui.tableWidget->setColumnCount(2);
|
2010-03-10 17:08:37 +00:00
|
|
|
|
2011-05-04 15:53:36 +00:00
|
|
|
mapnik::parameters::const_iterator pos;
|
2010-03-10 17:08:37 +00:00
|
|
|
int index=0;
|
2011-05-04 15:53:36 +00:00
|
|
|
for (pos = ps.begin();pos != ps.end();++pos)
|
|
|
|
{
|
|
|
|
boost::optional<std::string> result;
|
2014-08-12 12:40:45 +00:00
|
|
|
mapnik::util::apply_visitor(mapnik::value_extractor_visitor<std::string>(result),pos->second);
|
2011-05-04 15:53:36 +00:00
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
QTableWidgetItem *keyItem = new QTableWidgetItem(QString(pos->first.c_str()));
|
|
|
|
QTableWidgetItem *valueItem = new QTableWidgetItem(QString((*result).c_str()));
|
|
|
|
ui.tableWidget->setItem(index,0,keyItem);
|
2011-10-23 14:09:12 +00:00
|
|
|
ui.tableWidget->setItem(index,1,valueItem);
|
2011-05-04 15:53:36 +00:00
|
|
|
++index;
|
|
|
|
}
|
2011-10-23 14:09:12 +00:00
|
|
|
}
|
2010-03-10 17:08:37 +00:00
|
|
|
}
|
2007-08-13 09:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Ui::LayerInfoDialog& layer_info_dialog::getUI()
|
|
|
|
{
|
|
|
|
return ui;
|
|
|
|
}
|