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.
88 lines (87 loc) • 3.52 kB
JavaScript
// 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 { DucHead } from '../duc/duc-head';
import { DucTextStyle } from '../duc/duc-text-style';
import { _DucElementStylesBase } from '../duc/duc-element-styles-base';
export class DucLeaderStyle {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsDucLeaderStyle(bb, obj) {
return (obj || new DucLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsDucLeaderStyle(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new DucLeaderStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
baseStyle(obj) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? (obj || new _DucElementStylesBase()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
headsOverride(index, obj) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? (obj || new DucHead()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
}
headsOverrideLength() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
dogleg() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
textStyle(obj) {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? (obj || new DucTextStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
textAttachment() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
blockAttachment() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
static startDucLeaderStyle(builder) {
builder.startObject(6);
}
static addBaseStyle(builder, baseStyleOffset) {
builder.addFieldOffset(0, baseStyleOffset, 0);
}
static addHeadsOverride(builder, headsOverrideOffset) {
builder.addFieldOffset(1, headsOverrideOffset, 0);
}
static createHeadsOverrideVector(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 startHeadsOverrideVector(builder, numElems) {
builder.startVector(4, numElems, 4);
}
static addDogleg(builder, dogleg) {
builder.addFieldFloat64(2, dogleg, 0.0);
}
static addTextStyle(builder, textStyleOffset) {
builder.addFieldOffset(3, textStyleOffset, 0);
}
static addTextAttachment(builder, textAttachment) {
builder.addFieldInt8(4, textAttachment, null);
}
static addBlockAttachment(builder, blockAttachment) {
builder.addFieldInt8(5, blockAttachment, null);
}
static endDucLeaderStyle(builder) {
const offset = builder.endObject();
return offset;
}
}