UNPKG

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.

246 lines (245 loc) 10.6 kB
// 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 { DynamicSnapSettings } from '../duc/dynamic-snap-settings'; import { LayerSnapFilters } from '../duc/layer-snap-filters'; import { PolarTrackingSettings } from '../duc/polar-tracking-settings'; import { SnapMarkerSettings } from '../duc/snap-marker-settings'; import { SnapOverride } from '../duc/snap-override'; import { TrackingLineStyle } from '../duc/tracking-line-style'; export class SnapSettings { constructor() { this.bb = null; this.bb_pos = 0; } __init(i, bb) { this.bb_pos = i; this.bb = bb; return this; } static getRootAsSnapSettings(bb, obj) { return (obj || new SnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } static getSizePrefixedRootAsSnapSettings(bb, obj) { bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); return (obj || new SnapSettings()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } readonly() { const offset = this.bb.__offset(this.bb_pos, 4); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } twistAngle() { const offset = this.bb.__offset(this.bb_pos, 6); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } snapTolerance() { const offset = this.bb.__offset(this.bb_pos, 8); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } objectSnapAperture() { const offset = this.bb.__offset(this.bb_pos, 10); return offset ? this.bb.readInt32(this.bb_pos + offset) : 0; } isOrthoModeOn() { const offset = this.bb.__offset(this.bb_pos, 12); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } polarTracking(obj) { const offset = this.bb.__offset(this.bb_pos, 14); return offset ? (obj || new PolarTrackingSettings()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } isObjectSnapOn() { const offset = this.bb.__offset(this.bb_pos, 16); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } activeObjectSnapModes(index) { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; } activeObjectSnapModesLength() { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } activeObjectSnapModesArray() { const offset = this.bb.__offset(this.bb_pos, 18); return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; } snapPriority(index) { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0; } snapPriorityLength() { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } snapPriorityArray() { const offset = this.bb.__offset(this.bb_pos, 20); return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null; } showTrackingLines() { const offset = this.bb.__offset(this.bb_pos, 22); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } trackingLineStyle(obj) { const offset = this.bb.__offset(this.bb_pos, 24); return offset ? (obj || new TrackingLineStyle()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } dynamicSnap(obj) { const offset = this.bb.__offset(this.bb_pos, 26); return offset ? (obj || new DynamicSnapSettings()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } temporaryOverrides(index, obj) { const offset = this.bb.__offset(this.bb_pos, 28); return offset ? (obj || new SnapOverride()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null; } temporaryOverridesLength() { const offset = this.bb.__offset(this.bb_pos, 28); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } incrementalDistance() { const offset = this.bb.__offset(this.bb_pos, 30); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } magneticStrength() { const offset = this.bb.__offset(this.bb_pos, 32); return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0; } layerSnapFilters(obj) { const offset = this.bb.__offset(this.bb_pos, 34); return offset ? (obj || new LayerSnapFilters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } elementTypeFilters(index, optionalEncoding) { const offset = this.bb.__offset(this.bb_pos, 36); return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null; } elementTypeFiltersLength() { const offset = this.bb.__offset(this.bb_pos, 36); return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0; } snapMode() { const offset = this.bb.__offset(this.bb_pos, 38); return offset ? this.bb.readUint8(this.bb_pos + offset) : null; } snapMarkers(obj) { const offset = this.bb.__offset(this.bb_pos, 40); return offset ? (obj || new SnapMarkerSettings()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null; } constructionSnapEnabled() { const offset = this.bb.__offset(this.bb_pos, 42); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } snapToGridIntersections() { const offset = this.bb.__offset(this.bb_pos, 44); return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false; } static startSnapSettings(builder) { builder.startObject(21); } static addReadonly(builder, readonly) { builder.addFieldInt8(0, +readonly, +false); } static addTwistAngle(builder, twistAngle) { builder.addFieldFloat64(1, twistAngle, 0.0); } static addSnapTolerance(builder, snapTolerance) { builder.addFieldInt32(2, snapTolerance, 0); } static addObjectSnapAperture(builder, objectSnapAperture) { builder.addFieldInt32(3, objectSnapAperture, 0); } static addIsOrthoModeOn(builder, isOrthoModeOn) { builder.addFieldInt8(4, +isOrthoModeOn, +false); } static addPolarTracking(builder, polarTrackingOffset) { builder.addFieldOffset(5, polarTrackingOffset, 0); } static addIsObjectSnapOn(builder, isObjectSnapOn) { builder.addFieldInt8(6, +isObjectSnapOn, +false); } static addActiveObjectSnapModes(builder, activeObjectSnapModesOffset) { builder.addFieldOffset(7, activeObjectSnapModesOffset, 0); } static createActiveObjectSnapModesVector(builder, data) { builder.startVector(1, data.length, 1); for (let i = data.length - 1; i >= 0; i--) { builder.addInt8(data[i]); } return builder.endVector(); } static startActiveObjectSnapModesVector(builder, numElems) { builder.startVector(1, numElems, 1); } static addSnapPriority(builder, snapPriorityOffset) { builder.addFieldOffset(8, snapPriorityOffset, 0); } static createSnapPriorityVector(builder, data) { builder.startVector(1, data.length, 1); for (let i = data.length - 1; i >= 0; i--) { builder.addInt8(data[i]); } return builder.endVector(); } static startSnapPriorityVector(builder, numElems) { builder.startVector(1, numElems, 1); } static addShowTrackingLines(builder, showTrackingLines) { builder.addFieldInt8(9, +showTrackingLines, +false); } static addTrackingLineStyle(builder, trackingLineStyleOffset) { builder.addFieldOffset(10, trackingLineStyleOffset, 0); } static addDynamicSnap(builder, dynamicSnapOffset) { builder.addFieldOffset(11, dynamicSnapOffset, 0); } static addTemporaryOverrides(builder, temporaryOverridesOffset) { builder.addFieldOffset(12, temporaryOverridesOffset, 0); } static createTemporaryOverridesVector(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 startTemporaryOverridesVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addIncrementalDistance(builder, incrementalDistance) { builder.addFieldFloat64(13, incrementalDistance, 0.0); } static addMagneticStrength(builder, magneticStrength) { builder.addFieldFloat64(14, magneticStrength, 0.0); } static addLayerSnapFilters(builder, layerSnapFiltersOffset) { builder.addFieldOffset(15, layerSnapFiltersOffset, 0); } static addElementTypeFilters(builder, elementTypeFiltersOffset) { builder.addFieldOffset(16, elementTypeFiltersOffset, 0); } static createElementTypeFiltersVector(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 startElementTypeFiltersVector(builder, numElems) { builder.startVector(4, numElems, 4); } static addSnapMode(builder, snapMode) { builder.addFieldInt8(17, snapMode, null); } static addSnapMarkers(builder, snapMarkersOffset) { builder.addFieldOffset(18, snapMarkersOffset, 0); } static addConstructionSnapEnabled(builder, constructionSnapEnabled) { builder.addFieldInt8(19, +constructionSnapEnabled, +false); } static addSnapToGridIntersections(builder, snapToGridIntersections) { builder.addFieldInt8(20, +snapToGridIntersections, +false); } static endSnapSettings(builder) { const offset = builder.endObject(); return offset; } }