Kernel SDK Developer's Guide > Common Data Access > Build a CDA Tree
Build a CDA Tree

There are three modes that are used for building a CDA tree:

  • Obtain only the tree structure of the database (the fastest).
  • Obtain the tree structure of the database and a small set of properties that are used, for example, to group and sort objects in a tree.
  • Obtain a full set — a tree and cache of all properties of its nodes.

The createDatabaseHierarchyTree() function of the OdRxModelHierarchyTreeBase class is used to build a hierarchical tree structure. The function returns a smart pointer to the root node of the hierarchical tree.

virtual OdRxModelTreeBaseNodePtr createDatabaseHierarchyTree(const OdRxObject* pDb,
                                                             const bool create_properties_cache = true,
                                                             const bool class_dependent_hierarchy = false,
                                                             const bool class_dependent_property = false);

virtual OdRxModelTreeBaseNodePtr createDatabaseHierarchyTree(const OdRxObject* pDb,
                                                             const std::set* collected_properties,
                                                             const bool class_dependent_hierarchy = false,
                                                             const bool class_dependent_property = false);

Arguments:

  • pDb — Pointer to the source database object.
  • create_properties_cache — Flag to create a cache of properties. Default value is true.
  • collected_properties — A pointer to a set of property names to be added to the cache. If NULL, all properties are cached.
  • class_dependent_hierarchy — Flag to optimize the creation of a hierarchical tree. Set to true if the properties of database objects with a hierarchical attribute are statically dependent on the object type. Default value is false.
  • class_dependent_property — Flag to optimize cache creation. Set to true only if all properties of database objects are statically dependent on the object type. Default value is false.

Note: The class_dependent_hierarchy and class_dependent_property flags allow you to optimize performance of the methods only under the following conditions:

  • class_dependent_hierarchy — Properties containing a hierarchical attribute statically depend on the object type.
  • class_dependent_property — All properties of the object statically depend on the object type.
In all other cases the result is unpredictable.

Table of flags that are available for each file format and product:

.dwg DGN IFC BimNv BimRv
class_dependent_hierarchy + + + + -
class_dependent_property + + - + -

Below is an example of obtaining a hierarchical tree with the full set of properties.

OdRxModelHierarchyTreeBasePtr pHierarchyTreeBase = OdRxModelHierarchyTreeBase::createObject();

OdRxModelTreeBaseNodePtr pTree = pHierarchyTreeBase->createDatabaseHierarchyTree(pDb, true);

Where pTree is a pointer to the root node of the CDA hierarchical tree of the database.

See Also

Common Data Access

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.