MeshLib C++ Docs
Loading...
Searching...
No Matches
Data Model

This chapter represents documentation about data models. More...

Topics

 Features
 
 Viewport group
 
 Visual Object group
 

Classes

class  MR::ObjectChildrenHolder
 
class  MR::Object
 named object in the data model More...
 
class  MR::ObjectDistanceMap
 
class  MR::ObjectGcode
 
class  MR::ObjectLines
 
class  MR::ObjectLinesHolder
 
class  MR::ObjectMesh
 
class  MR::ObjectPoints
 
class  MR::SceneRoot
 
class  MR::XfBasedCache< T >
 
class  MR::ObjectLabel
 
class  MR::ObjectVoxels
 

Functions

template<typename T >
std::shared_ptr< const T > MR::Object::find () const
 finds a direct child by type
 
template<typename T >
std::shared_ptr< const T > MR::Object::find (const std::string_view &name) const
 finds a direct child by name and type
 
enum class  MR::ObjectSelectivityType { MR::ObjectSelectivityType::Selectable , MR::ObjectSelectivityType::Selected , MR::ObjectSelectivityType::Any }
 
template<typename ObjectT = Object>
std::shared_ptr< ObjectT > MR::asSelectivityType (std::shared_ptr< Object > obj, const ObjectSelectivityType &type)
 if input object is of given type then returns another pointer on it
 
