MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPointObject.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRFeatureObject.h"
5#include "MRMeshFwd.h"
6#include "MRVisualObject.h"
7
8namespace MR
9{
10
14{
15public:
19 MRMESH_API PointObject( const std::vector<Vector3f>& pointsToApprox );
20
21 PointObject( PointObject&& ) noexcept = default;
22 PointObject& operator = ( PointObject&& ) noexcept = default;
23
24 constexpr static const char* TypeName() noexcept { return "PointObject"; }
25 virtual const char* typeName() const override { return TypeName(); }
26
27 constexpr static const char* ClassName() noexcept { return "Point"; }
28 virtual std::string className() const override { return ClassName(); }
29
30 constexpr static const char* ClassNameInPlural() noexcept { return "Points"; }
31 virtual std::string classNameInPlural() const override { return ClassNameInPlural(); }
32
35 {}
36
37 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
38 MRMESH_API virtual std::shared_ptr<Object> shallowClone() const override;
39
41 [[nodiscard]] MRMESH_API Vector3f getPoint( ViewportId id = {} ) const;
43 MRMESH_API void setLocalPoint( const Vector3f& point, ViewportId id = {} );
44
45 MRMESH_API virtual std::vector<FeatureObjectSharedProperty>& getAllSharedProperties() const override;
46
47 [[nodiscard]] MRMESH_API FeatureObjectProjectPointResult projectPoint( const Vector3f& /*point*/, ViewportId id = {} ) const override;
48
49protected:
50 PointObject( const PointObject& other ) = default;
51
53 MRMESH_API virtual void swapBase_( Object& other ) override;
54
55 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
56
57 virtual Expected<std::future<Expected<void>>> serializeModel_( const std::filesystem::path& ) const override
58 { return {}; }
59
60 virtual Expected<void> deserializeModel_( const std::filesystem::path&, ProgressCallback ) override
61 { return {}; }
62
63 MRMESH_API void setupRenderObject_() const override;
64};
65
66}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:84
An interface class which allows feature objects to share setters and getters on their main properties...
Definition MRFeatureObject.h:93
named object in the data model
Definition MRObject.h:62
Definition MRPointObject.h:14
MRMESH_API FeatureObjectProjectPointResult projectPoint(const Vector3f &, ViewportId id={}) const override
static constexpr const char * ClassNameInPlural() noexcept
Definition MRPointObject.h:30
virtual Expected< void > deserializeModel_(const std::filesystem::path &, ProgressCallback) override
Reads model from file.
Definition MRPointObject.h:60
PointObject(const PointObject &other)=default
PointObject(ProtectedStruct, const PointObject &obj)
Definition MRPointObject.h:34
virtual MRMESH_API std::shared_ptr< Object > shallowClone() const override
static constexpr const char * ClassName() noexcept
Definition MRPointObject.h:27
virtual std::string classNameInPlural() const override
Definition MRPointObject.h:31
MRMESH_API Vector3f getPoint(ViewportId id={}) const
calculates point from xf
virtual std::string className() const override
Definition MRPointObject.h:28
virtual MRMESH_API std::vector< FeatureObjectSharedProperty > & getAllSharedProperties() const override
Create and generate list of bounded getters and setters for the main properties of feature object,...
MRMESH_API PointObject(const std::vector< Vector3f > &pointsToApprox)
Finds best point to approx given points.
MRMESH_API void setupRenderObject_() const override
PointObject(PointObject &&) noexcept=default
MRMESH_API PointObject()
Creates simple point object with zero position.
virtual MRMESH_API std::shared_ptr< Object > clone() const override
virtual MRMESH_API void serializeFields_(Json::Value &root) const override
virtual Expected< std::future< Expected< void > > > serializeModel_(const std::filesystem::path &) const override
Definition MRPointObject.h:57
virtual const char * typeName() const override
Definition MRPointObject.h:25
virtual MRMESH_API void swapBase_(Object &other) override
swaps this object with other
MRMESH_API void setLocalPoint(const Vector3f &point, ViewportId id={})
updates xf to fit given point
Definition MRViewportId.h:16
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:729
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:25
Definition MRFeatureObject.h:78
Definition MRObject.h:279