30 #include "../../../dataaccess/dataset/DataSet.h" 31 #include "../../../dataaccess/dataset/DataSetType.h" 32 #include "../../../dataaccess/datasource/DataSource.h" 33 #include "../../../dataaccess/datasource/DataSourceCapabilities.h" 34 #include "../../../dataaccess/datasource/DataSourceManager.h" 35 #include "../../../dataaccess/query/QueryCapabilities.h" 36 #include "../../../dataaccess/query/Select.h" 37 #include "../../../dataaccess/utils/Utils.h" 38 #include "../../../geometry/GeometryProperty.h" 39 #include "../../../maptools/QueryLayer.h" 40 #include "../../../se/Utils.h" 41 #include "../../widgets/help/HelpPushButton.h" 42 #include "../datasource/selector/DataSourceSelectorWizardPage.h" 43 #include "../datasource/selector/DataSourceSelectorWidget.h" 44 #include "../utils/DoubleListWidget.h" 59 #include <QMessageBox> 63 #include <boost/uuid/random_generator.hpp> 64 #include <boost/uuid/uuid_io.hpp> 73 this->setWizardStyle(QWizard::ModernStyle);
75 this->setWindowTitle(tr(
"Query Layer Builder"));
77 this->setOption(QWizard::HaveHelpButton,
true);
78 this->setOption(QWizard::HelpButtonOnRight,
false);
82 this->setButton(QWizard::HelpButton, helpButton);
95 std::list<te::da::DataSourceInfoPtr> list =
m_dataSourcePage->getSelectorWidget()->getSelecteds();
105 if(!dataSource->isOpened())
117 std::vector<std::pair<std::string, std::string> > vec;
144 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Layer name not defined."));
196 static boost::uuids::basic_random_generator<boost::mt19937> gen;
197 boost::uuids::uuid u = gen();
198 std::string
id = boost::uuids::to_string(u);
205 layer->setDataSourceId(
m_ds->getId());
206 layer->setRendererType(
"QUERY_LAYER_RENDERER");
210 std::unique_ptr<const te::map::LayerSchema> schema(layer->getSchema());
214 layer->computeExtent();
245 std::string dsId =
m_ds->getId();
247 std::vector<std::string> datasetNames;
257 std::vector<std::string> datasetNames =
m_ds->getDataSetNames();
259 std::vector<std::pair<std::string, std::string> > dataSetSelecteds;
261 m_dataSetPage->getWidget()->getDataSetNames(dataSetSelecteds);
263 std::vector<std::string> inputProperties;
264 std::vector<std::string> geomProperties;
269 for(
size_t t = 0; t < dataSetSelecteds.size(); ++t)
272 std::string alias = dataSetSelecteds[t].second;
275 std::string dataSetName = dataSetSelecteds[t].first;
278 std::unique_ptr<te::da::DataSetType> dsType;
280 for(
unsigned int i = 0; i < datasetNames.size(); ++i)
282 if(datasetNames[i] == dataSetName)
283 dsType =
m_ds->getDataSetType(datasetNames[i]);
288 for(
size_t i = 0; i < dsType->size(); ++i)
290 std::string propName = dsType->getProperty(i)->getName();
291 std::string fullName = alias +
"." + propName;
300 geomProperties.push_back(fullName);
303 inputProperties.push_back(fullName);
309 m_fieldPage->getWidget()->setInputValues(inputProperties);
311 m_fieldPage->getWidget()->setFixedOutputValues(geomProperties,
"geometry");
315 m_orderByPage->getWidget()->setAttributeList(inputProperties);
325 std::vector<std::string> vecOperators;
327 std::set<std::string>::iterator it;
334 vecOperators.push_back(*it);
344 vecOperators.push_back(*it);
352 std::vector<std::string> vecSpatialOperators;
358 vecSpatialOperators.push_back(*it);
366 std::vector<std::string> vecConnectors;
372 vecConnectors.push_back(*it);
const std::set< std::string > & getComparsionOperators() const
This class is a wizard page with the DoubleListWidget component, used to create the FIELD object of a...
This file has the WhereClauseWizardPage class.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
boost::shared_ptr< DataSource > DataSourcePtr
A Qt dialog that allows users to create query builder based on TerraLib query framework.
This class is a wizard page with the WhereClauseWidget component.
This file has the FieldsWizardPage class.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
const std::set< std::string > & getArithmeticOperators() const
A layer resulting from a query.
static te::dt::Date ds(2010, 01, 01)
This file has the OrderByWizardPage class.
const QueryCapabilities & getQueryCapabilities() const
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
const std::set< std::string > & getLogicalOperators() const
This file has the GroupByWizardPage class.
A class that informs the query support of a given data source.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A class that can be used to model a filter expression that can be applied to a query.
TEDATAACCESSEXPORT void GetDataSetNames(std::vector< std::string > &datasetNames, const std::string &datasourceId)
A Select models a query to be used when retrieving data from a DataSource.
const std::set< std::string > & getSpatialTopologicOperators() const
This class is used to define the layer attributes information.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
boost::intrusive_ptr< QueryLayer > QueryLayerPtr
This class is a wizard page with the DoubleListWidget component, used to create the GROUPBY object of...
This class is a wizard page with the DataSetWidget component.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
This file has the DataSetWizardPage class.
This file has the LayerAttributesWizardPage class.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr