MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPointMeasurementObject.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace MR
7{
8
9enum class MRMESH_CLASS PointMeasurementVisualizePropertyType
10{
12 _count [[maybe_unused]],
13};
14template <> struct IsVisualizeMaskEnum<PointMeasurementVisualizePropertyType> : std::true_type {};
15
17 : public MeasurementObject
19{
20public:
21 PointMeasurementObject() = default;
22
23 PointMeasurementObject( PointMeasurementObject&& ) noexcept = default;
24 PointMeasurementObject& operator =( PointMeasurementObject&& ) noexcept = default;
25
26 constexpr static const char* StaticTypeName() noexcept { return "PointMeasurementObject"; }
27 const char* typeName() const override { return StaticTypeName(); }
28
29 constexpr static const char* StaticClassName() noexcept { return "Measure Point"; }
30 std::string className() const override { return StaticClassName(); }
31
32 constexpr static const char* StaticClassNameInPlural() noexcept { return "Measure Points"; }
33 std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
34
36 PointMeasurementObject( ProtectedStruct, const PointMeasurementObject& obj ) : PointMeasurementObject( obj )
37 {}
38
39 MRMESH_API std::shared_ptr<Object> clone() const override;
40 MRMESH_API std::shared_ptr<Object> shallowClone() const override;
41
42 [[nodiscard]] MRMESH_API bool supportsVisualizeProperty( AnyVisualizeMaskEnum type ) const override;
43 MRMESH_API AllVisualizeProperties getAllVisualizeProperties() const override;
44 MRMESH_API const ViewportMask& getVisualizePropertyMask( AnyVisualizeMaskEnum type ) const override;
45
47 [[nodiscard]] MRMESH_API Vector3f getLocalPoint( ViewportId id = {} ) const;
48 [[nodiscard]] MRMESH_API Vector3f getWorldPoint( ViewportId id = {} ) const;
50 MRMESH_API void setLocalPoint( const Vector3f& point, ViewportId id = {} );
51 MRMESH_API void setWorldPoint( const Vector3f& point, ViewportId id = {} );
52
53 // Implement `ObjectComparableWithReference`:
54 [[nodiscard]] MRMESH_API std::size_t numComparableProperties() const override;
55 [[nodiscard]] MRMESH_API std::string_view getComparablePropertyName( std::size_t i ) const override;
56 [[nodiscard]] MRMESH_API std::optional<ComparableProperty> computeComparableProperty( std::size_t i ) const override;
57 [[nodiscard]] MRMESH_API std::optional<ComparisonTolerance> getComparisonTolerence( std::size_t i ) const override;
58 MRMESH_API void setComparisonTolerance( std::size_t i, std::optional<ComparisonTolerance> newTolerance ) override;
59 [[nodiscard]] MRMESH_API bool comparisonToleranceIsAlwaysOnlyPositive( std::size_t i ) const override;
60 // This returns 2: the point, and the optional normal direction. The normal doesn't need to be normalized, its length doesn't affect calculations.
61 // If the normal isn't specified, the Euclidean distance gets used.
62 [[nodiscard]] MRMESH_API std::size_t numComparisonReferenceValues() const override;
63 [[nodiscard]] MRMESH_API std::string_view getComparisonReferenceValueName( std::size_t i ) const override;
64 [[nodiscard]] MRMESH_API ComparisonReferenceValue getComparisonReferenceValue( std::size_t i ) const override;
65 MRMESH_API void setComparisonReferenceValue( std::size_t i, std::optional<ComparisonReferenceValue::Var> value ) override;
66
67protected:
68 PointMeasurementObject( const PointMeasurementObject& other ) = default;
69
71 MRMESH_API void swapBase_( Object& other ) override;
72
73 MRMESH_API void serializeFields_( Json::Value& root ) const override;
74 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
75
76 MRMESH_API void setupRenderObject_() const override;
77
78 private:
79 std::optional<Vector3f> referencePos_;
80 std::optional<Vector3f> referenceNormal_; // Not necessarily normalized.
81 std::optional<ComparisonTolerance> tolerance_;
82
83 ViewportMask capVisibility_ = ViewportMask::all();
84};
85
86} // namespace MR
_count
Definition MRFeatureObject.h:87
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
CapVisibility
Definition MRPointMeasurementObject.h:11
Definition MRMeasurementObject.h:11
Definition MRObjectComparableWithReference.h:14
Definition MRPointMeasurementObject.h:19
Definition MRCameraOrientationPlugin.h:8
AllVisualizeProperties
Definition MRVisualObject.h:32