MeshLib C++ Docs
Loading...
Searching...
No Matches
MRObjectDistanceMap.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
5
6
7namespace MR
8{
11
12
16{
17public:
19 ObjectDistanceMap( ObjectDistanceMap&& ) noexcept = default;
20 ObjectDistanceMap& operator = ( ObjectDistanceMap&& ) noexcept = default;
21 virtual ~ObjectDistanceMap() = default;
22
25
26 constexpr static const char* StaticTypeName() noexcept { return "ObjectDistanceMap"; }
27 virtual const char* typeName() const override { return StaticTypeName(); }
28
29 constexpr static const char* StaticClassName() noexcept { return "Distance Map"; }
30 virtual std::string className() const override { return StaticClassName(); }
31
32 constexpr static const char* StaticClassNameInPlural() noexcept { return "Distance Maps"; }
33 virtual std::string classNameInPlural() const override { return StaticClassNameInPlural(); }
34
35 MRMESH_API virtual void applyScale( float scaleFactor ) override;
36
37 MRMESH_API virtual std::shared_ptr<Object> clone() const override;
38 MRMESH_API virtual std::shared_ptr<Object> shallowClone() const override;
39
40 MRMESH_API virtual std::vector<std::string> getInfoLines() const override;
41
47 const std::shared_ptr<DistanceMap>& dmap,
48 const AffineXf3f& dmap2local,
49 bool needUpdateMesh = true,
50 ProgressCallback cb = {} );
51
53 MRMESH_API std::shared_ptr<Mesh> calculateMesh( ProgressCallback cb = {} ) const;
55 MRMESH_API void updateMesh( const std::shared_ptr<Mesh>& mesh );
56
57 [[nodiscard]] const std::shared_ptr<DistanceMap>& getDistanceMap() const { return dmap_; }
58
59 [[nodiscard]] virtual bool hasModel() const override { return bool( dmap_ ); }
60
62 MRMESH_API const AffineXf3f& getToWorldParameters() const { return dmap2local_; }
63
65 [[nodiscard]] MRMESH_API virtual size_t heapBytes() const override;
66
68 MRMESH_API void resetFrontColor() override;
69protected:
71
73 MRMESH_API virtual void swapBase_( Object& other ) override;
74
75 MRMESH_API virtual void serializeFields_( Json::Value& root ) const override;
76
77 MRMESH_API void deserializeFields_( const Json::Value& root ) override;
78
79 MRMESH_API Expected<void> deserializeModel_( const std::filesystem::path& path, ProgressCallback progressCb = {} ) override;
80
81 MRMESH_API virtual Expected<std::future<Expected<void>>> serializeModel_( const std::filesystem::path& path ) const override;
82private:
83 std::shared_ptr<DistanceMap> dmap_;
84 AffineXf3f dmap2local_;
85
86 const char * saveDistanceMapFormat_{ ".raw" };
87
92 bool construct_(
93 const std::shared_ptr<DistanceMap>& dmap,
94 const AffineXf3f& dmap2local,
95 bool needUpdateMesh = true,
96 ProgressCallback cb = {} );
97
99 void setDefaultColors_();
100
102 void setDefaultSceneProperties_();
103};
104
105}
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
named object in the data model
Definition MRObject.h:62
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
static constexpr const char * StaticClassNameInPlural() noexcept
Definition MRObjectDistanceMap.h:32
virtual void serializeFields_(Json::Value &root) const override
virtual void applyScale(float scaleFactor) override
scale object size (all point positions)
virtual std::string className() const override
Definition MRObjectDistanceMap.h:30
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
static constexpr const char * StaticClassName() noexcept
Definition MRObjectDistanceMap.h:29
ObjectDistanceMap(ObjectDistanceMap &&) noexcept=default
void resetFrontColor() override
reset basic object colors to their default values from the current theme
void deserializeFields_(const Json::Value &root) override
void updateMesh(const std::shared_ptr< Mesh > &mesh)
updates the grid to the current one
virtual void swapBase_(Object &other) override
swaps this object with other
tl::expected< T, E > Expected
Definition MRExpected.h:31
Expected< void > deserializeModel_(const std::filesystem::path &path, ProgressCallback progressCb={}) override
Reads model from file.
static constexpr const char * StaticTypeName() noexcept
Definition MRObjectDistanceMap.h:26
const std::shared_ptr< DistanceMap > & getDistanceMap() const
Definition MRObjectDistanceMap.h:57
virtual bool hasModel() const override
Definition MRObjectDistanceMap.h:59
virtual std::vector< std::string > getInfoLines() const override
return several info lines that can better describe the object in the UI
virtual Expected< std::future< Expected< void > > > serializeModel_(const std::filesystem::path &path) const override
virtual const char * typeName() const override
Definition MRObjectDistanceMap.h:27
bool setDistanceMap(const std::shared_ptr< DistanceMap > &dmap, const AffineXf3f &dmap2local, bool needUpdateMesh=true, ProgressCallback cb={})
virtual std::shared_ptr< Object > clone() const override
virtual std::string classNameInPlural() const override
Definition MRObjectDistanceMap.h:33
ObjectDistanceMap(const ObjectDistanceMap &other)=default
virtual std::shared_ptr< Object > shallowClone() const override
const std::shared_ptr< const Mesh > & mesh() const
Definition MRObjectMeshHolder.h:56
std::shared_ptr< Mesh > calculateMesh(ProgressCallback cb={}) const
creates a grid for this object
const AffineXf3f & getToWorldParameters() const
unlike the name, actually it is the transformation from distance map in local space
Definition MRObjectDistanceMap.h:62
@ other
Angle, normally float. Measure in radians.
Definition MRFeatureObject.h:27
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRObject.h:284