![]() |
Infohub JS API
|
Provides helpers for converting and normalizing GOM data.
Static Public Member Functions | |
| static | ensureModelFormat (treeData) |
| static | reformGOM ({ dict={}, tree, geometry={}, properties={}, relations={}, linkedobjects={}, styles=[] }={}) |
|
static |
Normalizes a parsed CNJSON payload to the nodes array format expected by addObjects().
Handles:
If a dict is present (at the wrapper level or in legacy nodes[0].meta.dict) all property keys/values are resolved through it and the dict is dropped from the output.
1-case format: { dict, nodes } 2-case format: [ nodes ] (legacy) and in the first node's meta.dict
| {object|Array} | treeData Parsed CNJSON file or API response |
|
static |
Reassembles a split CNZIP payload into the node tree consumed by addObjects() and POST /tree.
Current CNZIP exports store the style catalogue once in styles.styles and reference its entries from each geometry's facets/lines/texts. The old GOM format instead embeds the referenced style definitions in geometry.styles. This method restores that shape without copying unrelated styles to every node. Geometry fields are emitted in the legacy order (vertices, styles, ...), and every style is normalised to the canonical { id, name, color } order.
Relation targets may use the current right_objects key or the older right_object_ids key. Dictionary-compressed target IDs are resolved before their full data is read from linkedobjects.
meta is archive-level export metadata and is intentionally not attached to model nodes. The original tree and attached geometry objects are mutated in-place for performance.
| {object} | [param0={}] Parsed files from a CNZIP archive, keyed by filename section |
| {object} | [param0.dict={}] Dictionary used to resolve compressed keys and values |
| {Array} | param0.tree Model node tree |
| {object} | [param0.geometry={}] Geometry data keyed by object ID |
| {object} | [param0.properties={}] Property data keyed by object ID |
| {object} | [param0.relations={}] Relation data keyed by object ID |
| {object} | [param0.linkedobjects={}] Linked objects keyed by object ID |
| {(Array|{styles | Array})} [param0.styles=[]] Style catalogue or its containing object |