File: LasOpenDialog.h

package info (click to toggle)
cloudcompare 2.13.2%2Bgit20240821%2Bds-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 151,152 kB
  • sloc: cpp: 687,217; ansic: 165,269; python: 31,109; xml: 25,906; sh: 940; makefile: 509; java: 229; asm: 204; fortran: 160; javascript: 73; perl: 18
file content (133 lines) | stat: -rw-r--r-- 4,744 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#pragma once

//##########################################################################
//#                                                                        #
//#                CLOUDCOMPARE PLUGIN: LAS-IO Plugin                      #
//#                                                                        #
//#  This program is free software; you can redistribute it and/or modify  #
//#  it under the terms of the GNU General Public License as published by  #
//#  the Free Software Foundation; version 2 of the License.               #
//#                                                                        #
//#  This program is distributed in the hope that it will be useful,       #
//#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
//#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
//#  GNU General Public License for more details.                          #
//#                                                                        #
//#                   COPYRIGHT: Thomas Montaigu                           #
//#                                                                        #
//##########################################################################

#include "LasDetails.h"
#include "LasExtraScalarField.h"
#include "LasScalarField.h"
#include "LasTiler.h"

// GUI generated by Qt Designer
#include <ui_lasopendialog.h>

// system
#include <string>
#include <vector>

// CCCoreLib
#include <CCGeom.h>
#include <ccLog.h>

/// Dialog shown to the user when opening a LAS file
class LasOpenDialog : public QDialog
    , public Ui::LASOpenDialog
{
	Q_OBJECT

  public:
	enum class Action
	{
		/// The user wants to load the file in CloudCompare
		Load,
		/// The user wants to tile the file into multiple smaller ones
		Tile,
	};

	/// Default constructor
	explicit LasOpenDialog(QWidget* parent = nullptr);

	/// Set some informations about the file
	/// to be displayed to the user.
	void setInfo(int versionMinor, int pointFormatId, qulonglong numPoints);

	/// Sets the list of standard LAS scalar fields as well as
	/// user defined extra LAS scalar fields that are available in the file
	/// that the user is able to check which one should be loaded.
	void setAvailableScalarFields(const std::vector<LasScalarField>&      scalarFields,
	                              const std::vector<LasExtraScalarField>& extraScalarFields);

	/// Removes from the lists scalar fields and extra scalar fields
	/// which the user unchecked from the list of fields to load.
	void filterOutNotChecked(std::vector<LasScalarField>&      scalarFields,
	                         std::vector<LasExtraScalarField>& extraScalarFields);

	/// Returns the array of extra scalar fields to be used as normals
	std::array<LasExtraScalarField, 3> getExtraFieldsToBeLoadedAsNormals(const std::vector<LasExtraScalarField>& extraScalarFields) const ;

	/// Returns whether the user wants to ignore (not load)
	/// fields for which values are all default values.
	bool shouldIgnoreFieldsWithDefaultValues() const;

	/// Returns whether the user wants to treat the
	/// rgb from the file as 8-bit components.
	bool shouldForce8bitColors() const;

	/// Returns whether the user wants to decompose the classification field
	/// according to what the LAS standard says.
	bool shouldDecomposeClassification() const;

	/// Returns quiet_NaN if the time shift value should be
	/// automatically found.
	///
	/// Otherwise, returns the value manually specified by the user.
	double timeShiftValue() const;

	/// Returns the action the user wants to do.
	///
	/// The action is based on the active tab when the
	/// user accepted the dialog.
	Action action() const;

	/// Returns the tiling options.
	///
	/// Only valid when the action is Tiling
	LasTilingOptions tilingOptions() const;

	void resetShouldSkipDialog();

	bool shouldSkipDialog() const;

  private:
	bool isChecked(const LasScalarField& lasScalarField) const;

	bool isChecked(const LasExtraScalarField& lasExtraScalarField) const;

	void doSelectAll(bool doSelect);
	void doSelectAllESF(bool doSelect);

	/// Connected to the "automatic time shift" check box.
	///
	/// Depending on if the user checks or un-checks the automatic time shift,
	/// we need to enable / disable the double spin box that
	/// is used to get the manually entered time shift.
	void onAutomaticTimeShiftToggle(bool checked);

	void onApplyAll();

	void onNormalComboBoxChanged(const QString& name);

	void onBrowseTilingOutputDir();

	void onCurrentTabChanged(int index);

	/// Hides or un-hides the checkboxes that corresponds to the flag fields
	void onDecomposeClassificationToggled(bool state);

  private:
	bool m_shouldSkipDialog{false};
};