ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
DualCloudFeature.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 // # ACLOUDVIEWER PLUGIN: q3DMASC #
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 or later 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: Dimitri Lague / CNRS / UEB #
24 // # #
25 // ##########################################################################
26 
27 // Local
28 #include "FeaturesInterface.h"
29 
30 namespace masc {
32 struct DualCloudFeature : public Feature {
33 public: // DualCloudFeatureType
35 
37  switch (type) {
38  case Invalid:
39  return "Invalid";
40  case IDIFF:
41  return "IDIFF";
42  default:
43  assert(false);
44  break;
45  }
46  return "Invalid";
47  }
48 
49  static inline DualCloudFeatureType FromString(const QString& token) {
50  return FromUpperString(token.toUpper());
51  }
52  static DualCloudFeatureType FromUpperString(const QString& token) {
53  if (token == "IDIFF") return IDIFF;
54 
55  return Invalid;
56  }
57 
58 public: // methods
61 
62  // inherited from Feature
63  virtual Type getType() const override { return Type::DualCloudFeature; }
64  virtual Feature::Shared clone() const override {
65  return Feature::Shared(new DualCloudFeature(*this));
66  }
67  virtual bool prepare(
68  const CorePoints& corePoints,
69  QString& error,
70  cloudViewer::GenericProgressCallback* progressCb = nullptr,
71  SFCollector* generatedScalarFields = nullptr) override;
72  virtual bool checkValidity(QString corePointRole,
73  QString& error) const override;
74  virtual QString toString() const override;
75 
77 
80 };
81 } // namespace masc
masc::Feature::Shared
QSharedPointer< Feature > Shared
Shared type.
Definition: FeaturesInterface.h:49
masc
3DMASC classifier
Definition: ContextBasedFeature.h:30
FeaturesInterface.h
masc::DualCloudFeature::getType
virtual Type getType() const override
Returns the type (must be reimplemented by child struct)
Definition: DualCloudFeature.h:63
masc::DualCloudFeature::DualCloudFeature
DualCloudFeature(DualCloudFeatureType p_type)
Default constructor.
Definition: DualCloudFeature.h:60
cloudViewer::GenericProgressCallback
Definition: GenericProgressCallback.h:20
masc::DualCloudFeature::IDIFF
@ IDIFF
Definition: DualCloudFeature.h:34
masc::DualCloudFeature::Invalid
@ Invalid
Definition: DualCloudFeature.h:34
masc::CorePoints
Core points descriptor.
Definition: CorePoints.h:39
masc::Feature::Type::DualCloudFeature
@ DualCloudFeature
masc::DualCloudFeature::FromString
static DualCloudFeatureType FromString(const QString &token)
Definition: DualCloudFeature.h:49
masc::DualCloudFeature::toString
virtual QString toString() const override
Returns the formatted description.
Definition: DualCloudFeature.cpp:21
masc::Feature::scale
double scale
Scale (diameter)
Definition: FeaturesInterface.h:230
masc::Feature
Generic feature descriptor.
Definition: FeaturesInterface.h:46
masc::DualCloudFeature
Dual-cloud feature.
Definition: DualCloudFeature.h:32
masc::Feature::Type
Type
Feature type.
Definition: FeaturesInterface.h:56
masc::DualCloudFeature::checkValidity
virtual bool checkValidity(QString corePointRole, QString &error) const override
Checks the feature definition validity.
Definition: DualCloudFeature.cpp:26
masc::DualCloudFeature::FromUpperString
static DualCloudFeatureType FromUpperString(const QString &token)
Definition: DualCloudFeature.h:52
masc::Feature::cloud1
ccPointCloud * cloud1
Definition: FeaturesInterface.h:232
masc::DualCloudFeature::prepare
virtual bool prepare(const CorePoints &corePoints, QString &error, cloudViewer::GenericProgressCallback *progressCb=nullptr, SFCollector *generatedScalarFields=nullptr) override
Prepares the feature (compute the scalar field, etc.)
Definition: DualCloudFeature.cpp:12
masc::DualCloudFeature::type
DualCloudFeatureType type
Dual-cloud feature type.
Definition: DualCloudFeature.h:79
masc::Feature::NO_OPERATION
@ NO_OPERATION
Definition: FeaturesInterface.h:95
SFCollector
SF collector.
Definition: ScalarFieldCollector.h:42
masc::DualCloudFeature::DualCloudFeatureType
DualCloudFeatureType
Definition: DualCloudFeature.h:34
masc::DualCloudFeature::clone
virtual Feature::Shared clone() const override
Clones this feature.
Definition: DualCloudFeature.h:64
masc::Feature::op
Operation op
Definition: FeaturesInterface.h:238
masc::Feature::checkValidity
virtual bool checkValidity(QString corePointRole, QString &error) const
Checks the feature definition validity.
Definition: FeaturesInterface.h:179
masc::DualCloudFeature::ToString
static QString ToString(DualCloudFeatureType type)
Definition: DualCloudFeature.h:36
masc::Feature::cloud2
ccPointCloud * cloud2
Definition: FeaturesInterface.h:232
corePoints
cloudViewer::GenericIndexedCloud * corePoints
Definition: qCanupoTools.cpp:35
DualCloudFeature.h