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.
75 lines (74 loc) • 2.96 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 GridStyle {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsGridStyle(bb, obj) {
return (obj || new GridStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsGridStyle(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new GridStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
color(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
opacity() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
dashPattern(index) {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
}
dashPatternLength() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
}
dashPatternArray() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
static startGridStyle(builder) {
builder.startObject(3);
}
static addColor(builder, colorOffset) {
builder.addFieldOffset(0, colorOffset, 0);
}
static addOpacity(builder, opacity) {
builder.addFieldFloat64(1, opacity, 0.0);
}
static addDashPattern(builder, dashPatternOffset) {
builder.addFieldOffset(2, dashPatternOffset, 0);
}
static createDashPatternVector(builder, data) {
builder.startVector(8, data.length, 8);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat64(data[i]);
}
return builder.endVector();
}
static startDashPatternVector(builder, numElems) {
builder.startVector(8, numElems, 8);
}
static endGridStyle(builder) {
const offset = builder.endObject();
return offset;
}
static createGridStyle(builder, colorOffset, opacity, dashPatternOffset) {
GridStyle.startGridStyle(builder);
GridStyle.addColor(builder, colorOffset);
GridStyle.addOpacity(builder, opacity);
GridStyle.addDashPattern(builder, dashPatternOffset);
return GridStyle.endGridStyle(builder);
}
}