template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getAllObjectsInTree (Object *root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
 
template<typename ObjectT = Object>
MR_BIND_IGNORE std::vector< std::shared_ptr< ObjectT > > MR::getAllObjectsInTree (Object &root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
 
template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostVisibleObjects (Object *root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
 Returns all topmost visible objects of given type (if an object is returned, its children are not) excluding root.
 
template<typename ObjectT = Object>
MR_BIND_IGNORE std::vector< std::shared_ptr< ObjectT > > MR::getTopmostVisibleObjects (Object &root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
 
template<typename ObjectT = Object>
std::shared_ptr< ObjectT > MR::getDepthFirstObject (Object *root, const ObjectSelectivityType &type)
 return first object of given type in depth-first traverse order excluding root
 
template<typename ObjectT = Object>
MR_BIND_IGNORE std::shared_ptr< ObjectT > MR::getDepthFirstObject (Object &root, const ObjectSelectivityType &type)
 
MRMESH_API std::shared_ptr< ObjectMR::createObject (const std::string &className)
 the function to create new object instance by registered class name
 
MRMESH_API Expected< LoadedObjectMeshMR::makeObjectMeshFromFile (const std::filesystem::path &file, const ProgressCallback &cb={})
 loads mesh from given file in new object
 
MRMESH_API Expected< LoadedObjectMR::makeObjectFromMeshFile (const std::filesystem::path &file, const ProgressCallback &cb={}, bool returnOnlyMesh=false)
 loads data from given file and makes either ObjectMesh or ObjectPoints (if the file has points but not faces)
 
MRMESH_API Expected< ObjectLinesMR::makeObjectLinesFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads lines from given file in new object
 
MRMESH_API Expected< ObjectPointsMR::makeObjectPointsFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads points from given file in new object
 
MRMESH_API Expected< ObjectDistanceMapMR::makeObjectDistanceMapFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads distance map from given file in new object
 
MRMESH_API Expected< ObjectGcodeMR::makeObjectGcodeFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads gcode from given file in new object
 
MRMESH_API Expected< LoadedObjectsMR::loadObjectFromFile (const std::filesystem::path &filename, const ProgressCallback &callback={})
 load all objects (or any type: mesh, lines, points, voxels or scene) from file
 
MRMESH_API bool MR::isSupportedFileInSubfolders (const std::filesystem::path &folder)
 
MRMESH_API Expected< LoadedObjectMR::loadSceneFromAnySupportedFormat (const std::filesystem::path &path, const ProgressCallback &callback={})
 
MRMESH_API Expected< LoadedObjectMR::deserializeObjectTree (const std::filesystem::path &path, const FolderCallback &postDecompress={}, const ProgressCallback &progressCb={})
 loads objects tree from given scene file (zip/mru)
 
MRMESH_API Expected< LoadedObjectMR::deserializeObjectTreeFromFolder (const std::filesystem::path &folder, const ProgressCallback &progressCb={})
 loads objects tree from given scene folder
 
MRMESH_API IOFilters MR::getAllFilters ()
 returns filters for all supported file formats for all types of objects
 

Detailed Description

This chapter represents documentation about data models.

Enumeration Type Documentation

◆ ObjectSelectivityType

enum class MR::ObjectSelectivityType
strong
Enumerator
Selectable 
Selected 
Any 

Function Documentation

◆ asSelectivityType()

template<typename ObjectT = Object>
std::shared_ptr< ObjectT > MR::asSelectivityType ( std::shared_ptr< Object > obj,
const ObjectSelectivityType & type )

if input object is of given type then returns another pointer on it

◆ createObject()

MRMESH_API std::shared_ptr< Object > MR::createObject ( const std::string & className)

the function to create new object instance by registered class name

◆ deserializeObjectTree()

MRMESH_API Expected< LoadedObject > MR::deserializeObjectTree ( const std::filesystem::path & path,
const FolderCallback & postDecompress = {},
const ProgressCallback & progressCb = {} )

loads objects tree from given scene file (zip/mru)

format specification: children are saved under folder with name of their parent object all objects parameters are saved in one JSON file in the root folder

if postDecompress is set, it is called after decompression loading is controlled with Object::deserializeModel_ and Object::deserializeFields_

◆ deserializeObjectTreeFromFolder()

MRMESH_API Expected< LoadedObject > MR::deserializeObjectTreeFromFolder ( const std::filesystem::path & folder,
const ProgressCallback & progressCb = {} )

loads objects tree from given scene folder

format specification: children are saved under folder with name of their parent object all objects parameters are saved in one JSON file in the root folder

loading is controlled with Object::deserializeModel_ and Object::deserializeFields_

◆ find() [1/2]

template<typename T >
std::shared_ptr< const T > MR::Object::find ( ) const

finds a direct child by type

◆ find() [2/2]

template<typename T >
std::shared_ptr< const T > MR::Object::find ( const std::string_view & name) const

finds a direct child by name and type

◆ getAllFilters()

MRMESH_API IOFilters MR::getAllFilters ( )

returns filters for all supported file formats for all types of objects

◆ getAllObjectsInTree() [1/2]

template<typename ObjectT = Object>
MR_BIND_IGNORE std::vector< std::shared_ptr< ObjectT > > MR::getAllObjectsInTree ( Object & root,
const ObjectSelectivityType & type = ObjectSelectivityType::Selectable )
inline

◆ getAllObjectsInTree() [2/2]

template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getAllObjectsInTree ( Object * root,
const ObjectSelectivityType & type = ObjectSelectivityType::Selectable )

Traverses tree and collect objects of given type excluding root returns vector

◆ getDepthFirstObject() [1/2]

template<typename ObjectT = Object>
MR_BIND_IGNORE std::shared_ptr< ObjectT > MR::getDepthFirstObject ( Object & root,
const ObjectSelectivityType & type )
inline

◆ getDepthFirstObject() [2/2]

template<typename ObjectT = Object>
std::shared_ptr< ObjectT > MR::getDepthFirstObject ( Object * root,
const ObjectSelectivityType & type )

return first object of given type in depth-first traverse order excluding root

◆ getTopmostVisibleObjects() [1/2]

template<typename ObjectT = Object>
MR_BIND_IGNORE std::vector< std::shared_ptr< ObjectT > > MR::getTopmostVisibleObjects ( Object & root,
const ObjectSelectivityType & type = ObjectSelectivityType::Selectable )
inline

◆ getTopmostVisibleObjects() [2/2]

template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostVisibleObjects ( Object * root,
const ObjectSelectivityType & type = ObjectSelectivityType::Selectable )

Returns all topmost visible objects of given type (if an object is returned, its children are not) excluding root.

◆ isSupportedFileInSubfolders()

MRMESH_API bool MR::isSupportedFileInSubfolders ( const std::filesystem::path & folder)

◆ loadObjectFromFile()

MRMESH_API Expected< LoadedObjects > MR::loadObjectFromFile ( const std::filesystem::path & filename,
const ProgressCallback & callback = {} )

load all objects (or any type: mesh, lines, points, voxels or scene) from file

Parameters
callback- callback function to set progress (for progress bar)

◆ loadSceneFromAnySupportedFormat()

MRMESH_API Expected< LoadedObject > MR::loadSceneFromAnySupportedFormat ( const std::filesystem::path & path,
const ProgressCallback & callback = {} )

◆ makeObjectDistanceMapFromFile()

MRMESH_API Expected< ObjectDistanceMap > MR::makeObjectDistanceMapFromFile ( const std::filesystem::path & file,
ProgressCallback callback = {} )

loads distance map from given file in new object

◆ makeObjectFromMeshFile()

MRMESH_API Expected< LoadedObject > MR::makeObjectFromMeshFile ( const std::filesystem::path & file,
const ProgressCallback & cb = {},
bool returnOnlyMesh = false )

loads data from given file and makes either ObjectMesh or ObjectPoints (if the file has points but not faces)

if true the function can return only ObjectMesh and never ObjectPoints

◆ makeObjectGcodeFromFile()

MRMESH_API Expected< ObjectGcode > MR::makeObjectGcodeFromFile ( const std::filesystem::path & file,
ProgressCallback callback = {} )

loads gcode from given file in new object

◆ makeObjectLinesFromFile()

MRMESH_API Expected< ObjectLines > MR::makeObjectLinesFromFile ( const std::filesystem::path & file,
ProgressCallback callback = {} )

loads lines from given file in new object

◆ makeObjectMeshFromFile()

MRMESH_API Expected< LoadedObjectMesh > MR::makeObjectMeshFromFile ( const std::filesystem::path & file,
const ProgressCallback & cb = {} )

loads mesh from given file in new object

◆ makeObjectPointsFromFile()

MRMESH_API Expected< ObjectPoints > MR::makeObjectPointsFromFile ( const std::filesystem::path & file,
ProgressCallback callback = {} )

loads points from given file in new object