ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LasSaveDialog.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // ##########################################################################
11 // # #
12 // # CloudViewer PLUGIN: LAS-IO Plugin #
13 // # #
14 // # This program is free software; you can redistribute it and/or modify #
15 // # it under the terms of the GNU General Public License as published by #
16 // # the Free Software Foundation; version 2 of the License. #
17 // # #
18 // # This program is distributed in the hope that it will be useful, #
19 // # but WITHOUT ANY WARRANTY; without even the implied warranty of #
20 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21 // # GNU General Public License for more details. #
22 // # #
23 // # COPYRIGHT: Thomas Montaigu #
24 // # #
25 // ##########################################################################
26 
27 #include "LasDetails.h"
28 #include "LasExtraScalarField.h"
29 #include "LasScalarField.h"
30 #include "ui_lassavedialog.h"
31 
32 // Qt
33 #include <QDialog>
34 
35 // CORE
36 #include <CVGeom.h>
37 
38 class QStringListModel;
39 class ccScalarField;
40 class ccPointCloud;
41 
42 class MappingLabel;
44 
47 class LasSaveDialog : public QDialog
48  , public Ui::LASSaveDialog
49 {
50  Q_OBJECT
51 
52  public:
53  explicit LasSaveDialog(ccPointCloud* cloud, QWidget* parent = nullptr);
54 
55  void setVersionAndPointFormat(const LasDetails::LasVersion versionAndFmt);
57  void setOptimalScale(const CCVector3d& scale, bool autoCheck = false);
60  void setOriginalScale(const CCVector3d& scale, bool canUseScale, bool autoCheck = true);
62  void setExtraScalarFields(const std::vector<LasExtraScalarField>& extraScalarFields);
63 
65  uint8_t selectedPointFormat() const;
67  void selectedVersion(uint8_t& versionMajor, uint8_t& versionMinor) const;
69  CCVector3d chosenScale() const;
71  bool shouldSaveRGB() const;
73  bool shouldSaveWaveform() const;
78  std::vector<LasScalarField> fieldsToSave() const;
79  std::vector<LasExtraScalarField> extraFieldsToSave() const;
80 
81  public Q_SLOTS:
82  void handleSelectedVersionChange(const QString&);
83  void handleSelectedPointFormatChange(int index);
84  void handleComboBoxChange(int index);
86 
87  private:
88  LasExtraScalarFieldCard* createCard() const;
89 
90  private:
91  ccPointCloud* m_cloud{nullptr};
93  QStringListModel* m_scalarFieldsNamesModel{nullptr};
96  QStringListModel* m_extraFieldsDataTypesModel{nullptr};
97  CCVector3d m_optimalScale;
98  CCVector3d m_originalScale;
101  std::vector<std::pair<MappingLabel*, QComboBox*>> m_scalarFieldMapping;
102 };
void setExtraScalarFields(const std::vector< LasExtraScalarField > &extraScalarFields)
Set the extra LAS scalar fields saved from the original file.
void handleComboBoxChange(int index)
void setOriginalScale(const CCVector3d &scale, bool canUseScale, bool autoCheck=true)
void handleSelectedPointFormatChange(int index)
When the user changes the point format, we need to update the scalar field form.
bool shouldSaveWaveform() const
Returns whether the user wants to save the Waveforms.
LasSaveDialog(ccPointCloud *cloud, QWidget *parent=nullptr)
void selectedVersion(uint8_t &versionMajor, uint8_t &versionMinor) const
Returns the version currently selected.
bool shouldSaveRGB() const
Returns whether the user wants to save RGB.
std::vector< LasScalarField > fieldsToSave() const
void addExtraScalarFieldCard()
uint8_t selectedPointFormat() const
Returns the point format currently selected.
CCVector3d chosenScale() const
Returns the currently selected scale.
std::vector< LasExtraScalarField > extraFieldsToSave() const
void setVersionAndPointFormat(const LasDetails::LasVersion versionAndFmt)
void handleSelectedVersionChange(const QString &)
void setOptimalScale(const CCVector3d &scale, bool autoCheck=false)
Set scale that would offer the user the best precision.
Widget to map a predefined scalar field 'role' with a particular scalar field (combo box)
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
A scalar field associated to display-related parameters.
See SelectBestVersion
Definition: LasDetails.h:178