MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMeshOrPointsObject.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include <variant>
4
5namespace MR
6{
7
11{
12public:
16 MRMESH_API MeshOrPointsObject( std::shared_ptr<VisualObject> vo );
17 MeshOrPointsObject( std::shared_ptr<ObjectMesh> om ) { set( std::move( om ) ); }
18 MeshOrPointsObject( std::shared_ptr<ObjectPoints> op ) { set( std::move( op ) ); }
19
21 MRMESH_API void set( std::shared_ptr<ObjectMesh> om );
24
26 MRMESH_API void set( std::shared_ptr<ObjectPoints> op );
29
30 void reset() { set( std::shared_ptr<ObjectMesh>{} ); }
31 const std::shared_ptr<VisualObject>& operator->() const { return visualObject_; }
32 const std::shared_ptr<VisualObject>& get() const { return visualObject_; }
33 bool operator==( std::shared_ptr<VisualObject> other ) const { return visualObject_ == other; }
34
37private:
38 std::variant<ObjectMesh*, ObjectPoints*> var_;
39 std::shared_ptr<VisualObject> visualObject_;
40};
41
42}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
Definition MRMeshOrPointsObject.h:11
MRMESH_API void set(std::shared_ptr< ObjectMesh > om)
set to hold ObjectMesh
MRMESH_API void set(std::shared_ptr< ObjectPoints > op)
set to hold ObjectPoints
const std::shared_ptr< VisualObject > & get() const
Definition MRMeshOrPointsObject.h:32
MeshOrPointsObject(std::shared_ptr< ObjectMesh > om)
Definition MRMeshOrPointsObject.h:17
MRMESH_API MeshOrPointsObject(std::shared_ptr< VisualObject > vo)
void reset()
Definition MRMeshOrPointsObject.h:30
MeshOrPointsObject()
Definition MRMeshOrPointsObject.h:13
MRMESH_API MeshOrPoints meshOrPoints() const
get class that hold either mesh part or point cloud
const std::shared_ptr< VisualObject > & operator->() const
Definition MRMeshOrPointsObject.h:31
bool operator==(std::shared_ptr< VisualObject > other) const
Definition MRMeshOrPointsObject.h:33
MRMESH_API ObjectMesh * asObjectMesh() const
if holding ObjectMesh, return pointer to it, otherwise return nullptr
MeshOrPointsObject(std::shared_ptr< ObjectPoints > op)
Definition MRMeshOrPointsObject.h:18
MRMESH_API ObjectPoints * asObjectPoints() const
if holding ObjectPoints, return pointer to it, otherwise return nullptr
Definition MRMesh/MRMeshOrPoints.h:17
Definition MRObjectMesh.h:11
Definition MRObjectPoints.h:11