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.
166 lines (165 loc) • 6.49 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 { GeometricPoint } from '../duc/geometric-point';
import { GridStyle } from '../duc/grid-style';
import { IsometricGridSettings } from '../duc/isometric-grid-settings';
import { PolarGridSettings } from '../duc/polar-grid-settings';
export class GridSettings {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsGridSettings(bb, obj) {
return (obj || new GridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsGridSettings(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new GridSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
type() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
readonly() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
displayType() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint8(this.bb_pos + offset) : null;
}
isAdaptive() {
const offset = this.bb.__offset(this.bb_pos, 10);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
xSpacing() {
const offset = this.bb.__offset(this.bb_pos, 12);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
ySpacing() {
const offset = this.bb.__offset(this.bb_pos, 14);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
subdivisions() {
const offset = this.bb.__offset(this.bb_pos, 16);
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
}
origin(obj) {
const offset = this.bb.__offset(this.bb_pos, 18);
return offset ? (obj || new GeometricPoint()).__init(this.bb_pos + offset, this.bb) : null;
}
rotation() {
const offset = this.bb.__offset(this.bb_pos, 20);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
followUcs() {
const offset = this.bb.__offset(this.bb_pos, 22);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
majorStyle(obj) {
const offset = this.bb.__offset(this.bb_pos, 24);
return offset ? (obj || new GridStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
minorStyle(obj) {
const offset = this.bb.__offset(this.bb_pos, 26);
return offset ? (obj || new GridStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
showMinor() {
const offset = this.bb.__offset(this.bb_pos, 28);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
minZoom() {
const offset = this.bb.__offset(this.bb_pos, 30);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
maxZoom() {
const offset = this.bb.__offset(this.bb_pos, 32);
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
}
autoHide() {
const offset = this.bb.__offset(this.bb_pos, 34);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
polarSettings(obj) {
const offset = this.bb.__offset(this.bb_pos, 36);
return offset ? (obj || new PolarGridSettings()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
isometricSettings(obj) {
const offset = this.bb.__offset(this.bb_pos, 38);
return offset ? (obj || new IsometricGridSettings()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
}
enableSnapping() {
const offset = this.bb.__offset(this.bb_pos, 40);
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
}
static startGridSettings(builder) {
builder.startObject(19);
}
static addType(builder, type) {
builder.addFieldInt8(0, type, null);
}
static addReadonly(builder, readonly) {
builder.addFieldInt8(1, +readonly, +false);
}
static addDisplayType(builder, displayType) {
builder.addFieldInt8(2, displayType, null);
}
static addIsAdaptive(builder, isAdaptive) {
builder.addFieldInt8(3, +isAdaptive, +false);
}
static addXSpacing(builder, xSpacing) {
builder.addFieldFloat64(4, xSpacing, 0.0);
}
static addYSpacing(builder, ySpacing) {
builder.addFieldFloat64(5, ySpacing, 0.0);
}
static addSubdivisions(builder, subdivisions) {
builder.addFieldInt32(6, subdivisions, 0);
}
static addOrigin(builder, originOffset) {
builder.addFieldStruct(7, originOffset, 0);
}
static addRotation(builder, rotation) {
builder.addFieldFloat64(8, rotation, 0.0);
}
static addFollowUcs(builder, followUcs) {
builder.addFieldInt8(9, +followUcs, +false);
}
static addMajorStyle(builder, majorStyleOffset) {
builder.addFieldOffset(10, majorStyleOffset, 0);
}
static addMinorStyle(builder, minorStyleOffset) {
builder.addFieldOffset(11, minorStyleOffset, 0);
}
static addShowMinor(builder, showMinor) {
builder.addFieldInt8(12, +showMinor, +false);
}
static addMinZoom(builder, minZoom) {
builder.addFieldFloat64(13, minZoom, 0.0);
}
static addMaxZoom(builder, maxZoom) {
builder.addFieldFloat64(14, maxZoom, 0.0);
}
static addAutoHide(builder, autoHide) {
builder.addFieldInt8(15, +autoHide, +false);
}
static addPolarSettings(builder, polarSettingsOffset) {
builder.addFieldOffset(16, polarSettingsOffset, 0);
}
static addIsometricSettings(builder, isometricSettingsOffset) {
builder.addFieldOffset(17, isometricSettingsOffset, 0);
}
static addEnableSnapping(builder, enableSnapping) {
builder.addFieldInt8(18, +enableSnapping, +false);
}
static endGridSettings(builder) {
const offset = builder.endObject();
return offset;
}
}