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.
122 lines (121 loc) • 5.76 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';
export class DucGlobalState {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsDucGlobalState(bb, obj) {
return (obj || new DucGlobalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsDucGlobalState(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new DucGlobalState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
viewBackgroundColor(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
mainScope(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
dashSpacingScale() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
isDashSpacingAffectedByViewportScale() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
scopeExponentThreshold() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
}
dimensionsAssociativeByDefault() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
useAnnotativeScaling() {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
displayPrecisionLinear() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
displayPrecisionAngular() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
pruningLevel() {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
static startDucGlobalState(builder) {
builder.startObject(11);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addViewBackgroundColor(builder, viewBackgroundColorOffset) {
builder.addFieldOffset(1, viewBackgroundColorOffset, 0);
}
static addMainScope(builder, mainScopeOffset) {
builder.addFieldOffset(2, mainScopeOffset, 0);
}
static addDashSpacingScale(builder, dashSpacingScale) {
builder.addFieldFloat32(3, dashSpacingScale, 0.0);
}
static addIsDashSpacingAffectedByViewportScale(builder, isDashSpacingAffectedByViewportScale) {
builder.addFieldInt8(4, +isDashSpacingAffectedByViewportScale, +false);
}
static addScopeExponentThreshold(builder, scopeExponentThreshold) {
builder.addFieldInt8(5, scopeExponentThreshold, 0);
}
static addDimensionsAssociativeByDefault(builder, dimensionsAssociativeByDefault) {
builder.addFieldInt8(6, +dimensionsAssociativeByDefault, +false);
}
static addUseAnnotativeScaling(builder, useAnnotativeScaling) {
builder.addFieldInt8(7, +useAnnotativeScaling, +false);
}
static addDisplayPrecisionLinear(builder, displayPrecisionLinear) {
builder.addFieldInt32(8, displayPrecisionLinear, 0);
}
static addDisplayPrecisionAngular(builder, displayPrecisionAngular) {
builder.addFieldInt32(9, displayPrecisionAngular, 0);
}
static addPruningLevel(builder, pruningLevel) {
builder.addFieldInt8(10, pruningLevel, null);
}
static endDucGlobalState(builder) {
const offset = builder.endObject();
return offset;
}
static createDucGlobalState(builder, nameOffset, viewBackgroundColorOffset, mainScopeOffset, dashSpacingScale, isDashSpacingAffectedByViewportScale, scopeExponentThreshold, dimensionsAssociativeByDefault, useAnnotativeScaling, displayPrecisionLinear, displayPrecisionAngular, pruningLevel) {
DucGlobalState.startDucGlobalState(builder);
DucGlobalState.addName(builder, nameOffset);
DucGlobalState.addViewBackgroundColor(builder, viewBackgroundColorOffset);
DucGlobalState.addMainScope(builder, mainScopeOffset);
DucGlobalState.addDashSpacingScale(builder, dashSpacingScale);
DucGlobalState.addIsDashSpacingAffectedByViewportScale(builder, isDashSpacingAffectedByViewportScale);
DucGlobalState.addScopeExponentThreshold(builder, scopeExponentThreshold);
DucGlobalState.addDimensionsAssociativeByDefault(builder, dimensionsAssociativeByDefault);
DucGlobalState.addUseAnnotativeScaling(builder, useAnnotativeScaling);
DucGlobalState.addDisplayPrecisionLinear(builder, displayPrecisionLinear);
DucGlobalState.addDisplayPrecisionAngular(builder, displayPrecisionAngular);
if (pruningLevel !== null)
DucGlobalState.addPruningLevel(builder, pruningLevel);
return DucGlobalState.endDucGlobalState(builder);
}
}