te::qt::widgets::DataSetTableView Class Reference

A customized table view for te::map::AbstractLayer objects. Uses a te::qt::widgets::DataSetModel as its model. More...

#include <DataSetTableView.h>

Inheritance diagram for te::qt::widgets::DataSetTableView:
QTableView

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::AbstractLayergetLayer ()
 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...
 
HighlightDelegatem_delegate
 Delegate used for rendering selected rows. More...
 
bool m_doScroll
 Flag to force or not scrolling. More...
 
te::da::DataSetm_dset
 Data set being used. More...
 
te::map::AbstractLayerm_layer
 Pointer to the layer being presented. More...
 
DataSetTableModelm_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...
 
TablePopupFilterm_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::DataSourceTransactorm_transactor
 Pointer to the transactor, to keep data while table is open. More...
 

Detailed Description

A customized table view for te::map::AbstractLayer objects. Uses a te::qt::widgets::DataSetModel as its model.

Note
We assume that the layer can return ALWAYS return a te::da::DataSet object with random access of it's values.

Definition at line 84 of file DataSetTableView.h.

Constructor & Destructor Documentation

te::qt::widgets::DataSetTableView::DataSetTableView ( QWidget parent = 0)
te::qt::widgets::DataSetTableView::~DataSetTableView ( )
virtual

Member Function Documentation

void te::qt::widgets::DataSetTableView::createChartDisplay ( te::qt::widgets::ChartDisplayWidget )
signal
void te::qt::widgets::DataSetTableView::createHistogram ( const int column)
slot

Creates a new histogram based on the data at position column.

Parameters
columnColumn 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().

void te::qt::widgets::DataSetTableView::createNormalDistribution ( const int column)
slot

Creates a new chart that displays the normal distribution based on the data at position column.

Parameters
columnColumn 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.

void te::qt::widgets::DataSetTableView::deselectOIds ( te::da::ObjectIdSet )
signal

Referenced by highlightRow().

void te::qt::widgets::DataSetTableView::enableAutoPan ( const bool )
signal

Referenced by DataSetTableView().

bool te::qt::widgets::DataSetTableView::getAcceptDrop ( )

Gets accept drop flag.

Returns
True: accept drop. False: not accept drop.

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.

Returns
True: is drag drop. False: not is drag drop.

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.

Returns
The selecte 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().

void te::qt::widgets::DataSetTableView::hideColumn ( const int column)
slot

Hides the column at position column.

Parameters
columnColumn to be hidden.

Definition at line 1245 of file DataSetTableView.cpp.

Referenced by HideGeometryColumns(), and HideTsVectorColumn().

void te::qt::widgets::DataSetTableView::highlightRow ( const int row,
const bool add 
)
slot
void te::qt::widgets::DataSetTableView::highlightRows ( const int initRow,
const int finalRow 
)
slot

Select all rows from initRow to finalRow.

Parameters
initRowthe begin row.
finalRowthe final row.
Note
It does not matter if initRow is less than finalRow.

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().

void te::qt::widgets::DataSetTableView::promote ( const bool scroll = false)
slot

Promotes the highlighted rows.

The rows highlighted are presented in the begining of the table.

Parameters
Iftrue, 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().

void te::qt::widgets::DataSetTableView::removeSelection ( const int initRow,
const int finalRow 
)
protected

Definition at line 1781 of file DataSetTableView.cpp.

void te::qt::widgets::DataSetTableView::resetColumnsOrder ( )
slot

Shows columns in the original order.

Definition at line 1498 of file DataSetTableView.cpp.

References nCols.

void te::qt::widgets::DataSetTableView::saveEditions ( )
slot
void te::qt::widgets::DataSetTableView::selectOIds ( te::da::ObjectIdSet ,
const bool ,
te::gm::Envelope  
)
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.

Parameters
bTrue: accept drop. False: do not accept drop.

Definition at line 1055 of file DataSetTableView.cpp.

References te::qt::widgets::DataSetTableHorizontalHeader::setAcceptDrop().

