UNPKG

ducjs

Version:

The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.

270 lines (269 loc) 10.4 kB
// automatically generated by the FlatBuffers compiler, do not modify /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */ import * as flatbuffers from 'flatbuffers'; import { BoundElement } from '../duc/bound-element'; import { _DucElementStylesBase } from '../duc/duc-element-styles-base'; export class _DucElementBase { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAs_DucElementBase(bb, obj) { return (obj || new _DucElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAs_DucElementBase(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new _DucElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } id(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } styles(obj) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? (obj || new _DucElementStylesBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } x() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } y() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } width() { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } height() { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } angle() { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } scope(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } label(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } description(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 22); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } isVisible() { const offset = this.bb.__offset(this.bb_pos, 24); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } seed() { const offset = this.bb.__offset(this.bb_pos, 26); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } version() { const offset = this.bb.__offset(this.bb_pos, 28); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } versionNonce() { const offset = this.bb.__offset(this.bb_pos, 30); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } updated() { const offset = this.bb.__offset(this.bb_pos, 32); return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0'); } index(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 34); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } isPlot() { const offset = this.bb.__offset(this.bb_pos, 36); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } isAnnotative() { const offset = this.bb.__offset(this.bb_pos, 38); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } isDeleted() { const offset = this.bb.__offset(this.bb_pos, 40); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } groupIds(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 42); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } groupIdsLength() { const offset = this.bb.__offset(this.bb_pos, 42); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } regionIds(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 44); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } regionIdsLength() { const offset = this.bb.__offset(this.bb_pos, 44); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } layerId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 46); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } frameId(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 48); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } boundElements(index, obj) { const offset = this.bb.__offset(this.bb_pos, 50); return offset ? (obj || new BoundElement()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } boundElementsLength() { const offset = this.bb.__offset(this.bb_pos, 50); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } zIndex() { const offset = this.bb.__offset(this.bb_pos, 52); return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0; } link(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 54); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } locked() { const offset = this.bb.__offset(this.bb_pos, 56); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } customData(optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 58); return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; } static start_DucElementBase(builder) { builder.startObject(28); } static addId(builder, idOffset) { builder.addFieldOffset(0, idOffset, 0); } static addStyles(builder, stylesOffset) { builder.addFieldOffset(1, stylesOffset, 0); } static addX(builder, x) { builder.addFieldFloat64(2, x, 0.0); } static addY(builder, y) { builder.addFieldFloat64(3, y, 0.0); } static addWidth(builder, width) { builder.addFieldFloat64(4, width, 0.0); } static addHeight(builder, height) { builder.addFieldFloat64(5, height, 0.0); } static addAngle(builder, angle) { builder.addFieldFloat64(6, angle, 0.0); } static addScope(builder, scopeOffset) { builder.addFieldOffset(7, scopeOffset, 0); } static addLabel(builder, labelOffset) { builder.addFieldOffset(8, labelOffset, 0); } static addDescription(builder, descriptionOffset) { builder.addFieldOffset(9, descriptionOffset, 0); } static addIsVisible(builder, isVisible) { builder.addFieldInt8(10, +isVisible, +false); } static addSeed(builder, seed) { builder.addFieldInt32(11, seed, 0); } static addVersion(builder, version) { builder.addFieldInt32(12, version, 0); } static addVersionNonce(builder, versionNonce) { builder.addFieldInt32(13, versionNonce, 0); } static addUpdated(builder, updated) { builder.addFieldInt64(14, updated, BigInt('0')); } static addIndex(builder, indexOffset) { builder.addFieldOffset(15, indexOffset, 0); } static addIsPlot(builder, isPlot) { builder.addFieldInt8(16, +isPlot, +false); } static addIsAnnotative(builder, isAnnotative) { builder.addFieldInt8(17, +isAnnotative, +false); } static addIsDeleted(builder, isDeleted) { builder.addFieldInt8(18, +isDeleted, +false); } static addGroupIds(builder, groupIdsOffset) { builder.addFieldOffset(19, groupIdsOffset, 0); } static createGroupIdsVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startGroupIdsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addRegionIds(builder, regionIdsOffset) { builder.addFieldOffset(20, regionIdsOffset, 0); } static createRegionIdsVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startRegionIdsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addLayerId(builder, layerIdOffset) { builder.addFieldOffset(21, layerIdOffset, 0); } static addFrameId(builder, frameIdOffset) { builder.addFieldOffset(22, frameIdOffset, 0); } static addBoundElements(builder, boundElementsOffset) { builder.addFieldOffset(23, boundElementsOffset, 0); } static createBoundElementsVector(builder, data) { builder.startVector(4, data.length, 4); for (let i = data.length - 1; i >= 0; i--) { builder.addOffset(data[i]); } return builder.endVector(); } static startBoundElementsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addZIndex(builder, zIndex) { builder.addFieldFloat32(24, zIndex, 0.0); } static addLink(builder, linkOffset) { builder.addFieldOffset(25, linkOffset, 0); } static addLocked(builder, locked) { builder.addFieldInt8(26, +locked, +false); } static addCustomData(builder, customDataOffset) { builder.addFieldOffset(27, customDataOffset, 0); } static end_DucElementBase(builder) { const offset = builder.endObject(); builder.requiredField(offset, 4); // id return offset; } }