A customized table view for te::map::AbstractLayer objects. Uses a te::qt::widgets::DataSetModel as its model. More...
#include <DataSetTableView.h>
Public Slots | |
| void | addColumn () |
| Add column to the table. More... | |
| void | removeColumn (const int &column) |
| void | saveEditions () |
| Saves all editions to the dataset. More... | |
| void | setAutoPanEnabled (const bool &enable) |
| void | setAutoScrollEnabled (const bool &enable) |
| Enable / disable auto-scroll. More... | |
| void | setOIdsColumnsVisible (const bool &visible) |
| Shows or hides the icon sinalizing the columns that identify each row. More... | |
| void | setPromotionEnabled (const bool &enable) |
| Enable / disable promotion. More... | |
Table slot methods. | |
Methods to handle user interaction with table. | |
| void | createHistogram (const int &column) |
| Creates a new histogram based on the data at position column. More... | |
| void | createNormalDistribution (const int &column) |
| Creates a new chart that displays the normal distribution based on the data at position column. More... | |
| void | hideColumn (const int &column) |
| Hides the column at position column. More... | |
| void | showColumn (const int &column) |
| Shows the hidden column. More... | |
| void | renameColumn (const int &column) |
| Rename a column of the table. More... | |
| void | retypeColumn (const int &column) |
| Changes teh type of a column in the table. More... | |
| void | changeColumnData (const int &column) |
| Shows the change column data dialog. More... | |
| void | showAllColumns () |
| Shows all hidden columns. More... | |
| void | resetColumnsOrder () |
| Shows columns in the original order. More... | |
| void | highlightRow (const int &row, const bool &add) |
| Used to highlight the data when the mouse is clicked over a row in the table. More... | |
| void | highlightRows (const int &initRow, const int &finalRow) |
| Select all rows from initRow to finalRow. More... | |
| void | promote (const bool &scroll=false) |
| Promotes the highlighted rows. More... | |
| void | sortByColumns (const bool &asc, const int &col) |
| Sort by the selected columns. More... | |
Signals | |
| void | createChartDisplay (te::qt::widgets::ChartDisplayWidget *) |
| void | deselectOIds (te::da::ObjectIdSet *) |
| void | enableAutoPan (const bool &) |
| void | selectOIds (te::da::ObjectIdSet *, const bool &, te::gm::Envelope *) |
| Emmite when objects was selected. More... | |
Public Member Functions | |
| DataSetTableView (QWidget *parent=0) | |
| Constructor. More... | |
| bool | getAcceptDrop () |
| Gets accept drop flag. More... | |
| bool | getDragDrop () |
| Gets the drag drop flag. More... | |
| te::map::AbstractLayer * | getLayer () |
| Gets selected layer. More... | |
| bool | hasEditions () const |
| Returns true if there are unsaved editions e false if there is not. More... | |
| void | highlightOIds (const te::da::ObjectIdSet *oids) |
| Highlights the objects identified by oids. More... | |
| void | setAcceptDrop (bool b) |
| Sets the drop on the horizontal header. More... | |
| void | setDataSet (te::da::DataSet *dset, const bool &clearEditor=true) |
| Updates the data set being visualized. More... | |
| void | setDragDrop (bool b) |
| Sets the drag drop on the horizontal header. When the drag drop is enabled, you lose the ability to swap columns. More... | |
| void | setHighlightColor (const QColor &color) |
| Update the color to be used. More... | |
| void | setLayer (te::map::AbstractLayer *layer, const bool &clearEditor=true, const bool &editable=true) |
| Sets the layer to be presented. More... | |
| virtual void | setLayerSchema (const te::da::DataSetType *schema) |
| Sets the schema of the data set. It is used to define the primary keys and create the ObjectIdSet. More... | |
| virtual | ~DataSetTableView () |
| Virtual destructor. More... | |
Protected Member Functions | |
| void | removeSelection (const int &initRow, const int &finalRow) |
Protected Attributes | |
| bool | m_autoPanEnabled |
| Auto pan enabling. More... | |
| bool | m_autoScrollEnabled |
| Auto scroll enabling. More... | |
| HighlightDelegate * | m_delegate |
| Delegate used for rendering selected rows. More... | |
| bool | m_doScroll |
| Flag to force or not scrolling. More... | |
| te::da::DataSet * | m_dset |
| Data set being used. More... | |
| te::map::AbstractLayer * | m_layer |
| Pointer to the layer being presented. More... | |
| DataSetTableModel * | m_model |
| The model to be used. More... | |
| bool | m_orderAsc |
| Flag that sinalizes if the it is sorted in ascending sorting. More... | |
| std::vector< std::string > | m_orderby |
| Order by columns. More... | |
| TablePopupFilter * | m_popupFilter |
| The menus popup filter. More... | |
| bool | m_promotionEnabled |
| Promotion enabled. More... | |
| bool | m_resetOrder |
| Flag that sinalizes if there's is no sort. More... | |
| std::unique_ptr< te::da::DataSourceTransactor > | m_transactor |
| Pointer to the transactor, to keep data while table is open. More... | |
A customized table view for te::map::AbstractLayer objects. Uses a te::qt::widgets::DataSetModel as its model.
Definition at line 84 of file DataSetTableView.h.
| te::qt::widgets::DataSetTableView::DataSetTableView | ( | QWidget * | parent = 0 | ) |
Constructor.
| parent | Qt widget parent. |
Definition at line 985 of file DataSetTableView.cpp.
References enableAutoPan(), te::qt::widgets::DataSetTableModel::getPromoter(), highlightRow(), highlightRows(), m_delegate, m_model, m_popupFilter, te::qt::widgets::HighlightDelegate::setColor(), and te::qt::widgets::HighlightDelegate::setPromoter().
|
virtual |
Virtual destructor.
Definition at line 1026 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableModel::hasEditions(), m_model, te::xsd::serialize::Save(), and saveEditions().
|
slot |
Add column to the table.
Definition at line 1677 of file DataSetTableView.cpp.
References ds, GetDataSource(), te::qt::widgets::AddColumnDialog::getNewProperty(), te::map::AbstractLayer::getSchema(), te::qt::widgets::DataSetTableModel::insertColumns(), m_layer, m_model, p, setLayer(), te::map::AbstractLayer::setOutOfDate(), te::qt::widgets::AddColumnDialog::setTableName(), and te::common::Exception::what().
|
slot |
Shows the change column data dialog.
| column | Index of the column to be updated. |
Definition at line 1338 of file DataSetTableView.cpp.
References te::qt::widgets::AlterDataDialog::alterAllData(), te::da::Function::getArg(), GetColumnsNames(), GetDataSource(), te::qt::widgets::AlterDataDialog::getExpression(), te::da::ObjectIdSet::getExpressionByInClause(), te::da::BinaryFunction::getFirst(), te::da::Constraint::getName(), te::dt::Property::getName(), te::da::Function::getNumArgs(), te::da::PrimaryKey::getProperties(), te::da::ObjectIdSet::getPropertyNames(), te::map::AbstractLayer::getSchema(), te::da::BinaryFunction::getSecond(), te::map::AbstractLayer::getSelected(), te::dt::Property::getType(), te::da::Literal::getValue(), l1, m_dset, m_layer, te::qt::widgets::AlterDataDialog::setDataColumns(), te::qt::widgets::AlterDataDialog::setHelpLabelText(), setLayer(), te::map::AbstractLayer::setOutOfDate(), te::qt::widgets::AlterDataDialog::setSelectedColumn(), te::dt::STRING_TYPE, te::dt::AbstractData::toString(), and te::common::Exception::what().
|
signal |
Referenced by createHistogram(), and createNormalDistribution().
|
slot |
Creates a new histogram based on the data at position column.
| column | Column that provides the data for the histogram. |
Definition at line 1201 of file DataSetTableView.cpp.
References createChartDisplay(), te::qt::widgets::createHistogramDisplay(), te::qt::widgets::HistogramDataWidget::getHistogram(), te::qt::widgets::HistogramDataWidget::getSummaryFunction(), m_layer, and te::qt::widgets::HistogramDataWidget::setHistogramProperty().
|
slot |
Creates a new chart that displays the normal distribution based on the data at position column.
| column | Column that provides the data used to calculate the normal distribution. |
Definition at line 1230 of file DataSetTableView.cpp.
References createChartDisplay(), te::qt::widgets::createNormalDistribution(), te::map::AbstractLayer::getData(), te::dt::INT16_TYPE, m_layer, and te::dt::NUMERIC_TYPE.
|
signal |
Referenced by highlightRow().
|
signal |
Referenced by DataSetTableView().
| bool te::qt::widgets::DataSetTableView::getAcceptDrop | ( | ) |
Gets accept drop flag.
Definition at line 1061 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableHorizontalHeader::getAcceptDrop().
| bool te::qt::widgets::DataSetTableView::getDragDrop | ( | ) |
Gets the drag drop flag.
Definition at line 1049 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableHorizontalHeader::getDragDrop().
| te::map::AbstractLayer * te::qt::widgets::DataSetTableView::getLayer | ( | ) |
Gets selected layer.
Definition at line 1133 of file DataSetTableView.cpp.
References m_layer.
Referenced by TablePopupFilter::showStatistics().
| bool te::qt::widgets::DataSetTableView::hasEditions | ( | ) | const |
Returns true if there are unsaved editions e false if there is not.
Definition at line 1196 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableModel::hasEditions(), and m_model.
Referenced by TablePopupFilter::eventFilter().
|
slot |
Hides the column at position column.
| column | Column to be hidden. |
Definition at line 1245 of file DataSetTableView.cpp.
Referenced by HideGeometryColumns(), and HideTsVectorColumn().
| void te::qt::widgets::DataSetTableView::highlightOIds | ( | const te::da::ObjectIdSet * | oids | ) |
Highlights the objects identified by oids.
| oids | The identifiers of rows to be highlighted. |
Definition at line 1169 of file DataSetTableView.cpp.
References te::da::ObjectIdSet::begin(), te::qt::widgets::DataSetTableModel::getPromoter(), m_autoScrollEnabled, m_delegate, m_doScroll, m_model, m_promotionEnabled, te::qt::widgets::Promoter::map2Row(), promote(), te::qt::widgets::HighlightDelegate::setObjectIdSet(), and te::da::ObjectIdSet::size().
Referenced by te::qt::af::DataSetTableDockWidget::onApplicationTriggered(), te::qt::af::DataSetTableDockWidget::setLayer(), and setLayer().
Used to highlight the data when the mouse is clicked over a row in the table.
| row | Row to be highlighted. |
| add | True to add to selection, false to new selection. |
Definition at line 1513 of file DataSetTableView.cpp.
References te::da::ObjectIdSet::begin(), te::da::ObjectIdSet::contains(), deselectOIds(), GetExtent(), te::qt::widgets::DataSetTableModel::getObjectIdSet(), te::qt::widgets::DataSetTableModel::getPromoter(), te::qt::widgets::HighlightDelegate::getSelected(), te::map::AbstractLayer::getSelected(), m_delegate, m_doScroll, m_dset, m_layer, m_model, m_promotionEnabled, promote(), selectOIds(), and te::qt::widgets::HighlightDelegate::setObjectIdSet().
Referenced by DataSetTableView().
|
slot |
Select all rows from initRow to finalRow.
| initRow | the begin row. |
| finalRow | the final row. |
Definition at line 1550 of file DataSetTableView.cpp.
References GetExtent(), te::qt::widgets::DataSetTableModel::getObjectIdSet(), te::qt::widgets::DataSetTableModel::getPromoter(), m_doScroll, m_dset, m_model, m_promotionEnabled, promote(), and selectOIds().
Referenced by DataSetTableView().
|
slot |
Promotes the highlighted rows.
The rows highlighted are presented in the begining of the table.
| If | true, scrolls to the top of the table. |
Definition at line 1580 of file DataSetTableView.cpp.
References te::qt::widgets::HighlightDelegate::getSelected(), m_delegate, m_model, m_popupFilter, te::qt::widgets::DataSetTableModel::promote(), te::qt::widgets::DataSetTableModel::setEnabled(), and TablePopupFilter::setEnabled().
Referenced by highlightOIds(), highlightRow(), highlightRows(), setPromotionEnabled(), and sortByColumns().
|
slot |
Definition at line 1726 of file DataSetTableView.cpp.
References ds, GetDataSource(), te::map::AbstractLayer::getSchema(), m_layer, m_model, te::qt::widgets::DataSetTableModel::removeColumns(), setLayer(), te::map::AbstractLayer::setOutOfDate(), and te::common::Exception::what().
|
protected |
Definition at line 1781 of file DataSetTableView.cpp.
|
slot |
Rename a column of the table.
| column | Index of the column to be renamed. |
Definition at line 1255 of file DataSetTableView.cpp.
References GetDataSource(), te::qt::widgets::RenameColumnDialog::getNewName(), te::qt::widgets::RenameColumnDialog::getOldName(), te::da::DataSet::getPropertyName(), te::map::AbstractLayer::getSchema(), m_dset, m_layer, setLayer(), te::qt::widgets::RenameColumnDialog::setOldColumnName(), te::map::AbstractLayer::setOutOfDate(), TE_LOG_INFO, and te::common::Exception::what().
|
slot |
Shows columns in the original order.
Definition at line 1498 of file DataSetTableView.cpp.
References nCols.
|
slot |
Changes teh type of a column in the table.
| column | Index of the column to be changed. |
Definition at line 1301 of file DataSetTableView.cpp.
References GetDataSource(), te::dt::Property::getName(), te::qt::widgets::RetypeColumnDialog::getProperty(), te::map::AbstractLayer::getSchema(), te::dt::Property::getType(), m_layer, te::qt::widgets::RetypeColumnDialog::setColumnName(), setDataSet(), setLayer(), te::map::AbstractLayer::setOutOfDate(), te::qt::widgets::RetypeColumnDialog::setTableName(), and te::qt::widgets::RetypeColumnDialog::setType().
|
slot |
Saves all editions to the dataset.
Definition at line 1796 of file DataSetTableView.cpp.
References ds, GetDataSource(), te::qt::widgets::DataSetTableModel::getEditions(), te::da::GetEmptyOIDSet(), te::map::AbstractLayer::getSchema(), m_layer, m_model, setLayer(), and te::common::Exception::what().
Referenced by ~DataSetTableView().
|
signal |
Emmite when objects was selected.
Referenced by highlightRow(), and highlightRows().
| void te::qt::widgets::DataSetTableView::setAcceptDrop | ( | bool | b | ) |
Sets the drop on the horizontal header.
| b | True: accept drop. False: do not accept drop. |
Definition at line 1055 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableHorizontalHeader::setAcceptDrop().
|
slot |
Definition at line 1757 of file DataSetTableView.cpp.
References m_autoPanEnabled.
|
slot |
Enable / disable auto-scroll.
| enable | True for enable auto-scroll, false for disable it. |
Definition at line 1762 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableModel::getPromoter(), te::da::ObjectIdSet::getPropertyPos(), te::qt::widgets::HighlightDelegate::getSelected(), m_autoScrollEnabled, m_delegate, m_dset, m_model, and te::qt::widgets::Promoter::preProcessKeys().
| void te::qt::widgets::DataSetTableView::setDataSet | ( | te::da::DataSet * | dset, |
| const bool & | clearEditor = true |
||
| ) |
Updates the data set being visualized.
Note that this DataSet MUST HAVE random access. The view DOES TAKE the ownership of the pointer.
| dset | The new data set to be visualized. |
| clearEditor | True for reset editions, false to maintain it. |
Definition at line 1138 of file DataSetTableView.cpp.
References HideGeometryColumns(), HideTsVectorColumn(), m_delegate, m_dset, m_model, m_popupFilter, reset(), te::qt::widgets::DataSetTableModel::setDataSet(), te::qt::widgets::HighlightDelegate::setDataSet(), te::qt::widgets::DataSetTableHorizontalHeader::setDataSet(), and TablePopupFilter::setDataSet().
Referenced by main(), retypeColumn(), setLayer(), and sortByColumns().
| void te::qt::widgets::DataSetTableView::setDragDrop | ( | bool | b | ) |
Sets the drag drop on the horizontal header. When the drag drop is enabled, you lose the ability to swap columns.
| b | True: does the drag drop. False: do not drag drop. |
Definition at line 1043 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableHorizontalHeader::setDragDrop().
| void te::qt::widgets::DataSetTableView::setHighlightColor | ( | const QColor & | color | ) |
Update the color to be used.
| color | The new color; |
Definition at line 1189 of file DataSetTableView.cpp.
References m_delegate, and te::qt::widgets::HighlightDelegate::setColor().
Referenced by te::qt::af::DataSetTableDockWidget::setHighlightColor().
| void te::qt::widgets::DataSetTableView::setLayer | ( | te::map::AbstractLayer * | layer, |
| const bool & | clearEditor = true, |
||
| const bool & | editable = true |
||
| ) |
Sets the layer to be presented.
| layer | Pointer to the layer to be presented. |
| clearEditor | True for reset editions, false to maintain it. |
| editable | True to allow layer editions. |
Definition at line 1067 of file DataSetTableView.cpp.
References ds, GetCapabilities(), te::da::DataSourceCapabilities::getDataSetCapabilities(), GetDataSetQuery(), GetDataSource(), te::map::AbstractLayer::getEncoding(), te::map::AbstractLayer::getSchema(), te::map::AbstractLayer::getSelected(), highlightOIds(), te::da::DataSetCapabilities::isConnected(), m_layer, m_model, m_orderAsc, m_orderby, m_popupFilter, m_transactor, te::common::RANDOM, setDataSet(), TablePopupFilter::setDataSetTypeCapabilities(), te::qt::widgets::DataSetTableModel::setEditable(), TablePopupFilter::setIsEditable(), TablePopupFilter::setIsOGR(), te::qt::widgets::DataSetTableHorizontalHeader::setLayer(), and setLayerSchema().
Referenced by addColumn(), changeColumnData(), removeColumn(), renameColumn(), retypeColumn(), saveEditions(), and te::qt::af::DataSetTableDockWidget::setLayer().
|
virtual |
Sets the schema of the data set. It is used to define the primary keys and create the ObjectIdSet.
| schema | The DataSetType to extract keys. |
Definition at line 1154 of file DataSetTableView.cpp.
References te::da::GetEmptyOIDSet(), m_delegate, m_model, te::qt::widgets::HighlightDelegate::setObjectIdSet(), and te::qt::widgets::DataSetTableModel::setPkeysColumns().
Referenced by setLayer().
|
slot |
Shows or hides the icon sinalizing the columns that identify each row.
| visible | True for icon visible, false otherwise. |
Definition at line 1670 of file DataSetTableView.cpp.
References m_model, and te::qt::widgets::DataSetTableModel::showOIdsVisible().
|
slot |
Enable / disable promotion.
If enabled all selected rows will be moved to te top of the table.
| enable | True to enable promotion, false to disable it |
Definition at line 1769 of file DataSetTableView.cpp.
References te::qt::widgets::DataSetTableModel::getPromoter(), te::da::ObjectIdSet::getPropertyPos(), te::qt::widgets::HighlightDelegate::getSelected(), m_delegate, m_dset, m_model, m_popupFilter, m_promotionEnabled, te::qt::widgets::Promoter::preProcessKeys(), promote(), and TablePopupFilter::setPromotionEnabled().
|
slot |
Shows all hidden columns.
Definition at line 1489 of file DataSetTableView.cpp.
References TablePopupFilter::getHiddenColumns(), and m_popupFilter.
|
slot |
Shows the hidden column.
| column | Column to be presented. |
Definition at line 1250 of file DataSetTableView.cpp.
Sort by the selected columns.
| asc | True for ascendent order, false for descendent. |
| col | Index of the column to used by sorting. |
Definition at line 1601 of file DataSetTableView.cpp.
References te::da::DataSourceCapabilities::getDataSetCapabilities(), GetDataSetQuery(), GetDataSource(), te::map::AbstractLayer::getEncoding(), te::qt::widgets::DataSetTableModel::getPromoter(), te::da::DataSet::getPropertyName(), te::da::ObjectIdSet::getPropertyPos(), te::qt::widgets::HighlightDelegate::getSelected(), te::da::DataSetCapabilities::isConnected(), m_delegate, m_dset, m_layer, m_model, m_orderby, m_promotionEnabled, m_transactor, nCols, te::qt::widgets::Promoter::preProcessKeys(), promote(), te::common::RANDOM, setDataSet(), and te::common::Exception::what().
|
protected |
Auto pan enabling.
Definition at line 361 of file DataSetTableView.h.
Referenced by setAutoPanEnabled().
|
protected |
Auto scroll enabling.
Definition at line 362 of file DataSetTableView.h.
Referenced by highlightOIds(), and setAutoScrollEnabled().
|
protected |
Delegate used for rendering selected rows.
Definition at line 358 of file DataSetTableView.h.
Referenced by DataSetTableView(), highlightOIds(), highlightRow(), promote(), setAutoScrollEnabled(), setDataSet(), setHighlightColor(), setLayerSchema(), setPromotionEnabled(), and sortByColumns().
|
protected |
Flag to force or not scrolling.
Definition at line 363 of file DataSetTableView.h.
Referenced by highlightOIds(), highlightRow(), and highlightRows().
|
protected |
Data set being used.
Definition at line 365 of file DataSetTableView.h.
Referenced by changeColumnData(), highlightRow(), highlightRows(), renameColumn(), setAutoScrollEnabled(), setDataSet(), setPromotionEnabled(), and sortByColumns().
|
protected |
Pointer to the layer being presented.
Definition at line 359 of file DataSetTableView.h.
Referenced by addColumn(), changeColumnData(), createHistogram(), createNormalDistribution(), getLayer(), highlightRow(), removeColumn(), renameColumn(), retypeColumn(), saveEditions(), setLayer(), and sortByColumns().
|
protected |
The model to be used.
Definition at line 356 of file DataSetTableView.h.
Referenced by addColumn(), DataSetTableView(), hasEditions(), highlightOIds(), highlightRow(), highlightRows(), promote(), removeColumn(), saveEditions(), setAutoScrollEnabled(), setDataSet(), setLayer(), setLayerSchema(), setOIdsColumnsVisible(), setPromotionEnabled(), sortByColumns(), and ~DataSetTableView().
|
protected |
Flag that sinalizes if the it is sorted in ascending sorting.
Definition at line 367 of file DataSetTableView.h.
Referenced by setLayer().
|
protected |
Order by columns.
Definition at line 366 of file DataSetTableView.h.
Referenced by setLayer(), and sortByColumns().
|
protected |
The menus popup filter.
Definition at line 357 of file DataSetTableView.h.
Referenced by DataSetTableView(), promote(), setDataSet(), setLayer(), setPromotionEnabled(), and showAllColumns().
|
protected |
Promotion enabled.
Definition at line 364 of file DataSetTableView.h.
Referenced by highlightOIds(), highlightRow(), highlightRows(), setPromotionEnabled(), and sortByColumns().
|
protected |
Flag that sinalizes if there's is no sort.
Definition at line 368 of file DataSetTableView.h.
|
protected |
Pointer to the transactor, to keep data while table is open.
Definition at line 360 of file DataSetTableView.h.
Referenced by setLayer(), and sortByColumns().