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.

67 lines (66 loc) 2.63 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 { ElementContentBase } from '../duc/element-content-base'; import { StrokeSides } from '../duc/stroke-sides'; import { StrokeStyle } from '../duc/stroke-style'; export class ElementStroke { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsElementStroke(bb, obj) { return (obj || new ElementStroke()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsElementStroke(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new ElementStroke()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } content(obj) { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? (obj || new ElementContentBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } width() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } style(obj) { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? (obj || new StrokeStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } placement() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } strokeSides(obj) { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? (obj || new StrokeSides()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } static startElementStroke(builder) { builder.startObject(5); } static addContent(builder, contentOffset) { builder.addFieldOffset(0, contentOffset, 0); } static addWidth(builder, width) { builder.addFieldFloat64(1, width, 0.0); } static addStyle(builder, styleOffset) { builder.addFieldOffset(2, styleOffset, 0); } static addPlacement(builder, placement) { builder.addFieldInt8(3, placement, null); } static addStrokeSides(builder, strokeSidesOffset) { builder.addFieldOffset(4, strokeSidesOffset, 0); } static endElementStroke(builder) { const offset = builder.endObject(); return offset; } }