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::ObjectMeshHolder
class  MR::ObjectPoints
class  MR::ObjectPointsHolder
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::LocalSelectable , MR::ObjectSelectivityType::Selected , MR::ObjectSelectivityType::LocalSelected ,
  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>
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>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostVisibleObjects (Object &root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable)
template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostObjects (Object *root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable, bool visibilityCheck=false)
 Returns all topmost objects of given type (if an object is returned, its children are not) excluding root.
template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostObjects (Object &root, const ObjectSelectivityType &type=ObjectSelectivityType::Selectable, bool visibilityCheck=false)
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>
std::shared_ptr< ObjectT > MR::getDepthFirstObject (Object &root, const ObjectSelectivityType &type)
std::shared_ptr< Object > MR::createObject (const std::string &className)
 the function to create new object instance by registered class name
Expected< LoadedObjectMesh > MR::makeObjectMeshFromFile (const std::filesystem::path &file, const ProgressCallback &cb={})
 loads mesh from given file in new object
Expected< LoadedObject > MR::makeObjectFromMeshFile (const std::filesystem::path &file, const ProgressCallback &cb={}, bool returnOnlyMesh=false)
 loads data from given file and makes either ObjectMesh, ObjectLines or ObjectPoints (if the file has points or edges but not faces)
Expected< ObjectLines > MR::makeObjectLinesFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads lines from given file in new object
Expected< ObjectPoints > MR::makeObjectPointsFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads points from given file in new object
Expected< ObjectDistanceMap > MR::makeObjectDistanceMapFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads distance map from given file in new object
Expected< ObjectGcode > MR::makeObjectGcodeFromFile (const std::filesystem::path &file, ProgressCallback callback={})
 loads gcode from given file in new object
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
bool MR::isSupportedFileInSubfolders (const std::filesystem::path &folder)
 checks if there are any supported files folder and subfolders
Expected< LoadedObject > MR::loadSceneFromAnySupportedFormat (const std::filesystem::path &path, const ProgressCallback &callback={})
 tries to load scene from every format listed in SceneFormatFilters
LoadedObject MR::makeObjectMesh (std::string objName, LoadedMeshData data)
 constructs new ObjectMesh from the given data
Expected< LoadedObject > MR::deserializeObjectTree (const std::filesystem::path &path, const FolderCallback &postDecompress={}, const ProgressCallback &progressCb={})
 loads objects tree from given scene file (zip/mru)
Expected< LoadedObject > MR::deserializeObjectTreeFromFolder (const std::filesystem::path &folder, const ProgressCallback &progressCb={})
 loads objects tree from given scene folder
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

#include <MRMesh/MRObjectsAccess.h>

Enumerator
Selectable 

object itself and all its ancestors are selectable

LocalSelectable 

object itself is selectable

Selected 

object itself is selected and all its ancestors are selectable

LocalSelected 

object itself is selected

Any 

any object

Function Documentation

◆ asSelectivityType()

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

#include <MRMesh/MRObjectsAccess.h>

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

◆ createObject()

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

#include <MRMesh/MRObjectFactory.h>

the function to create new object instance by registered class name

◆ deserializeObjectTree()

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

#include <MRMesh/MRObjectLoad.h>

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()

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

#include <MRMesh/MRObjectLoad.h>

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

#include <MRMesh/MRObject.h>

finds a direct child by type

not found

◆ find() [2/2]

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

#include <MRMesh/MRObject.h>

finds a direct child by name and type

not found

◆ getAllFilters()

IOFilters MR::getAllFilters ( )
nodiscard

#include <MRMesh/MRObjectLoad.h>

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

◆ getAllObjectsInTree() [1/2]

template<typename ObjectT = Object>
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 )

#include <MRMesh/MRObjectsAccess.h>

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

◆ getDepthFirstObject() [1/2]

template<typename ObjectT = Object>
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 )

#include <MRMesh/MRObjectsAccess.h>

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

◆ getTopmostObjects() [1/2]

template<typename ObjectT = Object>
std::vector< std::shared_ptr< ObjectT > > MR::getTopmostObjects ( Object & root,
const ObjectSelectivityType & type = ObjectSelectivityType::Selectable,
bool visibilityCheck = false )
inline

◆ getTopmostObjects() [2/2]

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

#include <MRMesh/MRObjectsAccess.h>

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

◆ getTopmostVisibleObjects() [1/2]

template<typename ObjectT = Object>
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 )

#include <MRMesh/MRObjectsAccess.h>

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

◆ isSupportedFileInSubfolders()

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

#include <MRMesh/MRObjectLoad.h>

checks if there are any supported files folder and subfolders

◆ loadObjectFromFile()

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

#include <MRMesh/MRObjectLoad.h>

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()

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

#include <MRMesh/MRObjectLoad.h>

tries to load scene from every format listed in SceneFormatFilters

◆ makeObjectDistanceMapFromFile()

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

#include <MRMesh/MRObjectLoad.h>

loads distance map from given file in new object

◆ makeObjectFromMeshFile()

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

#include <MRMesh/MRObjectLoad.h>

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

if true the function can return only ObjectMesh and never other object type

◆ makeObjectGcodeFromFile()

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

#include <MRMesh/MRObjectLoad.h>

loads gcode from given file in new object

◆ makeObjectLinesFromFile()

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

#include <MRMesh/MRObjectLoad.h>

loads lines from given file in new object

◆ makeObjectMesh()

LoadedObject MR::makeObjectMesh ( std::string objName,
LoadedMeshData data )
nodiscard

#include <MRMesh/MRObjectLoad.h>

constructs new ObjectMesh from the given data

◆ makeObjectMeshFromFile()

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

#include <MRMesh/MRObjectLoad.h>

loads mesh from given file in new object

◆ makeObjectPointsFromFile()

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

#include <MRMesh/MRObjectLoad.h>

loads points from given file in new object