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.

125 lines (124 loc) 5.17 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 { DucLine } from '../duc/duc-line'; import { DucPath } from '../duc/duc-path'; import { DucPoint } from '../duc/duc-point'; import { DucPointBinding } from '../duc/duc-point-binding'; import { _DucElementBase } from '../duc/duc-element-base'; export class _DucLinearElementBase { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAs_DucLinearElementBase(bb, obj) { return (obj || new _DucLinearElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAs_DucLinearElementBase(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new _DucLinearElementBase()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } base(obj) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? (obj || new _DucElementBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } points(index, obj) { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? (obj || new DucPoint()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } pointsLength() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } lines(index, obj) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? (obj || new DucLine()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } linesLength() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } pathOverrides(index, obj) { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? (obj || new DucPath()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } pathOverridesLength() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } lastCommittedPoint(obj) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? (obj || new DucPoint()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } startBinding(obj) { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? (obj || new DucPointBinding()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } endBinding(obj) { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? (obj || new DucPointBinding()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } static start_DucLinearElementBase(builder) { builder.startObject(7); } static addBase(builder, baseOffset) { builder.addFieldOffset(0, baseOffset, 0); } static addPoints(builder, pointsOffset) { builder.addFieldOffset(1, pointsOffset, 0); } static createPointsVector(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 startPointsVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addLines(builder, linesOffset) { builder.addFieldOffset(2, linesOffset, 0); } static createLinesVector(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 startLinesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addPathOverrides(builder, pathOverridesOffset) { builder.addFieldOffset(3, pathOverridesOffset, 0); } static createPathOverridesVector(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 startPathOverridesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addLastCommittedPoint(builder, lastCommittedPointOffset) { builder.addFieldOffset(4, lastCommittedPointOffset, 0); } static addStartBinding(builder, startBindingOffset) { builder.addFieldOffset(5, startBindingOffset, 0); } static addEndBinding(builder, endBindingOffset) { builder.addFieldOffset(6, endBindingOffset, 0); } static end_DucLinearElementBase(builder) { const offset = builder.endObject(); return offset; } }