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.
80 lines (79 loc) • 3.19 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 { CustomHatchPattern } from '../duc/custom-hatch-pattern';
import { DucPoint } from '../duc/duc-point';
export class DucHatchStyle {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsDucHatchStyle(bb, obj) {
return (obj || new DucHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsDucHatchStyle(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new DucHatchStyle()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
hatchStyle() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
patternName(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
patternScale() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
}
patternAngle() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
patternOrigin(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;
}
patternDouble() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
customPattern(obj) {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? (obj || new CustomHatchPattern()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
static startDucHatchStyle(builder) {
builder.startObject(7);
}
static addHatchStyle(builder, hatchStyle) {
builder.addFieldInt8(0, hatchStyle, null);
}
static addPatternName(builder, patternNameOffset) {
builder.addFieldOffset(1, patternNameOffset, 0);
}
static addPatternScale(builder, patternScale) {
builder.addFieldFloat32(2, patternScale, 0.0);
}
static addPatternAngle(builder, patternAngle) {
builder.addFieldFloat64(3, patternAngle, 0.0);
}
static addPatternOrigin(builder, patternOriginOffset) {
builder.addFieldOffset(4, patternOriginOffset, 0);
}
static addPatternDouble(builder, patternDouble) {
builder.addFieldInt8(5, +patternDouble, +false);
}
static addCustomPattern(builder, customPatternOffset) {
builder.addFieldOffset(6, customPatternOffset, 0);
}
static endDucHatchStyle(builder) {
const offset = builder.endObject();
return offset;
}
}