void te::qt::widgets::DataSetTableView::setAutoPanEnabled ( const bool enable)
slot

Definition at line 1757 of file DataSetTableView.cpp.

References m_autoPanEnabled.

void te::qt::widgets::DataSetTableView::setAutoScrollEnabled ( const bool enable)
slot
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.

Parameters
dsetThe new data set to be visualized.
clearEditorTrue 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.

Parameters
bTrue: 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.

Parameters
colorThe 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::setLayerSchema ( const te::da::DataSetType schema)
virtual

Sets the schema of the data set. It is used to define the primary keys and create the ObjectIdSet.

Parameters
schemaThe 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().

void te::qt::widgets::DataSetTableView::setOIdsColumnsVisible ( const bool visible)
slot

Shows or hides the icon sinalizing the columns that identify each row.

Parameters
visibleTrue for icon visible, false otherwise.

Definition at line 1670 of file DataSetTableView.cpp.

References m_model, and te::qt::widgets::DataSetTableModel::showOIdsVisible().

void te::qt::widgets::DataSetTableView::setPromotionEnabled ( const bool enable)
slot

Enable / disable promotion.

If enabled all selected rows will be moved to te top of the table.

Parameters
enableTrue 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().

void te::qt::widgets::DataSetTableView::showAllColumns ( )
slot

Shows all hidden columns.

Definition at line 1489 of file DataSetTableView.cpp.

References TablePopupFilter::getHiddenColumns(), and m_popupFilter.

void te::qt::widgets::DataSetTableView::showColumn ( const int column)
slot

Shows the hidden column.

Parameters
columnColumn to be presented.

Definition at line 1250 of file DataSetTableView.cpp.

Member Data Documentation

bool te::qt::widgets::DataSetTableView::m_autoPanEnabled
protected

Auto pan enabling.

Definition at line 361 of file DataSetTableView.h.

Referenced by setAutoPanEnabled().

bool te::qt::widgets::DataSetTableView::m_autoScrollEnabled
protected

Auto scroll enabling.

Definition at line 362 of file DataSetTableView.h.

Referenced by highlightOIds(), and setAutoScrollEnabled().

HighlightDelegate* te::qt::widgets::DataSetTableView::m_delegate
protected
bool te::qt::widgets::DataSetTableView::m_doScroll
protected

Flag to force or not scrolling.

Definition at line 363 of file DataSetTableView.h.

Referenced by highlightOIds(), highlightRow(), and highlightRows().

te::da::DataSet* te::qt::widgets::DataSetTableView::m_dset
protected
te::map::AbstractLayer* te::qt::widgets::DataSetTableView::m_layer
protected
bool te::qt::widgets::DataSetTableView::m_orderAsc
protected

Flag that sinalizes if the it is sorted in ascending sorting.

Definition at line 367 of file DataSetTableView.h.

Referenced by setLayer().

std::vector<std::string> te::qt::widgets::DataSetTableView::m_orderby
protected

Order by columns.

Definition at line 366 of file DataSetTableView.h.

Referenced by setLayer(), and sortByColumns().

TablePopupFilter* te::qt::widgets::DataSetTableView::m_popupFilter
protected

The menus popup filter.

Definition at line 357 of file DataSetTableView.h.

Referenced by DataSetTableView(), promote(), setDataSet(), setLayer(), setPromotionEnabled(), and showAllColumns().

bool te::qt::widgets::DataSetTableView::m_promotionEnabled
protected

Promotion enabled.

Definition at line 364 of file DataSetTableView.h.

Referenced by highlightOIds(), highlightRow(), highlightRows(), setPromotionEnabled(), and sortByColumns().

bool te::qt::widgets::DataSetTableView::m_resetOrder
protected

Flag that sinalizes if there's is no sort.

Definition at line 368 of file DataSetTableView.h.

std::unique_ptr<te::da::DataSourceTransactor> te::qt::widgets::DataSetTableView::m_transactor
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().


The documentation for this class was generated from the following files: