1
/***************************************************************************
2
qgsgeomtypedialog.cpp - description
5
copyright : (C) 2004 by Marco Hugentobler
6
email : marco.hugentobler@autoform.ch
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
17
/* $Id: qgsgeomtypedialog.cpp 4695 2006-01-15 21:22:13Z gsherman $ */
19
#include "qgsgeomtypedialog.h"
20
#include "qgsaddattrdialog.h"
22
QgsGeomTypeDialog::QgsGeomTypeDialog(): QDialog()
25
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
26
connect(mCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
28
mPointRadioButton->setChecked(true);
29
mAttributeView->removeColumn(0);
30
mAttributeView->addColumn(tr("Name"));
31
mAttributeView->addColumn(tr("Type"));
32
mFileFormatComboBox->insertItem("ESRI Shapefile");
33
/*mFileFormatComboBox->insertItem("Comma Separated Value");
34
mFileFormatComboBox->insertItem("GML");
35
mFileFormatComboBox->insertItem("Mapinfo File");*/
38
QgsGeomTypeDialog::~QgsGeomTypeDialog()
43
QGis::WKBTYPE QgsGeomTypeDialog::selectedType() const
45
if(mPointRadioButton->isChecked())
47
return QGis::WKBPoint;
49
else if(mLineRadioButton->isChecked())
51
return QGis::WKBLineString;
53
else if(mPolygonRadioButton->isChecked())
55
return QGis::WKBPolygon;
58
return QGis::WKBUnknown;
61
void QgsGeomTypeDialog::on_mAddAttributeButton_clicked()
63
std::list<QString> types;
64
types.push_back("Real");
65
types.push_back("Integer");
66
types.push_back("String");
67
QgsAddAttrDialog d(types);
68
if(d.exec()==QDialog::Accepted)
70
Q3ListViewItem* attritem=new Q3ListViewItem(mAttributeView, d.name(), d.type());
72
if(mAttributeView->childCount()>0)
74
mOkButton->setEnabled(true);
78
void QgsGeomTypeDialog::on_mRemoveAttributeButton_clicked()
80
delete(mAttributeView->currentItem());
81
if(mAttributeView->childCount()==0)
83
mOkButton->setEnabled(false);
88
void QgsGeomTypeDialog::on_btnHelp_clicked()
90
QgsContextHelp::run(context_id);
92
void QgsGeomTypeDialog::attributes(std::list<std::pair<QString, QString> >& at) const
94
Q3ListViewItemIterator it(mAttributeView);
95
while ( it.current() )
97
Q3ListViewItem *item = it.current();
98
at.push_back(std::make_pair(item->text(0), item->text(1)));
100
qWarning(("appending "+item->text(0)+"//"+item->text(1)).toLocal8Bit().data());
106
QString QgsGeomTypeDialog::selectedFileFormat() const
108
return mFileFormatComboBox->currentText();