27 #include "../../../dataaccess/dataset/DataSetAdapter.h" 
   28 #include "../../../dataaccess/dataset/DataSetTypeConverter.h" 
   29 #include "../../../dataaccess/datasource/DataSourceInfo.h" 
   30 #include "../../../dataaccess/datasource/DataSourceInfoManager.h" 
   31 #include "../../../dataaccess/datasource/DataSourceManager.h" 
   32 #include "../../../dataaccess/utils/Utils.h" 
   33 #include "../../../geometry/GeometryProperty.h" 
   34 #include "../../../maptools/DataSetLayer.h" 
   36 #include "ui_SHP2PostGISDialogForm.h" 
   39 #include <QMessageBox> 
   46     m_ui(new Ui::SHP2PostGisDialogForm)
 
   52   m_ui->m_imgLabel->setPixmap(QIcon::fromTheme(
"data-exchange-shp-pgis-hint").pixmap(112,48));
 
   68   std::list<te::map::AbstractLayerPtr>::iterator it = layers.begin();
 
   70   while(it != layers.end())
 
   83     if(dsPtr->getType() == 
"OGR") 
 
   84       m_ui->m_inputLayerComboBox->addItem(l->getTitle().c_str(), QVariant::fromValue(l));
 
   89   if(m_ui->m_inputLayerComboBox->count() > 0)
 
   91     QString s = m_ui->m_inputLayerComboBox->currentText();
 
   93     m_ui->m_dataSetLineEdit->setText(s);
 
   99   m_ui->m_outputDataSourceComboBox->clear();
 
  101   std::vector<te::da::DataSourceInfoPtr> datasources;
 
  105   for(std::size_t i = 0; i < datasources.size(); ++i)
 
  109     if(datasource.get() == 0)
 
  112     const std::string& title = datasource->getTitle();
 
  114     m_ui->m_outputDataSourceComboBox->addItem(title.c_str(), QVariant::fromValue(datasource));
 
  120   QMessageBox::information(
this, 
"Help", 
"Under development");
 
  125   int idxLayer = m_ui->m_inputLayerComboBox->currentIndex();
 
  129     QMessageBox::warning(
this, tr(
"Warning"), tr(
"Input layer not selected."));
 
  133   QVariant varLayer = m_ui->m_inputLayerComboBox->itemData(idxLayer, Qt::UserRole);
 
  138     QMessageBox::warning(
this, tr(
"Warning"), tr(
"Error getting selected layer."));
 
  142   int idxDataSource = m_ui->m_outputDataSourceComboBox->currentIndex();
 
  146     QMessageBox::warning(
this, tr(
"Warning"), tr(
"Output data source not selected."));
 
  150   QVariant varDataSource = m_ui->m_outputDataSourceComboBox->itemData(idxDataSource, Qt::UserRole);
 
  155     QMessageBox::warning(
this, tr(
"Warning"), tr(
"Error getting selected data source."));
 
  159   if(m_ui->m_dataSetLineEdit->text().isEmpty())
 
  161     QMessageBox::warning(
this, tr(
"Warning"), tr(
"Data Set name not defined."));
 
  168     std::auto_ptr<te::da::DataSetType> dsType = layer->getSchema();
 
  172     if(dsType->size() == 0)
 
  181     dsTypeResult->
setName(m_ui->m_dataSetLineEdit->text().toStdString());
 
  184     if(m_ui->m_spatialIndexCheckBox->isChecked())
 
  192         std::string name = p->
getName() + 
"_idx";
 
  203     std::map<std::string,std::string> nopt;
 
  205     std::auto_ptr<te::da::DataSet> dataset = layer->getData();
 
  207     targetDSPtr->createDataSet(dsTypeResult, nopt);
 
  211      if(dataset->moveBeforeFirst())
 
  212        targetDSPtr->add(dsTypeResult->getName(), dsAdapter.get(), targetDSPtr->getConnectionInfo());
 
  214     QMessageBox::information(
this, tr(
"Exchanger"), tr(
"Layer exported successfully."));
 
  216   catch(
const std::exception& e)
 
  218     QString errMsg(tr(
"Error during exchanger. The reported error is: %1"));
 
  220     errMsg = errMsg.arg(e.what());
 
  222     QMessageBox::information(
this, tr(
"Exchanger"), errMsg);
 
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager. 
 
TEDATAACCESSEXPORT void LoadProperties(te::da::DataSetType *dataset, const std::string &datasourceId)
 
boost::shared_ptr< DataSource > DataSourcePtr
 
A class that models the description of a dataset. 
 
Q_DECLARE_METATYPE(te::map::AbstractLayerPtr)
 
DataSetType * getResult() const 
 
void setIndexType(IndexType t)
It sets the index type. 
 
void add(te::dt::Property *p)
It adds the property to the list of properties of the index. 
 
te::dt::Property * clone() const 
It returns a clone of the object. 
 
It models a property definition. 
 
An converter for DataSetType. 
 
void setName(const std::string &name)
It sets the property name. 
 
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance. 
 
A exchanger dialog from SHP to PostGis operation. 
 
const std::string & getDataSourceId() const 
 
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used. 
 
void onHelpPushButtonClicked()
 
SHP2PostGISDialog(QWidget *parent=0, Qt::WindowFlags f=0)
 
void setDataSources()
Set the list of data sources that can be used. 
 
A layer with reference to a dataset. 
 
void setName(const std::string &name)
It sets the index name. 
 
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
 
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
std::auto_ptr< Ui::SHP2PostGisDialogForm > m_ui
 
It describes an index associated to a DataSetType. 
 
void onOkPushButtonClicked()
 
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
 
const std::string & getName() const 
It returns the property name.