![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Dialog for configuration of ASCII files opening sequence. More...
#include <AsciiOpenDlg.h>


Classes | |
| struct | SequenceItem |
| ASCII open sequence item. More... | |
Public Types | |
| using | Sequence = std::vector< SequenceItem > |
| ASCII open sequence. More... | |
Public Member Functions | |
| AsciiOpenDlg (QWidget *parent=nullptr) | |
| Default constructor. More... | |
| ~AsciiOpenDlg () override | |
| Default destructor. More... | |
| void | setInput (const QString &filename, QTextStream *stream=nullptr) |
| Sets the input filename or text stream. More... | |
| bool | restorePreviousContext () |
| Restores the previous context ('Apply all' button) More... | |
| Sequence | getOpenSequence () const |
| Returns the whole "opening" sequence as set by the user. More... | |
| unsigned | getSkippedLinesCount () const |
| Returns number of lines to skip. More... | |
| unsigned char | getSeparator () const |
| Returns user selected separator. More... | |
| bool | useCommaAsDecimal () const |
| Returns whether comma should be used as decimal point. More... | |
| double | getAverageLineSize () const |
| Returns roughly estimated average line size (in bytes) More... | |
| unsigned | getColumnsCount () const |
| Returns columns count per line. More... | |
| unsigned | getMaxCloudSize () const |
| Returns the max number of points per cloud. More... | |
| bool | showLabelsIn2D () const |
| Whether labels should be visible in 2D. More... | |
| bool | safeSequence () const |
| Returns whether the current sequence is 'safe'. More... | |
| void | onSeparatorChange (const QString &separator) |
| Slot called when separator changes. More... | |
| void | updateTable () |
| Forces the table to update itself. More... | |
| void | setSkippedLines (int linesCount) |
| Sets the number of lines to skip. More... | |
| void | commaDecimalCheckBoxToggled (bool) |
| Slot called when the 'comma as decimal' checkbox is toggled. More... | |
Static Public Member Functions | |
| static bool | CheckOpenSequence (const Sequence &sequence, QString &errorMessage) |
| Checks the "opening" sequence as set by the user. More... | |
| static void | ResetApplyAll () |
| Resets the "apply all" flag (if set) More... | |
Protected Types | |
| enum | ColumnType { TEXT = 0 , UNKNOWN = 1 , IGNORED = 2 , VALID = 3 } |
Protected Member Functions | |
| bool | apply () |
| void | applyAll () |
| void | columnsTypeHasChanged (int index) |
| void | shortcutButtonPressed () |
| void | checkSelectedColumnsValidity () |
| void | autoFindBestSeparator () |
| Tries to guess the best separator automagically. More... | |
| void | setSeparator (QChar) |
| Sets the current separator. More... | |
Protected Attributes | |
| Ui_AsciiOpenDialog * | m_ui |
| unsigned | m_skippedLines |
| QChar | m_separator |
| double | m_averageLineSize |
| QString | m_filename |
| QTextStream * | m_stream |
| QString | m_headerLine |
| std::vector< ColumnType > | m_columnType |
| Identifies columns with numbers only [mandatory]. More... | |
| unsigned | m_columnsCount |
Dialog for configuration of ASCII files opening sequence.
Definition at line 100 of file AsciiOpenDlg.h.
| using AsciiOpenDlg::Sequence = std::vector<SequenceItem> |
ASCII open sequence.
Definition at line 137 of file AsciiOpenDlg.h.
|
protected |
| Enumerator | |
|---|---|
| TEXT | |
| UNKNOWN | |
| IGNORED | |
| VALID | |
Definition at line 212 of file AsciiOpenDlg.h.
|
explicit |
Default constructor.
| parent | parent widget |
Definition at line 99 of file AsciiOpenDlg.cpp.
References apply(), applyAll(), CC_MAX_NUMBER_OF_POINTS_PER_CLOUD, commaDecimalCheckBoxToggled(), m_ui, onSeparatorChange(), s_maxCloudSizeDoubleSpinBoxValue, setSkippedLines(), and shortcutButtonPressed().
|
override |
|
protected |
Definition at line 1046 of file AsciiOpenDlg.cpp.
References CheckOpenSequence(), getOpenSequence(), m_ui, and s_maxCloudSizeDoubleSpinBoxValue.
Referenced by applyAll(), and AsciiOpenDlg().
|
protected |
Definition at line 1059 of file AsciiOpenDlg.cpp.
References apply(), AsciiOpenContext::applyAll, getOpenSequence(), m_ui, s_asciiOpenContext, AsciiOpenContext::save(), and AsciiOpenContext::sequence.
Referenced by AsciiOpenDlg().
|
protected |
Tries to guess the best separator automagically.
Definition at line 160 of file AsciiOpenDlg.cpp.
References m_columnType, setSeparator(), TEXT, and type.
Referenced by setInput().
|
static |
Checks the "opening" sequence as set by the user.
Definition at line 1012 of file AsciiOpenDlg.cpp.
References ASCII_OPEN_DLG_Scalar, ASCII_OPEN_DLG_TYPES_COUNT, ASCII_OPEN_DLG_TYPES_NAMES, ASCII_OPEN_DLG_X, ASCII_OPEN_DLG_Y, ASCII_OPEN_DLG_Z, and type.
Referenced by apply(), AsciiFilter::loadStream(), and restorePreviousContext().
|
protected |
Definition at line 986 of file AsciiOpenDlg.cpp.
References ASCII_OPEN_DLG_Label, m_columnsCount, m_columnType, m_ui, and TEXT.
Referenced by columnsTypeHasChanged(), and updateTable().
|
protected |
Definition at line 1221 of file AsciiOpenDlg.cpp.
References ASCII_OPEN_DLG_B, ASCII_OPEN_DLG_Bf, ASCII_OPEN_DLG_G, ASCII_OPEN_DLG_Gf, ASCII_OPEN_DLG_None, ASCII_OPEN_DLG_NX, ASCII_OPEN_DLG_NY, ASCII_OPEN_DLG_NZ, ASCII_OPEN_DLG_R, ASCII_OPEN_DLG_Rf, ASCII_OPEN_DLG_Scalar, ASCII_OPEN_DLG_X, ASCII_OPEN_DLG_Y, ASCII_OPEN_DLG_Z, checkSelectedColumnsValidity(), m_columnsCount, and m_ui.
Referenced by updateTable().
| void AsciiOpenDlg::commaDecimalCheckBoxToggled | ( | bool | ) |
Slot called when the 'comma as decimal' checkbox is toggled.
Definition at line 313 of file AsciiOpenDlg.cpp.
References m_ui, and onSeparatorChange().
Referenced by AsciiOpenDlg().
|
inline |
Returns roughly estimated average line size (in bytes)
Definition at line 152 of file AsciiOpenDlg.h.
Referenced by AsciiFilter::loadStream().
|
inline |
Returns columns count per line.
Definition at line 155 of file AsciiOpenDlg.h.
Referenced by safeSequence().
| unsigned AsciiOpenDlg::getMaxCloudSize | ( | ) | const |
Returns the max number of points per cloud.
Definition at line 1335 of file AsciiOpenDlg.cpp.
References cloudViewer::utility::floor(), and m_ui.
Referenced by AsciiFilter::loadStream().
| AsciiOpenDlg::Sequence AsciiOpenDlg::getOpenSequence | ( | ) | const |
Returns the whole "opening" sequence as set by the user.
Definition at line 1108 of file AsciiOpenDlg.cpp.
References m_columnsCount, m_headerLine, m_separator, m_ui, and QtCompat::SkipEmptyParts.
Referenced by apply(), applyAll(), AsciiFilter::loadStream(), and safeSequence().
|
inline |
Returns user selected separator.
Definition at line 146 of file AsciiOpenDlg.h.
Referenced by AsciiFilter::loadStream(), and shortcutButtonPressed().
|
inline |
Returns number of lines to skip.
Definition at line 143 of file AsciiOpenDlg.h.
Referenced by AsciiFilter::loadStream().
| void AsciiOpenDlg::onSeparatorChange | ( | const QString & | separator | ) |
Slot called when separator changes.
Definition at line 287 of file AsciiOpenDlg.cpp.
References m_columnType, m_headerLine, m_separator, m_ui, and updateTable().
Referenced by AsciiOpenDlg(), and commaDecimalCheckBoxToggled().
|
static |
Resets the "apply all" flag (if set)
Definition at line 1068 of file AsciiOpenDlg.cpp.
References AsciiOpenContext::applyAll, and s_asciiOpenContext.
Referenced by AsciiFilter::loadStream().
| bool AsciiOpenDlg::restorePreviousContext | ( | ) |
Restores the previous context ('Apply all' button)
Definition at line 1070 of file AsciiOpenDlg.cpp.
References AsciiOpenContext::applyAll, CheckOpenSequence(), AsciiOpenContext::load(), m_columnsCount, m_separator, m_skippedLines, m_ui, s_asciiOpenContext, AsciiOpenContext::separator, AsciiOpenContext::sequence, AsciiOpenContext::skipLines, AsciiOpenDlg::SequenceItem::type, and updateTable().
Referenced by AsciiFilter::loadStream().
| bool AsciiOpenDlg::safeSequence | ( | ) | const |
Returns whether the current sequence is 'safe'.
A safe sequence is safe if it matches the header (if any) or if the file has less than 6 columns.
Definition at line 1137 of file AsciiOpenDlg.cpp.
References ASCII_OPEN_DLG_A, ASCII_OPEN_DLG_Af, ASCII_OPEN_DLG_B, ASCII_OPEN_DLG_Bf, ASCII_OPEN_DLG_G, ASCII_OPEN_DLG_Gf, ASCII_OPEN_DLG_Grey, ASCII_OPEN_DLG_Label, ASCII_OPEN_DLG_None, ASCII_OPEN_DLG_NX, ASCII_OPEN_DLG_NY, ASCII_OPEN_DLG_NZ, ASCII_OPEN_DLG_R, ASCII_OPEN_DLG_Rf, ASCII_OPEN_DLG_RGB32f, ASCII_OPEN_DLG_RGB32i, ASCII_OPEN_DLG_Scalar, ASCII_OPEN_DLG_X, ASCII_OPEN_DLG_Y, ASCII_OPEN_DLG_Z, CouldBeA(), CouldBeB(), CouldBeG(), CouldBeGrey(), CouldBeLabel(), CouldBeNx(), CouldBeNy(), CouldBeNz(), CouldBeR(), CouldBeRGBf(), CouldBeRGBi(), CouldBeX(), CouldBeY(), CouldBeZ(), getColumnsCount(), getOpenSequence(), m_headerLine, m_separator, QtCompat::SkipEmptyParts, and type.
| void AsciiOpenDlg::setInput | ( | const QString & | filename, |
| QTextStream * | stream = nullptr |
||
| ) |
Sets the input filename or text stream.
| filename | filename |
| stream | text stream |
Definition at line 147 of file AsciiOpenDlg.cpp.
References autoFindBestSeparator(), filename, m_filename, m_stream, m_ui, and updateTable().
Referenced by AsciiFilter::loadStream().
|
protected |
Sets the current separator.
Definition at line 1322 of file AsciiOpenDlg.cpp.
References m_ui.
Referenced by autoFindBestSeparator(), and shortcutButtonPressed().
| void AsciiOpenDlg::setSkippedLines | ( | int | linesCount | ) |
Sets the number of lines to skip.
Definition at line 190 of file AsciiOpenDlg.cpp.
References m_skippedLines, and updateTable().
Referenced by AsciiOpenDlg().
|
protected |
Definition at line 1299 of file AsciiOpenDlg.cpp.
References getSeparator(), m_columnsCount, m_ui, and setSeparator().
Referenced by AsciiOpenDlg().
| bool AsciiOpenDlg::showLabelsIn2D | ( | ) | const |
Whether labels should be visible in 2D.
Definition at line 1340 of file AsciiOpenDlg.cpp.
References m_ui.
Referenced by AsciiFilter::loadStream().
| void AsciiOpenDlg::updateTable | ( | ) |
Forces the table to update itself.
Definition at line 317 of file AsciiOpenDlg.cpp.
References ASCII_OPEN_DLG_A, ASCII_OPEN_DLG_Af, ASCII_OPEN_DLG_B, ASCII_OPEN_DLG_Bf, ASCII_OPEN_DLG_G, ASCII_OPEN_DLG_Gf, ASCII_OPEN_DLG_Grey, ASCII_OPEN_DLG_Label, ASCII_OPEN_DLG_NX, ASCII_OPEN_DLG_NY, ASCII_OPEN_DLG_NZ, ASCII_OPEN_DLG_R, ASCII_OPEN_DLG_Rf, ASCII_OPEN_DLG_RGB32f, ASCII_OPEN_DLG_RGB32i, ASCII_OPEN_DLG_Scalar, ASCII_OPEN_DLG_TYPES_COUNT, ASCII_OPEN_DLG_TYPES_NAMES, ASCII_OPEN_DLG_X, ASCII_OPEN_DLG_Y, ASCII_OPEN_DLG_Z, checkSelectedColumnsValidity(), columnsTypeHasChanged(), CouldBeA(), CouldBeB(), CouldBeBf(), CouldBeG(), CouldBeGf(), CouldBeGrey(), CouldBeLabel(), CouldBeNx(), CouldBeNy(), CouldBeNz(), CouldBeR(), CouldBeRf(), CouldBeRGBf(), CouldBeRGBi(), CouldBeScal(), CouldBeX(), CouldBeY(), CouldBeZ(), DISPLAYED_LINES, EnabledBits(), IGNORED, LINES_READ_FOR_STATS, m_averageLineSize, m_columnsCount, m_columnType, m_filename, m_headerLine, m_separator, m_skippedLines, m_stream, m_ui, MAX_COLUMNS, s_maxLabelCount, QtCompat::SkipEmptyParts, TEXT, type, UNKNOWN, useCommaAsDecimal(), VALID, W_BIT, X_BIT, XYZ_BITS, Y_BIT, and Z_BIT.
Referenced by onSeparatorChange(), restorePreviousContext(), setInput(), and setSkippedLines().
| bool AsciiOpenDlg::useCommaAsDecimal | ( | ) | const |
Returns whether comma should be used as decimal point.
Definition at line 308 of file AsciiOpenDlg.cpp.
References m_ui.
Referenced by AsciiFilter::loadStream(), and updateTable().
|
protected |
Definition at line 207 of file AsciiOpenDlg.h.
Referenced by updateTable().
|
protected |
Definition at line 217 of file AsciiOpenDlg.h.
Referenced by checkSelectedColumnsValidity(), columnsTypeHasChanged(), getOpenSequence(), restorePreviousContext(), shortcutButtonPressed(), and updateTable().
|
protected |
Identifies columns with numbers only [mandatory].
Definition at line 215 of file AsciiOpenDlg.h.
Referenced by autoFindBestSeparator(), checkSelectedColumnsValidity(), onSeparatorChange(), and updateTable().
|
protected |
Definition at line 208 of file AsciiOpenDlg.h.
Referenced by setInput(), and updateTable().
|
protected |
Definition at line 210 of file AsciiOpenDlg.h.
Referenced by getOpenSequence(), onSeparatorChange(), safeSequence(), and updateTable().
|
protected |
Definition at line 206 of file AsciiOpenDlg.h.
Referenced by getOpenSequence(), onSeparatorChange(), restorePreviousContext(), safeSequence(), and updateTable().
|
protected |
Definition at line 205 of file AsciiOpenDlg.h.
Referenced by restorePreviousContext(), setSkippedLines(), and updateTable().
|
protected |
Definition at line 209 of file AsciiOpenDlg.h.
Referenced by setInput(), and updateTable().
|
protected |
Definition at line 203 of file AsciiOpenDlg.h.
Referenced by apply(), applyAll(), AsciiOpenDlg(), checkSelectedColumnsValidity(), columnsTypeHasChanged(), commaDecimalCheckBoxToggled(), getMaxCloudSize(), getOpenSequence(), onSeparatorChange(), restorePreviousContext(), setInput(), setSeparator(), shortcutButtonPressed(), showLabelsIn2D(), updateTable(), useCommaAsDecimal(), and ~AsciiOpenDlg().