MeshLib C++ Docs
Loading...
Searching...
No Matches
MRVisualObjectTag.h
Go to the documentation of this file.
1#pragma once
2
3#include "exports.h"
4
5#include "MRMesh/MRColor.h"
7
8namespace Json { class Value; }
9
10namespace MR
11{
14
15
22
25{
26public:
28 MRVIEWER_API static VisualObjectTagManager& instance();
29
31 MRVIEWER_API static const std::map<std::string, VisualObjectTag>& tags();
32
34 MRVIEWER_API static void registerTag( std::string tag, VisualObjectTag visTag );
36 MRVIEWER_API static void updateTag( const std::string& tag, VisualObjectTag visTag );
38 MRVIEWER_API static void unregisterTag( const std::string& tag );
39
41 MRVIEWER_API static std::vector<std::shared_ptr<Object>> getAllObjectsWithTag( Object* root, const std::string& tag, const ObjectSelectivityType& type = ObjectSelectivityType::Selectable );
42
44 MRVIEWER_API static void update( VisualObject& visObj, const std::string& tag );
45
46private:
47 struct ProtectedTag {};
48 explicit VisualObjectTagManager( ProtectedTag );
49
50 boost::signals2::scoped_connection onTagAdded_;
51 boost::signals2::scoped_connection onTagRemoved_;
52
53 friend MRVIEWER_API void deserializeFromJson( const Json::Value&, VisualObjectTagManager& );
54
55 std::map<std::string, VisualObjectTag> visTags_;
56};
57
58MRVIEWER_API void deserializeFromJson( const Json::Value& root, VisualObjectTagManager& manager );
59MRVIEWER_API void serializeToJson( const VisualObjectTagManager& manager, Json::Value& root );
60
61}
named object in the data model
Definition MRObject.h:62
class for storing and changing visual object properties based on the object tags
Definition MRVisualObjectTag.h:25
Visual Object.
Definition MRVisualObject.h:116
Color selectedColor
Definition MRVisualObjectTag.h:19
MRMESH_API void serializeToJson(const EndMillCutter &cutter, Json::Value &root)
static MRVIEWER_API const std::map< std::string, VisualObjectTag > & tags()
get read-only access to the visual object tags' storage
static MRVIEWER_API void unregisterTag(const std::string &tag)
remove visual object tag; linked objects are NOT updated automatically
friend MRVIEWER_API void deserializeFromJson(const Json::Value &, VisualObjectTagManager &)
static MRVIEWER_API void updateTag(const std::string &tag, VisualObjectTag visTag)
update visual object tag; linked objects are NOT updated automatically
static MRVIEWER_API VisualObjectTagManager & instance()
get access to the global instance
static MRVIEWER_API void registerTag(std::string tag, VisualObjectTag visTag)
add visual object tag
static MRVIEWER_API std::vector< std::shared_ptr< Object > > getAllObjectsWithTag(Object *root, const std::string &tag, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
find all object in given object tree with the visual object tag
Color unselectedColor
Definition MRVisualObjectTag.h:20
static MRVIEWER_API void update(VisualObject &visObj, const std::string &tag)
update visual object properties according to whether given object has the visual object tag or not
MRMESH_API Expected< void > deserializeFromJson(const Json::Value &root, EndMillCutter &cutter)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRColor.h:12
modified color set for visual objects
Definition MRVisualObjectTag.h:18